Overview
Comment: | Handle stream errors |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ccfc230e32fa469e00c70b4584d64c66 |
User & Date: | florob@babelmonkeys.de on 2011-04-15 00:41:23 |
Other Links: | manifest | tags |
Context
2011-04-15
| ||
00:51 | Don't answer to IQs of type "error" or "result" check-in: 0e2d960203 user: florob@babelmonkeys.de tags: trunk | |
00:41 | Handle stream errors check-in: ccfc230e32 user: florob@babelmonkeys.de tags: trunk | |
2011-04-07
| ||
21:13 |
Split up XMPP_handleStanza. Non-Stanzas are now handled in separate functions check-in: ba3acce2ec user: florob@babelmonkeys.de tags: trunk | |
Changes
Modified src/XMPPConnection.h from [de4a3311e8] to [660f92f7a3].
︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | + | #define XMPP_NS_BIND @"urn:ietf:params:xml:ns:xmpp-bind" #define XMPP_NS_CLIENT @"jabber:client" #define XMPP_NS_ROSTER @"jabber:iq:roster" #define XMPP_NS_SASL @"urn:ietf:params:xml:ns:xmpp-sasl" #define XMPP_NS_STARTTLS @"urn:ietf:params:xml:ns:xmpp-tls" #define XMPP_NS_STANZAS @"urn:ietf:params:xml:ns:xmpp-stanzas" #define XMPP_NS_SESSION @"urn:ietf:params:xml:ns:xmpp-session" #define XMPP_NS_XMPP_STREAM @"urn:ietf:params:xml:ns:xmpp-streams" #define XMPP_NS_STREAM @"http://etherx.jabber.org/streams" @protocol XMPPConnectionDelegate #ifndef XMPP_CONNECTION_M <OFObject> #endif #ifdef OF_HAVE_OPTIONAL_PROTOCOLS |
︙ |
Modified src/XMPPConnection.m from [330b6dadbb] to [60d0b36b6c].
︙ | |||
281 282 283 284 285 286 287 288 289 290 291 292 293 294 | 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 | + + + + + + + + + + + + + | } } [parser setDelegate: elementBuilder]; [pool release]; } - (void)parser: (OFXMLParser*)p didEndElement: (OFString*)name withPrefix: (OFString*)prefix namespace: (OFString*)ns attributes: (OFArray*)attrs { if (![name isEqual: @"stream"] || ![prefix isEqual: @"stream"] || ![ns isEqual: XMPP_NS_STREAM]) { of_log(@"Did not get expected stream end!"); assert(0); } } - (void)elementBuilder: (OFXMLElementBuilder*)b didBuildElement: (OFXMLElement*)elem { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [elem setDefaultNamespace: XMPP_NS_CLIENT]; |
︙ | |||
346 347 348 349 350 351 352 353 354 355 356 357 358 359 | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | - (void)XMPP_handleStream: (OFXMLElement*)elem { if ([[elem name] isEqual: @"features"]) { [self XMPP_handleFeatures: elem]; return; } if ([[elem name] isEqual: @"error"]) { OFString *condition, *reason; [parser setDelegate: self]; [sock writeString: @"</stream:stream>"]; [sock close]; if ([elem elementForName: @"bad-format" namespace: XMPP_NS_XMPP_STREAM]) condition = @"bad-format"; else if ([elem elementForName: @"bad-namespace-prefix" namespace: XMPP_NS_XMPP_STREAM]) condition = @"bad-namespace-prefix"; else if ([elem elementForName: @"conflict" namespace: XMPP_NS_XMPP_STREAM]) condition = @"conflict"; else if ([elem elementForName: @"connection-timeout" namespace: XMPP_NS_XMPP_STREAM]) condition = @"connection-timeout"; else if ([elem elementForName: @"host-gone" namespace: XMPP_NS_XMPP_STREAM]) condition = @"host-gone"; else if ([elem elementForName: @"host-unknown" namespace: XMPP_NS_XMPP_STREAM]) condition = @"host-unknown"; else if ([elem elementForName: @"improper-addressing" namespace: XMPP_NS_XMPP_STREAM]) condition = @"improper-addressing"; else if ([elem elementForName: @"internal-server-error" namespace: XMPP_NS_XMPP_STREAM]) condition = @"internal-server-error"; else if ([elem elementForName: @"invalid-from" namespace: XMPP_NS_XMPP_STREAM]) condition = @"invalid-from"; else if ([elem elementForName: @"invalid-namespace" namespace: XMPP_NS_XMPP_STREAM]) condition = @"invalid-namespace"; else if ([elem elementForName: @"invalid-xml" namespace: XMPP_NS_XMPP_STREAM]) condition = @"invalid-xml"; else if ([elem elementForName: @"not-authorized" namespace: XMPP_NS_XMPP_STREAM]) condition = @"not-authorized"; else if ([elem elementForName: @"not-well-formed" namespace: XMPP_NS_XMPP_STREAM]) condition = @"not-well-formed"; else if ([elem elementForName: @"policy-violation" namespace: XMPP_NS_XMPP_STREAM]) condition = @"policy-violation"; else if ([elem elementForName: @"remote-connection-failed" namespace: XMPP_NS_XMPP_STREAM]) condition = @"remote-connection-failed"; else if ([elem elementForName: @"reset" namespace: XMPP_NS_XMPP_STREAM]) condition = @"reset"; else if ([elem elementForName: @"resource-constraint" namespace: XMPP_NS_XMPP_STREAM]) condition = @"resource-constraint"; else if ([elem elementForName: @"restricted-xml" namespace: XMPP_NS_XMPP_STREAM]) condition = @"restricted-xml"; else if ([elem elementForName: @"see-other-host" namespace: XMPP_NS_XMPP_STREAM]) condition = @"see-other-host"; else if ([elem elementForName: @"system-shutdown" namespace: XMPP_NS_XMPP_STREAM]) condition = @"system-shutdown"; else if ([elem elementForName: @"undefined-condition" namespace: XMPP_NS_XMPP_STREAM]) condition = @"undefined-condition"; else if ([elem elementForName: @"unsupported-encoding" namespace: XMPP_NS_XMPP_STREAM]) condition = @"unsupported-encoding"; else if ([elem elementForName: @"unsupported-feature" namespace: XMPP_NS_XMPP_STREAM]) condition = @"unsupported-feature"; else if ([elem elementForName: @"unsupported-stanza-type" namespace: XMPP_NS_XMPP_STREAM]) condition = @"unsupported-stanza-type"; else if ([elem elementForName: @"unsupported-version" namespace: XMPP_NS_XMPP_STREAM]) condition = @"unsupported-version"; else condition = @"undefined"; reason = [[elem elementForName: @"text" namespace: XMPP_NS_XMPP_STREAM] stringValue]; @throw [XMPPStreamErrorException newWithClass: isa connection: self condition: condition reason: reason]; return; } assert(0); } - (void)XMPP_handleTLS: (OFXMLElement*)elem { if ([[elem name] isEqual: @"proceed"]) { |
︙ |
Modified src/XMPPExceptions.h from [2a495c565d] to [74f141b417].
︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | + + + + + + + + + + + + + + + + + + + + + + + | + newWithClass: (Class)class_ connection: (XMPPConnection*)conn; - initWithClass: (Class)class_ connection: (XMPPConnection*)conn; - (XMPPConnection*)connection; @end @interface XMPPStreamErrorException: XMPPException { OFString *condition; OFString *reason; } #ifdef OF_HAVE_PROPERTIES @property (readonly, nonatomic) OFString *condition; @property (readonly, nonatomic) OFString *reason; #endif + newWithClass: (Class)class_ connection: (XMPPConnection*)conn condition: (OFString*)condition_ reason: (OFString*)reason_; - initWithClass: (Class)class_ connection: (XMPPConnection*)conn condition: (OFString*)condition_ reason: (OFString*)reason_; - (OFString*)condition; - (OFString*)reason; @end @interface XMPPStringPrepFailedException: XMPPException { OFString *profile; OFString *string; } |
︙ |
Modified src/XMPPExceptions.m from [95ac10b065] to [d368ce72c2].
︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } - (XMPPConnection*)connection { return connection; } @end @implementation XMPPStreamErrorException + newWithClass: (Class)class_ connection: (XMPPConnection*)conn condition: (OFString*)condition_ reason: (OFString*)reason_; { return [[self alloc] initWithClass: class_ connection: conn condition: condition_ reason: reason_]; } - initWithClass: (Class)class_ connection: (XMPPConnection*)conn { Class c = isa; [self release]; @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithClass: (Class)class_ connection: (XMPPConnection*)conn condition: (OFString*)condition_ reason: (OFString*)reason_ { self = [super initWithClass: class_ connection: conn]; @try { condition = [condition_ copy]; reason = [reason_ copy]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [condition release]; [reason release]; [super dealloc]; } - (OFString*)description { if (description != nil) return description; description = [[OFString alloc] initWithFormat: @"Got stream error: %@. Reason: %@!", condition, reason]; return description; } - (OFString*)condition { return condition; } - (OFString*)reason { return reason; } @end @implementation XMPPStringPrepFailedException + newWithClass: (Class)class_ connection: (XMPPConnection*)conn profile: (OFString*)profile string: (OFString*)string { |
︙ |