Index: src/XMPPDiscoEntity.h ================================================================== --- src/XMPPDiscoEntity.h +++ src/XMPPDiscoEntity.h @@ -35,10 +35,11 @@ { OFMutableDictionary *_discoNodes; XMPPConnection *_connection; OFString *_capsNode; } + #ifdef OF_HAVE_PROPERTIES /** * \brief The XMPPDiscoNodes this entity provides Services Discovery * responses for * Index: src/XMPPDiscoIdentity.m ================================================================== --- src/XMPPDiscoIdentity.m +++ src/XMPPDiscoIdentity.m @@ -26,11 +26,11 @@ + identityWithCategory: (OFString*)category type: (OFString*)type name: (OFString*)name { return [[[self alloc] initWithCategory: category - type: type + type: type name: name] autorelease]; } + identityWithCategory: (OFString*)category type: (OFString*)type Index: src/XMPPDiscoNode.h ================================================================== --- src/XMPPDiscoNode.h +++ src/XMPPDiscoNode.h @@ -35,10 +35,11 @@ OFString *_name; OFSortedList *_identities; OFSortedList *_features; OFMutableDictionary *_childNodes; } + #ifdef OF_HAVE_PROPERTIES /// \brief The JID this node lives on @property (readonly) XMPPJID *JID; /// \brief The node's opaque name of the node @property (readonly) OFString *node; Index: src/XMPPMulticastDelegate.h ================================================================== --- src/XMPPMulticastDelegate.h +++ src/XMPPMulticastDelegate.h @@ -28,11 +28,11 @@ * \brief A class to provide multiple delegates in a single class */ @interface XMPPMulticastDelegate: OFObject { OFDataArray *_delegates; - size_t handlerIndex; + size_t _handlerIndex; } /** * \brief Adds a delegate which should receive the broadcasts. * Index: src/XMPPMulticastDelegate.m ================================================================== --- src/XMPPMulticastDelegate.m +++ src/XMPPMulticastDelegate.m @@ -63,12 +63,14 @@ for (i = 0; i < count; i++) { if (items[i] != delegate) continue; [_delegates removeItemAtIndex: i]; - if (i <= handlerIndex) - handlerIndex--; + + if (i <= _handlerIndex) + _handlerIndex--; + return; } } - (BOOL)broadcastSelector: (SEL)selector @@ -76,21 +78,25 @@ { size_t count = [_delegates count]; id *items = [_delegates items]; BOOL handled = NO; - for (handlerIndex = 0; handlerIndex < count; handlerIndex++) { - id responder = items[handlerIndex]; + for (_handlerIndex = 0; _handlerIndex < count; _handlerIndex++) { + id responder = items[_handlerIndex]; + if (![responder respondsToSelector: selector]) continue; BOOL (*imp)(id, SEL, id) = (BOOL(*)(id, SEL, id)) [responder methodForSelector: selector]; handled |= imp(responder, selector, object); - // Update count and items, since the handler might have - // changed them. + + /* + * Update count and items, since the handler might have changed + * them. + */ count = [_delegates count]; items = [_delegates items]; } return handled; @@ -102,23 +108,27 @@ { size_t count = [_delegates count]; id *items = [_delegates items]; BOOL handled = NO; - for (handlerIndex = 0; handlerIndex < count; handlerIndex++) { - id responder = items[handlerIndex]; + for (_handlerIndex = 0; _handlerIndex < count; _handlerIndex++) { + id responder = items[_handlerIndex]; + if (![responder respondsToSelector: selector]) continue; BOOL (*imp)(id, SEL, id, id) = (BOOL(*)(id, SEL, id, id)) [responder methodForSelector: selector]; handled |= imp(responder, selector, object1, object2); - // Update count and items, since the handler might have - // changed them. + + /* + * Update count and items, since the handler might have changed + * them. + */ count = [_delegates count]; items = [_delegates items]; } return handled; } @end Index: tests/test.m ================================================================== --- tests/test.m +++ tests/test.m @@ -152,11 +152,10 @@ wasBoundToJID: (XMPPJID*)jid { of_log(@"Bound to JID: %@", [jid fullJID]); of_log(@"Supports SM: %@", [conn_ supportsStreamManagement] ? @"YES" : @"NO"); - XMPPDiscoEntity *discoEntity = [[XMPPDiscoEntity alloc] initWithConnection: conn]; [discoEntity addIdentity: