Overview
Comment: | XMPPConnection: Verify origin of IQ responses |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4aae7b6dd1d5f1b84daa88af850b6bf1 |
User & Date: | florob@babelmonkeys.de on 2014-02-03 22:36:13 |
Other Links: | manifest | tags |
Context
2014-02-03
| ||
22:50 | XMPPRoster: Ensure roster pushes were sent by the server check-in: 6f1b17c116 user: florob@babelmonkeys.de tags: trunk | |
22:36 | XMPPConnection: Verify origin of IQ responses check-in: 4aae7b6dd1 user: florob@babelmonkeys.de tags: trunk | |
22:34 | Adapt to ObjFW changes check-in: 0668df366c user: florob@babelmonkeys.de tags: trunk | |
Changes
Modified src/XMPPConnection.m from [150ec0f157] to [15582e8207].
︙ | ︙ | |||
559 560 561 562 563 564 565 566 | - (void)sendIQ: (XMPPIQ*)IQ callbackTarget: (id)target selector: (SEL)selector { OFAutoreleasePool *pool; XMPPCallback *callback; | > > > | | > | | > > > > > > | > > > | | > | | > > > > > > | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | - (void)sendIQ: (XMPPIQ*)IQ callbackTarget: (id)target selector: (SEL)selector { OFAutoreleasePool *pool; XMPPCallback *callback; OFString *ID, *key; pool = [[OFAutoreleasePool alloc] init]; if ((ID = [IQ ID]) == nil) { ID = [self generateStanzaID]; [IQ setID: ID]; } if ((key = [[IQ to] fullJID]) == nil) key = [_JID bareJID]; if (key == nil) // Only happens for resource bind key = @"bind"; key = [key stringByAppendingString: ID]; callback = [XMPPCallback callbackWithTarget: target selector: selector]; [_callbacks setObject: callback forKey: key]; [pool release]; [self sendStanza: IQ]; } #ifdef OF_HAVE_BLOCKS - (void)sendIQ: (XMPPIQ*)IQ callbackBlock: (xmpp_callback_block_t)block { OFAutoreleasePool *pool; XMPPCallback *callback; OFString *ID, *key; pool = [[OFAutoreleasePool alloc] init]; if ((ID = [IQ ID]) == nil) { ID = [self generateStanzaID]; [IQ setID: ID]; } if ((key = [[IQ to] fullJID]) == nil) key = [_JID bareJID]; if (key == nil) // Connection not yet bound, can't send stanzas @throw [OFInvalidArgumentException exception]; key = [key stringByAppendingString: ID]; callback = [XMPPCallback callbackWithBlock: block]; [_callbacks setObject: callback forKey: key]; [pool release]; [self sendStanza: IQ]; } #endif - (OFString*)generateStanzaID |
︙ | ︙ | |||
954 955 956 957 958 959 960 | exceptionWithConnection: self reason: [element XMLString]]; } assert(0); } | | > > > > > > > | | | | | | | | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 | exceptionWithConnection: self reason: [element XMLString]]; } assert(0); } - (void)XMPP_handleIQ: (XMPPIQ*)IQ { bool handled = false; XMPPCallback *callback; OFString *key; if ((key = [[IQ from] fullJID]) == nil) key = [_JID bareJID]; if (key == nil) // Only happens for resource bind key = @"bind"; key = [key stringByAppendingString: [IQ ID]]; if ((callback = [_callbacks objectForKey: key])) { [callback runWithIQ: IQ connection: self]; [_callbacks removeObjectForKey: key]; return; } handled = [_delegates broadcastSelector: @selector( connection:didReceiveIQ:) withObject: self withObject: IQ]; if (!handled && ![[IQ type] isEqual: @"error"] && ![[IQ type] isEqual: @"result"]) { [self sendStanza: [IQ errorIQWithType: @"cancel" condition: @"service-unavailable"]]; } } - (void)XMPP_handleMessage: (XMPPMessage*)message { [_delegates broadcastSelector: @selector(connection:didReceiveMessage:) |
︙ | ︙ |