Browse files

Squashed commit of the following:

commit 479fc36
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Wed Jun 12 16:54:16 2013 +0100

    Fixes iOS 7 Analyser Warnings

commit 6075ec9
Merge: b4cc970 0e31a96
Author: Spencer MacDonald <spencer.macdonald.other@gmail.com>
Date:   Wed Jun 5 06:02:04 2013 -0700

    Merge pull request #204 from jonasman/master

    fixed a typo in XMPPRoom

commit 0e31a96
Author: Joao Nunes <joao@Joao-Nuness-MacBook-Pro-3.local>
Date:   Wed Jun 5 14:58:05 2013 +0300

    Fixed a typo in XMPPRoom

commit b4cc970
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon May 20 10:38:18 2013 +0100

    XMPPCapabilities autoFetchMyServerCapabilities

    Some XEPs require you to check if the server supports them before attempting to use them, setting autoFetchMyServerCapabilities to YES means the server is automatically queried upon authentication.

commit dfaf53f
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 19 14:15:14 2013 +0100

    Code Clean Up and Convenience Methods

commit e110992
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 18 18:34:10 2013 +0100

    XEP-0066: Out of Band Data

    Fixes #196

commit 6027964
Merge: 783f625 54aa804
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 18 14:30:15 2013 +0100

    Merge branch 'master' of https://github.com/robbiehanson/XMPPFramework

commit 783f625
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 18 14:29:24 2013 +0100

    XMPPIDTracker numberOfIDs API

commit 54aa804
Merge: 6b3cca6 8375968
Author: Spencer MacDonald <spencer.macdonald.other@gmail.com>
Date:   Fri May 17 11:47:14 2013 -0700

    Merge pull request #197 from greenwoodcm/master

    Fixed build error in FacebookTest

commit 8375968
Author: Chris Greenwood <greenwoodcm@gmail.com>
Date:   Fri May 17 11:34:12 2013 -0400

    Fixed FacebookTest - updated references to Facebook SDK files so that it compiles

commit 6b3cca6
Merge: b13a80e 35293d2
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 17 11:14:32 2013 +0100

    Merge branch 'master' of https://github.com/robbiehanson/XMPPFramework

commit b13a80e
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 17 11:14:15 2013 +0100

    XMPPCoreDataStorage autoRecreateDatabaseFile

    Most of the time you only override didNotAddPersistentStoreWithPath: to remove the current database file and attempt to create a new one. This commit makes this into property.

commit 35293d2
Merge: 3bc668c 95c6e74
Author: Spencer MacDonald <spencer.macdonald.other@gmail.com>
Date:   Wed May 15 04:15:00 2013 -0700

    Merge pull request #195 from jonasman/master

    fixed XMPPPrivacy using old method name

commit 95c6e74
Author: Joao Nunes <joao@Joao-Nuness-MacBook-Pro-3.local>
Date:   Wed May 15 13:46:18 2013 +0300

    Fixed XMPPPrivacy extention using old DidDisconnect method name

commit 3bc668c
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon May 13 10:34:38 2013 +0100

    Ignore -1 Last Activity

    Fixes #190

commit 7c5d93d
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 12 12:00:40 2013 +0100

    Delegate Refactor Missed a File

commit 48a37bc
Merge: 555d3d4 627c270
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 12 11:56:59 2013 +0100

    Merge branch 'master' of https://github.com/robbiehanson/XMPPFramework

commit 627c270
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 11 20:50:23 2013 +0100

    XMPPSystemInputActivityMonitor

    -  XMPPSystemInputActivityMonitor is used to keep track of system input activity.
    - This module could be used to add such features as "auto away" when the user is inactive for 5 mins.

commit 555d3d4
Merge: 22691b3 f39451a
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 11 16:24:33 2013 +0100

    Merge branch 'master' of https://github.com/robbiehanson/XMPPFramework

commit 22691b3
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 11 16:24:22 2013 +0100

    Roster APIs

    Additional APIs to Hook into Roster Events

commit ee571c2
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 11 16:22:31 2013 +0100

    Code Clean Up

commit f39451a
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 11 12:57:17 2013 +0100

    Google Shared Status

    Fixes #189
    Fixes #112

commit 62a6e16
Author: galaxas0 <aditya.nrusimha@gmail.com>
Date:   Fri May 10 19:17:00 2013 -0600

    Create XMPPSharedStatus.m

commit 55ead57
Author: galaxas0 <aditya.nrusimha@gmail.com>
Date:   Fri May 10 19:16:44 2013 -0600

    Create XMPPSharedStatus.h

commit f0f9f14
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Wed May 8 19:37:25 2013 +0100

    XMPPRosterStorage should only create users from presence if XMPPRoster allowRosterlessOperation is YES

    Fixes #186

commit c50ce34
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Tue May 7 19:45:19 2013 +0100

    XMPPIDTrackerTimeoutNone const

commit 0a917be
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Tue May 7 19:39:21 2013 +0100

    Variables the Wrong Way Round

commit 2154cca
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon May 6 11:31:45 2013 +0100

    XEP-0297: Stanza Forwarding

commit 7c87833
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon May 6 11:31:19 2013 +0100

    XEP-0059: Result Set Management

commit b382e31
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 5 16:32:28 2013 +0100

    Rename BOOL

commit 9b40b4b
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 5 16:10:25 2013 +0100

    NSXMLElement xmlns prefix APIs

commit 349232e
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 5 15:51:32 2013 +0100

    XEP-0184

commit 9bbef60
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 5 15:50:40 2013 +0100

    XMPPStream enumerateModulesOfClass: withBlock: API

commit 26135b2
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun May 5 14:32:30 2013 +0100

    XMPPStream Connect APIs now have optional timeout parameter

    Fixes #59
    Fixes #122

commit c4f622c
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 4 19:03:24 2013 +0100

    Fixes iOS 6 Warnings for ServerlessDemo

commit 4c1028c
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 4 19:02:59 2013 +0100

    Move XEP-0203: Delayed Delivery to a Category on NSXMLElement not XMPPElement

    XEPs such as 0313: Message Archive Management show that Delayed Delivery can be used for thins other than iq, presence and message elements.

commit 9627d78
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat May 4 18:46:26 2013 +0100

    XMPPElement To and From Methods

commit 10aa529
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 3 15:17:36 2013 +0100

    XMPPTrackingInfo allows for the actual element to be attached to help with tracking

commit 2a4ed5f
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 3 13:14:21 2013 +0100

    XMPPvCardAvatarModule APIs Updated for Consistency

    Fixes #95

commit 9a2b64d
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 3 12:14:44 2013 +0100

    XMPPCoreDataStorage setAutoAllowExternalBinaryDataStorage

    This method calls setAllowsExternalBinaryDataStorage:YES for all Binary Data Attributes in the Managed Object Model. On OS Versions that do not support external binary data storage, this property does nothing.

commit 8d4e45f
Merge: f9567be ddbf12b
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 3 11:07:49 2013 +0100

    Merge branch 'master' of https://github.com/robbiehanson/XMPPFramework

commit f9567be
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 3 11:07:36 2013 +0100

    Compression Methods API

    Note that the XMPPStream doesn't currently support any compression methods

commit 32e8065
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri May 3 10:23:47 2013 +0100

    Simplified featuresForXMPPCapabilities API

commit ddbf12b
Merge: 777f378 75ea765
Author: Spencer MacDonald <spencer.macdonald.other@gmail.com>
Date:   Fri May 3 02:10:31 2013 -0700

    Merge pull request #150 from noa--/pullreq6

    Add room JID as parameter to XMPPMUC delegate methods

commit 777f378
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Tue Apr 30 13:11:09 2013 +0100

    XMPPIQ, XMPPMessage and XMPPPresence now support initWithXMLString:error:

commit ee401b3
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Tue Apr 30 13:08:46 2013 +0100

    XEP-0308: Last Message Correction

commit 32aa85a
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Tue Apr 30 12:04:30 2013 +0100

    XEP-0172

commit 49b4522
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon Apr 29 19:39:38 2013 +0100

    Rename Method for Consistency

commit 1cf373b
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon Apr 29 16:00:22 2013 +0100

    XMPPCapabilities featureElementsForXMPPCapabilities API

    Typically all you want to do in xmppCapabilities:collectingMyCapabilities: is add feature elements to the query, so passing in the query directly into the delegate method isn't very clean. Moreover it doesn't deal with multiple modules supplying the same feature elements.

    featureElementsForXMPPCapabilities: allows you to supply an array of feature elements and also discards duplicate features automatically.

commit fea613e
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Mon Apr 29 10:37:15 2013 +0100

    XMPPvCardAvatarModule autoClearMyvcard API

    Fixes #106

commit 3f67dc2
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 21:47:50 2013 +0100

    vCard Avatar Updates

    Merge from Pull Request #46

commit 6907a71
Merge: 4dfa846 df26210
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 19:21:39 2013 +0100

    Merge branch 'master' of https://github.com/robbiehanson/XMPPFramework

commit 4dfa846
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 19:20:58 2013 +0100

    XMPPMessage Initializers

    - Initializers for elementID and child element

commit de0fe72
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 19:19:29 2013 +0100

    Naming Consistency

commit df26210
Merge: 0e2e6a2 638ee3d
Author: Spencer MacDonald <spencer.macdonald.other@gmail.com>
Date:   Sun Apr 28 08:54:41 2013 -0700

    Merge pull request #179 from terryso/master

    Implement changeNickName method for XMPPRoom Class

commit 0e2e6a2
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 14:45:23 2013 +0100

    XEP-0012 Last Activity implementation

commit 92aba53
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 13:35:06 2013 +0100

    Module Headers Now Have Defines

commit 3d3dec7
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sun Apr 28 13:18:12 2013 +0100

    Prefix Reachability Callback

commit a1a1aca
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 21:53:53 2013 +0100

    Fix Apple bug parsing fraction digits that round to next second.

    The bug is documented in http://openradar.appspot.com/13024643,
    http://openradar.appspot.com/12761015 and http://openradar.appspot.com/12029137

    To workaround, we use a simple NSNumberFormatter to parse the fractional part,
    and create the final result adding the intervals from the date without the
    fractional part and the parsing result of the fraction part as a double.

commit 5fa604d
Merge: a3b05e7 4537473
Author: Spencer MacDonald <spencer.macdonald.other@gmail.com>
Date:   Sat Apr 27 12:47:00 2013 -0700

    Merge pull request #145 from noa--/pullreq3

    Add support to XMPPReconnect for -oldSchoolSecureConnect

commit a3b05e7
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 18:40:02 2013 +0100

    Add User to Groups

commit 76e012d
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 15:48:23 2013 +0100

    Fixes issue #47

    id attribute added to the bind resource iq

commit e309e22
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 15:41:35 2013 +0100

    XEP-0085: Chat State Notifications APIs

    chatState

commit 3abbe5a
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 14:50:45 2013 +0100

    XEP-0045: Multi-User Chat Typos

    items => item

commit 73aaa47
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 14:31:40 2013 +0100

    Fixes Analyser Warning

commit 46267a4
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Sat Apr 27 14:30:50 2013 +0100

    XMPPStream APIs

    isConnecting
    isAuthenticating
    authenticationDate

commit 329b5bd
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri Apr 26 22:00:51 2013 +0100

    Fixes iPhone Sample Projects warnings on iOS 6

commit 1d79f17
Author: Spencer MacDonald <spencer.macdonald@gmail.com>
Date:   Fri Apr 26 21:59:26 2013 +0100

    libidn.a includes x86_64 i386 armv7 architectures

commit 5bb556f
Merge: c90e9b2 2b280f2
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Thu Apr 25 11:04:54 2013 -0700

    Merge pull request #172 from andrewtj/atj-fix-inverted-queue-asserts

    Fix inverted queue asserts

commit 638ee3d
Author: terryso <suchuanyi@126.com>
Date:   Thu Apr 25 10:45:32 2013 +0800

    implement changeNickName method for XMPPRoom class

commit c90e9b2
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 24 16:23:14 2013 -0700

    Several updates to PubSub module

commit 4fcc987
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 24 16:12:00 2013 -0700

    Minor changes (log levels, comments, imports)

commit 2b280f2
Author: Andrew Tunnell-Jones <andrew@tj.id.au>
Date:   Thu Apr 11 02:37:03 2013 +0000

    Fix inverted queue asserts

    Fix inverted queue asserts introduced in b378ed5.

commit 66d4a18
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 10 16:00:24 2013 -0700

    Bug fix for issue #170

commit 3c4134d
Merge: 1609551 be54584
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 10 13:26:42 2013 -0700

    Merge pull request #121 from andrewtj/atj-dedupe-presence-elements

    XMPPCapabilities should update c element if present

commit 1609551
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 10 13:11:33 2013 -0700

    Bug fix for issue #156 : Bug in XMPPRoomCoreDataStorage causing duplicate messages

commit b071267
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 10 12:00:47 2013 -0700

    Adding all files to Xcode project in order to test for warnings throughout framework

commit 05e52a3
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 10 11:46:28 2013 -0700

    Converting queueTags from 'char *' to 'void *', and removing unneeded comparisons

commit b378ed5
Merge: 8503cef 2341cef
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Wed Apr 10 10:41:54 2013 -0700

    Merge branch 'remove-get-current-queue' of https://github.com/drodriguez/XMPPFramework into drodriguez-remove-get-current-queue

    Resolved Conflicts:
    	Utilities/XMPPIDTracker.m
    	Vendor/CocoaAsyncSocket/GCDAsyncSocket.h
    	Vendor/CocoaAsyncSocket/GCDAsyncSocket.m
    	Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.m
    	Vendor/CocoaLumberjack/DDFileLogger.m
    	Vendor/CocoaLumberjack/DDLog.m
    	Vendor/CocoaLumberjack/DDTTYLogger.m

commit 8503cef
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:39:56 2013 -0700

    Merging latest changes from CocoaLumberjack project

commit 3a9e9cd
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:36:08 2013 -0700

    Merging latest changes from CocoaAsyncSocket project

commit 7d00d63
Merge: 3cdef85 2d0b30e
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:35:19 2013 -0700

    Merge branch 'master' of github.com:robbiehanson/XMPPFramework

commit 3cdef85
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:33:18 2013 -0700

    Updating xcode project

commit 2d0b30e
Merge: 5cbb6fc 0aa633c
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:30:08 2013 -0700

    Merge pull request #147 from noa--/pullreq5

    Fix array-bounds crash in XMPPPubSub when parsing ping-response IQs

commit 5cbb6fc
Merge: 8d28b2e d566388
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:28:23 2013 -0700

    Merge pull request #152 from noa--/pullreq8

    Fix "no visible @interface…" error in XEP-0224

commit 8d28b2e
Merge: 96dac82 509d50a
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:26:36 2013 -0700

    Merge pull request #143 from noa--/pullreq1

    Fix node creation when using options dictionary

commit 96dac82
Merge: 7662e11 2e7fe01
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:22:58 2013 -0700

    Merge pull request #139 from drodriguez/bye-bye-needs-dispatch-retain-release

    Remove uses of NEEDS_DISPATCH_RETAIN_RELEASE. Use OS_OBJECT_USE_OBJC.

commit 7662e11
Merge: b0835be 7fbb1d3
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Tue Apr 2 11:20:42 2013 -0700

    Merge pull request #137 from drodriguez/fix-ddlist-removeall

    Fix DDList removeAll: not moving to the next node after removing the first.

commit d566388
Author: Paul Melnikow <email@paulmelnikow.com>
Date:   Sun Feb 3 10:48:51 2013 -0500

    Fix "no visible @interface…" error in XEP-0224

    Fixes #93

commit 75ea765
Author: Paul Melnikow <email@paulmelnikow.com>
Date:   Sun Feb 3 00:57:51 2013 -0500

    Add room JID as parameter to XMPPMUC delegate methods

commit 0aa633c
Author: Paul Melnikow <email@paulmelnikow.com>
Date:   Sat Jan 26 13:50:43 2013 -0500

    Fix array-bounds crash in XMPPPubSub when parsing ping-response IQs

    Crash occurs when id has only one component, and count is 0

    Example:
    <iq xmlns="jabber:client" id="3FA360E2-EB57-4F71-A645-183C53555773" type="result"></iq>

commit 4537473
Author: Paul Melnikow <email@paulmelnikow.com>
Date:   Fri Jan 25 15:33:34 2013 -0500

    Add support to XMPPReconnect for -oldSchoolSecureConnect

commit 509d50a
Author: Paul Melnikow <email@paulmelnikow.com>
Date:   Sun Jan 20 18:39:54 2013 -0500

    Fix node creation when using options dictionary

    1. Create node should precede configure node instead of following it
    2. The values in the options dictionary should be the option values, and the keys the field names, instead of reversed

commit 2341cef
Author: Daniel Rodríguez Troitiño <drodrigueztroitino@yahoo.es>
Date:   Mon Jan 14 21:34:56 2013 +0100

    Remove all uses of dispatch_get_current_queue, except for logging.

    All uses of dispatch_get_current_queue (deprecated since iOS 6.0) are removed,
    and replaced by assigning a static queue tag, which is checked for its value.
    Inside the queue, the specific will return itself, while outside the queue it
    will return NULL, which will make the check fail.

    Only two instances of dispatch_get_current_queue remain, both have been
    surrounded by pragmas to disable the warning by the Clang compiler.
    - DDLog.m: obtaining the current queue label.
    - DelegateTesters.m: obtaining the current queue label for NSLog.

commit 2e7fe01
Author: Daniel Rodríguez Troitiño <drodrigueztroitino@yahoo.es>
Date:   Sun Jan 13 19:47:57 2013 +0100

    Remove uses of NEEDS_DISPATCH_RETAIN_RELEASE. Use OS_OBJECT_USE_OBJC.

    According to os/object.h the macro OS_OBJECT_USE_OBJC can be used to determine
    if the compilation target supports libSystem objects be used as Obj-C types.

commit 7fbb1d3
Author: Daniel Rodríguez Troitiño <drodrigueztroitino@yahoo.es>
Date:   Wed Jan 9 01:40:16 2013 +0100

    Fix DDList removeAll: not moving to the next node after removing the first.

    Also includes a test in TestDDList that will crash with "malloc: *** error for
    object 0x123456: pointer being freed was not allocated".

