diff --git a/TNStropheConnection.j b/TNStropheConnection.j index f27a3cc..73aab31 100644 --- a/TNStropheConnection.j +++ b/TNStropheConnection.j @@ -184,14 +184,10 @@ return self; } -@end - #pragma mark - #pragma mark TNStropheConnection Connection -@implementation TNStropheConnection (Connection) - - (void)addNamespaceWithName:(CPString)aName value:(CPString)aValue { Strophe.addNamespace(aName, aValue) @@ -292,14 +288,10 @@ _connection.flush(); } -@end - #pragma mark - #pragma mark TNStropheConnection Features -@implementation TNStropheConnection (Features) - - (void)addFeature:(CPString)aFeatureNamespace { [_features addObject:aFeatureNamespace]; @@ -348,14 +340,10 @@ return YES; } -@end - #pragma mark - #pragma mark TNStropheConnection Sending -@implementation TNStropheConnection (Sending) - /*! send a TNStropheStanza object @param aStanza: the stanza to send */ @@ -403,14 +391,10 @@ _audioTagReceive.play(); } -@end - #pragma mark - #pragma mark TNStropheConnection Handlers -@implementation TNStropheConnection (Handlers) - /*! allows to register a selector for beeing fired on XMPP events, according to the content of a dictionnary parameter. The dictionnary should contains zero to many of the followings : - namespace: the namespace of the stanza or of the first child (like query) @@ -512,10 +496,6 @@ @end - -#pragma mark - -#pragma mark TNStropheConnection CPCoding - @implementation TNStropheConnection (CPCoding) - (id)initWithCoder:(CPCoder)aCoder diff --git a/TNStropheContact.j b/TNStropheContact.j index 37dbb7b..5628709 100644 --- a/TNStropheContact.j +++ b/TNStropheContact.j @@ -24,9 +24,6 @@ @import "TNStropheGlobals.j" -#pragma mark - -#pragma mark TNStropheContact - /*! @ingroup strophecappuccino this is an implementation of a XMPP Contact */ @@ -110,13 +107,9 @@ return self; } -@end - #pragma mark - -#pragma mark TNStropheContact Status - -@implementation TNStropheContact (Status) +#pragma mark Status /*! probe the contact about its status You should never have to use this message if you are using TNStropheRoster @@ -257,13 +250,9 @@ _isComposing = NO; } -@end - #pragma mark - -#pragma mark TNStropheContact Subscription - -@implementation TNStropheContact (Subscription) +#pragma mark Subscription /*! subscribe to the contact */ @@ -289,13 +278,9 @@ [_connection send:auth]; } -@end - #pragma mark - -#pragma mark TNStropheContact MetaData - -@implementation TNStropheContact (MetaData) +#pragma mark MetaData - (CPString)description { @@ -404,13 +389,9 @@ [[CPNotificationCenter defaultCenter] postNotificationName:TNStropheContactGroupUpdatedNotification object:self]; } -@end - #pragma mark - -#pragma mark TNStropheContact Communicating - -@implementation TNStropheContact (Communicating) +#pragma mark Communicating /*! send a TNStropheStanza to the contact. From, ant To value are rewritten. This message uses a given stanza id in order to use it if you need. You should mostly use the @@ -588,11 +569,7 @@ @end - -#pragma mark - -#pragma mark TNStropheContact codingCompliant - -@implementation TNStropheContact (codingCompliant) +@implementation TNStropheContact (CPCoding) - (id)initWithCoder:(CPCoder)aCoder { diff --git a/TNStropheGroup.j b/TNStropheGroup.j index 852f01d..dbfeb79 100644 --- a/TNStropheGroup.j +++ b/TNStropheGroup.j @@ -17,13 +17,9 @@ */ @import - @import "TNStropheGlobals.j" -#pragma mark - -#pragma mark TNStropheGroup - /*! @ingroup strophecappuccino this is an implementation of a basic XMPP Group. */ @@ -89,11 +85,7 @@ @end - -#pragma mark - -#pragma mark TNStropheGroup codingCompliant - -@implementation TNStropheGroup (codingCompliant) +@implementation TNStropheGroup (CPCoding) - (id)initWithCoder:(CPCoder)aCoder { diff --git a/TNStropheRoster.j b/TNStropheRoster.j index 8b3531f..5638859 100644 --- a/TNStropheRoster.j +++ b/TNStropheRoster.j @@ -79,13 +79,9 @@ [_connection disconnect]; } -@end - #pragma mark - -#pragma mark TNStropheRoster Fetch - -@implementation TNStropheRoster (Fetch) +#pragma mark Fetch /*! ask the server to get the roster of the TNStropheConnection user */ @@ -143,13 +139,9 @@ return NO; } -@end - #pragma mark - -#pragma mark TNStropheRoster Groups - -@implementation TNStropheRoster (Groups) +#pragma mark Groups /*! add a group to the roster with given name @param aGroupName the name of the new group @@ -259,13 +251,9 @@ return nil; } -@end - #pragma mark - -#pragma mark TNStropheRoster Contacts - -@implementation TNStropheRoster (Contacts) +#pragma mark Contacts /*! add a new contact to the roster with given information @param aJID the JID of the new contact @@ -404,13 +392,9 @@ [aContact changeGroup:newGroup]; } -@end - #pragma mark - -#pragma mark TNStropheRoster Subscriptions - -@implementation TNStropheRoster (Subscriptions) +#pragma mark Subscriptions /*! message sent when a presence information received send didReceiveSubscriptionRequest: to the delegate with the stanza as parameter diff --git a/TNXMLNode.j b/TNXMLNode.j index 57f565f..21b3c11 100644 --- a/TNXMLNode.j +++ b/TNXMLNode.j @@ -19,9 +19,6 @@ @import -#pragma mark - -#pragma mark TNXMLNode - /*! @ingroup strophecappuccino This is an implementation of a really basic XML node in Cappuccino */ @@ -104,25 +101,6 @@ return [TNXMLNode nodeWithXMLNode:Strophe.copyElement([self tree])]; } -/*! Add a child to the current seletected node - This will move the stanza object pointer to the child node - @param aTagName name of the new tag - @param attributes CPDictionary contains all attributes -*/ -- (void)addChildWithName:(CPString)aTagName andAttributes:(CPDictionary)attributes -{ - _xmlNode = _xmlNode.c(aTagName, attributes); -} - -/*! Add a child to the current seletected node - This will move the stanza object pointer to the child node - @param aTagName name of the new tag -*/ -- (void)addChildWithName:(CPString)aTagName -{ - [self addChildWithName:aTagName andAttributes:{}]; -} - /*! append a node to the current node @param aNode the dom element to add. */ @@ -139,21 +117,20 @@ _xmlNode = _xmlNode.t(aText); } -/*! return a DOM Element of the TNXMLNode - @return an DOM Element +/*! get the text node value + @return CPString of the content of node */ -- (id)tree +- (CPString)text { - return _xmlNode.tree(); + return Strophe.getText([self tree]); } -/*! convert the TNXMLNode into its string representation - @return string representation of the TNXMLNode +/*! return a DOM Element of the TNXMLNode + @return an DOM Element */ -- (CPString)stringValue +- (id)tree { - //return Strophe.toString(_xmlNode); - return Strophe.serialize(_xmlNode); + return _xmlNode.tree(); } /*! Move the pointer to the parent of the current node @@ -168,6 +145,23 @@ return NO; } +/*! convert the TNXMLNode into its string representation + @return string representation of the TNXMLNode +*/ +- (CPString)stringValue +{ + //return Strophe.toString(_xmlNode); + return Strophe.serialize(_xmlNode); +} + +- (CPString)description +{ + return [self stringValue]; +} + +#pragma mark - +#pragma mark Attributes + /*! get value of an attribute of the current node @param anAttribute the attribute @return the value of anAttribute @@ -190,6 +184,52 @@ _xmlNode.attrs(attr); } +/*! return the name of the current node + @return CPString containing the name of the current node +*/ +- (CPString)name +{ + return [self tree].tagName; +} + +/*! get the xmlns field of the node + @return xmlns field of node +*/ +- (CPString)namespace +{ + return [self valueForAttribute:@"xmlns"]; +} + +/*! set the xmlns field of the node + @param the new xmls value +*/ +- (void)setNamespace:(CPString)aNamespace +{ + [self setValue:aNamespace forAttribute:@"xmlns"]; +} + +#pragma mark - +#pragma mark Children + +/*! Add a child to the current seletected node + This will move the stanza object pointer to the child node + @param aTagName name of the new tag + @param attributes CPDictionary contains all attributes +*/ +- (void)addChildWithName:(CPString)aTagName andAttributes:(CPDictionary)attributes +{ + _xmlNode = _xmlNode.c(aTagName, attributes); +} + +/*! Add a child to the current seletected node + This will move the stanza object pointer to the child node + @param aTagName name of the new tag +*/ +- (void)addChildWithName:(CPString)aTagName +{ + [self addChildWithName:aTagName andAttributes:{}]; +} + /*! get an CPArray of TNXMLNode with matching tag name @param aName the name tags should match @return CPArray of TNXMLNode @@ -243,47 +283,14 @@ return [self ownChildrenWithName:nil]; } -/*! return the name of the current node - @return CPString containing the name of the current node -*/ -- (CPString)name -{ - return [self tree].tagName; -} - - (BOOL)containsChildrenWithName:(CPString)aName { return ([self firstChildWithName:aName]) ? YES : NO; } -/*! get the text node value - @return CPString of the content of node -*/ -- (CPString)text -{ - return Strophe.getText([self tree]); -} +@end -- (CPString)description -{ - return [self stringValue]; -} - -/*! get the xmlns field of the node - @return xmlns field of node -*/ -- (CPString)namespace -{ - return [self valueForAttribute:@"xmlns"]; -} - -/*! set the xmlns field of the node - @param the new xmls value -*/ -- (void)setNamespace:(CPString)aNamespace -{ - [self setValue:aNamespace forAttribute:@"xmlns"]; -} +@implementation TNXMLNode (CPCoding) - (id)initWithCoder:(CPCoder)aCoder {