Overview
Comment: | Request session and send initial presence in tests. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ae80606d3d88f7eb21082a13908a0af1 |
User & Date: | js on 2011-03-21 15:15:35 |
Other Links: | manifest | tags |
Context
2011-03-21
| ||
16:51 | Add Xcode project. check-in: 1ea39ac77e user: js tags: trunk | |
15:15 | Request session and send initial presence in tests. check-in: ae80606d3d user: js tags: trunk | |
14:44 | Move auth and bound handling to delegate. check-in: 15c050df49 user: js tags: trunk | |
Changes
Modified src/XMPPConnection.h from [5712350844] to [2b28aa53b0].
︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + | XMPPJID *JID; /// The port to connect to short port; /// Whether to use TLS BOOL useTLS; id <XMPPConnectionDelegate, OFObject> delegate; XMPPAuthenticator *authModule; BOOL needsSession; } @property (copy) OFString *username; @property (copy) OFString *password; @property (copy) OFString *server; @property (copy) OFString *resource; @property (copy, readonly) XMPPJID *JID; |
︙ |
Modified src/XMPPConnection.m from [bdd589660a] to [761caabf32].
︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | + | #import "XMPPPresence.h" #import "XMPPExceptions.h" #define NS_BIND @"urn:ietf:params:xml:ns:xmpp-bind" #define NS_CLIENT @"jabber:client" #define NS_SASL @"urn:ietf:params:xml:ns:xmpp-sasl" #define NS_STARTTLS @"urn:ietf:params:xml:ns:xmpp-tls" #define NS_SESSION @"urn:ietf:params:xml:ns:xmpp-session" #define NS_STREAM @"http://etherx.jabber.org/streams" @implementation XMPPConnection @synthesize username, password, server, resource, JID, port, useTLS, delegate; - init { |
︙ | |||
191 192 193 194 195 196 197 | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | - - + | size_t len = [sock readNBytes: 512 intoBuffer: buf]; if (len < 1 && [delegate respondsToSelector: @selector(connectionWasClosed:)]) [delegate connectionWasClosed: self]; |
︙ | |||
253 254 255 256 257 258 259 260 261 262 263 264 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | + + + + + + + + + + - - - - - + + + + + + + + + + + - - - - - + + + + + + + + + + + + + - + + + + - + + + + - + + + + + + + + + - + + + + + + + + + + | if (resource) [bind addChild: [OFXMLElement elementWithName: @"resource" stringValue: resource]]; [iq addChild: bind]; [self sendStanza: iq]; } - (void)_sendSession { XMPPIQ *iq = [XMPPIQ IQWithType: @"set" ID: @"session0"]; [iq addChild: [OFXMLElement elementWithName: @"session" namespace: NS_SESSION]]; [self sendStanza: iq]; } - (void)_handleResourceBind: (XMPPIQ*)iq { OFXMLElement *bindElem = iq.children.firstObject; OFXMLElement *jidElem; |
︙ | |||
341 342 343 344 345 346 347 348 349 350 351 352 353 354 | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | + + | - (void)elementBuilder: (OFXMLElementBuilder*)b didBuildElement: (OFXMLElement*)elem { elem.defaultNamespace = NS_CLIENT; [elem setPrefix: @"stream" forNamespace: NS_STREAM]; of_log(@"In: %@", elem); if ([elem.namespace isEqual: NS_CLIENT]) { if ([elem.name isEqual: @"iq"]) { [self _handleIQ: [XMPPIQ stanzaWithElement: elem]]; return; } |
︙ |
Modified tests/test.m from [8016af6ff2] to [b2456e219f].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - - - + | #import "XMPPJID.h" #import "XMPPStanza.h" #import "XMPPIQ.h" #import "XMPPMessage.h" #import "XMPPPresence.h" @interface AppDelegate: OFObject <OFApplicationDelegate, XMPPConnectionDelegate> |
︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | + + + + + + + + | { of_log(@"Auth successful"); } - (void)connection: (XMPPConnection*)conn wasBoundToJID: (XMPPJID*)jid { XMPPPresence *pres; of_log(@"Bound to JID: %@", [jid fullJID]); pres = [XMPPPresence presence]; [pres addPriority: 10]; [pres addStatus: @"ObjXMPP test is working!"]; [conn sendStanza: pres]; } - (void)connection: (XMPPConnection*)conn didReceiveIQ: (XMPPIQ*)iq { of_log(@"IQ: %@", iq); } |
︙ |