@@ -79,27 +79,22 @@
assert([msg.XMLString isEqual: @"Hello everyone"
@""]);
- XMPPIQ *IQ = [XMPPIQ IQWithType: @"set"
- ID: @"128"];
+ XMPPIQ *IQ = [XMPPIQ IQWithType: @"set" ID: @"128"];
IQ.to = [XMPPJID JIDWithString: @"juliet@capulet.lit"];
IQ.from = [XMPPJID JIDWithString: @"romeo@montague.lit"];
assert([IQ.XMLString isEqual: @""]);
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"];
+ [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.XMLString isEqual: [stanza XMLString]]);
assert(([[OFString stringWithFormat: @"%@, %@, %@, %@",
stanza.from.fullJID, stanza.to.fullJID, stanza.type, stanza.ID]
isEqual: @"bob@localhost, alice@localhost, get, 42"]));
@@ -145,12 +140,11 @@
- (void)connectionWasAuthenticated: (XMPPConnection *)conn
{
OFLog(@"Auth successful");
}
-- (void)connection: (XMPPConnection *)conn_
- wasBoundToJID: (XMPPJID *)JID
+- (void)connection: (XMPPConnection *)conn_ wasBoundToJID: (XMPPJID *)JID
{
OFLog(@"Bound to JID: %@", JID.fullJID);
OFLog(@"Supports SM: %@",
conn_.supportsStreamManagement ? @"true" : @"false");
@@ -210,16 +204,14 @@
pres.status = @"ObjXMPP test is working!";
[conn sendStanza: pres];
#ifdef OF_HAVE_BLOCKS
- XMPPIQ *IQ = [XMPPIQ IQWithType: @"get"
- ID: [conn generateStanzaID]];
+ XMPPIQ *IQ = [XMPPIQ IQWithType: @"get" ID: [conn generateStanzaID]];
[IQ addChild: [OFXMLElement elementWithName: @"ping"
namespace: @"urn:xmpp:ping"]];
- [conn sendIQ: IQ
- callbackBlock: ^ (XMPPConnection *c, XMPPIQ *resp) {
+ [conn sendIQ: IQ callbackBlock: ^ (XMPPConnection *c, XMPPIQ *resp) {
OFLog(@"Ping response: %@", resp);
}];
#endif
}
@@ -241,20 +233,18 @@
didReceiveRosterItem: (XMPPRosterItem *)rosterItem
{
OFLog(@"Got roster push: %@", rosterItem);
}
-- (bool)connection: (XMPPConnection *)conn
- didReceiveIQ: (XMPPIQ *)iq
+- (bool)connection: (XMPPConnection *)conn didReceiveIQ: (XMPPIQ *)iq
{
OFLog(@"IQ: %@", iq);
return NO;
}
-- (void)connection: (XMPPConnection *)conn
- didReceiveMessage: (XMPPMessage *)msg
+- (void)connection: (XMPPConnection *)conn didReceiveMessage: (XMPPMessage *)msg
{
OFLog(@"Message: %@", msg);
}
- (void)connection: (XMPPConnection *)conn
@@ -261,17 +251,15 @@
didReceivePresence: (XMPPPresence *)pres
{
OFLog(@"Presence: %@", pres);
}
-- (void)connection: (XMPPConnection *)conn
- didThrowException: (id)e
+- (void)connection: (XMPPConnection *)conn didThrowException: (id)e
{
@throw e;
}
-- (void)connectionWasClosed: (XMPPConnection *)conn
- error: (OFXMLElement *)error
+- (void)connectionWasClosed: (XMPPConnection *)conn error: (OFXMLElement *)error
{
OFLog(@"Connection was closed: %@", error);
}
@end