diff --git a/src/XMPPDiscoEntity.h b/src/XMPPDiscoEntity.h index cfc0693..4b90807 100644 --- a/src/XMPPDiscoEntity.h +++ b/src/XMPPDiscoEntity.h @@ -37,6 +37,7 @@ XMPPConnection *_connection; OFString *_capsNode; } + #ifdef OF_HAVE_PROPERTIES /** * \brief The XMPPDiscoNodes this entity provides Services Discovery diff --git a/src/XMPPDiscoIdentity.m b/src/XMPPDiscoIdentity.m index 26a9563..8d7923e 100644 --- a/src/XMPPDiscoIdentity.m +++ b/src/XMPPDiscoIdentity.m @@ -28,7 +28,7 @@ name: (OFString*)name { return [[[self alloc] initWithCategory: category - type: type + type: type name: name] autorelease]; } diff --git a/src/XMPPDiscoNode.h b/src/XMPPDiscoNode.h index cb35fd6..2959812 100644 --- a/src/XMPPDiscoNode.h +++ b/src/XMPPDiscoNode.h @@ -37,6 +37,7 @@ OFSortedList *_features; OFMutableDictionary *_childNodes; } + #ifdef OF_HAVE_PROPERTIES /// \brief The JID this node lives on @property (readonly) XMPPJID *JID; diff --git a/src/XMPPMulticastDelegate.h b/src/XMPPMulticastDelegate.h index 306c70a..0516343 100644 --- a/src/XMPPMulticastDelegate.h +++ b/src/XMPPMulticastDelegate.h @@ -30,7 +30,7 @@ @interface XMPPMulticastDelegate: OFObject { OFDataArray *_delegates; - size_t handlerIndex; + size_t _handlerIndex; } /** diff --git a/src/XMPPMulticastDelegate.m b/src/XMPPMulticastDelegate.m index 1d165f8..aa9ccd0 100644 --- a/src/XMPPMulticastDelegate.m +++ b/src/XMPPMulticastDelegate.m @@ -65,8 +65,10 @@ continue; [_delegates removeItemAtIndex: i]; - if (i <= handlerIndex) - handlerIndex--; + + if (i <= _handlerIndex) + _handlerIndex--; + return; } } @@ -78,8 +80,9 @@ 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; @@ -87,8 +90,11 @@ [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]; } @@ -104,8 +110,9 @@ 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; @@ -113,8 +120,11 @@ [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]; } diff --git a/tests/test.m b/tests/test.m index 6940c04..70f5899 100644 --- a/tests/test.m +++ b/tests/test.m @@ -155,7 +155,6 @@ OF_APPLICATION_DELEGATE(AppDelegate) of_log(@"Supports SM: %@", [conn_ supportsStreamManagement] ? @"YES" : @"NO"); - XMPPDiscoEntity *discoEntity = [[XMPPDiscoEntity alloc] initWithConnection: conn];