Index: src/XMPPCallback.h ================================================================== --- src/XMPPCallback.h +++ src/XMPPCallback.h @@ -20,14 +20,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ #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 { id object; @@ -42,7 +43,8 @@ + callbackWithCallbackObject: (id)object selector: (SEL)selector; - initWithCallbackObject: (id)object selector: (SEL)selector; -- (void)runWithIQ: (XMPPIQ*)iq; +- (void)runWithIQ: (XMPPIQ*)iq + connection: (XMPPConnection*)connection; @end Index: src/XMPPCallback.m ================================================================== --- src/XMPPCallback.m +++ src/XMPPCallback.m @@ -65,15 +65,17 @@ { [super dealloc]; } - (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 Index: src/XMPPConnection.h ================================================================== --- src/XMPPConnection.h +++ src/XMPPConnection.h @@ -21,10 +21,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ #import +#import "XMPPCallback.h" + @class XMPPConnection; @class XMPPJID; @class XMPPIQ; @class XMPPMessage; @class XMPPPresence; @@ -299,11 +301,11 @@ * \brief Sends an XMPPIQ, registering a callback block. * * \param callback The callback block */ - (void)sendIQ: (XMPPIQ*)iq - withCallbackBlock: (void(^)(XMPPIQ*))block; + withCallbackBlock: (xmpp_callback_block_t)block; #endif /** * \brief Generates a new, unique stanza ID. * Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -786,11 +786,12 @@ { BOOL handled = NO; XMPPCallback *callback; if ((callback = [callbacks objectForKey: [iq ID]])) { - [callback runWithIQ: iq]; + [callback runWithIQ: iq + connection: self]; [callbacks removeObjectForKey: [iq ID]]; return; } handled = [delegates broadcastSelector: @selector(