55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
-
+
|
- (void)XMPP_handleFeatures: (OFXMLElement*)elem;
- (void)XMPP_handleIQ: (XMPPIQ*)iq;
- (void)XMPP_handleMessage: (XMPPMessage*)msg;
- (void)XMPP_handlePresence: (XMPPPresence*)pres;
@end
@implementation XMPPConnection
@synthesize username, password, server, resource, JID, port, useTLS, delegate;
@synthesize JID, port, useTLS, delegate;
- init
{
self = [super init];
sock = [[OFTCPSocket alloc] init];
parser = [[OFXMLParser alloc] init];
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
+
+
+
+
+
|
username = [[OFString alloc] initWithCString: node];
} @finally {
free(node);
}
[old release];
}
- (OFString*)username
{
return [[username copy] autorelease];
}
- (void)setResource: (OFString*)resource_
{
OFString *old = resource;
char *res;
Stringprep_rc rc;
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
+
+
+
+
+
|
resource = [[OFString alloc] initWithCString: res];
} @finally {
free(res);
}
[old release];
}
- (OFString*)resource
{
return [[resource copy] autorelease];
}
- (void)setServer: (OFString*)server_
{
OFString *old = server;
char *srv;
Idna_rc rc;
|
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
+
+
+
+
+
|
server = [[OFString alloc] initWithCString: srv];
} @finally {
free(srv);
}
[old release];
}
- (OFString*)server
{
return [[server copy] autorelease];
}
- (void)setPassword: (OFString*)password_
{
OFString *old = password;
char *pass;
Stringprep_rc rc;
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
+
+
+
+
+
|
password = [[OFString alloc] initWithCString: pass];
} @finally {
free(pass);
}
[old release];
}
- (OFString*)password
{
return [[password copy] autorelease];
}
- (void)connect
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
[sock connectToHost: server
onPort: port];
|