28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
+
|
#import "XMPPConnection.h"
#import "XMPPJID.h"
#import "XMPPStanza.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
#import "XMPPRoster.h"
#import "XMPPJSONFileStorage.h"
@interface AppDelegate: OFObject
#ifdef OF_HAVE_OPTIONAL_PROTOCOLS
<OFApplicationDelegate, XMPPConnectionDelegate, XMPPRosterDelegate>
#endif
{
XMPPConnection *conn;
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
+
-
+
+
+
+
-
+
+
|
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"]));
conn = [[XMPPConnection alloc] init];
roster = [[XMPPRoster alloc] initWithConnection: conn];
[conn addDelegate: self];
XMPPJSONFileStorage *storage =
[[XMPPJSONFileStorage alloc] initWithFile: @"storage.json"];
[conn setDataStorage: storage];
[conn addDelegate: self];
roster = [[XMPPRoster alloc] initWithConnection: conn];
[roster addDelegate: self];
if ([arguments count] != 3) {
of_log(@"Invalid count of command line arguments!");
[OFApplication terminateWithStatus: 1];
}
|