27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
+
|
#import "XMPPConnection.h"
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
#import "XMPPRoster.h"
@interface AppDelegate: OFObject <OFApplicationDelegate, XMPPConnectionDelegate>
@end
OF_APPLICATION_DELEGATE(AppDelegate)
@implementation AppDelegate
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
-
+
+
+
+
|
[conn requestRoster];
}
- (void)connectionDidReceiveRoster :(XMPPConnection*)conn
{
XMPPPresence *pres;
of_log(@"Got roster");
of_log(@"Got roster! Groups: %@", conn.roster.groups);
for (OFString *group in conn.roster.groups)
of_log(@"Group %@: %@", group,
[conn.roster rosterItemsInGroup: group]);
pres = [XMPPPresence presence];
[pres addPriority: 10];
[pres addStatus: @"ObjXMPP test is working!"];
[conn sendStanza: pres];
}
|