Skip to content

Commit

Permalink
Merge branch 'master' of github.com:robbiehanson/XMPPFramework
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiehanson committed Apr 2, 2013
2 parents 3cdef85 + 2d0b30e commit 7d00d63
Show file tree
Hide file tree
Showing 26 changed files with 88 additions and 619 deletions.
30 changes: 2 additions & 28 deletions Core/XMPPModule.m
Expand Up @@ -6,32 +6,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
#if DEBUG #if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN; static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN;
Expand Down Expand Up @@ -60,7 +34,7 @@ - (id)initWithDispatchQueue:(dispatch_queue_t)queue
if (queue) if (queue)
{ {
moduleQueue = queue; moduleQueue = queue;
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_retain(moduleQueue); dispatch_retain(moduleQueue);
#endif #endif
} }
Expand All @@ -77,7 +51,7 @@ - (id)initWithDispatchQueue:(dispatch_queue_t)queue


- (void)dealloc - (void)dealloc
{ {
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_release(moduleQueue); dispatch_release(moduleQueue);
#endif #endif
} }
Expand Down
36 changes: 5 additions & 31 deletions Core/XMPPParser.m
Expand Up @@ -11,32 +11,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
#if DEBUG #if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_VERBOSE; static const int xmppLogLevel = XMPP_LOG_LEVEL_VERBOSE;
Expand Down Expand Up @@ -725,15 +699,15 @@ - (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq parserQu
delegate = aDelegate; delegate = aDelegate;
delegateQueue = dq; delegateQueue = dq;


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
if (delegateQueue) if (delegateQueue)
dispatch_retain(delegateQueue); dispatch_retain(delegateQueue);
#endif #endif


if (pq) { if (pq) {
parserQueue = pq; parserQueue = pq;


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_retain(parserQueue); dispatch_retain(parserQueue);
#endif #endif
} }
Expand Down Expand Up @@ -785,7 +759,7 @@ - (void)dealloc
xmlFreeParserCtxt(parserCtxt); xmlFreeParserCtxt(parserCtxt);
} }


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
if (delegateQueue) if (delegateQueue)
dispatch_release(delegateQueue); dispatch_release(delegateQueue);
if (parserQueue) if (parserQueue)
Expand All @@ -795,7 +769,7 @@ - (void)dealloc


- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue
{ {
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
if (newDelegateQueue) if (newDelegateQueue)
dispatch_retain(newDelegateQueue); dispatch_retain(newDelegateQueue);
#endif #endif
Expand All @@ -804,7 +778,7 @@ - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQ


delegate = newDelegate; delegate = newDelegate;


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
if (delegateQueue) if (delegateQueue)
dispatch_release(delegateQueue); dispatch_release(delegateQueue);
#endif #endif
Expand Down
34 changes: 4 additions & 30 deletions Core/XMPPStream.m
Expand Up @@ -17,32 +17,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
#if DEBUG #if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_INFO | XMPP_LOG_FLAG_SEND_RECV; // | XMPP_LOG_FLAG_TRACE; static const int xmppLogLevel = XMPP_LOG_LEVEL_INFO | XMPP_LOG_FLAG_SEND_RECV; // | XMPP_LOG_FLAG_TRACE;
Expand Down Expand Up @@ -277,7 +251,7 @@ - (id)initP2PFrom:(XMPPJID *)jid
**/ **/
- (void)dealloc - (void)dealloc
{ {
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_release(xmppQueue); dispatch_release(xmppQueue);
dispatch_release(willSendIqQueue); dispatch_release(willSendIqQueue);
dispatch_release(willSendMessageQueue); dispatch_release(willSendMessageQueue);
Expand Down Expand Up @@ -2548,7 +2522,7 @@ - (void)continueReceiveIQ:(XMPPIQ *)iq
[self sendElement:iqResponse]; [self sendElement:iqResponse];
} }


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_release(delSemaphore); dispatch_release(delSemaphore);
dispatch_release(delGroup); dispatch_release(delGroup);
#endif #endif
Expand Down Expand Up @@ -3818,7 +3792,7 @@ - (void)setupKeepAliveTimer
[self keepAlive]; [self keepAlive];
}}); }});


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_source_t theKeepAliveTimer = keepAliveTimer; dispatch_source_t theKeepAliveTimer = keepAliveTimer;