commit be54584
Author: Andrew Tunnell-Jones <andrew@tj.id.au>
Date:   Tue Nov 20 03:10:54 2012 +0000

    XMPPvCardAvatarModule should update x element if present

commit a0705af
Author: Andrew Tunnell-Jones <andrew@tj.id.au>
Date:   Sat Nov 3 05:55:57 2012 +0000

    XMPPCapabilities should update c element if present

    Presence stanzas sent by XMPPStream's resendMyPresence may already
    contain a c element. If a c element is present in the presence stanza
    XMPPCapabilities should replace it rather than add an additional c
    element.

commit b0835be
Merge: f533eb8 33554eb
Author: Robbie Hanson <robbiehanson@deusty.com>
Date:   Fri Oct 26 09:24:21 2012 -0700

    Merge pull request #109 from chrisballinger/libidn-1.25-iOS6

    Upgrade to libidn-1.25 (iOS 6 compatibility)

commit 33554eb
Author: Chris Ballinger <chrisballinger@gmail.com>
Date:   Mon Sep 17 17:41:29 2012 -0700

    Upgrade to libidn-1.25, remove support for armv6 and add support for armv7s

Signed-off-by: Bradford Toney <bradford.toney@gmail.com>
  • Loading branch information...
1 parent 37a5c96 commit b6782e212d2f18784df8d5826306f6fafaeb10b3 @bluemoon bluemoon committed Jun 15, 2013
Showing with 7,483 additions and 2,402 deletions.
  1. +2 −2 Authentication/Anonymous/XMPPAnonymousAuthentication.m
  2. +2 −2 Authentication/Deprecated-Digest/XMPPDeprecatedDigestAuthentication.m
  3. +2 −2 Authentication/Deprecated-Plain/XMPPDeprecatedPlainAuthentication.m
  4. +4 −1 Authentication/Digest-MD5/XMPPDigestMD5Authentication.m
  5. +4 −5 Authentication/X-Facebook-Platform/XMPPXFacebookPlatformAuthentication.m
  6. +2 −0 Categories/NSXMLElement+XMPP.h
  7. +41 −0 Categories/NSXMLElement+XMPP.m
  8. +17 −1 Core/XMPPElement.h
  9. +72 −0 Core/XMPPElement.m
  10. +8 −0 Core/XMPPIQ.m
  11. +1 −0 Core/XMPPInternal.h
  12. +14 −0 Core/XMPPMessage.h
  13. +80 −6 Core/XMPPMessage.m
  14. +5 −1 Core/XMPPModule.h
  15. +15 −34 Core/XMPPModule.m
  16. +19 −38 Core/XMPPParser.m
  17. +8 −0 Core/XMPPPresence.m
  18. +65 −4 Core/XMPPStream.h
  19. +379 −135 Core/XMPPStream.m
  20. +1 −0 Extensions/BandwidthMonitor/XMPPBandwidthMonitor.h
  21. +5 −3 Extensions/BandwidthMonitor/XMPPBandwidthMonitor.m
  22. +22 −0 Extensions/CoreDataStorage/XMPPCoreDataStorage.h
  23. +109 −41 Extensions/CoreDataStorage/XMPPCoreDataStorage.m
  24. +51 −0 Extensions/GoogleSharedStatus/XMPPGoogleSharedStatus.h
  25. +370 −0 Extensions/GoogleSharedStatus/XMPPGoogleSharedStatus.m
  26. +5 −5 Extensions/ProcessOne/XMPPProcessOne.m
  27. +10 −0 Extensions/Reconnect/XMPPReconnect.h
  28. +33 −52 Extensions/Reconnect/XMPPReconnect.m
  29. +8 −0 Extensions/Roster/CoreDataStorage/XMPPRosterCoreDataStorage.h
  30. +69 −3 Extensions/Roster/CoreDataStorage/XMPPRosterCoreDataStorage.m
  31. +1 −1 Extensions/Roster/MemoryStorage/XMPPResourceMemoryStorageObject.m
  32. +1 −0 Extensions/Roster/MemoryStorage/XMPPRosterMemoryStorage.h
  33. +34 −43 Extensions/Roster/MemoryStorage/XMPPRosterMemoryStorage.m
  34. +55 −1 Extensions/Roster/XMPPRoster.h
  35. +115 −46 Extensions/Roster/XMPPRoster.m
  36. +56 −0 Extensions/SystemInputActivityMonitor/XMPPSystemInputActivityMonitor.h
  37. +202 −0 Extensions/SystemInputActivityMonitor/XMPPSystemInputActivityMonitor.m
  38. +2 −0 Extensions/XEP-0009/XMPPJabberRPCModule.h
  39. +4 −30 Extensions/XEP-0009/XMPPJabberRPCModule.m
  40. +94 −0 Extensions/XEP-0012/XMPPIQ+LastActivity.h
  41. +96 −0 Extensions/XEP-0012/XMPPIQ+LastActivity.m
  42. +119 −0 Extensions/XEP-0012/XMPPLastActivity.h
  43. +222 −0 Extensions/XEP-0012/XMPPLastActivity.m
  44. +2 −0 Extensions/XEP-0016/XMPPPrivacy.h
  45. +11 −11 Extensions/XEP-0016/XMPPPrivacy.m
  46. +19 −42 Extensions/XEP-0045/CoreDataStorage/XMPPRoomCoreDataStorage.m
  47. +15 −66 Extensions/XEP-0045/HybridStorage/XMPPRoomHybridStorage.m
  48. +16 −38 Extensions/XEP-0045/MemoryStorage/XMPPRoomMemoryStorage.m
  49. +1 −1 Extensions/XEP-0045/MemoryStorage/XMPPRoomMessageMemoryStorageObject.m
  50. +2 −2 Extensions/XEP-0045/XMPPMUC.h
  51. +5 −3 Extensions/XEP-0045/XMPPMUC.m
  52. +4 −2 Extensions/XEP-0045/XMPPRoom.h
  53. +26 −23 Extensions/XEP-0045/XMPPRoom.m
  54. +18 −2 Extensions/XEP-0054/CoreDataStorage/XMPPvCardCoreDataStorage.m
  55. +1 −1 Extensions/XEP-0054/CoreDataStorage/XMPPvCardCoreDataStorageObject.m
  56. +34 −8 Extensions/XEP-0054/XMPPvCardTempModule.h
  57. +105 −23 Extensions/XEP-0054/XMPPvCardTempModule.m
  58. +16 −0 Extensions/XEP-0059/NSXMLElement+XEP_0059.h
  59. +47 −0 Extensions/XEP-0059/NSXMLElement+XEP_0059.m
  60. +96 −0 Extensions/XEP-0059/XMPPResultSet.h
  61. +230 −0 Extensions/XEP-0059/XMPPResultSet.m
  62. +35 −0 Extensions/XEP-0060/XMPPIQ+XEP_0060.h
  63. +25 −0 Extensions/XEP-0060/XMPPIQ+XEP_0060.m
  64. +322 −34 Extensions/XEP-0060/XMPPPubSub.h
  65. +772 −285 Extensions/XEP-0060/XMPPPubSub.m
  66. +1 −0 Extensions/XEP-0065/TURNSocket.h
  67. +16 −39 Extensions/XEP-0065/TURNSocket.m
  68. +45 −0 Extensions/XEP-0066/XMPPIQ+XEP_0066.h
  69. +229 −0 Extensions/XEP-0066/XMPPIQ+XEP_0066.m
  70. +14 −0 Extensions/XEP-0066/XMPPMessage+XEP_0066.h
  71. +97 −0 Extensions/XEP-0066/XMPPMessage+XEP_0066.m
  72. +54 −68 Extensions/XEP-0082/XMPPDateTimeProfiles.m
  73. +2 −0 Extensions/XEP-0085/XMPPMessage+XEP_0085.h
  74. +4 −0 Extensions/XEP-0085/XMPPMessage+XEP_0085.m
  75. +14 −35 Extensions/XEP-0115/CoreDataStorage/XMPPCapabilitiesCoreDataStorage.m
  76. +18 −0 Extensions/XEP-0115/XMPPCapabilities.h
  77. +117 −82 Extensions/XEP-0115/XMPPCapabilities.m
  78. +5 −5 Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchivingCoreDataStorage.m
  79. +4 −4 Extensions/XEP-0136/XMPPMessageArchiving.m
  80. +13 −0 Extensions/XEP-0153/XMPPvCardAvatarModule.h
  81. +97 −46 Extensions/XEP-0153/XMPPvCardAvatarModule.m
  82. +8 −0 Extensions/XEP-0172/XMPPMessage+XEP_0172.h
  83. +13 −0 Extensions/XEP-0172/XMPPMessage+XEP_0172.m
  84. +8 −0 Extensions/XEP-0172/XMPPPresence+XEP_0172.h
  85. +12 −0 Extensions/XEP-0172/XMPPPresence+XEP_0172.m
  86. +3 −1 Extensions/XEP-0184/XMPPMessage+XEP_0184.h
  87. +8 −1 Extensions/XEP-0184/XMPPMessage+XEP_0184.m
  88. +32 −0 Extensions/XEP-0184/XMPPMessageDeliveryReceipts.h
  89. +210 −0 Extensions/XEP-0184/XMPPMessageDeliveryReceipts.m
  90. +9 −35 Extensions/XEP-0199/XMPPAutoPing.m
  91. +3 −3 Extensions/XEP-0199/XMPPPing.m
  92. +8 −34 Extensions/XEP-0202/XMPPAutoTime.m
  93. +3 −3 Extensions/XEP-0202/XMPPTime.m
  94. +4 −2 Extensions/XEP-0203/{XMPPElement+Delay.h → NSXMLElement+XEP_0203.h}
  95. +6 −7 Extensions/XEP-0203/{XMPPElement+Delay.m → NSXMLElement+XEP_0203.m}
  96. +21 −0 Extensions/XEP-0223/XEP_0223.h
  97. +20 −0 Extensions/XEP-0223/XEP_0223.m
  98. +2 −0 Extensions/XEP-0224/XMPPAttentionModule.h
  99. +2 −2 Extensions/XEP-0224/XMPPAttentionModule.m
  100. +1 −0 Extensions/XEP-0224/XMPPMessage+XEP_0224.m
  101. +39 −0 Extensions/XEP-0297/NSXMLElement+XEP_0297.h
  102. +138 −0 Extensions/XEP-0297/NSXMLElement+XEP_0297.m
  103. +11 −0 Extensions/XEP-0308/XMPPMessage+XEP_0308.h
  104. +32 −0 Extensions/XEP-0308/XMPPMessage+XEP_0308.m
  105. +2 −4 Utilities/DDList.m
  106. +2 −28 Utilities/GCDMulticastDelegate.m
  107. +18 −0 Utilities/XMPPIDTracker.h
  108. +61 −29 Utilities/XMPPIDTracker.m
  109. +1 −0 Utilities/XMPPSRVResolver.h
  110. +20 −43 Utilities/XMPPSRVResolver.m
  111. +113 −85 Vendor/CocoaAsyncSocket/GCDAsyncSocket.h
  112. +238 −142 Vendor/CocoaAsyncSocket/GCDAsyncSocket.m
  113. +5 −5 Vendor/CocoaLumberjack/DDASLLogger.m
  114. +243 −170 Vendor/CocoaLumberjack/DDAbstractDatabaseLogger.m
  115. +130 −122 Vendor/CocoaLumberjack/DDFileLogger.m
  116. +6 −2 Vendor/CocoaLumberjack/DDLog.h
  117. +107 −91 Vendor/CocoaLumberjack/DDLog.m
  118. +136 −137 Vendor/CocoaLumberjack/DDTTYLogger.m
  119. +3 −3 Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.m
  120. +11 −17 Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.h
  121. +11 −1 Vendor/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.m
  122. +184 −0 Vendor/libidn/build-libidn.sh
  123. +45 −18 Vendor/libidn/idn-int.h
  124. BIN Vendor/libidn/libidn-1.24.tar.gz
  125. BIN Vendor/libidn/libidn.a
  126. +1 −1 Vendor/libidn/stringprep.h
  127. +4 −4 Xcode/DesktopXMPP/RosterController.m
  128. +6 −6 Xcode/DesktopXMPP/XMPPStream.xcodeproj/project.pbxproj
  129. +4 −4 Xcode/ServerlessDemo/Classes/ChatViewController.m
  130. +1 −1 Xcode/ServerlessDemo/Classes/RootViewController.m
  131. BIN Xcode/ServerlessDemo/Default-568h@2x.png
  132. +4 −0 Xcode/ServerlessDemo/ServerlessDemo.xcodeproj/project.pbxproj
  133. +117 −73 Xcode/Testing/FacebookTest/FacebookTest.xcodeproj/project.pbxproj
  134. +1 −1 Xcode/Testing/FacebookTest/FacebookTest/FacebookTestAppDelegate.m
  135. +7 −1 Xcode/Testing/MulticastDelegateTest/Shared/DelegateTesters.m
  136. +4 −2 Xcode/Testing/MulticastDelegateTest/Shared/MulticastDelegateTest.m
  137. +15 −0 Xcode/Testing/TestDDList/TestDDList/AppDelegate.m
  138. +62 −34 Xcode/Testing/TestXEP82/TestXEP82.m
  139. +2 −2 Xcode/iPhoneXMPP/Classes/RootViewController.m
  140. +1 −1 Xcode/iPhoneXMPP/Classes/SettingsViewController.m
  141. +2 −2 Xcode/iPhoneXMPP/Classes/iPhoneXMPPAppDelegate.m
  142. BIN Xcode/iPhoneXMPP/Default-568h@2x.png
  143. +367 −9 Xcode/iPhoneXMPP/iPhoneXMPP.xcodeproj/project.pbxproj
