49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
@implementation AppDelegate
- (void)applicationDidFinishLaunching
{
OFArray *arguments = [OFApplication arguments];
XMPPPresence *pres = [XMPPPresence presence];
[pres setShow: @"chat"];
[pres setStatus: @"Bored"];
[pres setPriority: [OFNumber numberWithInt8: 20]];
[pres setTo: [XMPPJID JIDWithString: @"alice@example.com"]];
[pres setFrom: [XMPPJID JIDWithString: @"bob@example.org"]];
assert([[pres XMLString] isEqual: @"<presence to='alice@example.com' "
@"from='bob@example.org'><show>chat</show>"
@"<status>Bored</status><priority>20</priority>"
@"</presence>"]);
XMPPMessage *msg = [XMPPMessage messageWithType: @"chat"];
[msg setBody: @"Hello everyone"];
[msg setTo: [XMPPJID JIDWithString: @"jdev@conference.jabber.org"]];
[msg setFrom: [XMPPJID JIDWithString: @"alice@example.com"]];
assert([[msg XMLString] isEqual: @"<message type='chat' "
@"to='jdev@conference.jabber.org' "
@"from='alice@example.com'><body>Hello everyone</body>"
|
|
|
>
>
>
>
>
>
>
>
>
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
@implementation AppDelegate
- (void)applicationDidFinishLaunching
{
OFArray *arguments = [OFApplication arguments];
XMPPPresence *pres = [XMPPPresence presence];
[pres setShow: @"xa"];
[pres setStatus: @"Bored"];
[pres setPriority: [OFNumber numberWithInt8: 20]];
[pres setTo: [XMPPJID JIDWithString: @"alice@example.com"]];
[pres setFrom: [XMPPJID JIDWithString: @"bob@example.org"]];
assert([[pres XMLString] isEqual: @"<presence to='alice@example.com' "
@"from='bob@example.org'><show>xa</show>"
@"<status>Bored</status><priority>20</priority>"
@"</presence>"]);
XMPPPresence *pres2 = [XMPPPresence presence];
[pres2 setShow: @"away"];
[pres2 setStatus: @"Bored"];
[pres2 setPriority: [OFNumber numberWithInt8: 23]];
[pres2 setTo: [XMPPJID JIDWithString: @"alice@example.com"]];
[pres2 setFrom: [XMPPJID JIDWithString: @"bob@example.org"]];
assert([pres compare: pres2] == OF_ORDERED_ASCENDING);
XMPPMessage *msg = [XMPPMessage messageWithType: @"chat"];
[msg setBody: @"Hello everyone"];
[msg setTo: [XMPPJID JIDWithString: @"jdev@conference.jabber.org"]];
[msg setFrom: [XMPPJID JIDWithString: @"alice@example.com"]];
assert([[msg XMLString] isEqual: @"<message type='chat' "
@"to='jdev@conference.jabber.org' "
@"from='alice@example.com'><body>Hello everyone</body>"
|