diff --git a/src/XMPPCallback.h b/src/XMPPCallback.h index 0b738ee..61dde60 100644 --- a/src/XMPPCallback.h +++ b/src/XMPPCallback.h @@ -22,10 +22,11 @@ #import +@class XMPPConnection; @class XMPPIQ; #ifdef OF_HAVE_BLOCKS -typedef void(^xmpp_callback_block_t)(XMPPIQ*); +typedef void(^xmpp_callback_block_t)(XMPPConnection*, XMPPIQ*); #endif @interface XMPPCallback: OFObject @@ -44,5 +45,6 @@ typedef void(^xmpp_callback_block_t)(XMPPIQ*); - initWithCallbackObject: (id)object selector: (SEL)selector; -- (void)runWithIQ: (XMPPIQ*)iq; +- (void)runWithIQ: (XMPPIQ*)iq + connection: (XMPPConnection*)connection; @end diff --git a/src/XMPPCallback.m b/src/XMPPCallback.m index d2a5090..da61a4e 100644 --- a/src/XMPPCallback.m +++ b/src/XMPPCallback.m @@ -67,13 +67,15 @@ } - (void)runWithIQ: (XMPPIQ*)iq + connection: (XMPPConnection*)connection { #ifdef OF_HAVE_BLOCKS if ([object isKindOfClass: [OFBlock class]]) - ((xmpp_callback_block_t)object)(iq); + ((xmpp_callback_block_t)object)(connection, iq); else #endif [object performSelector: selector + withObject: connection withObject: iq]; } @end diff --git a/src/XMPPConnection.h b/src/XMPPConnection.h index a9aad2b..8fd1912 100644 --- a/src/XMPPConnection.h +++ b/src/XMPPConnection.h @@ -23,6 +23,8 @@ #import +#import "XMPPCallback.h" + @class XMPPConnection; @class XMPPJID; @class XMPPIQ; @@ -301,7 +303,7 @@ * \param callback The callback block */ - (void)sendIQ: (XMPPIQ*)iq - withCallbackBlock: (void(^)(XMPPIQ*))block; + withCallbackBlock: (xmpp_callback_block_t)block; #endif /** diff --git a/src/XMPPConnection.m b/src/XMPPConnection.m index 606db9b..38f8f02 100644 --- a/src/XMPPConnection.m +++ b/src/XMPPConnection.m @@ -788,7 +788,8 @@ XMPPCallback *callback; if ((callback = [callbacks objectForKey: [iq ID]])) { - [callback runWithIQ: iq]; + [callback runWithIQ: iq + connection: self]; [callbacks removeObjectForKey: [iq ID]]; return; }