View
4 Authentication/Anonymous/XMPPAnonymousAuthentication.m
@@ -116,8 +116,8 @@ - (BOOL)authenticateAnonymously:(NSError **)errPtr
result = NO;
}
}};
-
- if (dispatch_get_current_queue() == self.xmppQueue)
+
+ if (dispatch_get_specific(self.xmppQueueTag))
block();
else
dispatch_sync(self.xmppQueue, block);
View
4 Authentication/Deprecated-Digest/XMPPDeprecatedDigestAuthentication.m
@@ -150,8 +150,8 @@ - (BOOL)supportsDeprecatedDigestAuthentication
result = (digest != nil);
}
}};
-
- if (dispatch_get_current_queue() == self.xmppQueue)
+
+ if (dispatch_get_specific(self.xmppQueueTag))
block();
else
dispatch_sync(self.xmppQueue, block);
View
4 Authentication/Deprecated-Plain/XMPPDeprecatedPlainAuthentication.m
@@ -144,8 +144,8 @@ - (BOOL)supportsDeprecatedPlainAuthentication
result = (plain != nil);
}
}};
-
- if (dispatch_get_current_queue() == self.xmppQueue)
+
+ if (dispatch_get_specific(self.xmppQueueTag))
block();
else
dispatch_sync(self.xmppQueue, block);
View
5 Authentication/Digest-MD5/XMPPDigestMD5Authentication.m
@@ -242,7 +242,10 @@ - (NSDictionary *)dictionaryFromChallenge:(NSXMLElement *)challenge
[value deleteCharactersInRange:NSMakeRange([value length]-1, 1)];
}
- [auth setObject:value forKey:key];
+ if(key && value)
+ {
+ [auth setObject:value forKey:key];
+ }
}
}
View
9 Authentication/X-Facebook-Platform/XMPPXFacebookPlatformAuthentication.m
@@ -252,8 +252,8 @@ - (NSString *)facebookAppId
dispatch_block_t block = ^{
result = objc_getAssociatedObject(self, &facebookAppIdKey);
};
-
- if (dispatch_get_current_queue() == self.xmppQueue)
+
+ if (dispatch_get_specific(self.xmppQueueTag))
block();
else
dispatch_sync(self.xmppQueue, block);
@@ -269,7 +269,7 @@ - (void)setFacebookAppId:(NSString *)inFacebookAppId
objc_setAssociatedObject(self, &facebookAppIdKey, newFacebookAppId, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
};
- if (dispatch_get_current_queue() == self.xmppQueue)
+ if (dispatch_get_specific(self.xmppQueueTag))
block();
else
dispatch_async(self.xmppQueue, block);
@@ -313,8 +313,7 @@ - (BOOL)authenticateWithFacebookAccessToken:(NSString *)accessToken error:(NSErr
}
}};
-
- if (dispatch_get_current_queue() == self.xmppQueue)
+ if (dispatch_get_specific(self.xmppQueueTag))
block();
else
dispatch_sync(self.xmppQueue, block);
View
2 Categories/NSXMLElement+XMPP.h
@@ -22,13 +22,15 @@
**/
- (NSArray *)elementsForXmlns:(NSString *)ns;
+- (NSArray *)elementsForXmlnsPrefix:(NSString *)nsPrefix;
/**
* Extracting a single element.
**/
- (NSXMLElement *)elementForName:(NSString *)name;
- (NSXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns;
+- (NSXMLElement *)elementForName:(NSString *)name xmlnsPrefix:(NSString *)xmlnsPrefix;
/**
* Working with the common xmpp xmlns value.
View
41 Categories/NSXMLElement+XMPP.m
@@ -46,6 +46,26 @@ - (NSArray *)elementsForXmlns:(NSString *)ns
return elements;
}
+- (NSArray *)elementsForXmlnsPrefix:(NSString *)nsPrefix
+{
+ NSMutableArray *elements = [NSMutableArray array];
+
+ for (NSXMLNode *node in [self children])
+ {
+ if ([node isKindOfClass:[NSXMLElement class]])
+ {
+ NSXMLElement *element = (NSXMLElement *)node;
+
+ if ([[element xmlns] hasPrefix:nsPrefix])
+ {
+ [elements addObject:element];
+ }
+ }
+ }
+
+ return elements;
+}
+
/**
* This method returns the first child element for the given name (as an NSXMLElement).
* If no child elements exist for the given name, nil is returned.
@@ -99,6 +119,27 @@ - (NSXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns
}
}
+- (NSXMLElement *)elementForName:(NSString *)name xmlnsPrefix:(NSString *)xmlnsPrefix{
+
+ NSXMLElement *result = nil;
+
+ for (NSXMLNode *node in [self children])
+ {
+ if ([node isKindOfClass:[NSXMLElement class]])
+ {
+ NSXMLElement *element = (NSXMLElement *)node;
+
+ if ([[element name] isEqualToString:name] && [[element xmlns] hasPrefix:xmlnsPrefix])
+ {
+ result = element;
+ break;
+ }
+ }
+ }
+
+ return result;
+}
+
/**
* Returns the common xmlns "attribute", which is only accessible via the namespace methods.
* The xmlns value is often used in jabber elements.
View
18 Core/XMPPElement.h
@@ -1,10 +1,10 @@
#import <Foundation/Foundation.h>
+#import "XMPPJID.h"
#if TARGET_OS_IPHONE
#import "DDXML.h"
#endif
-@class XMPPJID;
/**
* The XMPPElement provides the base class for XMPPIQ, XMPPMessage & XMPPPresence.
@@ -17,6 +17,8 @@
@interface XMPPElement : NSXMLElement <NSCoding, NSCopying>
+#pragma mark Common Jabber Methods
+
- (NSString *)elementID;
- (XMPPJID *)to;
@@ -25,4 +27,18 @@
- (NSString *)toStr;
- (NSString *)fromStr;
+#pragma mark To and From Methods
+
+- (BOOL)isTo:(XMPPJID *)to;
+- (BOOL)isTo:(XMPPJID *)to options:(XMPPJIDCompareOptions)mask;
+
+- (BOOL)isFrom:(XMPPJID *)from;
+- (BOOL)isFrom:(XMPPJID *)from options:(XMPPJIDCompareOptions)mask;
+
+- (BOOL)isToOrFrom:(XMPPJID *)toOrFrom;
+- (BOOL)isToOrFrom:(XMPPJID *)toOrFrom options:(XMPPJIDCompareOptions)mask;
+
+- (BOOL)isTo:(XMPPJID *)to from:(XMPPJID *)from;
+- (BOOL)isTo:(XMPPJID *)to from:(XMPPJID *)from options:(XMPPJIDCompareOptions)mask;
+
@end
View
72 Core/XMPPElement.m
@@ -104,4 +104,76 @@ - (XMPPJID *)from
return [XMPPJID jidWithString:[self fromStr]];
}
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#pragma mark To and From Methods
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+- (BOOL)isTo:(XMPPJID *)to
+{
+ return [self.to isEqualToJID:to];
+}
+
+- (BOOL)isTo:(XMPPJID *)to options:(XMPPJIDCompareOptions)mask
+{
+ return [self.to isEqualToJID:to options:mask];
+}
+
+- (BOOL)isFrom:(XMPPJID *)from
+{
+ return [self.from isEqualToJID:from];
+}
+
+- (BOOL)isFrom:(XMPPJID *)from options:(XMPPJIDCompareOptions)mask
+{
+ return [self.from isEqualToJID:from options:mask];
+}
+
+- (BOOL)isToOrFrom:(XMPPJID *)toOrFrom
+{
+ if([self isTo:toOrFrom] || [self isFrom:toOrFrom])
+ {
+ return YES;
+ }
+ else
+ {
+ return NO;
+ }
+}
+
+- (BOOL)isToOrFrom:(XMPPJID *)toOrFrom options:(XMPPJIDCompareOptions)mask
+{
+ if([self isTo:toOrFrom options:mask] || [self isFrom:toOrFrom options:mask])
+ {
+ return YES;
+ }
+ else
+ {
+ return NO;
+ }
+}
+
+- (BOOL)isTo:(XMPPJID *)to from:(XMPPJID *)from
+{
+ if([self isTo:to] && [self isFrom:from])
+ {
+ return YES;
+ }
+ else
+ {
+ return NO;
+ }
+}
+
+- (BOOL)isTo:(XMPPJID *)to from:(XMPPJID *)from options:(XMPPJIDCompareOptions)mask
+{
+ if([self isTo:to options:mask] && [self isFrom:from options:mask])
+ {
+ return YES;
+ }
+ else
+ {
+ return NO;
+ }
+}
+
@end
View
8 Core/XMPPIQ.m
@@ -134,6 +134,14 @@ - (id)initWithType:(NSString *)type child:(NSXMLElement *)childElement
return [self initWithType:type to:nil elementID:nil child:childElement];
}
+- (id)initWithXMLString:(NSString *)string error:(NSError *__autoreleasing *)error
+{
+ if((self = [super initWithXMLString:string error:error])){
+ self = [XMPPIQ iqFromElement:self];
+ }
+ return self;
+}
+
- (NSString *)type
{
return [[self attributeStringValueForName:@"type"] lowercaseString];
View
1 Core/XMPPInternal.h
@@ -45,6 +45,7 @@ extern NSString *const XMPPStreamDidChangeMyJIDNotification;
**/
@property (readonly) dispatch_queue_t xmppQueue;
+@property (readonly) void *xmppQueueTag;
@property (readonly) XMPPStreamState state;
/**
View
14 Core/XMPPMessage.h
@@ -19,10 +19,24 @@
+ (XMPPMessage *)message;
+ (XMPPMessage *)messageWithType:(NSString *)type;
+ (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)to;
++ (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid;
++ (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement;
++ (XMPPMessage *)messageWithType:(NSString *)type elementID:(NSString *)eid;
++ (XMPPMessage *)messageWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement;
++ (XMPPMessage *)messageWithType:(NSString *)type child:(NSXMLElement *)childElement;
- (id)init;
- (id)initWithType:(NSString *)type;
- (id)initWithType:(NSString *)type to:(XMPPJID *)to;
+- (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid;
+- (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement;
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid;
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement;
+- (id)initWithType:(NSString *)type child:(NSXMLElement *)childElement;
+
+- (NSString *)body;
+
+- (void)addBody:(NSString *)body;
- (BOOL)isChatMessage;
- (BOOL)isChatMessageWithBody;
View
86 Core/XMPPMessage.m
@@ -55,30 +55,104 @@ + (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)to
return [[XMPPMessage alloc] initWithType:type to:to];
}
++ (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid
+{
+ return [[XMPPMessage alloc] initWithType:type to:jid elementID:eid];
+}
+
++ (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement
+{
+ return [[XMPPMessage alloc] initWithType:type to:jid elementID:eid child:childElement];
+}
+
++ (XMPPMessage *)messageWithType:(NSString *)type elementID:(NSString *)eid
+{
+ return [[XMPPMessage alloc] initWithType:type elementID:eid];
+}
+
++ (XMPPMessage *)messageWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement
+{
+ return [[XMPPMessage alloc] initWithType:type elementID:eid child:childElement];
+}
+
++ (XMPPMessage *)messageWithType:(NSString *)type child:(NSXMLElement *)childElement
+{
+ return [[XMPPMessage alloc] initWithType:type child:childElement];
+}
+
- (id)init
{
- self = [super initWithName:@"message"];
- return self;
+ return [self initWithType:nil to:nil elementID:nil child:nil];
}
- (id)initWithType:(NSString *)type
{
- return [self initWithType:type to:nil];
+ return [self initWithType:type to:nil elementID:nil child:nil];
+}
+
+- (id)initWithType:(NSString *)type to:(XMPPJID *)jid
+{
+ return [self initWithType:type to:jid elementID:nil child:nil];
+}
+
+- (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid
+{
+ return [self initWithType:type to:jid elementID:eid child:nil];
}
-- (id)initWithType:(NSString *)type to:(XMPPJID *)to
+- (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement
{
if ((self = [super initWithName:@"message"]))
{
if (type)
[self addAttributeWithName:@"type" stringValue:type];
- if (to)
- [self addAttributeWithName:@"to" stringValue:[to description]];
+ if (jid)
+ [self addAttributeWithName:@"to" stringValue:[jid full]];
+
+ if (eid)
+ [self addAttributeWithName:@"id" stringValue:eid];
+
+ if (childElement)
+ [self addChild:childElement];
}
return self;
}
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid
+{
+ return [self initWithType:type to:nil elementID:eid child:nil];
+}
+
+- (id)initWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement
+{
+ return [self initWithType:type to:nil elementID:eid child:childElement];
+}
+
+- (id)initWithType:(NSString *)type child:(NSXMLElement *)childElement
+{
+ return [self initWithType:type to:nil elementID:nil child:childElement];
+}
+
+- (id)initWithXMLString:(NSString *)string error:(NSError *__autoreleasing *)error
+{
+ if((self = [super initWithXMLString:string error:error])){
+ self = [XMPPMessage messageFromElement:self];
+ }
+ return self;
+}
+
+- (NSString *)body
+{
+ return [[self elementForName:@"body"] stringValue];
+}
+
+- (void)addBody:(NSString *)body
+{
+ NSXMLElement *bodyElement = [NSXMLElement elementWithName:@"body" stringValue:body];
+ [self addChild:bodyElement];
+}
+
- (BOOL)isChatMessage
{
return [[[self attributeForName:@"type"] stringValue] isEqualToString:@"chat"];
View
6 Core/XMPPModule.h
@@ -16,12 +16,16 @@
@interface XMPPModule : NSObject
{
XMPPStream *xmppStream;
-
+
dispatch_queue_t moduleQueue;
+ void *moduleQueueTag;
+
id multicastDelegate;
}
@property (readonly) dispatch_queue_t moduleQueue;
+@property (readonly) void *moduleQueueTag;
+
@property (strong, readonly) XMPPStream *xmppStream;
- (id)init;
View
49 Core/XMPPModule.m
@@ -6,40 +6,13 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#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
#if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN;
#else
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN;
#endif
-
@implementation XMPPModule
/**
@@ -60,7 +33,7 @@ - (id)initWithDispatchQueue:(dispatch_queue_t)queue
if (queue)
{
moduleQueue = queue;
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_retain(moduleQueue);
#endif
}
@@ -70,14 +43,17 @@ - (id)initWithDispatchQueue:(dispatch_queue_t)queue
moduleQueue = dispatch_queue_create(moduleQueueName, NULL);
}
+ moduleQueueTag = &moduleQueueTag;
+ dispatch_queue_set_specific(moduleQueue, moduleQueueTag, moduleQueueTag, NULL);
+
multicastDelegate = [[GCDMulticastDelegate alloc] init];
}
return self;
}
- (void)dealloc
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_release(moduleQueue);
#endif
}
@@ -106,7 +82,7 @@ - (BOOL)activate:(XMPPStream *)aXmppStream
}
};
- if (dispatch_get_current_queue() == moduleQueue)
+ if (dispatch_get_specific(moduleQueueTag))
block();
else
dispatch_sync(moduleQueue, block);
@@ -135,7 +111,7 @@ - (void)deactivate
}
};
- if (dispatch_get_current_queue() == moduleQueue)
+ if (dispatch_get_specific(moduleQueueTag))
block();
else
dispatch_sync(moduleQueue, block);
@@ -146,9 +122,14 @@ - (dispatch_queue_t)moduleQueue
return moduleQueue;
}
+- (void *)moduleQueueTag
+{
+ return moduleQueueTag;
+}
+
- (XMPPStream *)xmppStream
{
- if (dispatch_get_current_queue() == moduleQueue)
+ if (dispatch_get_specific(moduleQueueTag))
{
return xmppStream;
}
@@ -172,7 +153,7 @@ - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue
[multicastDelegate addDelegate:delegate delegateQueue:delegateQueue];
};
- if (dispatch_get_current_queue() == moduleQueue)
+ if (dispatch_get_specific(moduleQueueTag))
block();
else
dispatch_async(moduleQueue, block);
@@ -184,7 +165,7 @@ - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueu
[multicastDelegate removeDelegate:delegate delegateQueue:delegateQueue];
};
- if (dispatch_get_current_queue() == moduleQueue)
+ if (dispatch_get_specific(moduleQueueTag))
block();
else if (synchronously)
dispatch_sync(moduleQueue, block);
View
57 Core/XMPPParser.m
@@ -11,32 +11,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#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
#if DEBUG
static const int xmppLogLevel = XMPP_LOG_LEVEL_VERBOSE;
@@ -46,7 +20,7 @@
#define CHECK_FOR_NULL(value) \
do { \
- if (value == NULL) { \
+ if (value == NULL) { \
xmpp_xmlAbortDueToMemoryShortage(ctxt); \
return; \
} \
@@ -56,7 +30,6 @@
static void xmpp_recursiveAddChild(NSXMLElement *parent, xmlNodePtr childNode);
#endif
-
@implementation XMPPParser
{
#if __has_feature(objc_arc_weak)
@@ -67,6 +40,7 @@ @implementation XMPPParser
dispatch_queue_t delegateQueue;
dispatch_queue_t parserQueue;
+ void *xmppParserQueueTag;
BOOL hasReportedRoot;
unsigned depth;
@@ -575,7 +549,11 @@ static void xmpp_xmlStartElement(void *ctx, const xmlChar *nodeName,
}
else
{
- lastAddedNs->next = newNs;
+ if(lastAddedNs != NULL)
+ {
+ lastAddedNs->next = newNs;
+ }
+
lastAddedNs = newNs;
}
@@ -609,7 +587,7 @@ static void xmpp_xmlStartElement(void *ctx, const xmlChar *nodeName,
{
newNode->nsDef = newNs;
}
- else
+ else if(lastAddedNs != NULL)
{
lastAddedNs->next = newNs;
}
@@ -725,22 +703,25 @@ - (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq parserQu
delegate = aDelegate;
delegateQueue = dq;
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (delegateQueue)
dispatch_retain(delegateQueue);
#endif
-
+
if (pq) {
parserQueue = pq;
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_retain(parserQueue);
#endif
}
else {
parserQueue = dispatch_queue_create("xmpp.parser", NULL);
}
+ xmppParserQueueTag = &xmppParserQueueTag;
+ dispatch_queue_set_specific(parserQueue, xmppParserQueueTag, xmppParserQueueTag, NULL);
+
hasReportedRoot = NO;
depth = 0;
@@ -785,7 +766,7 @@ - (void)dealloc
xmlFreeParserCtxt(parserCtxt);
}
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (delegateQueue)
dispatch_release(delegateQueue);
if (parserQueue)
@@ -795,7 +776,7 @@ - (void)dealloc
- (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (newDelegateQueue)
dispatch_retain(newDelegateQueue);
#endif
@@ -804,15 +785,15 @@ - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQ
delegate = newDelegate;
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
if (delegateQueue)
dispatch_release(delegateQueue);
#endif
delegateQueue = newDelegateQueue;
};
- if (dispatch_get_current_queue() == parserQueue)
+ if (dispatch_get_specific(xmppParserQueueTag))
block();
else
dispatch_async(parserQueue, block);
@@ -866,7 +847,7 @@ - (void)parseData:(NSData *)data
}
}};
- if (dispatch_get_current_queue() == parserQueue)
+ if (dispatch_get_specific(xmppParserQueueTag))
block();
else
dispatch_async(parserQueue, block);
View
8 Core/XMPPPresence.m
@@ -79,6 +79,14 @@ - (id)initWithType:(NSString *)type to:(XMPPJID *)to
return self;
}
+- (id)initWithXMLString:(NSString *)string error:(NSError *__autoreleasing *)error
+{
+ if((self = [super initWithXMLString:string error:error])){
+ self = [XMPPPresence presenceFromElement:self];
+ }
+ return self;
+}
+
- (NSString *)type
{
NSString *type = [self attributeStringValueForName:@"type"];
View
69 Core/XMPPStream.h
@@ -37,6 +37,7 @@ enum XMPPStreamErrorCode
};
typedef enum XMPPStreamErrorCode XMPPStreamErrorCode;
+extern const NSTimeInterval XMPPStreamTimeoutNone;
@interface XMPPStream : NSObject <GCDAsyncSocketDelegate>
@@ -235,6 +236,11 @@ typedef enum XMPPStreamErrorCode XMPPStreamErrorCode;
- (BOOL)isDisconnected;
/**
+ * Returns YES is the connection is currently connecting
+**/
+- (BOOL)isConnecting;
+
+/**
* Returns YES if the connection is open, and the stream has been properly established.
* If the stream is neither disconnected, nor connected, then a connection is currently being established.
*
@@ -248,29 +254,32 @@ typedef enum XMPPStreamErrorCode XMPPStreamErrorCode;
/**
* Connects to the configured hostName on the configured hostPort.
+ * The timeout is optional. To not time out use XMPPStreamTimeoutNone.
* If the hostName or myJID are not set, this method will return NO and set the error parameter.
**/
-- (BOOL)connect:(NSError **)errPtr;
+- (BOOL)connectWithTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr;
/**
* THIS IS DEPRECATED BY THE XMPP SPECIFICATION.
*
* The xmpp specification outlines the proper use of SSL/TLS by negotiating
* the startTLS upgrade within the stream negotiation.
* This method exists for those ancient servers that still require the connection to be secured prematurely.
- *
+ * The timeout is optional. To not time out use XMPPStreamTimeoutNone.
+ *
* Note: Such servers generally use port 5223 for this, which you will need to set.
**/
-- (BOOL)oldSchoolSecureConnect:(NSError **)errPtr;
+- (BOOL)oldSchoolSecureConnectWithTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr;
/**
* Starts a P2P connection to the given user and given address.
+ * The timeout is optional. To not time out use XMPPStreamTimeoutNone.
* This method only works with XMPPStream objects created using the initP2P method.
*
* The given address is specified as a sockaddr structure wrapped in a NSData object.
* For example, a NSData object returned from NSNetservice's addresses method.
**/
-- (BOOL)connectTo:(XMPPJID *)remoteJID withAddress:(NSData *)remoteAddr error:(NSError **)errPtr;
+- (BOOL)connectTo:(XMPPJID *)remoteJID withAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr;
/**
* Starts a P2P connection with the given accepted socket.
@@ -445,10 +454,51 @@ typedef enum XMPPStreamErrorCode XMPPStreamErrorCode;
- (BOOL)authenticateWithPassword:(NSString *)password error:(NSError **)errPtr;
/**
+ * Returns whether or not the xmpp stream is currently authenticating with the XMPP Server.
+**/
+- (BOOL)isAuthenticating;
+
+/**
* Returns whether or not the xmpp stream has successfully authenticated with the server.
**/
- (BOOL)isAuthenticated;
+/**
+ * Returns the date when the xmpp stream successfully authenticated with the server.
+ **/
+- (NSDate *)authenticationDate;
+
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#pragma mark Compression
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * Returns the server's list of supported compression methods in accordance to XEP-0138: Stream Compression
+ * Each item in the array will be of type NSString.
+ *
+ * For example, if the server supplied this stanza within it's reported stream:features:
+ *
+ * <compression xmlns='http://jabber.org/features/compress'>
+ * <method>zlib</method>
+ * <method>lzw</method>
+ * </compression>
+ *
+ * Then this method would return [@"zlib", @"lzw"].
+ **/
+- (NSArray *)supportedCompressionMethods;
+
+
+/**
+ * Returns whether or not the given compression method name was specified in the
+ * server's list of supported compression methods.
+ *
+ * Note: The XMPPStream doesn't currently support any compression methods
+**/
+
+- (BOOL)supportsCompressionMethod:(NSString *)compressionMethod;
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Server Info
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -584,6 +634,12 @@ typedef enum XMPPStreamErrorCode XMPPStreamErrorCode;
**/
- (void)enumerateModulesWithBlock:(void (^)(XMPPModule *module, NSUInteger idx, BOOL *stop))block;
+/**
+ * Allows for enumeration of the currently registered modules that are a kind of Class.
+ * idx is in relation to all modules not just those of the given class.
+**/
+- (void)enumerateModulesOfClass:(Class)aClass withBlock:(void (^)(XMPPModule *module, NSUInteger idx, BOOL *stop))block;
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Utilities
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -863,6 +919,11 @@ typedef enum XMPPStreamErrorCode XMPPStreamErrorCode;
- (void)xmppStreamWasToldToDisconnect:(XMPPStream *)sender;
/**
+ * This methods is called if the XMPP Stream's connect times out
+**/
+- (void)xmppStreamConnectDidTimeout:(XMPPStream *)sender;
+
+/**
* This method is called after the stream is closed.
*
* The given error parameter will be non-nil if the error was due to something outside the general xmpp realm.
View
514 Core/XMPPStream.m
@@ -17,32 +17,6 @@
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#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
#if XMPP_DEBUG_MODE == 1
static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN;
@@ -71,9 +45,13 @@
#define TAG_XMPP_WRITE_STREAM 201
#define TAG_XMPP_WRITE_RECEIPT 202
+// Define the timeouts (in seconds) for SRV
+#define TIMEOUT_SRV_RESOLUTION 30.0
+
NSString *const XMPPStreamErrorDomain = @"XMPPStreamErrorDomain";
NSString *const XMPPStreamDidChangeMyJIDNotification = @"XMPPStreamDidChangeMyJID";
+const NSTimeInterval XMPPStreamTimeoutNone = -1;
enum XMPPStreamFlags
{
@@ -99,6 +77,7 @@
@interface XMPPStream ()
{
dispatch_queue_t xmppQueue;
+ void *xmppQueueTag;
dispatch_queue_t willSendIqQueue;
dispatch_queue_t willSendMessageQueue;
@@ -109,6 +88,8 @@ @interface XMPPStream ()
dispatch_queue_t willReceivePresenceQueue;
dispatch_queue_t didReceiveIqQueue;
+
+ dispatch_source_t connectTimer;
GCDMulticastDelegate <XMPPStreamDelegate> *multicastDelegate;
@@ -129,6 +110,7 @@ @interface XMPPStream ()
UInt16 hostPort;
id <XMPPSASLAuthentication> auth;
+ NSDate *authenticationDate;
XMPPJID *myJID_setByClient;
XMPPJID *myJID_setByServer;
@@ -169,6 +151,10 @@ - (void)continueHandleBinding:(NSString *)alternativeResource;
- (void)setupKeepAliveTimer;
- (void)keepAlive;
+- (void)startConnectTimeout:(NSTimeInterval)timeout;
+- (void)endConnectTimeout;
+- (void)doConnectTimeout;
+
- (void)continueReceiveMessage:(XMPPMessage *)message;
- (void)continueReceiveIQ:(XMPPIQ *)iq;
- (void)continueReceivePresence:(XMPPPresence *)presence;
@@ -195,7 +181,9 @@ @implementation XMPPStream
**/
- (void)commonInit
{
+ xmppQueueTag = &xmppQueueTag;
xmppQueue = dispatch_queue_create("xmpp", NULL);
+ dispatch_queue_set_specific(xmppQueue, xmppQueueTag, xmppQueueTag, NULL);
willSendIqQueue = dispatch_queue_create("xmpp.willSendIq", NULL);
willSendMessageQueue = dispatch_queue_create("xmpp.willSendMessage", NULL);
@@ -279,7 +267,7 @@ - (id)initP2PFrom:(XMPPJID *)jid
**/
- (void)dealloc
{
- #if NEEDS_DISPATCH_RETAIN_RELEASE
+ #if !OS_OBJECT_USE_OBJC
dispatch_release(xmppQueue);
dispatch_release(willSendIqQueue);
dispatch_release(willSendMessageQueue);
@@ -316,6 +304,7 @@ - (void)dealloc
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@synthesize xmppQueue;
+@synthesize xmppQueueTag;
- (XMPPStreamState)state
{
@@ -325,7 +314,7 @@ - (XMPPStreamState)state
result = (XMPPStreamState)state;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -335,7 +324,7 @@ - (XMPPStreamState)state
- (NSString *)hostName
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return hostName;
}
@@ -353,7 +342,7 @@ - (NSString *)hostName
- (void)setHostName:(NSString *)newHostName
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
if (hostName != newHostName)
{
@@ -373,7 +362,7 @@ - (void)setHostName:(NSString *)newHostName
- (UInt16)hostPort
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return hostPort;
}
@@ -395,7 +384,7 @@ - (void)setHostPort:(UInt16)newHostPort
hostPort = newHostPort;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -413,7 +402,7 @@ - (XMPPJID *)myJID
result = myJID_setByClient;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -439,7 +428,7 @@ - (void)setMyJID_setByClient:(XMPPJID *)newMyJID
}
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -469,7 +458,7 @@ - (void)setMyJID_setByServer:(XMPPJID *)newMyJID
}
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -482,7 +471,7 @@ - (void)setMyJID:(XMPPJID *)newMyJID
- (XMPPJID *)remoteJID
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return remoteJID;
}
@@ -500,7 +489,7 @@ - (XMPPJID *)remoteJID
- (XMPPPresence *)myPresence
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return myPresence;
}
@@ -524,7 +513,7 @@ - (NSTimeInterval)keepAliveInterval
result = keepAliveInterval;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -547,7 +536,7 @@ - (void)setKeepAliveInterval:(NSTimeInterval)interval
}
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -566,7 +555,7 @@ - (char)keepAliveWhitespaceCharacter
}
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -584,15 +573,15 @@ - (void)setKeepAliveWhitespaceCharacter:(char)keepAliveChar
}
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
}
- (UInt64)numberOfBytesSent
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return numberOfBytesSent;
}
@@ -610,7 +599,7 @@ - (UInt64)numberOfBytesSent
- (UInt64)numberOfBytesReceived
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return numberOfBytesReceived;
}
@@ -634,7 +623,7 @@ - (BOOL)resetByteCountPerConnection
result = (config & kResetByteCountPerConnection) ? YES : NO;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -651,7 +640,7 @@ - (void)setResetByteCountPerConnection:(BOOL)flag
config &= ~kResetByteCountPerConnection;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -667,7 +656,7 @@ - (BOOL)enableBackgroundingOnSocket
result = (config & kEnableBackgroundingOnSocket) ? YES : NO;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -684,7 +673,7 @@ - (void)setEnableBackgroundingOnSocket:(BOOL)flag
config &= ~kEnableBackgroundingOnSocket;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -704,7 +693,7 @@ - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue
[multicastDelegate addDelegate:delegate delegateQueue:delegateQueue];
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -718,7 +707,7 @@ - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueu
[multicastDelegate removeDelegate:delegate delegateQueue:delegateQueue];
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -732,7 +721,7 @@ - (void)removeDelegate:(id)delegate
[multicastDelegate removeDelegate:delegate];
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -744,7 +733,7 @@ - (void)removeDelegate:(id)delegate
**/
- (BOOL)isP2P
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return (config & kP2PMode) ? YES : NO;
}
@@ -762,7 +751,7 @@ - (BOOL)isP2P
- (BOOL)isP2PInitiator
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return ((config & kP2PMode) && (flags & kP2PInitiator));
}
@@ -780,7 +769,7 @@ - (BOOL)isP2PInitiator
- (BOOL)isP2PRecipient
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return ((config & kP2PMode) && !(flags & kP2PInitiator));
}
@@ -798,14 +787,14 @@ - (BOOL)isP2PRecipient
- (BOOL)didStartNegotiation
{
- NSAssert(dispatch_get_current_queue() == xmppQueue, @"Invoked on incorrect queue");
+ NSAssert(dispatch_get_specific(xmppQueueTag), @"Invoked on incorrect queue");
return (flags & kDidStartNegotiation) ? YES : NO;
}
- (void)setDidStartNegotiation:(BOOL)flag
{
- NSAssert(dispatch_get_current_queue() == xmppQueue, @"Invoked on incorrect queue");
+ NSAssert(dispatch_get_specific(xmppQueueTag), @"Invoked on incorrect queue");
if (flag)
flags |= kDidStartNegotiation;
@@ -829,7 +818,7 @@ - (BOOL)isDisconnected
result = (state == STATE_XMPP_DISCONNECTED);
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -838,6 +827,27 @@ - (BOOL)isDisconnected
}
/**
+ * Returns YES is the connection is currently connecting
+ **/
+
+- (BOOL)isConnecting
+{
+ XMPPLogTrace();
+
+ __block BOOL result = NO;
+
+ dispatch_block_t block = ^{ @autoreleasepool {
+ result = (state == STATE_XMPP_CONNECTING);
+ }};
+
+ if (dispatch_get_specific(xmppQueueTag))
+ block();
+ else
+ dispatch_sync(xmppQueue, block);
+
+ return result;
+}
+/**
* Returns YES if the connection is open, and the stream has been properly established.
* If the stream is neither disconnected, nor connected, then a connection is currently being established.
**/
@@ -849,7 +859,7 @@ - (BOOL)isConnected
result = (state == STATE_XMPP_CONNECTED);
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -858,12 +868,94 @@ - (BOOL)isConnected
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+#pragma mark Connect Timeout
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Start Connect Timeout
+**/
+
+- (void)startConnectTimeout:(NSTimeInterval)timeout
+{
+ XMPPLogTrace();
+
+ if (timeout >= 0.0 && !connectTimer)
+ {
+ connectTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, xmppQueue);
+
+ dispatch_source_set_event_handler(connectTimer, ^{ @autoreleasepool {
+
+ [self doConnectTimeout];
+ }});
+
+#if !OS_OBJECT_USE_OBJC
+ dispatch_source_t theConnectTimer = connectTimer;
+ dispatch_source_set_cancel_handler(connectTimer, ^{
+ XMPPLogVerbose(@"%@: dispatch_release(connectTimer)", THIS_FILE);
+ dispatch_release(theConnectTimer);
+ });
+#endif
+
+ dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (timeout * NSEC_PER_SEC));
+ dispatch_source_set_timer(connectTimer, tt, DISPATCH_TIME_FOREVER, 0);
+
+ dispatch_resume(connectTimer);
+ }
+}
+
+/**
+ * End Connect Timeout
+**/
+
+- (void)endConnectTimeout
+{
+ XMPPLogTrace();
+
+ if (connectTimer)
+ {
+ dispatch_source_cancel(connectTimer);
+ connectTimer = NULL;
+ }
+}
+
+/**
+ * Connect has timed out, so inform the delegates and close the connection
+**/
+
+- (void)doConnectTimeout
+{
+ XMPPLogTrace();
+
+ [self endConnectTimeout];
+
+ if (state != STATE_XMPP_DISCONNECTED)
+ {
+ [multicastDelegate xmppStreamConnectDidTimeout:self];
+
+ if (state == STATE_XMPP_RESOLVING_SRV)
+ {
+ [srvResolver stop];
+ srvResolver = nil;
+
+ state = STATE_XMPP_DISCONNECTED;
+ }
+ else
+ {
+ [asyncSocket disconnect];
+
+ // Everthing will be handled in socketDidDisconnect:withError:
+ }
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark C2S Connection
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-- (BOOL)connectToHost:(NSString *)host onPort:(UInt16)port error:(NSError **)errPtr
+- (BOOL)connectToHost:(NSString *)host onPort:(UInt16)port withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr
{
- NSAssert(dispatch_get_current_queue() == xmppQueue, @"Invoked on incorrect queue");
+ NSAssert(dispatch_get_specific(xmppQueueTag), @"Invoked on incorrect queue");
XMPPLogTrace();
@@ -875,10 +967,15 @@ - (BOOL)connectToHost:(NSString *)host onPort:(UInt16)port error:(NSError **)err
numberOfBytesReceived = 0;
}
+ if(result)
+ {
+ [self startConnectTimeout:timeout];
+ }
+
return result;
}
-- (BOOL)connect:(NSError **)errPtr
+- (BOOL)connectWithTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr
{
XMPPLogTrace();
@@ -950,7 +1047,7 @@ - (BOOL)connect:(NSError **)errPtr
NSString *srvName = [XMPPSRVResolver srvNameFromXMPPDomain:[myJID_setByClient domain]];
- [srvResolver startWithSRVName:srvName timeout:30.0];
+ [srvResolver startWithSRVName:srvName timeout:TIMEOUT_SRV_RESOLUTION];
result = YES;
}
@@ -961,17 +1058,22 @@ - (BOOL)connect:(NSError **)errPtr
state = STATE_XMPP_CONNECTING;
NSError *connectErr = nil;
- result = [self connectToHost:hostName onPort:hostPort error:&connectErr];
+ result = [self connectToHost:hostName onPort:hostPort withTimeout:XMPPStreamTimeoutNone error:&connectErr];
if (!result)
{
err = connectErr;
state = STATE_XMPP_DISCONNECTED;
}
}
+
+ if(result)
+ {
+ [self startConnectTimeout:timeout];
+ }
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -982,7 +1084,7 @@ - (BOOL)connect:(NSError **)errPtr
return result;
}
-- (BOOL)oldSchoolSecureConnect:(NSError **)errPtr
+- (BOOL)oldSchoolSecureConnectWithTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr
{
XMPPLogTrace();
@@ -993,7 +1095,7 @@ - (BOOL)oldSchoolSecureConnect:(NSError **)errPtr
// Go through the regular connect routine
NSError *connectErr = nil;
- result = [self connect:&connectErr];
+ result = [self connectWithTimeout:timeout error:&connectErr];
if (result)
{
@@ -1008,7 +1110,7 @@ - (BOOL)oldSchoolSecureConnect:(NSError **)errPtr
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1030,7 +1132,7 @@ - (BOOL)oldSchoolSecureConnect:(NSError **)errPtr
* The given address is specified as a sockaddr structure wrapped in a NSData object.
* For example, a NSData object returned from NSNetservice's addresses method.
**/
-- (BOOL)connectTo:(XMPPJID *)jid withAddress:(NSData *)remoteAddr error:(NSError **)errPtr
+- (BOOL)connectTo:(XMPPJID *)jid withAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr
{
XMPPLogTrace();
@@ -1091,9 +1193,14 @@ - (BOOL)connectTo:(XMPPJID *)jid withAddress:(NSData *)remoteAddr error:(NSError
numberOfBytesSent = 0;
numberOfBytesReceived = 0;
}
+
+ if(result)
+ {
+ [self startConnectTimeout:timeout];
+ }
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1178,7 +1285,7 @@ - (BOOL)connectP2PWithSocket:(GCDAsyncSocket *)acceptedSocket error:(NSError **)
[self startNegotiation];
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1224,7 +1331,7 @@ - (void)disconnect
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1279,12 +1386,13 @@ - (void)disconnectAfterSending
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
}
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Security
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1294,7 +1402,7 @@ - (void)disconnectAfterSending
**/
- (BOOL)isSecure
{
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
{
return (flags & kIsSecure) ? YES : NO;
}
@@ -1319,7 +1427,7 @@ - (void)setIsSecure:(BOOL)flag
flags &= ~kIsSecure;
};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_async(xmppQueue, block);
@@ -1342,7 +1450,7 @@ - (BOOL)supportsStartTLS
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1352,7 +1460,7 @@ - (BOOL)supportsStartTLS
- (void)sendStartTLSRequest
{
- NSAssert(dispatch_get_current_queue() == xmppQueue, @"Invoked on incorrect queue");
+ NSAssert(dispatch_get_specific(xmppQueueTag), @"Invoked on incorrect queue");
XMPPLogTrace();
@@ -1422,7 +1530,7 @@ - (BOOL)secureConnection:(NSError **)errPtr
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1458,7 +1566,7 @@ - (BOOL)supportsInBandRegistration
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1539,7 +1647,7 @@ - (BOOL)registerWithPassword:(NSString *)password error:(NSError **)errPtr
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1577,7 +1685,7 @@ - (NSArray *)supportedAuthenticationMechanisms
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1618,7 +1726,7 @@ - (BOOL)supportsAuthenticationMechanism:(NSString *)mechanismType
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1675,7 +1783,7 @@ - (BOOL)authenticate:(id <XMPPSASLAuthentication>)inAuth error:(NSError **)errPt
}
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1767,7 +1875,7 @@ - (BOOL)authenticateWithPassword:(NSString *)inPassword error:(NSError **)errPtr
}};
- if (dispatch_get_current_queue() == xmppQueue)
+ if (dispatch_get_specific(xmppQueueTag))
block();
else
dispatch_sync(xmppQueue, block);
@@ -1778,6 +1886,24 @@ - (BOOL)authenticateWithPassword:(NSString *)inPassword error:(NSError **)errPtr
return result;
}
+- (BOOL)isAuthenticating{
+
+ XMPPLogTrace();
+
+ __block BOOL result = NO;
+
+ dispatch_block_t block = ^{ @autoreleasepool {
+ result = (state == STATE_XMPP_AUTH);
+ }};
+
+ if (dispatch_get_specific(xmppQueueTag))
+ block();
+ else
+ dispatch_sync(xmppQueue, block);
+
+ return result;
+}
+
- (BOOL)isAuthenticated
{
__block BOOL result = NO;