dispatch_source_set_cancel_handler(keepAliveTimer, ^{ dispatch_source_set_cancel_handler(keepAliveTimer, ^{
Expand Down Expand Up @@ -4282,7 +4256,7 @@ - (BOOL)wait:(NSTimeInterval)timeout_seconds


- (void)dealloc - (void)dealloc
{ {
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_release(semaphore); dispatch_release(semaphore);
#endif #endif
} }
Expand Down
28 changes: 1 addition & 27 deletions Extensions/CoreDataStorage/XMPPCoreDataStorage.m
Expand Up @@ -12,32 +12,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
#if DEBUG #if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN; static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN;
Expand Down Expand Up @@ -845,7 +819,7 @@ - (void)dealloc
[[self class] unregisterDatabaseFileName:databaseFileName]; [[self class] unregisterDatabaseFileName:databaseFileName];
} }


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
if (storageQueue) if (storageQueue)
dispatch_release(storageQueue); dispatch_release(storageQueue);
#endif #endif
Expand Down
30 changes: 2 additions & 28 deletions Extensions/Reconnect/XMPPReconnect.m
Expand Up @@ -7,32 +7,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

#define IMPOSSIBLE_REACHABILITY_FLAGS 0xFFFFFFFF #define IMPOSSIBLE_REACHABILITY_FLAGS 0xFFFFFFFF


// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
Expand Down Expand Up @@ -412,7 +386,7 @@ - (void)setupReconnectTimer


}}); }});


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_source_t theReconnectTimer = reconnectTimer; dispatch_source_t theReconnectTimer = reconnectTimer;


dispatch_source_set_cancel_handler(reconnectTimer, ^{ dispatch_source_set_cancel_handler(reconnectTimer, ^{
Expand Down Expand Up @@ -641,7 +615,7 @@ - (void)maybeAttemptReconnectWithReachabilityFlags:(SCNetworkReachabilityFlags)r


}}); }});


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_release(delSemaphore); dispatch_release(delSemaphore);
dispatch_release(delGroup); dispatch_release(delGroup);
#endif #endif
Expand Down
30 changes: 2 additions & 28 deletions Extensions/Roster/MemoryStorage/XMPPRosterMemoryStorage.m
Expand Up @@ -8,32 +8,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
#if DEBUG #if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN; // | XMPP_LOG_FLAG_TRACE; static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN; // | XMPP_LOG_FLAG_TRACE;
Expand Down Expand Up @@ -83,7 +57,7 @@ - (BOOL)configureWithParent:(XMPPRoster *)aParent queue:(dispatch_queue_t)queue
parent = aParent; parent = aParent;
parentQueue = queue; parentQueue = queue;


#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_retain(parentQueue); dispatch_retain(parentQueue);
#endif #endif


Expand All @@ -96,7 +70,7 @@ - (BOOL)configureWithParent:(XMPPRoster *)aParent queue:(dispatch_queue_t)queue


- (void)dealloc - (void)dealloc
{ {
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
if (parentQueue) if (parentQueue)
dispatch_release(parentQueue); dispatch_release(parentQueue);
#endif #endif
Expand Down
30 changes: 2 additions & 28 deletions Extensions/XEP-0009/XMPPJabberRPCModule.m
Expand Up @@ -16,32 +16,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif #endif


/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 10.8+
**/
#if TARGET_OS_IPHONE

// Compiling for iOS

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif

#else

// Compiling for Mac OS X

#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif

#endif

// Log levels: off, error, warn, info, verbose // Log levels: off, error, warn, info, verbose
// Log flags: trace // Log flags: trace
#if DEBUG #if DEBUG
Expand Down Expand Up @@ -83,7 +57,7 @@ - (id)initWithRpcID:(NSString *)aRpcID timer:(dispatch_source_t)aTimer
rpcID = [aRpcID copy]; rpcID = [aRpcID copy];


timer = aTimer; timer = aTimer;
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_retain(timer); dispatch_retain(timer);
#endif #endif
} }
Expand All @@ -105,7 +79,7 @@ - (void)cancelTimer
if (timer) if (timer)
{ {
dispatch_source_cancel(timer); dispatch_source_cancel(timer);
#if NEEDS_DISPATCH_RETAIN_RELEASE #if !OS_OBJECT_USE_OBJC
dispatch_release(timer); dispatch_release(timer);
#endif #endif
timer = NULL; timer = NULL;
Expand Down

0 comments on commit 7d00d63

Please sign in to comment.