@@ -2,10 +2,13 @@ #import #import "XMPPConnection.h" #import "XMPPStanza.h" +#import "XMPPIQ.h" +#import "XMPPMessage.h" +#import "XMPPPresence.h" @interface AppDelegate: OFObject { XMPPConnection *conn; } @@ -23,40 +26,40 @@ [pres addStatus: @"Bored"]; [pres addPriority: 20]; pres.to = @"alice@example.com"; pres.from = @"bob@example.org"; assert([[pres stringValue] isEqual: @"chat" - @"Bored20" - @""]); + @"from='bob@example.org'>chat" + @"Bored20" + @""]); XMPPMessage *msg = [XMPPMessage messageWithType: @"chat"]; [msg addBody: @"Hello everyone"]; msg.to = @"jdev@conference.jabber.org"; msg.from = @"alice@example.com"; assert([[msg stringValue] isEqual: @"Hello everyone" - @""]); + @"to='jdev@conference.jabber.org' " + @"from='alice@example.com'>Hello everyone" + @""]); XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"128"]; iq.to = @"juliet@capulet.lit"; iq.from = @"romeo@montague.lit"; assert([[iq stringValue] isEqual: @""]); + @"to='juliet@capulet.lit' " + @"from='romeo@montague.lit'/>"]); OFXMLElement *elem = [OFXMLElement elementWithName: @"iq"]; [elem addAttributeWithName: @"from" stringValue: @"bob@localhost"]; [elem addAttributeWithName: @"to" stringValue: @"alice@localhost"]; [elem addAttributeWithName: @"type" stringValue: @"get"]; [elem addAttributeWithName: @"id" stringValue: @"42"]; XMPPStanza *stanza = [XMPPStanza stanzaWithElement: elem]; assert([[elem stringValue] isEqual: [stanza stringValue]]); assert(([[OFString stringWithFormat: @"%@, %@, %@, %@", stanza.from, - stanza.to, stanza.type, stanza.ID] - isEqual: @"bob@localhost, alice@localhost, get, 42"])); + stanza.to, stanza.type, stanza.ID] + isEqual: @"bob@localhost, alice@localhost, get, 42"])); conn = [[XMPPConnection alloc] init]; if (arguments.count != 3) { of_log(@"Invalid count of command line arguments!");