Overview
Comment: | Make use of multicast delegates in XMPPRoster. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a77ad914f24e65903684dd5db32631f2 |
User & Date: | js on 2012-01-30 17:45:43 |
Other Links: | manifest | tags |
Context
2012-02-03
| ||
08:04 | Update .hgignore. check-in: 62973cfa1b user: js tags: trunk | |
2012-01-30
| ||
22:39 | Document XMPPConnectionDelegate check-in: b0ac3cc5eb user: florob@babelmonkeys.de tags: trunk | |
17:45 | Make use of multicast delegates in XMPPRoster. check-in: a77ad914f2 user: js tags: trunk | |
13:35 | Remove the roster delegate if it gets deallocated. check-in: 840e61d391 user: js tags: trunk | |
Changes
Modified src/XMPPConnection.m from [d30b689c50] to [187819bc21].
︙ | |||
302 303 304 305 306 307 308 | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | - + | } - (void)parseBuffer: (const char*)buffer withLength: (size_t)length { if (length < 1) { [delegates broadcastSelector: @selector(connectionWasClosed:) |
︙ | |||
372 373 374 375 376 377 378 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | - + | exceptionWithClass: isa reason: @"No matching identifier"]; } - (void)sendStanza: (OFXMLElement*)element { [delegates broadcastSelector: @selector(connection:didSendElement:) |
︙ | |||
482 483 484 485 486 487 488 | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | - + | return; [element setDefaultNamespace: XMPP_NS_CLIENT]; [element setPrefix: @"stream" forNamespace: XMPP_NS_STREAM]; [delegates broadcastSelector: @selector(connection:didReceiveElement:) |
︙ | |||
684 685 686 687 688 689 690 | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | - + - + | { if ([[element name] isEqual: @"proceed"]) { /* FIXME: Catch errors here */ SSLSocket *newSock; [delegates broadcastSelector: @selector( connectionWillUpgradeToTLS:) |
︙ | |||
740 741 742 743 744 745 746 | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | - + | if ([[element name] isEqual: @"success"]) { [authModule continueWithData: [OFDataArray dataArrayWithBase64EncodedString: [element stringValue]]]; [delegates broadcastSelector: @selector( connectionWWasAuthenticated:) |
︙ | |||
773 774 775 776 777 778 779 | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | - + - + - + | [callback runWithIQ: iq]; [callbacks removeObjectForKey: [iq ID]]; return; } handled = [delegates broadcastSelector: @selector( connection:didReceiveIQ:) |
︙ | |||
964 965 966 967 968 969 970 | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | - + | if (needsSession) { [self XMPP_sendSession]; return; } [delegates broadcastSelector: @selector(connection:wasBoundToJID:) |
︙ | |||
987 988 989 990 991 992 993 | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | - + | - (void)XMPP_handleSession: (XMPPIQ*)iq { if (![[iq type] isEqual: @"result"]) assert(0); [delegates broadcastSelector: @selector(connection:wasBoundToJID:) |
︙ |
Modified src/XMPPMulticastDelegate.h from [44c939a254] to [7474d32e16].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - + - - + + - + - - + + | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ |
Modified src/XMPPMulticastDelegate.m from [405f29fa95] to [427c4ecc5d].
︙ | |||
46 47 48 49 50 51 52 | 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 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 | - + - + - + - + - - + + - + | - (void)dealloc { [delegates release]; [super dealloc]; } |
Modified src/XMPPRoster.h from [ad6d9399e3] to [1412762159].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | + | #import <ObjFW/ObjFW.h> #import "XMPPConnection.h" @class XMPPRosterItem; @class XMPPIQ; @class XMPPRoster; @class XMPPMulticastDelegate; @protocol XMPPRosterDelegate #ifndef XMPP_ROSTER_M <OFObject> #endif #ifdef OF_HAVE_OPTIONAL_PROTOCOLS @optional |
︙ | |||
45 46 47 48 49 50 51 | 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 | - + - - - - - - + + | @interface XMPPRoster: OFObject #ifdef OF_HAVE_OPTIONAL_PROTOCOLS <XMPPConnectionDelegate> #endif { XMPPConnection *connection; OFMutableDictionary *rosterItems; |
Modified src/XMPPRoster.m from [299be9c4c8] to [eaf6a2879a].
︙ | |||
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 | 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 | + + | { self = [super init]; @try { rosterItems = [[OFMutableDictionary alloc] init]; connection = connection_; [connection addDelegate: self]; delegates = [[XMPPMulticastDelegate alloc] init]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [connection removeDelegate: self]; [delegates release]; [rosterItems release]; [super dealloc]; } - (OFDictionary*)rosterItems { |
︙ | |||
103 104 105 106 107 108 109 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - - - - + + + + | rosterItem = [self XMPP_rosterItemWithXMLElement: element]; if ([[rosterItem subscription] isEqual: @"remove"]) [self XMPP_deleteRosterItem: rosterItem]; else [self XMPP_addRosterItem: rosterItem]; |
︙ | |||
168 169 170 171 172 173 174 | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + - + - + - + | [query addChild: item]; [iq addChild: query]; [connection sendStanza: iq]; } |
︙ | |||
254 255 256 257 258 259 260 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - - + + | if ([[rosterItem subscription] isEqual: @"remove"]) [self XMPP_deleteRosterItem: rosterItem]; else [self XMPP_addRosterItem: rosterItem]; } |
Modified tests/test.m from [4c51fd299e] to [1465dc8600].
︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + | [[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]; |
︙ |