├── .DS_Store
├── .gitignore
├── LICENSE
├── README.md
├── XMPPManagerDemo
├── .DS_Store
├── XMPPManager.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── user.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── user.xcuserdatad
│ │ └── xcschemes
│ │ ├── XMPPManager.xcscheme
│ │ └── xcschememanagement.plist
├── XMPPManager
│ ├── A.h
│ ├── A.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── B.h
│ ├── B.m
│ ├── ChatViewController.h
│ ├── ChatViewController.m
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── ListViewController.h
│ ├── ListViewController.m
│ ├── LoginViewController.h
│ ├── LoginViewController.m
│ ├── TDBadgedCell.h
│ ├── TDBadgedCell.m
│ ├── XMPPManager-Info.plist
│ ├── XMPPManager-Prefix.pch
│ ├── XMPPManager.h
│ ├── XMPPManager.m
│ ├── XMPPManager.xcdatamodeld
│ │ ├── .xccurrentversion
│ │ └── XMPPManager.xcdatamodel
│ │ │ └── contents
│ ├── XMPPManagerDelegate.h
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── main.m
│ └── xmppFrameWork
│ │ ├── .DS_Store
│ │ ├── Authentication
│ │ ├── Anonymous
│ │ │ ├── XMPPAnonymousAuthentication.h
│ │ │ └── XMPPAnonymousAuthentication.m
│ │ ├── Deprecated-Digest
│ │ │ ├── XMPPDeprecatedDigestAuthentication.h
│ │ │ └── XMPPDeprecatedDigestAuthentication.m
│ │ ├── Deprecated-Plain
│ │ │ ├── XMPPDeprecatedPlainAuthentication.h
│ │ │ └── XMPPDeprecatedPlainAuthentication.m
│ │ ├── Digest-MD5
│ │ │ ├── XMPPDigestMD5Authentication.h
│ │ │ └── XMPPDigestMD5Authentication.m
│ │ ├── Plain
│ │ │ ├── XMPPPlainAuthentication.h
│ │ │ └── XMPPPlainAuthentication.m
│ │ ├── SCRAM-SHA-1
│ │ │ ├── XMPPSCRAMSHA1Authentication.h
│ │ │ └── XMPPSCRAMSHA1Authentication.m
│ │ ├── X-Facebook-Platform
│ │ │ ├── XMPPXFacebookPlatformAuthentication.h
│ │ │ └── XMPPXFacebookPlatformAuthentication.m
│ │ ├── X-OAuth2-Google
│ │ │ ├── XMPPXOAuth2Google.h
│ │ │ └── XMPPXOAuth2Google.m
│ │ └── XMPPSASLAuthentication.h
│ │ ├── Categories
│ │ ├── NSData+XMPP.h
│ │ ├── NSData+XMPP.m
│ │ ├── NSNumber+XMPP.h
│ │ ├── NSNumber+XMPP.m
│ │ ├── NSXMLElement+XMPP.h
│ │ └── NSXMLElement+XMPP.m
│ │ ├── Core
│ │ ├── XMPP.h
│ │ ├── XMPPElement.h
│ │ ├── XMPPElement.m
│ │ ├── XMPPIQ.h
│ │ ├── XMPPIQ.m
│ │ ├── XMPPInternal.h
│ │ ├── XMPPJID.h
│ │ ├── XMPPJID.m
│ │ ├── XMPPLogging.h
│ │ ├── XMPPMessage.h
│ │ ├── XMPPMessage.m
│ │ ├── XMPPModule.h
│ │ ├── XMPPModule.m
│ │ ├── XMPPParser.h
│ │ ├── XMPPParser.m
│ │ ├── XMPPPresence.h
│ │ ├── XMPPPresence.m
│ │ ├── XMPPStream.h
│ │ └── XMPPStream.m
│ │ ├── Extensions
│ │ ├── .DS_Store
│ │ ├── BandwidthMonitor
│ │ │ ├── XMPPBandwidthMonitor.h
│ │ │ └── XMPPBandwidthMonitor.m
│ │ ├── CoreDataStorage
│ │ │ ├── XMPPCoreDataStorage.h
│ │ │ ├── XMPPCoreDataStorage.m
│ │ │ └── XMPPCoreDataStorageProtected.h
│ │ ├── GoogleSharedStatus
│ │ │ ├── XMPPGoogleSharedStatus.h
│ │ │ └── XMPPGoogleSharedStatus.m
│ │ ├── ProcessOne
│ │ │ ├── XMPPProcessOne.h
│ │ │ └── XMPPProcessOne.m
│ │ ├── Reconnect
│ │ │ ├── XMPPReconnect.h
│ │ │ └── XMPPReconnect.m
│ │ ├── Roster
│ │ │ ├── CoreDataStorage
│ │ │ │ ├── XMPPGroupCoreDataStorageObject.h
│ │ │ │ ├── XMPPGroupCoreDataStorageObject.m
│ │ │ │ ├── XMPPResourceCoreDataStorageObject.h
│ │ │ │ ├── XMPPResourceCoreDataStorageObject.m
│ │ │ │ ├── XMPPRoster.xcdatamodel
│ │ │ │ │ ├── elements
│ │ │ │ │ └── layout
│ │ │ │ ├── XMPPRosterCoreDataStorage.h
│ │ │ │ ├── XMPPRosterCoreDataStorage.m
│ │ │ │ ├── XMPPUserCoreDataStorageObject.h
│ │ │ │ └── XMPPUserCoreDataStorageObject.m
│ │ │ ├── MemoryStorage
│ │ │ │ ├── XMPPResourceMemoryStorageObject.h
│ │ │ │ ├── XMPPResourceMemoryStorageObject.m
│ │ │ │ ├── XMPPRosterMemoryStorage.h
│ │ │ │ ├── XMPPRosterMemoryStorage.m
│ │ │ │ ├── XMPPRosterMemoryStoragePrivate.h
│ │ │ │ ├── XMPPUserMemoryStorageObject.h
│ │ │ │ └── XMPPUserMemoryStorageObject.m
│ │ │ ├── XMPPResource.h
│ │ │ ├── XMPPRoster.h
│ │ │ ├── XMPPRoster.m
│ │ │ ├── XMPPRosterPrivate.h
│ │ │ └── XMPPUser.h
│ │ ├── SystemInputActivityMonitor
│ │ │ ├── XMPPSystemInputActivityMonitor.h
│ │ │ └── XMPPSystemInputActivityMonitor.m
│ │ ├── XEP-0009
│ │ │ ├── XMPPIQ+JabberRPC.h
│ │ │ ├── XMPPIQ+JabberRPC.m
│ │ │ ├── XMPPIQ+JabberRPCResonse.h
│ │ │ ├── XMPPIQ+JabberRPCResonse.m
│ │ │ ├── XMPPJabberRPCModule.h
│ │ │ └── XMPPJabberRPCModule.m
│ │ ├── XEP-0012
│ │ │ ├── XMPPIQ+LastActivity.h
│ │ │ ├── XMPPIQ+LastActivity.m
│ │ │ ├── XMPPLastActivity.h
│ │ │ └── XMPPLastActivity.m
│ │ ├── XEP-0016
│ │ │ ├── XMPPPrivacy.h
│ │ │ └── XMPPPrivacy.m
│ │ ├── XEP-0045
│ │ │ ├── CoreDataStorage
│ │ │ │ ├── XMPPRoom.xcdatamodeld
│ │ │ │ │ ├── .xccurrentversion
│ │ │ │ │ └── XMPPRoom.xcdatamodel
│ │ │ │ │ │ └── contents
│ │ │ │ ├── XMPPRoomCoreDataStorage.h
│ │ │ │ ├── XMPPRoomCoreDataStorage.m
│ │ │ │ ├── XMPPRoomMessageCoreDataStorageObject.h
│ │ │ │ ├── XMPPRoomMessageCoreDataStorageObject.m
│ │ │ │ ├── XMPPRoomOccupantCoreDataStorageObject.h
│ │ │ │ └── XMPPRoomOccupantCoreDataStorageObject.m
│ │ │ ├── HybridStorage
│ │ │ │ ├── XMPPRoomHybrid.xcdatamodeld
│ │ │ │ │ ├── .xccurrentversion
│ │ │ │ │ └── XMPPRoomHybrid.xcdatamodel
│ │ │ │ │ │ └── contents
│ │ │ │ ├── XMPPRoomHybridStorage.h
│ │ │ │ ├── XMPPRoomHybridStorage.m
│ │ │ │ ├── XMPPRoomHybridStorageProtected.h
│ │ │ │ ├── XMPPRoomMessageHybridCoreDataStorageObject.h
│ │ │ │ ├── XMPPRoomMessageHybridCoreDataStorageObject.m
│ │ │ │ ├── XMPPRoomOccupantHybridMemoryStorageObject.h
│ │ │ │ └── XMPPRoomOccupantHybridMemoryStorageObject.m
│ │ │ ├── MemoryStorage
│ │ │ │ ├── XMPPRoomMemoryStorage.h
│ │ │ │ ├── XMPPRoomMemoryStorage.m
│ │ │ │ ├── XMPPRoomMessageMemoryStorageObject.h
│ │ │ │ ├── XMPPRoomMessageMemoryStorageObject.m
│ │ │ │ ├── XMPPRoomOccupantMemoryStorageObject.h
│ │ │ │ └── XMPPRoomOccupantMemoryStorageObject.m
│ │ │ ├── XMPPMUC.h
│ │ │ ├── XMPPMUC.m
│ │ │ ├── XMPPMessage+XEP0045.h
│ │ │ ├── XMPPMessage+XEP0045.m
│ │ │ ├── XMPPRoom.h
│ │ │ ├── XMPPRoom.m
│ │ │ ├── XMPPRoomMessage.h
│ │ │ ├── XMPPRoomOccupant.h
│ │ │ └── XMPPRoomPrivate.h
│ │ ├── XEP-0054
│ │ │ ├── CoreDataStorage
│ │ │ │ ├── XMPPvCard.xcdatamodeld
│ │ │ │ │ ├── .xccurrentversion
│ │ │ │ │ └── XMPPvCard.xcdatamodel
│ │ │ │ │ │ ├── elements
│ │ │ │ │ │ └── layout
│ │ │ │ ├── XMPPvCardAvatarCoreDataStorageObject.h
│ │ │ │ ├── XMPPvCardAvatarCoreDataStorageObject.m
│ │ │ │ ├── XMPPvCardCoreDataStorage.h
│ │ │ │ ├── XMPPvCardCoreDataStorage.m
│ │ │ │ ├── XMPPvCardCoreDataStorageObject.h
│ │ │ │ ├── XMPPvCardCoreDataStorageObject.m
│ │ │ │ ├── XMPPvCardTempCoreDataStorageObject.h
│ │ │ │ └── XMPPvCardTempCoreDataStorageObject.m
│ │ │ ├── XMPPvCardTemp.h
│ │ │ ├── XMPPvCardTemp.m
│ │ │ ├── XMPPvCardTempAdr.h
│ │ │ ├── XMPPvCardTempAdr.m
│ │ │ ├── XMPPvCardTempAdrTypes.h
│ │ │ ├── XMPPvCardTempAdrTypes.m
│ │ │ ├── XMPPvCardTempBase.h
│ │ │ ├── XMPPvCardTempBase.m
│ │ │ ├── XMPPvCardTempEmail.h
│ │ │ ├── XMPPvCardTempEmail.m
│ │ │ ├── XMPPvCardTempLabel.h
│ │ │ ├── XMPPvCardTempLabel.m
│ │ │ ├── XMPPvCardTempModule.h
│ │ │ ├── XMPPvCardTempModule.m
│ │ │ ├── XMPPvCardTempTel.h
│ │ │ └── XMPPvCardTempTel.m
│ │ ├── XEP-0059
│ │ │ ├── NSXMLElement+XEP_0059.h
│ │ │ ├── NSXMLElement+XEP_0059.m
│ │ │ ├── XMPPResultSet.h
│ │ │ └── XMPPResultSet.m
│ │ ├── XEP-0060
│ │ │ ├── XMPPIQ+XEP_0060.h
│ │ │ ├── XMPPIQ+XEP_0060.m
│ │ │ ├── XMPPPubSub.h
│ │ │ └── XMPPPubSub.m
│ │ ├── XEP-0065
│ │ │ ├── TURNSocket.h
│ │ │ └── TURNSocket.m
│ │ ├── XEP-0066
│ │ │ ├── XMPPIQ+XEP_0066.h
│ │ │ ├── XMPPIQ+XEP_0066.m
│ │ │ ├── XMPPMessage+XEP_0066.h
│ │ │ └── XMPPMessage+XEP_0066.m
│ │ ├── XEP-0082
│ │ │ ├── NSDate+XMPPDateTimeProfiles.h
│ │ │ ├── NSDate+XMPPDateTimeProfiles.m
│ │ │ ├── XMPPDateTimeProfiles.h
│ │ │ └── XMPPDateTimeProfiles.m
│ │ ├── XEP-0085
│ │ │ ├── XMPPMessage+XEP_0085.h
│ │ │ └── XMPPMessage+XEP_0085.m
│ │ ├── XEP-0092
│ │ │ ├── XMPPSoftwareVersion.h
│ │ │ └── XMPPSoftwareVersion.m
│ │ ├── XEP-0100
│ │ │ ├── XMPPTransports.h
│ │ │ └── XMPPTransports.m
│ │ ├── XEP-0106
│ │ │ ├── NSString+XEP_0106.h
│ │ │ └── NSString+XEP_0106.m
│ │ ├── XEP-0115
│ │ │ ├── CoreDataStorage
│ │ │ │ ├── XMPPCapabilities.xcdatamodel
│ │ │ │ │ ├── elements
│ │ │ │ │ └── layout
│ │ │ │ ├── XMPPCapabilitiesCoreDataStorage.h
│ │ │ │ ├── XMPPCapabilitiesCoreDataStorage.m
│ │ │ │ ├── XMPPCapsCoreDataStorageObject.h
│ │ │ │ ├── XMPPCapsCoreDataStorageObject.m
│ │ │ │ ├── XMPPCapsResourceCoreDataStorageObject.h
│ │ │ │ └── XMPPCapsResourceCoreDataStorageObject.m
│ │ │ ├── XMPPCapabilities.h
│ │ │ └── XMPPCapabilities.m
│ │ ├── XEP-0136
│ │ │ ├── CoreDataStorage
│ │ │ │ ├── XMPPMessageArchiving.xcdatamodeld
│ │ │ │ │ ├── .xccurrentversion
│ │ │ │ │ └── XMPPMessageArchiving.xcdatamodel
│ │ │ │ │ │ └── contents
│ │ │ │ ├── XMPPMessageArchivingCoreDataStorage.h
│ │ │ │ ├── XMPPMessageArchivingCoreDataStorage.m
│ │ │ │ ├── XMPPMessageArchiving_Contact_CoreDataObject.h
│ │ │ │ ├── XMPPMessageArchiving_Contact_CoreDataObject.m
│ │ │ │ ├── XMPPMessageArchiving_Message_CoreDataObject.h
│ │ │ │ └── XMPPMessageArchiving_Message_CoreDataObject.m
│ │ │ ├── XMPPMessageArchiving.h
│ │ │ └── XMPPMessageArchiving.m
│ │ ├── XEP-0153
│ │ │ ├── XMPPvCardAvatarModule.h
│ │ │ └── XMPPvCardAvatarModule.m
│ │ ├── XEP-0172
│ │ │ ├── XMPPMessage+XEP_0172.h
│ │ │ ├── XMPPMessage+XEP_0172.m
│ │ │ ├── XMPPPresence+XEP_0172.h
│ │ │ └── XMPPPresence+XEP_0172.m
│ │ ├── XEP-0184
│ │ │ ├── XMPPMessage+XEP_0184.h
│ │ │ ├── XMPPMessage+XEP_0184.m
│ │ │ ├── XMPPMessageDeliveryReceipts.h
│ │ │ └── XMPPMessageDeliveryReceipts.m
│ │ ├── XEP-0191
│ │ │ ├── XMPPBlocking.h
│ │ │ └── XMPPBlocking.m
│ │ ├── XEP-0199
│ │ │ ├── XMPPAutoPing.h
│ │ │ ├── XMPPAutoPing.m
│ │ │ ├── XMPPPing.h
│ │ │ └── XMPPPing.m
│ │ ├── XEP-0202
│ │ │ ├── XMPPAutoTime.h
│ │ │ ├── XMPPAutoTime.m
│ │ │ ├── XMPPTime.h
│ │ │ └── XMPPTime.m
│ │ ├── XEP-0203
│ │ │ ├── NSXMLElement+XEP_0203.h
│ │ │ └── NSXMLElement+XEP_0203.m
│ │ ├── XEP-0223
│ │ │ ├── XEP_0223.h
│ │ │ └── XEP_0223.m
│ │ ├── XEP-0224
│ │ │ ├── XMPPAttentionModule.h
│ │ │ ├── XMPPAttentionModule.m
│ │ │ ├── XMPPMessage+XEP_0224.h
│ │ │ └── XMPPMessage+XEP_0224.m
│ │ ├── XEP-0297
│ │ │ ├── NSXMLElement+XEP_0297.h
│ │ │ └── NSXMLElement+XEP_0297.m
│ │ ├── XEP-0308
│ │ │ ├── XMPPMessage+XEP_0308.h
│ │ │ └── XMPPMessage+XEP_0308.m
│ │ ├── XEP-0333
│ │ │ ├── XMPPMessage+XEP_0333.h
│ │ │ └── XMPPMessage+XEP_0333.m
│ │ └── XEP-0335
│ │ │ ├── NSXMLElement+XEP_0335.h
│ │ │ └── NSXMLElement+XEP_0335.m
│ │ ├── Utilities
│ │ ├── DDList.h
│ │ ├── DDList.m
│ │ ├── GCDMulticastDelegate.h
│ │ ├── GCDMulticastDelegate.m
│ │ ├── RFImageToDataTransformer.h
│ │ ├── RFImageToDataTransformer.m
│ │ ├── XMPPIDTracker.h
│ │ ├── XMPPIDTracker.m
│ │ ├── XMPPSRVResolver.h
│ │ ├── XMPPSRVResolver.m
│ │ ├── XMPPStringPrep.h
│ │ └── XMPPStringPrep.m
│ │ ├── Vendor
│ │ ├── .DS_Store
│ │ ├── CocoaAsyncSocket
│ │ │ ├── GCDAsyncSocket.h
│ │ │ └── GCDAsyncSocket.m
│ │ ├── CocoaLumberjack
│ │ │ ├── DDASLLogger.h
│ │ │ ├── DDASLLogger.m
│ │ │ ├── DDAbstractDatabaseLogger.h
│ │ │ ├── DDAbstractDatabaseLogger.m
│ │ │ ├── DDFileLogger.h
│ │ │ ├── DDFileLogger.m
│ │ │ ├── DDLog.h
│ │ │ ├── DDLog.m
│ │ │ ├── DDTTYLogger.h
│ │ │ ├── DDTTYLogger.m
│ │ │ └── Extensions
│ │ │ │ ├── ContextFilterLogFormatter.h
│ │ │ │ ├── ContextFilterLogFormatter.m
│ │ │ │ ├── DispatchQueueLogFormatter.h
│ │ │ │ ├── DispatchQueueLogFormatter.m
│ │ │ │ └── README.txt
│ │ ├── KissXML
│ │ │ ├── Categories
│ │ │ │ ├── NSString+DDXML.h
│ │ │ │ └── NSString+DDXML.m
│ │ │ ├── DDXML.h
│ │ │ ├── DDXMLDocument.h
│ │ │ ├── DDXMLDocument.m
│ │ │ ├── DDXMLElement.h
│ │ │ ├── DDXMLElement.m
│ │ │ ├── DDXMLNode.h
│ │ │ ├── DDXMLNode.m
│ │ │ └── Private
│ │ │ │ └── DDXMLPrivate.h
│ │ └── libidn
│ │ │ ├── .DS_Store
│ │ │ ├── build-libidn.sh
│ │ │ ├── idn-int.h
│ │ │ ├── libidn.a
│ │ │ └── stringprep.h
│ │ └── XMPPFramework.h
└── XMPPManagerTests
│ ├── XMPPManagerTests-Info.plist
│ ├── XMPPManagerTests.m
│ └── en.lproj
│ └── InfoPlist.strings
└── login2.png
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # CocoaPods
2 | #
3 | # We recommend against adding the Pods directory to your .gitignore. However
4 | # you should judge for yourself, the pros and cons are mentioned at:
5 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control?
6 | #
7 | # Pods/
8 |
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 cocoajin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/XMPPManagerDemo/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/.DS_Store
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | XMPPManager.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | CE4D2ACA18FFA1A300733A52
16 |
17 | primary
18 |
19 |
20 | CE4D2AEA18FFA1A400733A52
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/A.h:
--------------------------------------------------------------------------------
1 | //
2 | // A.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol ADelegate
12 |
13 | - (void)testA;
14 |
15 | @end
16 |
17 | @interface A : NSObject
18 |
19 | @property (nonatomic,assign)iddelegate;
20 |
21 | - (void)aAction;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/A.m:
--------------------------------------------------------------------------------
1 | //
2 | // A.m
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import "A.h"
10 |
11 | @implementation A
12 |
13 | - (void)aAction
14 | {
15 | [self.delegate testA];
16 | }
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
16 | @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
17 | @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
18 |
19 | - (void)saveContext;
20 | - (NSURL *)applicationDocumentsDirectory;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/B.h:
--------------------------------------------------------------------------------
1 | //
2 | // B.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "A.h"
11 |
12 | @interface B : NSObject
13 |
14 | +(id)shareB;
15 |
16 | - (void)testB;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/B.m:
--------------------------------------------------------------------------------
1 | //
2 | // B.m
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import "B.h"
10 |
11 | @implementation B
12 |
13 | +(id)shareB
14 | {
15 | static B *bShare = nil;
16 | static dispatch_once_t onceToken;
17 | dispatch_once(&onceToken, ^{
18 | bShare = [B new];
19 | });
20 |
21 | return bShare;
22 | }
23 |
24 | - (void)testB
25 | {
26 | NSLog(@"line<%d> %s",__LINE__,__func__);
27 |
28 | A *aV = [A new];
29 | aV.delegate = self;
30 |
31 | //有时,如果代理方法不走,就要用 单例方法实现了;
32 |
33 | [aV aAction];
34 |
35 |
36 | }
37 |
38 | - (void)testA
39 | {
40 | NSLog(@"line<%d> %s",__LINE__,__func__);
41 | }
42 |
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/ChatViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ChatViewController.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-18.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "XMPPFramework.h"
12 |
13 |
14 | @interface ChatViewController : UIViewController
15 |
16 | {
17 | UITextView *theTextView; //聊天窗口
18 | NSMutableString *chatMessage; //聊天信息
19 | UITextField *theTextField; //输入框
20 | }
21 |
22 | @property (nonatomic,strong)NSString *lastChatMessage;
23 |
24 | @property (nonatomic,strong)XMPPStream *xmppStream;
25 |
26 |
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/ListViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ListViewController.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "XMPPManager.h"
12 |
13 | #import "LoginViewController.h"
14 |
15 |
16 | @interface ListViewController : UITableViewController
17 |
18 | {
19 | NSMutableArray *onlineUsers; //在线用户
20 | NSMutableArray *offlineUsers; //离线用户
21 | BOOL pushToChatPage; //是否push到聊天页面
22 | NSString *lastChatMessage; //接收的最后一次信息
23 |
24 | XMPPManager *manager;
25 | }
26 |
27 |
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/LoginViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // LoginViewController.h
3 | // XMPPChat
4 | //
5 | // Created by cocoajin on 14-4-16.
6 | // Copyright (c) 2014年 www.zhgu.net. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @protocol LoginViewControllerDelegate
13 |
14 | @required
15 |
16 | - (void)loginWith:(NSString *)userName pwd:(NSString *)pwd serverIP:(NSString *)ip;
17 |
18 | @end
19 |
20 | @interface LoginViewController : UIViewController
21 |
22 | {
23 | UITextField *userName;
24 | UITextField *userPassword;
25 | UITextField *serverIP;
26 | }
27 |
28 | @property (nonatomic,assign)id delegate;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/TDBadgedCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // TDBadgedCell.h
3 | // TDBadgedTableCell
4 | // TDBageView
5 | //
6 | // Any rereleasing of this code is prohibited.
7 | // Please attribute use of this code within your application
8 | //
9 | // Any Queries should be directed to hi@tmdvs.me | http://www.tmdvs.me
10 | //
11 | // Created by Tim
12 | // Copyright 2011 Tim Davies. All rights reserved.
13 | //
14 |
15 | #import
16 | #import
17 |
18 | #ifndef TD_STRONG
19 | #if __has_feature(objc_arc)
20 | #define TD_STRONG strong
21 | #else
22 | #define TD_STRONG retain
23 | #endif
24 | #endif
25 |
26 | #ifndef TD_WEAK
27 | #if __has_feature(objc_arc_weak)
28 | #define TD_WEAK weak
29 | #elif __has_feature(objc_arc)
30 | #define TD_WEAK unsafe_unretained
31 | #else
32 | #define TD_WEAK assign
33 | #endif
34 | #endif
35 |
36 | @interface TDBadgeView : UIView
37 | {
38 | UIColor *__defaultColor;
39 | UIColor *__defaultHighlightColor;
40 | }
41 |
42 | @property (nonatomic, readonly) NSUInteger width;
43 | @property (nonatomic, TD_STRONG) NSString *badgeString;
44 | @property (nonatomic, TD_WEAK) UITableViewCell *parent;
45 | @property (nonatomic, TD_STRONG) UIColor *badgeColor;
46 | @property (nonatomic, TD_STRONG) UIColor *badgeTextColor;
47 | @property (nonatomic, TD_STRONG) UIColor *badgeColorHighlighted;
48 | @property (nonatomic, TD_STRONG) UIColor *badgeTextColorHighlighted;
49 | @property (nonatomic, assign) BOOL showShadow;
50 | @property (nonatomic, assign) BOOL boldFont;
51 | @property (nonatomic, assign) CGFloat fontSize;
52 | @property (nonatomic, assign) CGFloat radius;
53 |
54 | @end
55 |
56 | @interface TDBadgedCell : UITableViewCell {
57 |
58 | }
59 |
60 | @property (nonatomic, TD_STRONG) NSString *badgeString;
61 | @property (readonly, TD_STRONG) TDBadgeView *badge;
62 | @property (nonatomic, TD_STRONG) UIColor *badgeColor;
63 | @property (nonatomic, TD_STRONG) UIColor *badgeTextColor;
64 | @property (nonatomic, TD_STRONG) UIColor *badgeColorHighlighted;
65 | @property (nonatomic, TD_STRONG) UIColor *badgeTextColorHighlighted;
66 | @property (nonatomic, assign) BOOL showShadow;
67 | @property (nonatomic, assign) CGFloat badgeLeftOffset;
68 | @property (nonatomic, assign) CGFloat badgeRightOffset;
69 | @property (nonatomic, TD_STRONG) NSMutableArray *resizeableLabels;
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/XMPPManager-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.9ask.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/XMPPManager-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_3_0
10 | #warning "This project uses features only available in iOS SDK 3.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #import
17 | #endif
18 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/XMPPManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPManager.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "XMPPFramework.h"
11 |
12 | #import "XMPPManagerDelegate.h"
13 |
14 | @interface XMPPManager : NSObject
15 |
16 | @property (nonatomic,strong)XMPPStream *xmppStream;
17 |
18 | @property (nonatomic,assign)iddelegate;
19 |
20 | /**
21 | * 设置xmpp服务器的ip
22 | *
23 | * @param hostIP 服务器ip
24 | *
25 | * @return 返回一个xmpp服务器管理器
26 | */
27 | + (id)managerWith:(NSString *)hostIP;
28 |
29 |
30 | /**
31 | * 设置登录用户名和密码
32 | *
33 | * @param userName 用户名
34 | * @param pwd 密码
35 | */
36 | - (void)setUserName:(NSString *)userName password:(NSString *)pwd;
37 |
38 | /**
39 | * 设置 xmppStrem;
40 | */
41 | - (void)setUpStream;
42 |
43 | /**
44 | * 连接服务器;
45 | *
46 | * @return 是否连接成功
47 | */
48 | - (BOOL)connectServer;
49 |
50 | /**
51 | * 断开服务器连接;
52 | */
53 | - (void)disConnect;
54 |
55 | /**
56 | * 上线;
57 | */
58 | - (void)goOnLine;
59 |
60 | /**
61 | * 离线;
62 | */
63 | - (void)goOffLine;
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/XMPPManager.xcdatamodeld/.xccurrentversion:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | _XCCurrentVersionName
6 | XMPPManager.xcdatamodel
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/XMPPManager.xcdatamodeld/XMPPManager.xcdatamodel/contents:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/XMPPManagerDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPManagerDelegate.h
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "XMPP.h"
11 |
12 | @protocol XMPPManagerDelegate
13 |
14 | @optional
15 |
16 | /**
17 | * 用户登录服务器成功
18 | *
19 | * @param userJID 登录用户信息
20 | */
21 | - (void)userLoginSuccess:(XMPPJID *)userJID;
22 |
23 | /**
24 | * 新用户上线回调
25 | *
26 | * @param presence 上线用户
27 | */
28 | - (void)newUserOnline:(XMPPPresence *)presence;
29 |
30 | /**
31 | * 用户离线回调
32 | *
33 | * @param presence 离线用户
34 | */
35 | - (void)hasUserOffline:(XMPPPresence *)presence;
36 |
37 | /**
38 | * 收到新消息
39 | *
40 | * @param message 新消息内容
41 | */
42 | - (void)didReceiveMessage:(XMPPMessage *)message;
43 |
44 |
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // XMPPManager
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/.DS_Store
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/Anonymous/XMPPAnonymousAuthentication.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPSASLAuthentication.h"
3 | #import "XMPP.h"
4 |
5 |
6 | @interface XMPPAnonymousAuthentication : NSObject
7 |
8 | - (id)initWithStream:(XMPPStream *)stream;
9 |
10 | // This class implements the XMPPSASLAuthentication protocol.
11 | //
12 | // See XMPPSASLAuthentication.h for more information.
13 |
14 | @end
15 |
16 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17 | #pragma mark -
18 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
19 |
20 | @interface XMPPStream (XMPPAnonymousAuthentication)
21 |
22 | /**
23 | * Returns whether or not the server support anonymous authentication.
24 | *
25 | * This information is available after the stream is connected.
26 | * In other words, after the delegate has received xmppStreamDidConnect: notification.
27 | **/
28 | - (BOOL)supportsAnonymousAuthentication;
29 |
30 | /**
31 | * This method attempts to start the anonymous authentication process.
32 | *
33 | * This method is asynchronous.
34 | *
35 | * If there is something immediately wrong,
36 | * such as the stream is not connected or doesn't support anonymous authentication,
37 | * the method will return NO and set the error.
38 | * Otherwise the delegate callbacks are used to communicate auth success or failure.
39 | *
40 | * @see xmppStreamDidAuthenticate:
41 | * @see xmppStream:didNotAuthenticate:
42 | **/
43 | - (BOOL)authenticateAnonymously:(NSError **)errPtr;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/Deprecated-Digest/XMPPDeprecatedDigestAuthentication.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPSASLAuthentication.h"
3 | #import "XMPPStream.h"
4 |
5 |
6 | @interface XMPPDeprecatedDigestAuthentication : NSObject
7 |
8 | // This class implements the XMPPSASLAuthentication protocol.
9 | //
10 | // See XMPPSASLAuthentication.h for more information.
11 |
12 | @end
13 |
14 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
15 | #pragma mark -
16 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17 |
18 | @interface XMPPStream (XMPPDeprecatedDigestAuthentication)
19 |
20 | - (BOOL)supportsDeprecatedDigestAuthentication;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/Deprecated-Plain/XMPPDeprecatedPlainAuthentication.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPSASLAuthentication.h"
3 | #import "XMPPStream.h"
4 |
5 |
6 | @interface XMPPDeprecatedPlainAuthentication : NSObject
7 |
8 | // This class implements the XMPPSASLAuthentication protocol.
9 | //
10 | // See XMPPSASLAuthentication.h for more information.
11 |
12 | @end
13 |
14 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
15 | #pragma mark -
16 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17 |
18 | @interface XMPPStream (XMPPDeprecatedPlainAuthentication)
19 |
20 | - (BOOL)supportsDeprecatedPlainAuthentication;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/Digest-MD5/XMPPDigestMD5Authentication.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPSASLAuthentication.h"
3 | #import "XMPPStream.h"
4 |
5 |
6 | @interface XMPPDigestMD5Authentication : NSObject
7 |
8 | // This class implements the XMPPSASLAuthentication protocol.
9 | //
10 | // See XMPPSASLAuthentication.h for more information.
11 |
12 | @end
13 |
14 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
15 | #pragma mark -
16 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17 |
18 | @interface XMPPStream (XMPPDigestMD5Authentication)
19 |
20 | - (BOOL)supportsDigestMD5Authentication;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/Plain/XMPPPlainAuthentication.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPSASLAuthentication.h"
3 | #import "XMPPStream.h"
4 |
5 |
6 | @interface XMPPPlainAuthentication : NSObject
7 |
8 | // This class implements the XMPPSASLAuthentication protocol.
9 | //
10 | // See XMPPSASLAuthentication.h for more information.
11 |
12 | @end
13 |
14 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
15 | #pragma mark -
16 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17 |
18 | @interface XMPPStream (XMPPPlainAuthentication)
19 |
20 | - (BOOL)supportsPlainAuthentication;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/Plain/XMPPPlainAuthentication.m:
--------------------------------------------------------------------------------
1 | #import "XMPPPlainAuthentication.h"
2 | #import "XMPP.h"
3 | #import "XMPPLogging.h"
4 | #import "XMPPInternal.h"
5 | #import "NSData+XMPP.h"
6 | #import "NSXMLElement+XMPP.h"
7 |
8 | #if ! __has_feature(objc_arc)
9 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
10 | #endif
11 |
12 | // Log levels: off, error, warn, info, verbose
13 | #if DEBUG
14 | static const int xmppLogLevel = XMPP_LOG_LEVEL_INFO; // | XMPP_LOG_FLAG_TRACE;
15 | #else
16 | static const int xmppLogLevel = XMPP_LOG_LEVEL_WARN;
17 | #endif
18 |
19 |
20 | @implementation XMPPPlainAuthentication
21 | {
22 | #if __has_feature(objc_arc_weak)
23 | __weak XMPPStream *xmppStream;
24 | #else
25 | __unsafe_unretained XMPPStream *xmppStream;
26 | #endif
27 |
28 | NSString *password;
29 | }
30 |
31 | + (NSString *)mechanismName
32 | {
33 | return @"PLAIN";
34 | }
35 |
36 | - (id)initWithStream:(XMPPStream *)stream password:(NSString *)inPassword
37 | {
38 | if ((self = [super init]))
39 | {
40 | xmppStream = stream;
41 | password = inPassword;
42 | }
43 | return self;
44 | }
45 |
46 | - (BOOL)start:(NSError **)errPtr
47 | {
48 | XMPPLogTrace();
49 |
50 | // From RFC 4616 - PLAIN SASL Mechanism:
51 | // [authzid] UTF8NUL authcid UTF8NUL passwd
52 | //
53 | // authzid: authorization identity
54 | // authcid: authentication identity (username)
55 | // passwd : password for authcid
56 |
57 | NSString *username = [xmppStream.myJID user];
58 |
59 | NSString *payload = [NSString stringWithFormat:@"\0%@\0%@", username, password];
60 | NSString *base64 = [[payload dataUsingEncoding:NSUTF8StringEncoding] xmpp_base64Encoded];
61 |
62 | // Base-64-Info
63 |
64 | NSXMLElement *auth = [NSXMLElement elementWithName:@"auth" xmlns:@"urn:ietf:params:xml:ns:xmpp-sasl"];
65 | [auth addAttributeWithName:@"mechanism" stringValue:@"PLAIN"];
66 | [auth setStringValue:base64];
67 |
68 | [xmppStream sendAuthElement:auth];
69 |
70 | return YES;
71 | }
72 |
73 | - (XMPPHandleAuthResponse)handleAuth:(NSXMLElement *)authResponse
74 | {
75 | XMPPLogTrace();
76 |
77 | // We're expecting a success response.
78 | // If we get anything else we can safely assume it's the equivalent of a failure response.
79 |
80 | if ([[authResponse name] isEqualToString:@"success"])
81 | {
82 | return XMPP_AUTH_SUCCESS;
83 | }
84 | else
85 | {
86 | return XMPP_AUTH_FAIL;
87 | }
88 | }
89 |
90 | @end
91 |
92 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
93 | #pragma mark -
94 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
95 |
96 | @implementation XMPPStream (XMPPPlainAuthentication)
97 |
98 | - (BOOL)supportsPlainAuthentication
99 | {
100 | return [self supportsAuthenticationMechanism:[XMPPPlainAuthentication mechanismName]];
101 | }
102 |
103 | @end
104 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/SCRAM-SHA-1/XMPPSCRAMSHA1Authentication.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPSCRAMSHA1Authentication.h
3 | // iPhoneXMPP
4 | //
5 | // Created by David Chiles on 3/21/14.
6 | //
7 | //
8 |
9 | #import
10 | #import "XMPPSASLAuthentication.h"
11 | #import "XMPPStream.h"
12 |
13 | @interface XMPPSCRAMSHA1Authentication : NSObject
14 |
15 | @end
16 |
17 | @interface XMPPStream (XMPPSCRAMSHA1Authentication)
18 |
19 | - (BOOL)supportsSCRAMSHA1Authentication;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/X-Facebook-Platform/XMPPXFacebookPlatformAuthentication.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPSASLAuthentication.h"
3 | #import "XMPPStream.h"
4 |
5 |
6 | @interface XMPPXFacebookPlatformAuthentication : NSObject
7 |
8 | /**
9 | * You should use this init method (as opposed the one defined in the XMPPSASLAuthentication protocol).
10 | **/
11 | - (id)initWithStream:(XMPPStream *)stream appId:(NSString *)appId accessToken:(NSString *)accessToken;
12 |
13 | @end
14 |
15 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16 | #pragma mark -
17 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
18 |
19 | @interface XMPPStream (XMPPXFacebookPlatformAuthentication)
20 |
21 | /**
22 | * Facebook Chat X-FACEBOOK-PLATFORM SASL authentication initialization.
23 | * This is a convienence init method to help configure Facebook Chat.
24 | **/
25 | - (id)initWithFacebookAppId:(NSString *)fbAppId;
26 |
27 | /**
28 | * The appId can be passed to custom authentication classes.
29 | * For example, the appId is used for Facebook Chat X-FACEBOOK-PLATFORM SASL authentication.
30 | **/
31 | @property (readwrite, copy) NSString *facebookAppId;
32 |
33 | /**
34 | * Returns whether or not the server supports X-FACEBOOK-PLATFORM authentication.
35 | *
36 | * This information is available after the stream is connected.
37 | * In other words, after the delegate has received xmppStreamDidConnect: notification.
38 | **/
39 | - (BOOL)supportsXFacebookPlatformAuthentication;
40 |
41 | /**
42 | * This method attempts to start the facebook oauth authentication process.
43 | *
44 | * This method is asynchronous.
45 | *
46 | * If there is something immediately wrong,
47 | * such as the stream is not connected or doesn't have a set appId or accessToken,
48 | * the method will return NO and set the error.
49 | * Otherwise the delegate callbacks are used to communicate auth success or failure.
50 | *
51 | * @see xmppStreamDidAuthenticate:
52 | * @see xmppStream:didNotAuthenticate:
53 | **/
54 | - (BOOL)authenticateWithFacebookAccessToken:(NSString *)accessToken error:(NSError **)errPtr;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Authentication/X-OAuth2-Google/XMPPXOAuth2Google.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPXOAuth2Google.h
3 | // Off the Record
4 | //
5 | // Created by David Chiles on 9/13/13.
6 | // Copyright (c) 2013 Chris Ballinger. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "XMPPSASLAuthentication.h"
11 | #import "XMPPStream.h"
12 |
13 | @interface XMPPXOAuth2Google : NSObject
14 |
15 | -(id)initWithStream:(XMPPStream *)stream accessToken:(NSString *)accessToken;
16 |
17 | @end
18 |
19 |
20 |
21 | @interface XMPPStream (XMPPXOAuth2Google)
22 |
23 |
24 | - (BOOL)supportsXOAuth2GoogleAuthentication;
25 |
26 | - (BOOL)authenticateWithGoogleAccessToken:(NSString *)accessToken error:(NSError **)errPtr;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Categories/NSData+XMPP.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface NSData (XMPP)
4 |
5 | - (NSData *)xmpp_md5Digest;
6 |
7 | - (NSData *)xmpp_sha1Digest;
8 |
9 | - (NSString *)xmpp_hexStringValue;
10 |
11 | - (NSString *)xmpp_base64Encoded;
12 | - (NSData *)xmpp_base64Decoded;
13 |
14 | - (BOOL)xmpp_isJPEG;
15 | - (BOOL)xmpp_isPNG;
16 | - (NSString *)xmpp_imageType;
17 |
18 | @end
19 |
20 | #ifndef XMPP_EXCLUDE_DEPRECATED
21 |
22 | #define XMPP_DEPRECATED($message) __attribute__((deprecated($message)))
23 |
24 | @interface NSData (XMPPDeprecated)
25 | - (NSData *)md5Digest XMPP_DEPRECATED("Use -xmpp_md5Digest");
26 | - (NSData *)sha1Digest XMPP_DEPRECATED("Use -xmpp_sha1Digest");
27 | - (NSString *)hexStringValue XMPP_DEPRECATED("Use -xmpp_hexStringValue");
28 | - (NSString *)base64Encoded XMPP_DEPRECATED("Use -xmpp_base64Encoded");
29 | - (NSData *)base64Decoded XMPP_DEPRECATED("Use -xmpp_base64Decoded");
30 | @end
31 |
32 | #undef XMPP_DEPRECATED
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Categories/NSNumber+XMPP.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | @interface NSNumber (XMPP)
5 |
6 | + (NSNumber *)xmpp_numberWithPtr:(const void *)ptr;
7 | - (id)xmpp_initWithPtr:(const void *)ptr __attribute__((objc_method_family(init)));
8 |
9 | + (BOOL)xmpp_parseString:(NSString *)str intoInt32:(int32_t *)pNum;
10 | + (BOOL)xmpp_parseString:(NSString *)str intoUInt32:(uint32_t *)pNum;
11 |
12 | + (BOOL)xmpp_parseString:(NSString *)str intoInt64:(int64_t *)pNum;
13 | + (BOOL)xmpp_parseString:(NSString *)str intoUInt64:(uint64_t *)pNum;
14 |
15 | + (BOOL)xmpp_parseString:(NSString *)str intoNSInteger:(NSInteger *)pNum;
16 | + (BOOL)xmpp_parseString:(NSString *)str intoNSUInteger:(NSUInteger *)pNum;
17 |
18 | + (UInt8)xmpp_extractUInt8FromData:(NSData *)data atOffset:(unsigned int)offset;
19 |
20 | + (UInt16)xmpp_extractUInt16FromData:(NSData *)data atOffset:(unsigned int)offset andConvertFromNetworkOrder:(BOOL)flag;
21 |
22 | + (UInt32)xmpp_extractUInt32FromData:(NSData *)data atOffset:(unsigned int)offset andConvertFromNetworkOrder:(BOOL)flag;
23 |
24 | @end
25 |
26 | #ifndef XMPP_EXCLUDE_DEPRECATED
27 |
28 | #define XMPP_DEPRECATED($message) __attribute__((deprecated($message)))
29 |
30 | @interface NSNumber (XMPPDeprecated)
31 | + (NSNumber *)numberWithPtr:(const void *)ptr XMPP_DEPRECATED("Use +xmpp_numberWithPtr:");
32 | - (id)initWithPtr:(const void *)ptr XMPP_DEPRECATED("Use -xmpp_initWithPtr:");
33 | + (BOOL)parseString:(NSString *)str intoInt32:(int32_t *)pNum XMPP_DEPRECATED("Use +xmpp_parseString:intoInt32:");
34 | + (BOOL)parseString:(NSString *)str intoUInt32:(uint32_t *)pNum XMPP_DEPRECATED("Use +xmpp_parseString:intoUInt32:");
35 | + (BOOL)parseString:(NSString *)str intoInt64:(int64_t *)pNum XMPP_DEPRECATED("Use +xmpp_parseString:intoInt64:");
36 | + (BOOL)parseString:(NSString *)str intoUInt64:(uint64_t *)pNum XMPP_DEPRECATED("Use +xmpp_parseString:intoUInt64:");
37 | + (BOOL)parseString:(NSString *)str intoNSInteger:(NSInteger *)pNum XMPP_DEPRECATED("Use +xmpp_parseString:intoNSInteger:");
38 | + (BOOL)parseString:(NSString *)str intoNSUInteger:(NSUInteger *)pNum XMPP_DEPRECATED("Use +xmpp_parseString:intoNSUInteger:");
39 | + (UInt8)extractUInt8FromData:(NSData *)data atOffset:(unsigned int)offset XMPP_DEPRECATED("Use +xmpp_extractUInt8FromData:atOffset:");
40 | + (UInt16)extractUInt16FromData:(NSData *)data atOffset:(unsigned int)offset andConvertFromNetworkOrder:(BOOL)flag XMPP_DEPRECATED("Use +xmpp_extractUInt16FromData:atOffset:andConvertFromNetworkOrder:");
41 | + (UInt32)extractUInt32FromData:(NSData *)data atOffset:(unsigned int)offset andConvertFromNetworkOrder:(BOOL)flag XMPP_DEPRECATED("Use +xmpp_extractUInt32FromData:atOffset:andConvertFromNetworkOrder:");
42 | @end
43 |
44 | #undef XMPP_DEPRECATED
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPP.h:
--------------------------------------------------------------------------------
1 | //
2 | // Core classes
3 | //
4 |
5 | #import "XMPPJID.h"
6 | #import "XMPPStream.h"
7 | #import "XMPPElement.h"
8 | #import "XMPPIQ.h"
9 | #import "XMPPMessage.h"
10 | #import "XMPPPresence.h"
11 | #import "XMPPModule.h"
12 |
13 | //
14 | // Authentication
15 | //
16 |
17 | #import "XMPPSASLAuthentication.h"
18 | #import "XMPPDigestMD5Authentication.h"
19 | #import "XMPPSCRAMSHA1Authentication.h"
20 | #import "XMPPPlainAuthentication.h"
21 | #import "XMPPXFacebookPlatformAuthentication.h"
22 | #import "XMPPAnonymousAuthentication.h"
23 | #import "XMPPDeprecatedPlainAuthentication.h"
24 | #import "XMPPDeprecatedDigestAuthentication.h"
25 |
26 | //
27 | // Categories
28 | //
29 |
30 | #import "NSXMLElement+XMPP.h"
31 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPElement.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPJID.h"
3 |
4 | #if TARGET_OS_IPHONE
5 | #import "DDXML.h"
6 | #endif
7 |
8 |
9 | /**
10 | * The XMPPElement provides the base class for XMPPIQ, XMPPMessage & XMPPPresence.
11 | *
12 | * This class extends NSXMLElement.
13 | * The NSXML classes (NSXMLElement & NSXMLNode) provide a full-featured library for working with XML elements.
14 | *
15 | * On the iPhone, the KissXML library provides a drop-in replacement for Apple's NSXML classes.
16 | **/
17 |
18 | @interface XMPPElement : NSXMLElement
19 |
20 | #pragma mark Common Jabber Methods
21 |
22 | - (NSString *)elementID;
23 |
24 | - (XMPPJID *)to;
25 | - (XMPPJID *)from;
26 |
27 | - (NSString *)toStr;
28 | - (NSString *)fromStr;
29 |
30 | #pragma mark To and From Methods
31 |
32 | - (BOOL)isTo:(XMPPJID *)to;
33 | - (BOOL)isTo:(XMPPJID *)to options:(XMPPJIDCompareOptions)mask;
34 |
35 | - (BOOL)isFrom:(XMPPJID *)from;
36 | - (BOOL)isFrom:(XMPPJID *)from options:(XMPPJIDCompareOptions)mask;
37 |
38 | - (BOOL)isToOrFrom:(XMPPJID *)toOrFrom;
39 | - (BOOL)isToOrFrom:(XMPPJID *)toOrFrom options:(XMPPJIDCompareOptions)mask;
40 |
41 | - (BOOL)isTo:(XMPPJID *)to from:(XMPPJID *)from;
42 | - (BOOL)isTo:(XMPPJID *)to from:(XMPPJID *)from options:(XMPPJIDCompareOptions)mask;
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPInternal.h:
--------------------------------------------------------------------------------
1 | //
2 | // This file is for XMPPStream and various internal components.
3 | //
4 |
5 | #import "XMPPStream.h"
6 | #import "XMPPModule.h"
7 |
8 | // Define the various states we'll use to track our progress
9 | enum XMPPStreamState
10 | {
11 | STATE_XMPP_DISCONNECTED,
12 | STATE_XMPP_RESOLVING_SRV,
13 | STATE_XMPP_CONNECTING,
14 | STATE_XMPP_OPENING,
15 | STATE_XMPP_NEGOTIATING,
16 | STATE_XMPP_STARTTLS_1,
17 | STATE_XMPP_STARTTLS_2,
18 | STATE_XMPP_POST_NEGOTIATION,
19 | STATE_XMPP_REGISTERING,
20 | STATE_XMPP_AUTH,
21 | STATE_XMPP_BINDING,
22 | STATE_XMPP_START_SESSION,
23 | STATE_XMPP_CONNECTED,
24 | };
25 | typedef enum XMPPStreamState XMPPStreamState;
26 |
27 | /**
28 | * It is recommended that storage classes cache a stream's myJID.
29 | * This prevents them from constantly querying the property from the xmppStream instance,
30 | * as doing so goes through xmppStream's dispatch queue.
31 | * Caching the stream's myJID frees the dispatch queue to handle xmpp processing tasks.
32 | *
33 | * The object of the notification will be the XMPPStream instance.
34 | *
35 | * Note: We're not using the typical MulticastDelegate paradigm for this task as
36 | * storage classes are not typically added as a delegate of the xmppStream.
37 | **/
38 | extern NSString *const XMPPStreamDidChangeMyJIDNotification;
39 |
40 | @interface XMPPStream (/* Internal */)
41 |
42 | /**
43 | * Categories on XMPPStream should maintain thread safety by dispatching through the internal xmppQueue.
44 | * They may also need to ensure the stream is in the proper state for their activity.
45 | **/
46 |
47 | @property (readonly) dispatch_queue_t xmppQueue;
48 | @property (readonly) void *xmppQueueTag;
49 | @property (readonly) XMPPStreamState state;
50 |
51 | /**
52 | * This method is for use by xmpp authentication mechanism classes.
53 | * They should send elements using this method instead of the public sendElement classes,
54 | * as those methods don't send the elements while authentication is in progress.
55 | **/
56 | - (void)sendAuthElement:(NSXMLElement *)element;
57 |
58 | /**
59 | * This method allows you to inject an element into the stream as if it was received on the socket.
60 | * This is an advanced technique, but makes for some interesting possibilities.
61 | **/
62 | - (void)injectElement:(NSXMLElement *)element;
63 |
64 | @end
65 |
66 | @interface XMPPModule (/* Internal */)
67 |
68 | /**
69 | * Used internally by methods like XMPPStream's unregisterModule:.
70 | * Normally removing a delegate is a synchronous operation, but due to multiple dispatch_sync operations,
71 | * it must occasionally be done asynchronously to avoid deadlock.
72 | **/
73 | - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue synchronously:(BOOL)synchronously;
74 |
75 | @end
76 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPJID.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | enum XMPPJIDCompareOptions
4 | {
5 | XMPPJIDCompareUser = 1, // 001
6 | XMPPJIDCompareDomain = 2, // 010
7 | XMPPJIDCompareResource = 4, // 100
8 |
9 | XMPPJIDCompareBare = 3, // 011
10 | XMPPJIDCompareFull = 7, // 111
11 | };
12 | typedef enum XMPPJIDCompareOptions XMPPJIDCompareOptions;
13 |
14 |
15 | @interface XMPPJID : NSObject
16 | {
17 | __strong NSString *user;
18 | __strong NSString *domain;
19 | __strong NSString *resource;
20 | }
21 |
22 | + (XMPPJID *)jidWithString:(NSString *)jidStr;
23 | + (XMPPJID *)jidWithString:(NSString *)jidStr resource:(NSString *)resource;
24 | + (XMPPJID *)jidWithUser:(NSString *)user domain:(NSString *)domain resource:(NSString *)resource;
25 |
26 | @property (strong, readonly) NSString *user;
27 | @property (strong, readonly) NSString *domain;
28 | @property (strong, readonly) NSString *resource;
29 |
30 | /**
31 | * Terminology (from RFC 6120):
32 | *
33 | * The term "bare JID" refers to an XMPP address of the form (for an account at a server)
34 | * or of the form (for a server).
35 | *
36 | * The term "full JID" refers to an XMPP address of the form
37 | * (for a particular authorized client or device associated with an account)
38 | * or of the form (for a particular resource or script associated with a server).
39 | *
40 | * Thus a bareJID is one that does not have a resource.
41 | * And a fullJID is one that does have a resource.
42 | *
43 | * For convenience, there are also methods that that check for a user component as well.
44 | **/
45 |
46 | - (XMPPJID *)bareJID;
47 | - (XMPPJID *)domainJID;
48 |
49 | - (NSString *)bare;
50 | - (NSString *)full;
51 |
52 | - (BOOL)isBare;
53 | - (BOOL)isBareWithUser;
54 |
55 | - (BOOL)isFull;
56 | - (BOOL)isFullWithUser;
57 |
58 | /**
59 | * A server JID does not have a user component.
60 | **/
61 | - (BOOL)isServer;
62 |
63 | /**
64 | * Returns a new jid with the given resource.
65 | **/
66 | - (XMPPJID *)jidWithNewResource:(NSString *)resource;
67 |
68 | /**
69 | * When you know both objects are JIDs, this method is a faster way to check equality than isEqual:.
70 | **/
71 | - (BOOL)isEqualToJID:(XMPPJID *)aJID;
72 | - (BOOL)isEqualToJID:(XMPPJID *)aJID options:(XMPPJIDCompareOptions)mask;
73 |
74 | @end
75 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPMessage.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPElement.h"
3 |
4 | /**
5 | * The XMPPMessage class represents a element.
6 | * It extends XMPPElement, which in turn extends NSXMLElement.
7 | * All elements that go in and out of the
8 | * xmpp stream will automatically be converted to XMPPMessage objects.
9 | *
10 | * This class exists to provide developers an easy way to add functionality to message processing.
11 | * Simply add your own category to XMPPMessage to extend it with your own custom methods.
12 | **/
13 |
14 | @interface XMPPMessage : XMPPElement
15 |
16 | // Converts an NSXMLElement to an XMPPMessage element in place (no memory allocations or copying)
17 | + (XMPPMessage *)messageFromElement:(NSXMLElement *)element;
18 |
19 | + (XMPPMessage *)message;
20 | + (XMPPMessage *)messageWithType:(NSString *)type;
21 | + (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)to;
22 | + (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid;
23 | + (XMPPMessage *)messageWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement;
24 | + (XMPPMessage *)messageWithType:(NSString *)type elementID:(NSString *)eid;
25 | + (XMPPMessage *)messageWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement;
26 | + (XMPPMessage *)messageWithType:(NSString *)type child:(NSXMLElement *)childElement;
27 |
28 | - (id)init;
29 | - (id)initWithType:(NSString *)type;
30 | - (id)initWithType:(NSString *)type to:(XMPPJID *)to;
31 | - (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid;
32 | - (id)initWithType:(NSString *)type to:(XMPPJID *)jid elementID:(NSString *)eid child:(NSXMLElement *)childElement;
33 | - (id)initWithType:(NSString *)type elementID:(NSString *)eid;
34 | - (id)initWithType:(NSString *)type elementID:(NSString *)eid child:(NSXMLElement *)childElement;
35 | - (id)initWithType:(NSString *)type child:(NSXMLElement *)childElement;
36 |
37 | - (NSString *)type;
38 | - (NSString *)subject;
39 | - (NSString *)body;
40 | - (NSString *)bodyForLanguage:(NSString *)language;
41 | - (NSString *)thread;
42 |
43 | - (void)addSubject:(NSString *)subject;
44 | - (void)addBody:(NSString *)body;
45 | - (void)addBody:(NSString *)body withLanguage:(NSString *)language;
46 | - (void)addThread:(NSString *)thread;
47 |
48 | - (BOOL)isChatMessage;
49 | - (BOOL)isChatMessageWithBody;
50 | - (BOOL)isErrorMessage;
51 | - (BOOL)isMessageWithBody;
52 |
53 | - (NSError *)errorMessage;
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPModule.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "GCDMulticastDelegate.h"
3 |
4 | @class XMPPStream;
5 |
6 | /**
7 | * XMPPModule is the base class that all extensions/modules inherit.
8 | * They automatically get:
9 | *
10 | * - A dispatch queue.
11 | * - A multicast delegate that automatically invokes added delegates.
12 | *
13 | * The module also automatically registers/unregisters itself with the
14 | * xmpp stream during the activate/deactive methods.
15 | **/
16 | @interface XMPPModule : NSObject
17 | {
18 | XMPPStream *xmppStream;
19 |
20 | dispatch_queue_t moduleQueue;
21 | void *moduleQueueTag;
22 |
23 | id multicastDelegate;
24 | }
25 |
26 | @property (readonly) dispatch_queue_t moduleQueue;
27 | @property (readonly) void *moduleQueueTag;
28 |
29 | @property (strong, readonly) XMPPStream *xmppStream;
30 |
31 | - (id)init;
32 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue;
33 |
34 | - (BOOL)activate:(XMPPStream *)xmppStream;
35 | - (void)deactivate;
36 |
37 | - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
38 | - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
39 | - (void)removeDelegate:(id)delegate;
40 |
41 | - (NSString *)moduleName;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPParser.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #if TARGET_OS_IPHONE
4 | #import "DDXML.h"
5 | #endif
6 |
7 |
8 | @interface XMPPParser : NSObject
9 |
10 | - (id)initWithDelegate:(id)delegate delegateQueue:(dispatch_queue_t)dq;
11 | - (id)initWithDelegate:(id)delegate delegateQueue:(dispatch_queue_t)dq parserQueue:(dispatch_queue_t)pq;
12 |
13 | - (void)setDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
14 |
15 | /**
16 | * Asynchronously parses the given data.
17 | * The delegate methods will be dispatch_async'd as events occur.
18 | **/
19 | - (void)parseData:(NSData *)data;
20 |
21 | @end
22 |
23 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
24 | #pragma mark -
25 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
26 |
27 | @protocol XMPPParserDelegate
28 | @optional
29 |
30 | - (void)xmppParser:(XMPPParser *)sender didReadRoot:(NSXMLElement *)root;
31 |
32 | - (void)xmppParser:(XMPPParser *)sender didReadElement:(NSXMLElement *)element;
33 |
34 | - (void)xmppParserDidEnd:(XMPPParser *)sender;
35 |
36 | - (void)xmppParser:(XMPPParser *)sender didFail:(NSError *)error;
37 |
38 | - (void)xmppParserDidParseData:(XMPPParser *)sender;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Core/XMPPPresence.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPElement.h"
3 |
4 | /**
5 | * The XMPPPresence class represents a element.
6 | * It extends XMPPElement, which in turn extends NSXMLElement.
7 | * All elements that go in and out of the
8 | * xmpp stream will automatically be converted to XMPPPresence objects.
9 | *
10 | * This class exists to provide developers an easy way to add functionality to presence processing.
11 | * Simply add your own category to XMPPPresence to extend it with your own custom methods.
12 | **/
13 |
14 | @interface XMPPPresence : XMPPElement
15 |
16 | // Converts an NSXMLElement to an XMPPPresence element in place (no memory allocations or copying)
17 | + (XMPPPresence *)presenceFromElement:(NSXMLElement *)element;
18 |
19 | + (XMPPPresence *)presence;
20 | + (XMPPPresence *)presenceWithType:(NSString *)type;
21 | + (XMPPPresence *)presenceWithType:(NSString *)type to:(XMPPJID *)to;
22 |
23 | - (id)init;
24 | - (id)initWithType:(NSString *)type;
25 | - (id)initWithType:(NSString *)type to:(XMPPJID *)to;
26 |
27 | - (NSString *)type;
28 |
29 | - (NSString *)show;
30 | - (NSString *)status;
31 |
32 | - (int)priority;
33 |
34 | - (int)intShow;
35 |
36 | - (BOOL)isErrorPresence;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/.DS_Store
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/BandwidthMonitor/XMPPBandwidthMonitor.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Simple XMPP module that tracks average bandwidth of the xmpp stream.
3 | *
4 | * For now, this is a really simple module.
5 | * But perhaps in the future, as developers adapt this module,
6 | * they will open source their additions and improvements.
7 | **/
8 |
9 | #import
10 | #import "XMPP.h"
11 |
12 | #define _XMPP_BANDWIDTH_MONITOR_H
13 |
14 | @interface XMPPBandwidthMonitor : XMPPModule
15 |
16 | @property (readonly) double outgoingBandwidth;
17 | @property (readonly) double incomingBandwidth;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/GoogleSharedStatus/XMPPGoogleSharedStatus.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPModule.h"
3 |
4 | extern NSString *const XMPPGoogleSharedStatusShow;
5 | extern NSString *const XMPPGoogleSharedStatusInvisible;
6 | extern NSString *const XMPPGoogleSharedStatusStatus;
7 |
8 | extern NSString *const XMPPGoogleSharedStatusShowAvailable;
9 | extern NSString *const XMPPGoogleSharedStatusShowBusy;
10 | extern NSString *const XMPPGoogleSharedStatusShowIdle;
11 |
12 | @protocol XMPPGoogleSharedStatusDelegate;
13 |
14 |
15 | #define _XMPP_GOOGLE_SHARED_STATUS_H
16 |
17 | @interface XMPPGoogleSharedStatus : XMPPModule
18 |
19 | @property (nonatomic, assign) BOOL sharedStatusSupported;
20 | @property (nonatomic, strong) NSDictionary *sharedStatus;
21 |
22 | // Determines if the user is idle based on last received HID
23 | // event, and sends the presence as away, if the user is idle.
24 | @property (nonatomic, assign) BOOL assumeIdleUpdateResponsibility;
25 |
26 | @property (nonatomic, strong) NSString *status;
27 | @property (nonatomic, strong) NSString *show;
28 | @property (nonatomic, assign) BOOL invisible;
29 |
30 | // Convenience auto-updater for presence status.
31 | // Does not use XMPPGoogleSharedStatus.
32 | @property (nonatomic, copy) NSString *statusMessage;
33 | @property (nonatomic, copy) NSString *statusAvailability;
34 |
35 | - (void)updateSharedStatus:(NSString *)status
36 | show:(NSString *)show
37 | invisible:(BOOL)invisible;
38 |
39 | - (void)refreshSharedStatus;
40 |
41 | @end
42 |
43 | @protocol XMPPGoogleSharedStatusDelegate
44 |
45 | @optional
46 |
47 | // This delegate method is called when the server updates the shared
48 | // status module with new status information, or upon manual refresh.
49 | - (void)xmppGoogleSharedStatus:(XMPPGoogleSharedStatus *)sender didReceiveUpdatedStatus:(NSDictionary *)sharedStatus;
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPGroupCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPGroupCoreDataStorageObject.h
3 | //
4 | // Created by Eric Chamberlain on 3/20/11.
5 | // Copyright (c) 2011 RF.com. All rights reserved.
6 | //
7 |
8 | #import
9 | #import
10 |
11 |
12 | @class XMPPUserCoreDataStorageObject;
13 |
14 |
15 | @interface XMPPGroupCoreDataStorageObject : NSManagedObject {
16 | @private
17 | }
18 |
19 | @property (nonatomic, strong) NSString * name;
20 | @property (nonatomic, strong) NSSet* users;
21 |
22 | + (void)clearEmptyGroupsInManagedObjectContext:(NSManagedObjectContext *)moc;
23 |
24 | + (id)fetchOrInsertGroupName:(NSString *)groupName inManagedObjectContext:(NSManagedObjectContext *)moc;
25 |
26 | + (id)insertGroupName:(NSString *)groupName inManagedObjectContext:(NSManagedObjectContext *)moc;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPResourceCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "XMPPResource.h"
4 |
5 | @class XMPPStream;
6 | @class XMPPPresence;
7 | @class XMPPUserCoreDataStorageObject;
8 |
9 |
10 | @interface XMPPResourceCoreDataStorageObject : NSManagedObject
11 |
12 | @property (nonatomic, strong) XMPPJID *jid;
13 | @property (nonatomic, strong) XMPPPresence *presence;
14 |
15 | @property (nonatomic, assign) int priority;
16 | @property (nonatomic, assign) int intShow;
17 |
18 | @property (nonatomic, strong) NSString * jidStr;
19 | @property (nonatomic, strong) NSString * presenceStr;
20 |
21 | @property (nonatomic, strong) NSString * streamBareJidStr;
22 |
23 | @property (nonatomic, strong) NSString * type;
24 | @property (nonatomic, strong) NSString * show;
25 | @property (nonatomic, strong) NSString * status;
26 |
27 | @property (nonatomic, strong) NSDate * presenceDate;
28 |
29 | @property (nonatomic, strong) NSNumber * priorityNum;
30 | @property (nonatomic, strong) NSNumber * showNum;
31 |
32 | @property (nonatomic, strong) XMPPUserCoreDataStorageObject * user;
33 |
34 | + (id)insertInManagedObjectContext:(NSManagedObjectContext *)moc
35 | withPresence:(XMPPPresence *)presence
36 | streamBareJidStr:(NSString *)streamBareJidStr;
37 |
38 | - (void)updateWithPresence:(XMPPPresence *)presence;
39 |
40 | - (NSComparisonResult)compare:(id )another;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPRoster.xcdatamodel/elements:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPRoster.xcdatamodel/elements
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPRoster.xcdatamodel/layout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPRoster.xcdatamodel/layout
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPRosterCoreDataStorage.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import "XMPPRoster.h"
5 | #import "XMPPCoreDataStorage.h"
6 | #import "XMPPUserCoreDataStorageObject.h"
7 | #import "XMPPGroupCoreDataStorageObject.h"
8 | #import "XMPPResourceCoreDataStorageObject.h"
9 |
10 | /**
11 | * This class is an example implementation of XMPPRosterStorage using core data.
12 | * You are free to substitute your own roster storage class.
13 | **/
14 |
15 | @interface XMPPRosterCoreDataStorage : XMPPCoreDataStorage
16 | {
17 | // Inherits protected variables from XMPPCoreDataStorage
18 |
19 | #if __has_feature(objc_arc_weak)
20 | __weak XMPPRoster *parent;
21 | #else
22 | __unsafe_unretained XMPPRoster *parent;
23 | #endif
24 | dispatch_queue_t parentQueue;
25 | void *parentQueueTag;
26 |
27 | NSMutableSet *rosterPopulationSet;
28 | }
29 |
30 | /**
31 | * Convenience method to get an instance with the default database name.
32 | *
33 | * IMPORTANT:
34 | * You are NOT required to use the sharedInstance.
35 | *
36 | * If your application uses multiple xmppStreams, and you use a sharedInstance of this class,
37 | * then all of your streams share the same database store. You might get better performance if you create
38 | * multiple instances of this class instead (using different database filenames), as this way you can have
39 | * concurrent writes to multiple databases.
40 | **/
41 | + (instancetype)sharedInstance;
42 |
43 |
44 | /* Inherited from XMPPCoreDataStorage
45 | * Please see the XMPPCoreDataStorage header file for extensive documentation.
46 |
47 | - (id)initWithDatabaseFilename:(NSString *)databaseFileName storeOptions:(NSDictionary *)storeOptions;
48 | - (id)initWithInMemoryStore;
49 |
50 | @property (readonly) NSString *databaseFileName;
51 |
52 | @property (readwrite) NSUInteger saveThreshold;
53 |
54 | @property (readonly) NSManagedObjectModel *managedObjectModel;
55 | @property (readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
56 |
57 | @property (readonly) NSManagedObjectContext *mainThreadManagedObjectContext;
58 |
59 | */
60 |
61 | - (XMPPUserCoreDataStorageObject *)myUserForXMPPStream:(XMPPStream *)stream
62 | managedObjectContext:(NSManagedObjectContext *)moc;
63 |
64 | - (XMPPResourceCoreDataStorageObject *)myResourceForXMPPStream:(XMPPStream *)stream
65 | managedObjectContext:(NSManagedObjectContext *)moc;
66 |
67 | - (XMPPUserCoreDataStorageObject *)userForJID:(XMPPJID *)jid
68 | xmppStream:(XMPPStream *)stream
69 | managedObjectContext:(NSManagedObjectContext *)moc;
70 |
71 | - (XMPPResourceCoreDataStorageObject *)resourceForJID:(XMPPJID *)jid
72 | xmppStream:(XMPPStream *)stream
73 | managedObjectContext:(NSManagedObjectContext *)moc;
74 |
75 | @end
76 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/CoreDataStorage/XMPPUserCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #if !TARGET_OS_IPHONE
5 | #import
6 | #endif
7 |
8 | #import "XMPPUser.h"
9 | #import "XMPP.h"
10 |
11 | @class XMPPGroupCoreDataStorageObject;
12 | @class XMPPResourceCoreDataStorageObject;
13 |
14 |
15 | @interface XMPPUserCoreDataStorageObject : NSManagedObject
16 | {
17 | NSInteger section;
18 | }
19 |
20 | @property (nonatomic, strong) XMPPJID *jid;
21 | @property (nonatomic, strong) NSString * jidStr;
22 | @property (nonatomic, strong) NSString * streamBareJidStr;
23 |
24 | @property (nonatomic, strong) NSString * nickname;
25 | @property (nonatomic, strong) NSString * displayName;
26 | @property (nonatomic, strong) NSString * subscription;
27 | @property (nonatomic, strong) NSString * ask;
28 | @property (nonatomic, strong) NSNumber * unreadMessages;
29 |
30 | #if TARGET_OS_IPHONE
31 | @property (nonatomic, strong) UIImage *photo;
32 | #else
33 | @property (nonatomic, strong) NSImage *photo;
34 | #endif
35 |
36 | @property (nonatomic, assign) NSInteger section;
37 | @property (nonatomic, strong) NSString * sectionName;
38 | @property (nonatomic, strong) NSNumber * sectionNum;
39 |
40 | @property (nonatomic, strong) NSSet * groups;
41 | @property (nonatomic, strong) XMPPResourceCoreDataStorageObject * primaryResource;
42 | @property (nonatomic, strong) NSSet * resources;
43 |
44 | + (id)insertInManagedObjectContext:(NSManagedObjectContext *)moc
45 | withJID:(XMPPJID *)jid
46 | streamBareJidStr:(NSString *)streamBareJidStr;
47 |
48 | + (id)insertInManagedObjectContext:(NSManagedObjectContext *)moc
49 | withItem:(NSXMLElement *)item
50 | streamBareJidStr:(NSString *)streamBareJidStr;
51 |
52 | - (void)updateWithItem:(NSXMLElement *)item;
53 | - (void)updateWithPresence:(XMPPPresence *)presence streamBareJidStr:(NSString *)streamBareJidStr;
54 | - (void)recalculatePrimaryResource;
55 |
56 | - (NSComparisonResult)compareByName:(XMPPUserCoreDataStorageObject *)another;
57 | - (NSComparisonResult)compareByName:(XMPPUserCoreDataStorageObject *)another options:(NSStringCompareOptions)mask;
58 |
59 | - (NSComparisonResult)compareByAvailabilityName:(XMPPUserCoreDataStorageObject *)another;
60 | - (NSComparisonResult)compareByAvailabilityName:(XMPPUserCoreDataStorageObject *)another
61 | options:(NSStringCompareOptions)mask;
62 |
63 | @end
64 |
65 | @interface XMPPUserCoreDataStorageObject (CoreDataGeneratedAccessors)
66 |
67 | - (void)addResourcesObject:(XMPPResourceCoreDataStorageObject *)value;
68 | - (void)removeResourcesObject:(XMPPResourceCoreDataStorageObject *)value;
69 | - (void)addResources:(NSSet *)value;
70 | - (void)removeResources:(NSSet *)value;
71 |
72 | - (void)addGroupsObject:(XMPPGroupCoreDataStorageObject *)value;
73 | - (void)removeGroupsObject:(XMPPGroupCoreDataStorageObject *)value;
74 | - (void)addGroups:(NSSet *)value;
75 | - (void)removeGroups:(NSSet *)value;
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/MemoryStorage/XMPPResourceMemoryStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPResource.h"
3 |
4 | @class XMPPJID;
5 | @class XMPPIQ;
6 | @class XMPPPresence;
7 |
8 |
9 | @interface XMPPResourceMemoryStorageObject : NSObject
10 | {
11 | XMPPJID *jid;
12 | XMPPPresence *presence;
13 |
14 | NSDate *presenceDate;
15 | }
16 |
17 | /* From the XMPPResource protocol
18 |
19 | - (XMPPJID *)jid;
20 | - (XMPPPresence *)presence;
21 |
22 | - (NSDate *)presenceDate;
23 |
24 | - (NSComparisonResult)compare:(id )another;
25 |
26 | */
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/MemoryStorage/XMPPRosterMemoryStoragePrivate.h:
--------------------------------------------------------------------------------
1 | #import "XMPPUserMemoryStorageObject.h"
2 | #import "XMPPResourceMemoryStorageObject.h"
3 |
4 | /**
5 | * The following methods are designed to be invoked ONLY from
6 | * within the XMPPRosterMemoryStorage implementation.
7 | *
8 | * Warning: XMPPUserMemoryStorage and XMPPResourceMemoryStorage are not explicitly thread-safe.
9 | * Only copies that are no longer being actively
10 | * altered by the XMPPRosterMemoryStorage class should be considered read-only and therefore thread-safe.
11 | **/
12 |
13 | #define XMPP_USER_NO_CHANGE 0
14 | #define XMPP_USER_ADDED_RESOURCE 1
15 | #define XMPP_USER_UPDATED_RESOURCE 2
16 | #define XMPP_USER_REMOVED_RESOURCE 3
17 |
18 |
19 | @interface XMPPUserMemoryStorageObject ()
20 |
21 | - (void)commonInit;
22 |
23 | - (id)initWithJID:(XMPPJID *)aJid;
24 | - (id)initWithItem:(NSXMLElement *)item;
25 |
26 | - (void)updateWithItem:(NSXMLElement *)item;
27 |
28 | - (int)updateWithPresence:(XMPPPresence *)presence
29 | resourceClass:(Class)resourceClass
30 | andGetResource:(XMPPResourceMemoryStorageObject **)resourcePtr;
31 |
32 | - (void)clearAllResources;
33 |
34 | #if TARGET_OS_IPHONE
35 | @property (nonatomic, strong, readwrite) UIImage *photo;
36 | #else
37 | @property (nonatomic, strong, readwrite) NSImage *photo;
38 | #endif
39 |
40 | @end
41 |
42 | @interface XMPPResourceMemoryStorageObject ()
43 |
44 | - (id)initWithPresence:(XMPPPresence *)aPresence;
45 |
46 | - (void)updateWithPresence:(XMPPPresence *)presence;
47 |
48 | - (XMPPPresence *)presence;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/MemoryStorage/XMPPUserMemoryStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPUser.h"
3 | #import "XMPP.h"
4 |
5 | #if !TARGET_OS_IPHONE
6 | #import
7 | #endif
8 |
9 | @class XMPPResourceMemoryStorageObject;
10 |
11 |
12 | @interface XMPPUserMemoryStorageObject : NSObject
13 | {
14 | XMPPJID *jid;
15 | NSMutableDictionary *itemAttributes;
16 |
17 | NSMutableDictionary *resources;
18 | XMPPResourceMemoryStorageObject *primaryResource;
19 |
20 | #if TARGET_OS_IPHONE
21 | UIImage *photo;
22 | #else
23 | NSImage *photo;
24 | #endif
25 | }
26 |
27 | /* From the XMPPUser protocol
28 |
29 | - (XMPPJID *)jid;
30 | - (NSString *)nickname;
31 |
32 | - (BOOL)isOnline;
33 | - (BOOL)isPendingApproval;
34 |
35 | - (id )primaryResource;
36 | - (id )resourceForJID:(XMPPJID *)jid;
37 |
38 | - (NSArray *)allResources;
39 |
40 | */
41 |
42 | /**
43 | * Simple convenience method.
44 | * If a nickname exists for the user, the nickname is returned.
45 | * Otherwise the jid is returned (as a string).
46 | **/
47 | - (NSString *)displayName;
48 |
49 | /**
50 | * If XMPPvCardAvatarModule is included in the framework, the XMPPRoster will automatically integrate with it,
51 | * and we'll save the the user photos after they've been downloaded.
52 | **/
53 | #if TARGET_OS_IPHONE
54 | @property (nonatomic, strong, readonly) UIImage *photo;
55 | #else
56 | @property (nonatomic, strong, readonly) NSImage *photo;
57 | #endif
58 |
59 | /**
60 | * Simple comparison methods.
61 | **/
62 |
63 | - (NSComparisonResult)compareByName:(XMPPUserMemoryStorageObject *)another;
64 | - (NSComparisonResult)compareByName:(XMPPUserMemoryStorageObject *)another options:(NSStringCompareOptions)mask;
65 |
66 | - (NSComparisonResult)compareByAvailabilityName:(XMPPUserMemoryStorageObject *)another;
67 | - (NSComparisonResult)compareByAvailabilityName:(XMPPUserMemoryStorageObject *)another
68 | options:(NSStringCompareOptions)mask;
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/XMPPResource.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPP.h"
3 |
4 |
5 | @protocol XMPPResource
6 | @required
7 |
8 | - (XMPPJID *)jid;
9 | - (XMPPPresence *)presence;
10 |
11 | - (NSDate *)presenceDate;
12 |
13 | - (NSComparisonResult)compare:(id )another;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/XMPPRosterPrivate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPRoster.h"
3 |
4 | @interface XMPPRoster (PrivateInternalAPI)
5 |
6 | /**
7 | * XMPPRosterStorage classes may optionally use the same delegate(s) as their parent XMPPRoster.
8 | * This method allows such storage classes to access the delegate(s).
9 | *
10 | * Note: If the storage class operates on a different queue than its parent,
11 | * it MUST dispatch all calls to the multicastDelegate onto its parent's queue.
12 | * The parent's dispatch queue is passed in the configureWithParent:queue: method.
13 | **/
14 | - (GCDMulticastDelegate *)multicastDelegate;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/Roster/XMPPUser.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPP.h"
3 |
4 | @protocol XMPPResource;
5 |
6 |
7 | @protocol XMPPUser
8 | @required
9 |
10 | - (XMPPJID *)jid;
11 | - (NSString *)nickname;
12 |
13 | - (BOOL)isOnline;
14 | - (BOOL)isPendingApproval;
15 |
16 | - (id )primaryResource;
17 | - (id )resourceForJID:(XMPPJID *)jid;
18 |
19 | - (NSArray *)allResources;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/SystemInputActivityMonitor/XMPPSystemInputActivityMonitor.h:
--------------------------------------------------------------------------------
1 | #import "XMPPModule.h"
2 |
3 | extern const NSTimeInterval XMPPSystemInputActivityMonitorInactivityTimeIntervalNone;
4 |
5 | #define _XMPP_SYSTEM_INPUT_ACTIVITY_MONITOR_H
6 |
7 | /**
8 | * XMPPSystemInputActivityMonitor is used to keep track of system input activity.
9 | * This module could be used to add features such as "auto away" when the user is inactive for 5 mins.
10 | **/
11 |
12 | @interface XMPPSystemInputActivityMonitor : XMPPModule
13 | {
14 | dispatch_source_t timer;
15 |
16 | BOOL active;
17 | NSDate *lastActivityDate;
18 | NSTimeInterval inactivityTimeInterval;
19 | }
20 |
21 | /**
22 | * Returns wether the system is active based on the lastActivityDate and inactivityTimeInterval.
23 | **/
24 | @property (assign, getter = isActive, readonly) BOOL active;
25 |
26 | /**
27 | * The last time any input activity was detected.
28 | **/
29 | @property (assign, readonly) NSDate *lastActivityDate;
30 |
31 | /**
32 | * The minimum time interval after the last input activity, that assumes the system is idle.
33 | *
34 | * To disable activity checking set this value to XMPPSystemInputActivityMonitorInactivityTimeIntervalNone
35 | * If set to XMPPSystemInputActivityMonitorInactivityTimeIntervalNone none of delegate methods will be called.
36 | * Setting this value doesn't cause the delegate methods to be called immediately.
37 | *
38 | * Default 300 Seconds
39 | **/
40 | @property (assign) NSTimeInterval inactivityTimeInterval;
41 |
42 | @end
43 |
44 | @protocol XMPPSystemInputActivityMonitorDelegate
45 |
46 | /**
47 | * The system did become active after being inactive.
48 | **/
49 | - (void)xmppSystemInputActivityMonitorDidBecomeActive:(XMPPSystemInputActivityMonitor *)xmppSystemInputActivityMonitor;
50 |
51 | /**
52 | * The system did become inactive after being active.
53 | **/
54 | - (void)xmppSystemInputActivityMonitorDidBecomeInactive:(XMPPSystemInputActivityMonitor *)xmppSystemInputActivityMonitor;
55 |
56 | @end
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0009/XMPPIQ+JabberRPC.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPIQ+JabberRPC.h
3 | // XEP-0009
4 | //
5 | // Created by Eric Chamberlain on 5/16/10.
6 | //
7 |
8 | #import
9 |
10 | #import "XMPPIQ.h"
11 |
12 |
13 | @interface XMPPIQ(JabberRPC)
14 |
15 | /**
16 | * Creates and returns a new autoreleased XMPPIQ.
17 | * This is the only method you normally need to call.
18 | **/
19 | + (XMPPIQ *)rpcTo:(XMPPJID *)jid methodName:(NSString *)method parameters:(NSArray *)parameters;
20 |
21 | #pragma mark -
22 | #pragma mark Element helper methods
23 |
24 | // returns a Jabber-RPC query elelement
25 | //
26 | +(NSXMLElement *)elementRpcQuery;
27 |
28 | // returns a Jabber-RPC methodCall element
29 | //
30 | +(NSXMLElement *)elementMethodCall;
31 |
32 | // returns a Jabber-RPC methodName element
33 | // method
34 | +(NSXMLElement *)elementMethodName:(NSString *)method;
35 |
36 | // returns a Jabber-RPC params element
37 | //
38 | +(NSXMLElement *)elementParams;
39 |
40 | #pragma mark -
41 | #pragma mark Disco elements
42 |
43 | // returns the Disco query identity element
44 | //
45 | +(NSXMLElement *)elementRpcIdentity;
46 |
47 | // returns the Disco query feature element
48 | //
49 | +(NSXMLElement *)elementRpcFeature;
50 |
51 | #pragma mark -
52 | #pragma mark Conversion methods
53 |
54 | // encode any object into JabberRPC formatted element
55 | // this method calls the others
56 | +(NSXMLElement *)paramElementFromObject:(id)object;
57 |
58 | +(NSXMLElement *)valueElementFromObject:(id)object;
59 |
60 | +(NSXMLElement *)valueElementFromArray:(NSArray *)array;
61 | +(NSXMLElement *)valueElementFromDictionary:(NSDictionary *)dictionary;
62 |
63 | +(NSXMLElement *)valueElementFromBoolean:(CFBooleanRef)boolean;
64 | +(NSXMLElement *)valueElementFromNumber:(NSNumber *)number;
65 | +(NSXMLElement *)valueElementFromString:(NSString *)string;
66 | +(NSXMLElement *)valueElementFromDate:(NSDate *)date;
67 | +(NSXMLElement *)valueElementFromData:(NSData *)data;
68 |
69 | +(NSXMLElement *)valueElementFromElementWithName:(NSString *)elementName value:(NSString *)value;
70 |
71 |
72 | #pragma mark Wrapper methods
73 |
74 | +(NSXMLElement *)wrapElement:(NSString *)elementName aroundElement:(NSXMLElement *)element;
75 | +(NSXMLElement *)wrapValueElementAroundElement:(NSXMLElement *)element;
76 |
77 | @end
78 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0009/XMPPIQ+JabberRPCResonse.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPIQ+JabberRPCResonse.h
3 | // XEP-0009
4 | //
5 | // Created by Eric Chamberlain on 5/25/10.
6 | //
7 |
8 | #import "XMPPIQ.h"
9 |
10 | typedef enum {
11 | JabberRPCElementTypeArray,
12 | JabberRPCElementTypeDictionary,
13 | JabberRPCElementTypeMember,
14 | JabberRPCElementTypeName,
15 | JabberRPCElementTypeInteger,
16 | JabberRPCElementTypeDouble,
17 | JabberRPCElementTypeBoolean,
18 | JabberRPCElementTypeString,
19 | JabberRPCElementTypeDate,
20 | JabberRPCElementTypeData
21 | } JabberRPCElementType;
22 |
23 |
24 | @interface XMPPIQ(JabberRPCResonse)
25 |
26 | -(NSXMLElement *)methodResponseElement;
27 |
28 | // is this a Jabber RPC method response
29 | -(BOOL)isMethodResponse;
30 |
31 | -(BOOL)isFault;
32 |
33 | -(BOOL)isJabberRPC;
34 |
35 | -(id)methodResponse:(NSError **)error;
36 |
37 | -(id)objectFromElement:(NSXMLElement *)param;
38 |
39 |
40 | #pragma mark -
41 |
42 | -(NSArray *)parseArray:(NSXMLElement *)arrayElement;
43 |
44 | -(NSDictionary *)parseStruct:(NSXMLElement *)structElement;
45 |
46 | -(NSDictionary *)parseMember:(NSXMLElement *)memberElement;
47 |
48 | #pragma mark -
49 |
50 | - (NSDate *)parseDateString: (NSString *)dateString withFormat: (NSString *)format;
51 |
52 | #pragma mark -
53 |
54 | - (NSNumber *)parseInteger: (NSString *)value;
55 |
56 | - (NSNumber *)parseDouble: (NSString *)value;
57 |
58 | - (NSNumber *)parseBoolean: (NSString *)value;
59 |
60 | - (NSString *)parseString: (NSString *)value;
61 |
62 | - (NSDate *)parseDate: (NSString *)value;
63 |
64 | - (NSData *)parseData: (NSString *)value;
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0009/XMPPJabberRPCModule.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPJabberRPCModule.h
3 | // XEP-0009
4 | //
5 | // Originally created by Eric Chamberlain on 5/16/10.
6 | //
7 |
8 | #import
9 | #import "XMPPModule.h"
10 |
11 | #define _XMPP_JABBER_RPC_MODULE_H
12 |
13 | extern NSString *const XMPPJabberRPCErrorDomain;
14 |
15 | @class XMPPJID;
16 | @class XMPPStream;
17 | @class XMPPIQ;
18 | @protocol XMPPJabberRPCModuleDelegate;
19 |
20 |
21 | @interface XMPPJabberRPCModule : XMPPModule
22 | {
23 | NSMutableDictionary *rpcIDs;
24 | NSTimeInterval defaultTimeout;
25 | }
26 |
27 | @property (nonatomic, assign) NSTimeInterval defaultTimeout;
28 |
29 | - (NSString *)sendRpcIQ:(XMPPIQ *)iq;
30 | - (NSString *)sendRpcIQ:(XMPPIQ *)iq withTimeout:(NSTimeInterval)timeout;
31 |
32 | // caller knows best when a request has timed out
33 | // it should remove the rpcID, on timeout.
34 | - (void)timeoutRemoveRpcID:(NSString *)rpcID;
35 |
36 | @end
37 |
38 |
39 | @protocol XMPPJabberRPCModuleDelegate
40 | @optional
41 |
42 | // sent when transport error is received
43 | -(void)jabberRPC:(XMPPJabberRPCModule *)sender elementID:(NSString *)elementID didReceiveError:(NSError *)error;
44 |
45 | // sent when a methodResponse comes back
46 | -(void)jabberRPC:(XMPPJabberRPCModule *)sender elementID:(NSString *)elementID didReceiveMethodResponse:(id)response;
47 |
48 | // sent when a Jabber-RPC server request is received
49 | -(void)jabberRPC:(XMPPJabberRPCModule *)sender didReceiveSetIQ:(XMPPIQ *)iq;
50 | @end
51 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0012/XMPPIQ+LastActivity.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPIQ+LastActivity.m
3 | // XEP-0012
4 | //
5 | // Created by Daniel Rodríguez Troitiño on 1/26/2013.
6 | //
7 |
8 | #import "XMPPIQ+LastActivity.h"
9 |
10 | #import "XMPP.h"
11 |
12 | #if ! __has_feature(objc_arc)
13 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
14 | #endif
15 |
16 | NSString *const XMPPLastActivityNamespace = @"jabber:iq:last";
17 |
18 | @implementation XMPPIQ (LastActivity)
19 |
20 | + (XMPPIQ *)lastActivityQueryTo:(XMPPJID *)jid
21 | {
22 | NSXMLElement *query = [[NSXMLElement alloc] initWithName:@"query" xmlns:XMPPLastActivityNamespace];
23 | return [[self alloc] initWithType:@"get" to:jid elementID:[XMPPStream generateUUID] child:query];
24 | }
25 |
26 | + (XMPPIQ *)lastActivityResponseToIQ:(XMPPIQ *)request withSeconds:(NSUInteger)seconds
27 | {
28 | return [self lastActivityResponseToIQ:request withSeconds:seconds status:nil];
29 | }
30 |
31 | + (XMPPIQ *)lastActivityResponseToIQ:(XMPPIQ *)request withSeconds:(NSUInteger)seconds status:(NSString *)status
32 | {
33 | NSXMLElement *query = [[NSXMLElement alloc] initWithName:@"query" xmlns:XMPPLastActivityNamespace];
34 | [query addAttributeWithName:@"seconds" stringValue:[NSString stringWithFormat:@"%lu", (unsigned long)seconds]];
35 | if (status && [status length] > 0)
36 | {
37 | [query setStringValue:status];
38 | }
39 |
40 | return [[self alloc] initWithType:@"result" to:request.from elementID:request.elementID child:query];
41 | }
42 |
43 | + (XMPPIQ *)lastActivityResponseForbiddenToIQ:(XMPPIQ *)request
44 | {
45 | NSXMLElement *reason = [[NSXMLElement alloc] initWithName:@"forbidden" xmlns:@"urn:ietf:params:xml:ns:xmpp-stanzas"];
46 | NSXMLElement *error = [[NSXMLElement alloc] initWithName:@"error"];
47 | [error addAttributeWithName:@"type" stringValue:@"auth"];
48 | [error addChild:reason];
49 |
50 | return [[self alloc] initWithType:@"error" to:request.from elementID:request.elementID child:error];
51 | }
52 |
53 | - (BOOL)isLastActivityQuery
54 | {
55 | return nil != [self lastActivityQueryElement];
56 | }
57 |
58 | - (NSUInteger)lastActivitySeconds
59 | {
60 | NSUInteger seconds = NSNotFound;
61 | NSXMLElement *query = [self lastActivityQueryElement];
62 | if (query)
63 | {
64 | NSXMLNode *attribute = [query attributeForName:@"seconds"];
65 | if (attribute)
66 | {
67 | // Some Servers Return -1 to indicate no activity, so we need to ignore these
68 | if([query attributeIntegerValueForName:@"seconds"] >= 0)
69 | {
70 | seconds = [query attributeUnsignedIntegerValueForName:@"seconds"];
71 | }
72 | }
73 | }
74 |
75 | return seconds;
76 | }
77 |
78 | - (NSString *)lastActivityUnavailableStatus
79 | {
80 | NSXMLElement *query = [self lastActivityQueryElement];
81 | if (query)
82 | {
83 | return [query stringValue];
84 | }
85 | else
86 | {
87 | return nil;
88 | }
89 | }
90 |
91 | - (NSXMLElement *)lastActivityQueryElement
92 | {
93 | return [self elementForName:@"query" xmlns:XMPPLastActivityNamespace];
94 | }
95 |
96 | @end
97 |
98 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/CoreDataStorage/XMPPRoom.xcdatamodeld/.xccurrentversion:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | _XCCurrentVersionName
6 | XMPPRoom.xcdatamodel
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/CoreDataStorage/XMPPRoomMessageCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import "XMPP.h"
5 | #import "XMPPRoom.h"
6 |
7 |
8 | @interface XMPPRoomMessageCoreDataStorageObject : NSManagedObject
9 |
10 | /**
11 | * The properties below are documented in the XMPPRoomMessage protocol.
12 | **/
13 |
14 | @property (nonatomic, retain) XMPPMessage * message; // Transient (proper type, not on disk)
15 | @property (nonatomic, retain) NSString * messageStr; // Shadow (binary data, written to disk)
16 |
17 | @property (nonatomic, strong) XMPPJID * roomJID; // Transient (proper type, not on disk)
18 | @property (nonatomic, strong) NSString * roomJIDStr; // Shadow (binary data, written to disk)
19 |
20 | @property (nonatomic, retain) XMPPJID * jid; // Transient (proper type, not on disk)
21 | @property (nonatomic, retain) NSString * jidStr; // Shadow (binary data, written to disk)
22 |
23 | @property (nonatomic, retain) NSString * nickname;
24 | @property (nonatomic, retain) NSString * body;
25 |
26 | @property (nonatomic, retain) NSDate * localTimestamp;
27 | @property (nonatomic, strong) NSDate * remoteTimestamp;
28 |
29 | @property (nonatomic, assign) BOOL isFromMe;
30 | @property (nonatomic, strong) NSNumber * fromMe;
31 |
32 | /**
33 | * The 'type' property can be used to inject event messages.
34 | * For example: "JohnDoe entered the room".
35 | *
36 | * You can define your own types to suit your needs.
37 | * All normal messages will have a type of zero.
38 | **/
39 | @property (nonatomic, strong) NSNumber * type;
40 |
41 | /**
42 | * If a single instance of XMPPRoomCoreDataStorage is shared between multiple xmppStream's,
43 | * this may be needed to distinguish between the streams.
44 | **/
45 | @property (nonatomic, strong) NSString *streamBareJidStr;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/CoreDataStorage/XMPPRoomOccupantCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import "XMPP.h"
5 | #import "XMPPRoom.h"
6 |
7 |
8 | @interface XMPPRoomOccupantCoreDataStorageObject : NSManagedObject
9 |
10 | /**
11 | * The properties below are documented in the XMPPRoomOccupant protocol.
12 | **/
13 |
14 | @property (nonatomic, strong) XMPPPresence * presence; // Transient (proper type, not on disk)
15 | @property (nonatomic, strong) NSString * presenceStr; // Shadow (binary data, written to disk)
16 |
17 | @property (nonatomic, strong) XMPPJID * roomJID; // Transient (proper type, not on disk)
18 | @property (nonatomic, strong) NSString * roomJIDStr; // Shadow (binary data, written to disk)
19 |
20 | @property (nonatomic, strong) XMPPJID * jid; // Transient (proper type, not on disk)
21 | @property (nonatomic, strong) NSString * jidStr; // Shadow (binary data, written to disk)
22 |
23 | @property (nonatomic, strong) NSString * nickname;
24 |
25 | @property (nonatomic, strong) NSString * role;
26 | @property (nonatomic, strong) NSString * affiliation;
27 |
28 | @property (nonatomic, strong) XMPPJID * realJID; // Transient (proper type, not on disk)
29 | @property (nonatomic, strong) NSString * realJIDStr; // Shadow (binary data, written to disk)
30 |
31 | @property (nonatomic, strong) NSDate * createdAt;
32 |
33 | /**
34 | * If a single instance of XMPPRoomCoreDataStorage is shared between multiple xmppStream's,
35 | * this may be needed to distinguish between the streams.
36 | **/
37 | @property (nonatomic, strong) NSString * streamBareJidStr;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/HybridStorage/XMPPRoomHybrid.xcdatamodeld/.xccurrentversion:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | _XCCurrentVersionName
6 | XMPPRoomHybrid.xcdatamodel
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/HybridStorage/XMPPRoomHybrid.xcdatamodeld/XMPPRoomHybrid.xcdatamodel/contents:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/HybridStorage/XMPPRoomMessageHybridCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import "XMPP.h"
5 | #import "XMPPRoom.h"
6 |
7 |
8 | @interface XMPPRoomMessageHybridCoreDataStorageObject : NSManagedObject
9 |
10 | /**
11 | * The properties below are documented in the XMPPRoomMessage protocol.
12 | **/
13 |
14 | @property (nonatomic, retain) XMPPMessage * message; // Transient (proper type, not on disk)
15 | @property (nonatomic, retain) NSString * messageStr; // Shadow (binary data, written to disk)
16 |
17 | @property (nonatomic, strong) XMPPJID * roomJID; // Transient (proper type, not on disk)
18 | @property (nonatomic, strong) NSString * roomJIDStr; // Shadow (binary data, written to disk)
19 |
20 | @property (nonatomic, retain) XMPPJID * jid; // Transient (proper type, not on disk)
21 | @property (nonatomic, retain) NSString * jidStr; // Shadow (binary data, written to disk)
22 |
23 | @property (nonatomic, retain) NSString * nickname;
24 | @property (nonatomic, retain) NSString * body;
25 |
26 | @property (nonatomic, retain) NSDate * localTimestamp;
27 | @property (nonatomic, strong) NSDate * remoteTimestamp;
28 |
29 | @property (nonatomic, assign) BOOL isFromMe;
30 | @property (nonatomic, strong) NSNumber * fromMe;
31 |
32 | /**
33 | * The 'type' property can be used to inject event messages.
34 | * For example: "JohnDoe entered the room".
35 | *
36 | * You can define your own types to suit your needs.
37 | * All normal messages will have a type of zero.
38 | **/
39 | @property (nonatomic, strong) NSNumber * type;
40 |
41 | /**
42 | * If a single instance of XMPPRoomHybridStorage is shared between multiple xmppStream's,
43 | * this may be needed to distinguish between the streams.
44 | **/
45 | @property (nonatomic, strong) NSString *streamBareJidStr;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/HybridStorage/XMPPRoomOccupantHybridMemoryStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPRoom.h"
3 | #import "XMPPRoomOccupant.h"
4 |
5 |
6 | @interface XMPPRoomOccupantHybridMemoryStorageObject : NSObject
7 |
8 | - (id)initWithPresence:(XMPPPresence *)presence streamFullJid:(XMPPJID *)streamFullJid;
9 | - (void)updateWithPresence:(XMPPPresence *)presence;
10 |
11 | /**
12 | * The properties below are documented in the XMPPRoomOccupant protocol.
13 | **/
14 |
15 | @property (readonly) XMPPPresence *presence;
16 |
17 | @property (readonly) XMPPJID * jid;
18 | @property (readonly) XMPPJID * roomJID;
19 | @property (readonly) NSString * nickname;
20 |
21 | @property (readonly) NSString * role;
22 | @property (readonly) NSString * affiliation;
23 | @property (readonly) XMPPJID * realJID;
24 |
25 | @property (readonly) NSDate * createdAt;
26 |
27 | /**
28 | * Since XMPPRoomHybridStorage supports multiple xmppStreams,
29 | * this property may be used to differentiate between occupant objects.
30 | **/
31 | @property (readonly) XMPPJID * streamFullJid;
32 |
33 | /**
34 | * Sample comparison methods.
35 | **/
36 |
37 | - (NSComparisonResult)compareByNickname:(XMPPRoomOccupantHybridMemoryStorageObject *)another;
38 |
39 | - (NSComparisonResult)compareByCreatedAt:(XMPPRoomOccupantHybridMemoryStorageObject *)another;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/MemoryStorage/XMPPRoomMessageMemoryStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPRoomMessage.h"
3 |
4 |
5 | @interface XMPPRoomMessageMemoryStorageObject : NSObject
6 |
7 | - (id)initWithIncomingMessage:(XMPPMessage *)message;
8 | - (id)initWithOutgoingMessage:(XMPPMessage *)message jid:(XMPPJID *)myRoomJID;
9 |
10 | /**
11 | * The properties below are documented in the XMPPRoomMessage protocol.
12 | **/
13 |
14 | @property (nonatomic, readonly) XMPPMessage *message;
15 |
16 | @property (nonatomic, readonly) XMPPJID * roomJID;
17 |
18 | @property (nonatomic, readonly) XMPPJID * jid;
19 | @property (nonatomic, readonly) NSString * nickname;
20 |
21 | @property (nonatomic, readonly) NSDate * localTimestamp;
22 | @property (nonatomic, readonly) NSDate * remoteTimestamp;
23 |
24 | @property (nonatomic, readonly) BOOL isFromMe;
25 |
26 | /**
27 | * Compares two messages based on the localTimestamp.
28 | *
29 | * This method provides the ordering used by XMPPRoomMemoryStorage.
30 | * Subclasses may override this method to provide an alternative sorting mechanism.
31 | **/
32 | - (NSComparisonResult)compare:(XMPPRoomMessageMemoryStorageObject *)another;
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/MemoryStorage/XMPPRoomOccupantMemoryStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPRoom.h"
3 | #import "XMPPRoomOccupant.h"
4 |
5 |
6 | @interface XMPPRoomOccupantMemoryStorageObject : NSObject
7 |
8 | - (id)initWithPresence:(XMPPPresence *)presence;
9 | - (void)updateWithPresence:(XMPPPresence *)presence;
10 |
11 | /**
12 | * The properties below are documented in the XMPPRoomOccupant protocol.
13 | **/
14 |
15 | @property (readonly) XMPPPresence *presence;
16 |
17 | @property (readonly) XMPPJID * jid;
18 | @property (readonly) XMPPJID * roomJID;
19 | @property (readonly) NSString * nickname;
20 |
21 | @property (readonly) NSString * role;
22 | @property (readonly) NSString * affiliation;
23 | @property (readonly) XMPPJID * realJID;
24 |
25 | /**
26 | * Compares two occupants based on the nickname.
27 | *
28 | * This method provides the ordering used by XMPPRoomMemoryStorage.
29 | * Subclasses may override this method to provide an alternative sorting mechanism.
30 | **/
31 | - (NSComparisonResult)compare:(XMPPRoomOccupantMemoryStorageObject *)another;
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/XMPPMUC.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPP.h"
3 | #import "XMPPRoom.h"
4 |
5 | #define _XMPP_MUC_H
6 |
7 | /**
8 | * The XMPPMUC module, combined with XMPPRoom and associated storage classes,
9 | * provides an implementation of XEP-0045 Multi-User Chat.
10 | *
11 | * The bulk of the code resides in XMPPRoom, which handles the xmpp technical details
12 | * such as surrounding joining/leaving a room, sending/receiving messages, etc.
13 | *
14 | * The XMPPMUC class provides general (but important) tasks relating to MUC:
15 | * - It integrates with XMPPCapabilities (if available) to properly advertise support for MUC.
16 | * - It monitors active XMPPRoom instances on the xmppStream,
17 | * and provides an efficient query to see if a presence or message element is targeted at a room.
18 | * - It listens for MUC room invitations sent from other users.
19 | **/
20 |
21 | @interface XMPPMUC : XMPPModule
22 | {
23 | /* Inherited from XMPPModule:
24 |
25 | XMPPStream *xmppStream;
26 |
27 | dispatch_queue_t moduleQueue;
28 | */
29 |
30 | NSMutableSet *rooms;
31 | }
32 |
33 | /* Inherited from XMPPModule:
34 |
35 | - (id)init;
36 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue;
37 |
38 | - (BOOL)activate:(XMPPStream *)xmppStream;
39 | - (void)deactivate;
40 |
41 | @property (readonly) XMPPStream *xmppStream;
42 |
43 | - (NSString *)moduleName;
44 |
45 | */
46 |
47 | - (BOOL)isMUCRoomPresence:(XMPPPresence *)presence;
48 | - (BOOL)isMUCRoomMessage:(XMPPMessage *)message;
49 |
50 | @end
51 |
52 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
53 | #pragma mark -
54 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
55 |
56 | @protocol XMPPMUCDelegate
57 | @optional
58 |
59 | - (void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *) roomJID didReceiveInvitation:(XMPPMessage *)message;
60 | - (void)xmppMUC:(XMPPMUC *)sender roomJID:(XMPPJID *) roomJID didReceiveInvitationDecline:(XMPPMessage *)message;
61 |
62 | @end
63 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/XMPPMessage+XEP0045.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPMessage.h"
3 |
4 |
5 | @interface XMPPMessage(XEP0045)
6 |
7 | - (BOOL)isGroupChatMessage;
8 | - (BOOL)isGroupChatMessageWithBody;
9 | - (BOOL)isGroupChatMessageWithSubject;
10 |
11 | @end
12 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/XMPPMessage+XEP0045.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP0045.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 |
5 | @implementation XMPPMessage(XEP0045)
6 |
7 | - (BOOL)isGroupChatMessage
8 | {
9 | return [[[self attributeForName:@"type"] stringValue] isEqualToString:@"groupchat"];
10 | }
11 |
12 | - (BOOL)isGroupChatMessageWithBody
13 | {
14 | if ([self isGroupChatMessage])
15 | {
16 | NSString *body = [[self elementForName:@"body"] stringValue];
17 |
18 | return ([body length] > 0);
19 | }
20 |
21 | return NO;
22 | }
23 |
24 | - (BOOL)isGroupChatMessageWithSubject
25 | {
26 | if ([self isGroupChatMessage])
27 | {
28 | NSString *subject = [[self elementForName:@"subject"] stringValue];
29 |
30 | return ([subject length] > 0);
31 | }
32 |
33 | return NO;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/XMPPRoomMessage.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class XMPPJID;
4 | @class XMPPMessage;
5 |
6 |
7 | @protocol XMPPRoomMessage
8 |
9 | /**
10 | * The raw message that was sent / received.
11 | **/
12 | - (XMPPMessage *)message;
13 |
14 | /**
15 | * The JID of the MUC room.
16 | **/
17 | - (XMPPJID *)roomJID;
18 |
19 | /**
20 | * Who sent the message.
21 | * A typical MUC room jid is of the form "room_name@conference.domain.tld/some_nickname".
22 | **/
23 | - (XMPPJID *)jid;
24 |
25 | /**
26 | * The nickname of the user who sent the message.
27 | * This is a convenience method for [jid resource].
28 | **/
29 | - (NSString *)nickname;
30 |
31 | /**
32 | * Convenience method to access the body of the message.
33 | **/
34 | - (NSString *)body;
35 |
36 | /**
37 | * When the message was sent / received (as recorded by us).
38 | *
39 | * If the message was originally sent by us, the localTimestamp is recorded automatically.
40 | * If the message was received, the server may have included a delayed delivery date timestamp.
41 | * This is the case when first joining a room, and downloading the discussion history.
42 | * In such a case, the localTimestamp will be a reflection of the serverTimestamp.
43 | **/
44 | - (NSDate *)localTimestamp;
45 |
46 | /**
47 | * When the message was sent / received (as recorded by the server).
48 | *
49 | * Only set when the server includes a delayedDelivery timestamp within the message.
50 | **/
51 | - (NSDate *)remoteTimestamp;
52 |
53 | /**
54 | * Whether or not the message was sent by us.
55 | **/
56 | - (BOOL)isFromMe;
57 |
58 | @end
59 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/XMPPRoomOccupant.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class XMPPJID;
4 | @class XMPPPresence;
5 |
6 |
7 | @protocol XMPPRoomOccupant
8 |
9 | /**
10 | * Most recent presence message from occupant.
11 | **/
12 | - (XMPPPresence *)presence;
13 |
14 | /**
15 | * The MUC room the occupant is associated with.
16 | **/
17 | - (XMPPJID *)roomJID;
18 |
19 | /**
20 | * The JID of the occupant as reported by the room.
21 | * A typical MUC room will use JIDs of the form: "room_name@conference.domain.tl/some_nickname".
22 | **/
23 | - (XMPPJID *)jid;
24 |
25 | /**
26 | * The nickname of the user.
27 | * In other words, the resource portion of the occupants JID.
28 | **/
29 | - (NSString *)nickname;
30 |
31 | /**
32 | * The 'role' and 'affiliation' of the occupant within the MUC room.
33 | *
34 | * From XEP-0045, Section 5 - Roles and Affiliations:
35 | *
36 | * There are two dimensions along which we can measure a user's connection with or position in a room.
37 | * One is the user's long-lived affiliation with a room -- e.g., a user's status as an owner or an outcast.
38 | * The other is a user's role while an occupant of a room -- e.g., an occupant's position as a moderator with the
39 | * ability to kick visitors and participants. These two dimensions are distinct from each other, since an affiliation
40 | * lasts across visits, while a role lasts only for the duration of a visit. In addition, there is no one-to-one
41 | * correspondence between roles and affiliations; for example, someone who is not affiliated with a room may be
42 | * a (temporary) moderator, and a member may be a participant or a visitor in a moderated room.
43 | *
44 | * For more information, please see XEP-0045.
45 | **/
46 | - (NSString *)role;
47 | - (NSString *)affiliation;
48 |
49 | /**
50 | * If the MUC room is non-anonymous, the real JID of the user will be broadcast.
51 | *
52 | * An anonymous room uses JID's of the form: "room_name@conference.domain.tld/some_nickname".
53 | * A non-anonymous room also includes the occupants real full JID in the presence broadcast.
54 | **/
55 | - (XMPPJID *)realJID;
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0045/XMPPRoomPrivate.h:
--------------------------------------------------------------------------------
1 | #import "XMPPRoom.h"
2 |
3 |
4 | @interface XMPPRoom (PrivateInternalAPI)
5 |
6 | /**
7 | * XMPPRoomStorage classes may optionally use the same delegate(s) as their parent XMPPRoom.
8 | * This method allows such storage classes to access the delegate(s).
9 | *
10 | * Note: If the storage class operates on a different queue than its parent,
11 | * it MUST dispatch all calls to the multicastDelegate onto its parent's queue.
12 | * The parent's dispatch queue is passed in the configureWithParent:queue: method,
13 | * or may be obtained via the moduleQueue method below.
14 | **/
15 | - (GCDMulticastDelegate *)multicastDelegate;
16 |
17 | - (dispatch_queue_t)moduleQueue;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCard.xcdatamodeld/.xccurrentversion:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | _XCCurrentVersionName
6 | XMPPvCard.xcdatamodel
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCard.xcdatamodeld/XMPPvCard.xcdatamodel/elements:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCard.xcdatamodeld/XMPPvCard.xcdatamodel/elements
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCard.xcdatamodeld/XMPPvCard.xcdatamodel/layout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCard.xcdatamodeld/XMPPvCard.xcdatamodel/layout
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCardAvatarCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardAvatarCoreDataStorageObject.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Originally created by Eric Chamberlain on 3/18/11.
6 | //
7 | // This class is so that we don't load the photoData each time we need to touch the XMPPvCardCoreDataStorageObject.
8 |
9 | #import
10 | #import
11 |
12 | @class XMPPvCardCoreDataStorageObject;
13 |
14 |
15 | @interface XMPPvCardAvatarCoreDataStorageObject : NSManagedObject
16 |
17 | @property (nonatomic, strong) NSData * photoData;
18 | @property (nonatomic, strong) XMPPvCardCoreDataStorageObject * vCard;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCardAvatarCoreDataStorageObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardAvatarCoreDataStorageObject.m
3 | // XEP-0054 vCard-temp
4 | //
5 | // Originally created by Eric Chamberlain on 3/18/11.
6 | //
7 |
8 | #import "XMPPvCardAvatarCoreDataStorageObject.h"
9 | #import "XMPPvCardCoreDataStorageObject.h"
10 |
11 |
12 | @implementation XMPPvCardAvatarCoreDataStorageObject
13 |
14 | @dynamic photoData;
15 | @dynamic vCard;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCardCoreDataStorage.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardCoreDataStorage.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Originally created by Eric Chamberlain on 3/18/11.
6 | //
7 |
8 | #import
9 | #import
10 |
11 | #import "XMPPCoreDataStorage.h"
12 | #import "XMPPvCardTempModule.h"
13 | #import "XMPPvCardAvatarModule.h"
14 |
15 | /**
16 | * This class is an example implementation of XMPPCapabilitiesStorage using core data.
17 | * You are free to substitute your own storage class.
18 | **/
19 |
20 | @interface XMPPvCardCoreDataStorage : XMPPCoreDataStorage <
21 | XMPPvCardAvatarStorage,
22 | XMPPvCardTempModuleStorage
23 | > {
24 | // Inherits protected variables from XMPPCoreDataStorage
25 | }
26 |
27 | /**
28 | * XEP-0054 provides a mechanism for transmitting vCards via XMPP.
29 | * Because the JID doesn't change very often and can be large with image data,
30 | * it is safe to persistently store the JID and wait for a user to explicity ask for an update,
31 | * or use XEP-0153 to monitor for JID changes.
32 | *
33 | * For this reason, it is recommended you use this sharedInstance across all your xmppStreams.
34 | * This way all streams can shared a knowledgebase concerning known JIDs and Avatar photos.
35 | *
36 | * All other aspects of vCard handling (such as lookup failures, etc) are kept separate between streams.
37 | **/
38 | + (instancetype)sharedInstance;
39 |
40 | //
41 | // This class inherits from XMPPCoreDataStorage.
42 | //
43 | // Please see the XMPPCoreDataStorage header file for more information.
44 | //
45 |
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCardCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardCoreDataStorageObject.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Originally created by Eric Chamberlain on 3/18/11.
6 | //
7 |
8 | #import
9 | #import
10 |
11 |
12 | @class XMPPJID;
13 | @class XMPPvCardTemp;
14 | @class XMPPvCardTempCoreDataStorageObject;
15 | @class XMPPvCardAvatarCoreDataStorageObject;
16 |
17 |
18 | @interface XMPPvCardCoreDataStorageObject : NSManagedObject
19 |
20 |
21 | /*
22 | * User's JID, indexed for lookups
23 | */
24 | @property (nonatomic, strong) NSString * jidStr;
25 |
26 | /*
27 | * User's photoHash used by XEP-0153
28 | */
29 | @property (nonatomic, strong, readonly) NSString * photoHash;
30 |
31 | /*
32 | * The last time the record was modified, also used to determine if we need to fetch again
33 | */
34 | @property (nonatomic, strong) NSDate * lastUpdated;
35 |
36 |
37 | /*
38 | * Flag indicating whether a get request is already pending, used in conjunction with lastUpdated
39 | */
40 | @property (nonatomic, strong) NSNumber * waitingForFetch;
41 |
42 |
43 | /*
44 | * Relationship to the vCardTemp record.
45 | * We use a relationship, so the vCardTemp stays faulted until we really need it.
46 | */
47 | @property (nonatomic, strong) XMPPvCardTempCoreDataStorageObject * vCardTempRel;
48 |
49 |
50 | /*
51 | * Relationship to the vCardAvatar record.
52 | * We use a relationship, so the vCardAvatar stays faulted until we really need it.
53 | */
54 | @property (nonatomic, strong) XMPPvCardAvatarCoreDataStorageObject * vCardAvatarRel;
55 |
56 |
57 | /*
58 | * Accessor to retrieve photoData, so we can hide the underlying relationship implementation.
59 | */
60 | @property (nonatomic, strong) NSData *photoData;
61 |
62 |
63 | /*
64 | * Accessor to retrieve vCardTemp, so we can hide the underlying relationship implementation.
65 | */
66 | @property (nonatomic, strong) XMPPvCardTemp *vCardTemp;
67 |
68 |
69 | + (XMPPvCardCoreDataStorageObject *)fetchOrInsertvCardForJID:(XMPPJID *)jid
70 | inManagedObjectContext:(NSManagedObjectContext *)moc;
71 |
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCardTempCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempCoreDataStorageObject.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Oringally created by Eric Chamberlain on 3/18/11.
6 | //
7 | // This class is so that we don't load the vCardTemp each time we need to touch the XMPPvCardCoreDataStorageObject.
8 | // The vCardTemp abstraction also makes it easier to eventually add support for vCard4 over XMPP (XEP-0292).
9 |
10 | #import
11 | #import
12 |
13 | #import "XMPPvcardTemp.h"
14 |
15 | @class XMPPvCardCoreDataStorageObject;
16 |
17 |
18 | @interface XMPPvCardTempCoreDataStorageObject : NSManagedObject
19 |
20 | @property (nonatomic, strong) XMPPvCardTemp * vCardTemp;
21 | @property (nonatomic, strong) XMPPvCardCoreDataStorageObject * vCard;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/CoreDataStorage/XMPPvCardTempCoreDataStorageObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempCoreDataStorageObject.m
3 | // XEP-0054 vCard-temp
4 | //
5 | // Originally created by Eric Chamberlain on 3/18/11.
6 | //
7 |
8 | #import "XMPPvCardTempCoreDataStorageObject.h"
9 | #import "XMPPvCardCoreDataStorageObject.h"
10 |
11 |
12 | @implementation XMPPvCardTempCoreDataStorageObject
13 |
14 | @dynamic vCardTemp;
15 | @dynamic vCard;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempAdr.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempAdr.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import
12 |
13 | #import "XMPPvCardTempAdrTypes.h"
14 |
15 |
16 | @interface XMPPvCardTempAdr : XMPPvCardTempAdrTypes
17 |
18 | + (XMPPvCardTempAdr *)vCardAdrFromElement:(NSXMLElement *)elem;
19 |
20 | @property (nonatomic, weak) NSString *pobox;
21 | @property (nonatomic, weak) NSString *extendedAddress;
22 | @property (nonatomic, weak) NSString *street;
23 | @property (nonatomic, weak) NSString *locality;
24 | @property (nonatomic, weak) NSString *region;
25 | @property (nonatomic, weak) NSString *postalCode;
26 | @property (nonatomic, weak) NSString *country;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempAdrTypes.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempAdrTypes.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import
12 |
13 | #import "XMPPvCardTempBase.h"
14 |
15 |
16 | @interface XMPPvCardTempAdrTypes : XMPPvCardTempBase
17 |
18 |
19 | @property (nonatomic, assign, setter=setHome:) BOOL isHome;
20 | @property (nonatomic, assign, setter=setWork:) BOOL isWork;
21 | @property (nonatomic, assign, setter=setParcel:) BOOL isParcel;
22 | @property (nonatomic, assign, setter=setPostal:) BOOL isPostal;
23 | @property (nonatomic, assign, setter=setDomestic:) BOOL isDomestic;
24 | @property (nonatomic, assign, setter=setInternational:) BOOL isInternational;
25 | @property (nonatomic, assign, setter=setPreferred:) BOOL isPreferred;
26 |
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempAdrTypes.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempAdrTypes.m
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import "XMPPvCardTempAdrTypes.h"
12 |
13 | #if ! __has_feature(objc_arc)
14 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
15 | #endif
16 |
17 |
18 | @implementation XMPPvCardTempAdrTypes
19 |
20 |
21 | #pragma mark -
22 | #pragma mark Getter/setter methods
23 |
24 |
25 | - (BOOL)isHome {
26 | return [self elementForName:@"HOME"] != nil;
27 | }
28 |
29 |
30 | - (void)setHome:(BOOL)home {
31 | XMPP_VCARD_SET_EMPTY_CHILD(home && ![self isHome], @"HOME");
32 | }
33 |
34 |
35 | - (BOOL)isWork {
36 | return [self elementForName:@"WORK"] != nil;
37 | }
38 |
39 |
40 | - (void)setWork:(BOOL)work {
41 | XMPP_VCARD_SET_EMPTY_CHILD(work && ![self isWork], @"WORK");
42 | }
43 |
44 |
45 | - (BOOL)isParcel {
46 | return [self elementForName:@"PARCEL"] != nil;
47 | }
48 |
49 |
50 | - (void)setParcel:(BOOL)parcel {
51 | XMPP_VCARD_SET_EMPTY_CHILD(parcel && ![self isParcel], @"PARCEL");
52 | }
53 |
54 |
55 | - (BOOL)isPostal {
56 | return [self elementForName:@"POSTAL"] != nil;
57 | }
58 |
59 |
60 | - (void)setPostal:(BOOL)postal {
61 | XMPP_VCARD_SET_EMPTY_CHILD(postal && ![self isPostal], @"POSTAL");
62 | }
63 |
64 |
65 | - (BOOL)isDomestic {
66 | return [self elementForName:@"DOM"] != nil;
67 | }
68 |
69 |
70 | - (void)setDomestic:(BOOL)dom {
71 | XMPP_VCARD_SET_EMPTY_CHILD(dom && ![self isDomestic], @"DOM");
72 | // INTL and DOM are mutually exclusive
73 | if (dom) {
74 | [self setInternational:NO];
75 | }
76 | }
77 |
78 |
79 | - (BOOL)isInternational {
80 | return [self elementForName:@"INTL"] != nil;
81 | }
82 |
83 |
84 | - (void)setInternational:(BOOL)intl {
85 | XMPP_VCARD_SET_EMPTY_CHILD(intl && ![self isInternational], @"INTL");
86 | // INTL and DOM are mutually exclusive
87 | if (intl) {
88 | [self setDomestic:NO];
89 | }
90 | }
91 |
92 |
93 | - (BOOL)isPreferred {
94 | return [self elementForName:@"PREF"] != nil;
95 | }
96 |
97 |
98 | - (void)setPreferred:(BOOL)pref {
99 | XMPP_VCARD_SET_EMPTY_CHILD(pref && ![self isPreferred], @"PREF");
100 | }
101 |
102 |
103 | @end
104 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempBase.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempBase.m
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 | #import "XMPPvCardTempBase.h"
11 |
12 | #import
13 |
14 | #if ! __has_feature(objc_arc)
15 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
16 | #endif
17 |
18 | @implementation XMPPvCardTempBase
19 |
20 |
21 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
22 | #pragma mark -
23 | #pragma mark NSCoding protocol
24 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
25 |
26 |
27 | #if ! TARGET_OS_IPHONE
28 | - (id)replacementObjectForPortCoder:(NSPortCoder *)encoder
29 | {
30 | if([encoder isBycopy])
31 | return self;
32 | else
33 | return [super replacementObjectForPortCoder:encoder];
34 | // return [NSDistantObject proxyWithLocal:self connection:[encoder connection]];
35 | }
36 | #endif
37 |
38 |
39 | - (id)initWithCoder:(NSCoder *)coder
40 | {
41 | NSString *xmlString;
42 | if([coder allowsKeyedCoding])
43 | {
44 | xmlString = [coder decodeObjectForKey:@"xmlString"];
45 | }
46 | else
47 | {
48 | xmlString = [coder decodeObject];
49 | }
50 |
51 | // The method [super initWithXMLString:error:] may return a different self.
52 | // In other words, it may [self release], and alloc/init/return a new self.
53 | //
54 | // So to maintain the proper class (XMPPvCardTempEmail, XMPPvCardTempTel, etc)
55 | // we need to get a reference to the class before invoking super.
56 |
57 | Class selfClass = [self class];
58 |
59 | if ((self = [super initWithXMLString:xmlString error:nil]))
60 | {
61 | object_setClass(self, selfClass);
62 | }
63 | return self;
64 | }
65 |
66 |
67 | - (void)encodeWithCoder:(NSCoder *)coder
68 | {
69 | NSString *xmlString = [self XMLString];
70 |
71 | if([coder allowsKeyedCoding])
72 | {
73 | [coder encodeObject:xmlString forKey:@"xmlString"];
74 | }
75 | else
76 | {
77 | [coder encodeObject:xmlString];
78 | }
79 | }
80 |
81 | - (id)copyWithZone:(NSZone *)zone
82 | {
83 | NSXMLElement *elementCopy = [super copyWithZone:zone];
84 | object_setClass(elementCopy, [self class]);
85 |
86 | return elementCopy;
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempEmail.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempEmail.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import
12 |
13 | #import "XMPPvCardTempBase.h"
14 |
15 |
16 | @interface XMPPvCardTempEmail : XMPPvCardTempBase
17 |
18 | + (XMPPvCardTempEmail *)vCardEmailFromElement:(NSXMLElement *)elem;
19 |
20 | @property (nonatomic, assign, setter=setHome:) BOOL isHome;
21 | @property (nonatomic, assign, setter=setWork:) BOOL isWork;
22 | @property (nonatomic, assign, setter=setInternet:) BOOL isInternet;
23 | @property (nonatomic, assign, setter=setX400:) BOOL isX400;
24 | @property (nonatomic, assign, setter=setPreferred:) BOOL isPreferred;
25 |
26 | @property (nonatomic, weak) NSString *userid;
27 |
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempLabel.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import
12 |
13 | #import "XMPPvCardTempAdrTypes.h"
14 |
15 |
16 | @interface XMPPvCardTempLabel : XMPPvCardTempAdrTypes
17 |
18 |
19 | @property (nonatomic, weak) NSArray *lines;
20 |
21 |
22 | + (XMPPvCardTempLabel *)vCardLabelFromElement:(NSXMLElement *)elem;
23 |
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempLabel.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempLabel.m
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import "XMPPvCardTempLabel.h"
12 | #import "XMPPLogging.h"
13 |
14 | #import
15 |
16 | #if ! __has_feature(objc_arc)
17 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
18 | #endif
19 |
20 | #if DEBUG
21 | static const int xmppLogLevel = XMPP_LOG_LEVEL_ERROR;
22 | #else
23 | static const int xmppLogLevel = XMPP_LOG_LEVEL_ERROR;
24 | #endif
25 |
26 |
27 | @implementation XMPPvCardTempLabel
28 |
29 |
30 | + (void)initialize {
31 | // We use the object_setClass method below to dynamically change the class from a standard NSXMLElement.
32 | // The size of the two classes is expected to be the same.
33 | //
34 | // If a developer adds instance methods to this class, bad things happen at runtime that are very hard to debug.
35 | // This check is here to aid future developers who may make this mistake.
36 | //
37 | // For Fearless And Experienced Objective-C Developers:
38 | // It may be possible to support adding instance variables to this class if you seriously need it.
39 | // To do so, try realloc'ing self after altering the class, and then initialize your variables.
40 |
41 | size_t superSize = class_getInstanceSize([NSXMLElement class]);
42 | size_t ourSize = class_getInstanceSize([XMPPvCardTempLabel class]);
43 |
44 | if (superSize != ourSize)
45 | {
46 | XMPPLogError(@"Adding instance variables to XMPPvCardTempLabel is not currently supported!");
47 |
48 | [DDLog flushLog];
49 | exit(15);
50 | }
51 | }
52 |
53 |
54 | + (XMPPvCardTempLabel *)vCardLabelFromElement:(NSXMLElement *)elem {
55 | object_setClass(elem, [XMPPvCardTempLabel class]);
56 |
57 | return (XMPPvCardTempLabel *)elem;
58 | }
59 |
60 |
61 | #pragma mark -
62 | #pragma mark Getter/setter methods
63 |
64 |
65 | - (NSArray *)lines {
66 | NSArray *elems = [self elementsForName:@"LINE"];
67 | NSMutableArray *lines = [[NSMutableArray alloc] initWithCapacity:[elems count]];
68 |
69 | for (NSXMLElement *elem in elems) {
70 | [lines addObject:[elem stringValue]];
71 | }
72 |
73 | NSArray *result = [NSArray arrayWithArray:lines];
74 | return result;
75 | }
76 |
77 |
78 | - (void)setLines:(NSArray *)lines {
79 | NSArray *elems = [self elementsForName:@"LINE"];
80 |
81 | for (NSXMLElement *elem in elems) {
82 | [self removeChildAtIndex:[[self children] indexOfObject:elem]];
83 | }
84 |
85 | for (NSString *line in lines) {
86 | NSXMLElement *elem = [NSXMLElement elementWithName:@"LINE"];
87 | [elem setStringValue:line];
88 | [self addChild:elem];
89 | }
90 | }
91 |
92 |
93 | @end
94 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0054/XMPPvCardTempTel.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardTempTel.h
3 | // XEP-0054 vCard-temp
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 | // Copyright 2010 Martin Morrison. All rights reserved.
8 | //
9 |
10 |
11 | #import
12 |
13 | #import "XMPPvCardTempBase.h"
14 |
15 |
16 | @interface XMPPvCardTempTel : XMPPvCardTempBase
17 |
18 |
19 | + (XMPPvCardTempTel *)vCardTelFromElement:(NSXMLElement *)elem;
20 |
21 | @property (nonatomic, assign, setter=setHome:) BOOL isHome;
22 | @property (nonatomic, assign, setter=setWork:) BOOL isWork;
23 | @property (nonatomic, assign, setter=setVoice:) BOOL isVoice;
24 | @property (nonatomic, assign, setter=setFax:) BOOL isFax;
25 | @property (nonatomic, assign, setter=setPager:) BOOL isPager;
26 | @property (nonatomic, assign, setter=setMessaging:) BOOL hasMessaging;
27 | @property (nonatomic, assign, setter=setCell:) BOOL isCell;
28 | @property (nonatomic, assign, setter=setVideo:) BOOL isVideo;
29 | @property (nonatomic, assign, setter=setBBS:) BOOL isBBS;
30 | @property (nonatomic, assign, setter=setModem:) BOOL isModem;
31 | @property (nonatomic, assign, setter=setISDN:) BOOL isISDN;
32 | @property (nonatomic, assign, setter=setPCS:) BOOL isPCS;
33 | @property (nonatomic, assign, setter=setPreferred:) BOOL isPreferred;
34 |
35 | @property (nonatomic, weak) NSString *number;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0059/NSXMLElement+XEP_0059.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #if TARGET_OS_IPHONE
4 | #import "DDXML.h"
5 | #endif
6 |
7 | @class XMPPResultSet;
8 |
9 |
10 | @interface NSXMLElement (XEP_0059)
11 |
12 | - (BOOL)isResultSet;
13 | - (BOOL)hasResultSet;
14 | - (XMPPResultSet *)resultSet;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0059/NSXMLElement+XEP_0059.m:
--------------------------------------------------------------------------------
1 | #import "NSXMLElement+XEP_0059.h"
2 | #import "NSXMLElement+XMPP.h"
3 | #import "XMPPResultSet.h"
4 |
5 | #if ! __has_feature(objc_arc)
6 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
7 | #endif
8 |
9 |
10 | #define XMLNS_XMPP_RESULT_SET @"http://jabber.org/protocol/rsm"
11 | #define NAME_XMPP_RESULT_SET @"set"
12 |
13 | @implementation NSXMLElement (XEP_0059)
14 |
15 |
16 | - (BOOL)isResultSet
17 | {
18 | if([[self name] isEqualToString:NAME_XMPP_RESULT_SET] && [[self xmlns] isEqualToString:XMLNS_XMPP_RESULT_SET])
19 | {
20 | return YES;
21 | }
22 | else
23 | {
24 | return NO;
25 | }
26 | }
27 |
28 | - (BOOL)hasResultSet
29 | {
30 | if([self resultSet])
31 | {
32 | return YES;
33 | }
34 | else
35 | {
36 | return NO;
37 | }
38 | }
39 |
40 | - (XMPPResultSet *)resultSet
41 | {
42 | NSXMLElement *resultSetElement = [self elementForName:NAME_XMPP_RESULT_SET xmlns:XMLNS_XMPP_RESULT_SET];
43 | XMPPResultSet *resultSet = [XMPPResultSet resultSetFromElement:resultSetElement];
44 | return resultSet;
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0059/XMPPResultSet.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #if TARGET_OS_IPHONE
4 | #import "DDXML.h"
5 | #endif
6 |
7 | /**
8 | * The XMPPResultSet class represents an element form XEP-0059.
9 | * It extends NSXMLElement.
10 | *
11 | * Calling resultSet on an NSXMLElement returns an XMPPResultSet if it exists (see NSXMLElement+XEP_0059.h)
12 | *
13 | * This class exists to provide developers an easy way to add functionality to Result Set processing.
14 | * Simply add your own category to XMPPResultSet to extend it with your own custom methods.
15 | *
16 | * XMPPResultSet uses NSNotFound to Specify undefined integer values i.e. max,firstIndex and count.
17 | * XMPPResultSet uses a NSString of 0 length but not nil to supply empty elements i.e. before and after.
18 | *
19 | * Example:
20 | *
21 | * To fetch the last 10 items in a result set you need the following XML:
22 | *
23 | *
24 | * 10
25 | *
26 | *
27 | *
28 | * This Result Set can be created by:
29 | *
30 | * [XMPPResultSet resultSetWithMax:10 firstIndex:NSNotFound after:nil before:@""];
31 | **/
32 |
33 | @interface XMPPResultSet : NSXMLElement
34 |
35 | /**
36 | * Converts an NSXMLElement to an XMPPResultSet element in place (no memory allocations or copying)
37 | **/
38 | + (XMPPResultSet *)resultSetFromElement:(NSXMLElement *)element;
39 |
40 | /**
41 | * Creates and returns a new autoreleased XMPPResultSet element.
42 | **/
43 | + (XMPPResultSet *)resultSet;
44 |
45 | + (XMPPResultSet *)resultSetWithMax:(NSInteger)max;
46 |
47 | + (XMPPResultSet *)resultSetWithMax:(NSInteger)max
48 | firstIndex:(NSInteger)index;
49 |
50 | + (XMPPResultSet *)resultSetWithMax:(NSInteger)max
51 | after:(NSString *)after;
52 |
53 | + (XMPPResultSet *)resultSetWithMax:(NSInteger)max
54 | before:(NSString *)before;
55 |
56 | + (XMPPResultSet *)resultSetWithMax:(NSInteger)max
57 | firstIndex:(NSInteger)firstIndex
58 | after:(NSString *)after
59 | before:(NSString *)before;
60 |
61 |
62 | /**
63 | * Creates and returns a new XMPPResultSet element.
64 | **/
65 | - (id)init;
66 |
67 | - (id)initWithMax:(NSInteger)max;
68 |
69 | - (id)initWithMax:(NSInteger)max
70 | firstIndex:(NSInteger)firstIndex;
71 |
72 | - (id)initWithMax:(NSInteger)max
73 | after:(NSString *)after;
74 |
75 | - (id)initWithMax:(NSInteger)max
76 | before:(NSString *)before;
77 |
78 | - (id)initWithMax:(NSInteger)max
79 | firstIndex:(NSInteger)firstIndex
80 | after:(NSString *)after
81 | before:(NSString *)before;
82 |
83 |
84 | - (NSInteger)max;
85 |
86 | - (NSInteger)firstIndex;
87 |
88 | - (NSString *)after;
89 | - (NSString *)before;
90 |
91 | - (NSInteger)count;
92 |
93 | - (NSString *)first;
94 | - (NSString *)last;
95 |
96 | @end
97 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0060/XMPPIQ+XEP_0060.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPIQ.h"
3 |
4 | #define XMLNS_PUBSUB @"http://jabber.org/protocol/pubsub"
5 | #define XMLNS_PUBSUB_OWNER @"http://jabber.org/protocol/pubsub#owner"
6 | #define XMLNS_PUBSUB_EVENT @"http://jabber.org/protocol/pubsub#event"
7 | #define XMLNS_PUBSUB_NODE_CONFIG @"http://jabber.org/protocol/pubsub#node_config"
8 | #define XMLNS_PUBSUB_PUBLISH_OPTIONS @"http://jabber.org/protocol/pubsub#publish-options"
9 | #define XMLNS_PUBSUB_SUBSCRIBE_OPTIONS @"http://jabber.org/protocol/pubsub#subscribe_options"
10 |
11 | @interface XMPPIQ (XEP_0060)
12 |
13 | /**
14 | * Extracts the 'subid' from a PubSub subscription response.
15 | *
16 | * For example, if we sent a PubSub subscription request for node "princely_musings",
17 | * and the server returned this response:
18 | *
19 | *
20 | *
21 | *
26 | *
27 | *
28 | *
29 | * Then this method would return "ba49252aaa4f5d320c24d3766f0bdcade78c78d3".
30 | *
31 | * It is common to store the subid as it often a required attribute when unsubscribing.
32 | **/
33 | - (NSString *)pubsubid;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0060/XMPPIQ+XEP_0060.m:
--------------------------------------------------------------------------------
1 | #import "XMPPIQ+XEP_0060.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 |
5 | @implementation XMPPIQ (XEP_0060)
6 |
7 | - (NSString *)pubsubid
8 | {
9 | //
10 | //
11 | //
16 | //
17 | //
18 |
19 | NSXMLElement *pubsub = [self elementForName:@"pubsub" xmlns:XMLNS_PUBSUB];
20 | NSXMLElement *subscription = [pubsub elementForName:@"subscription"];
21 |
22 | return [subscription attributeStringValueForName:@"subid"];
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0065/TURNSocket.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class XMPPIQ;
4 | @class XMPPJID;
5 | @class XMPPStream;
6 | @class GCDAsyncSocket;
7 |
8 | /**
9 | * TURNSocket is an implementation of XEP-0065: SOCKS5 Bytestreams.
10 | *
11 | * It is used for establishing an out-of-band bytestream between any two XMPP users,
12 | * mainly for the purpose of file transfer.
13 | **/
14 | @interface TURNSocket : NSObject
15 | {
16 | int state;
17 | BOOL isClient;
18 |
19 | dispatch_queue_t turnQueue;
20 | void *turnQueueTag;
21 |
22 | XMPPStream *xmppStream;
23 | XMPPJID *jid;
24 | NSString *uuid;
25 |
26 | id delegate;
27 | dispatch_queue_t delegateQueue;
28 |
29 | dispatch_source_t turnTimer;
30 |
31 | NSString *discoUUID;
32 | dispatch_source_t discoTimer;
33 |
34 | NSArray *proxyCandidates;
35 | NSUInteger proxyCandidateIndex;
36 |
37 | NSMutableArray *candidateJIDs;
38 | NSUInteger candidateJIDIndex;
39 |
40 | NSMutableArray *streamhosts;
41 | NSUInteger streamhostIndex;
42 |
43 | XMPPJID *proxyJID;
44 | NSString *proxyHost;
45 | UInt16 proxyPort;
46 |
47 | GCDAsyncSocket *asyncSocket;
48 |
49 | NSDate *startTime, *finishTime;
50 | }
51 |
52 | + (BOOL)isNewStartTURNRequest:(XMPPIQ *)iq;
53 |
54 | + (NSArray *)proxyCandidates;
55 | + (void)setProxyCandidates:(NSArray *)candidates;
56 |
57 | - (id)initWithStream:(XMPPStream *)xmppStream toJID:(XMPPJID *)jid;
58 | - (id)initWithStream:(XMPPStream *)xmppStream incomingTURNRequest:(XMPPIQ *)iq;
59 |
60 | - (void)startWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)aDelegateQueue;
61 |
62 | - (BOOL)isClient;
63 |
64 | - (void)abort;
65 |
66 | @end
67 |
68 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
69 | #pragma mark -
70 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
71 |
72 | @protocol TURNSocketDelegate
73 | @optional
74 |
75 | - (void)turnSocket:(TURNSocket *)sender didSucceed:(GCDAsyncSocket *)socket;
76 |
77 | - (void)turnSocketDidFail:(TURNSocket *)sender;
78 |
79 | @end
80 |
81 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0066/XMPPIQ+XEP_0066.h:
--------------------------------------------------------------------------------
1 | #import "XMPPIQ.h"
2 |
3 | @interface XMPPIQ (XEP_0066)
4 |
5 | + (XMPPIQ *)outOfBandDataRequestTo:(XMPPJID *)jid
6 | elementID:(NSString *)eid
7 | URL:(NSURL *)URL
8 | desc:(NSString *)dec;
9 |
10 | + (XMPPIQ *)outOfBandDataRequestTo:(XMPPJID *)jid
11 | elementID:(NSString *)eid
12 | URI:(NSString *)URI
13 | desc:(NSString *)dec;
14 |
15 |
16 | - (id)initOutOfBandDataRequestTo:(XMPPJID *)jid
17 | elementID:(NSString *)eid
18 | URL:(NSURL *)URL
19 | desc:(NSString *)dec;
20 |
21 | - (id)initOutOfBandDataRequestTo:(XMPPJID *)jid
22 | elementID:(NSString *)eid
23 | URI:(NSString *)URI
24 | desc:(NSString *)dec;
25 |
26 | - (void)addOutOfBandURL:(NSURL *)URL desc:(NSString *)desc;
27 | - (void)addOutOfBandURI:(NSString *)URI desc:(NSString *)desc;
28 |
29 | - (XMPPIQ *)generateOutOfBandDataSuccessResponse;
30 |
31 | - (XMPPIQ *)generateOutOfBandDataFailureResponse;
32 |
33 | - (XMPPIQ *)generateOutOfBandDataRejectResponse;
34 |
35 | - (BOOL)isOutOfBandDataRequest;
36 | - (BOOL)isOutOfBandDataFailureResponse;
37 | - (BOOL)isOutOfBandDataRejectResponse;
38 |
39 | - (BOOL)hasOutOfBandData;
40 |
41 | - (NSURL *)outOfBandURL;
42 | - (NSString *)outOfBandURI;
43 | - (NSString *)outOfBandDesc;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0066/XMPPMessage+XEP_0066.h:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage.h"
2 |
3 | @interface XMPPMessage (XEP_0066)
4 |
5 | - (void)addOutOfBandURL:(NSURL *)URL desc:(NSString *)desc;
6 | - (void)addOutOfBandURI:(NSString *)URI desc:(NSString *)desc;
7 |
8 | - (BOOL)hasOutOfBandData;
9 |
10 | - (NSURL *)outOfBandURL;
11 | - (NSString *)outOfBandURI;
12 | - (NSString *)outOfBandDesc;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0066/XMPPMessage+XEP_0066.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP_0066.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 | #if ! __has_feature(objc_arc)
5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
6 | #endif
7 |
8 | #define NAME_OUT_OF_BAND @"x"
9 | #define XMLNS_OUT_OF_BAND @"jabber:iq:oob"
10 |
11 | @implementation XMPPMessage (XEP_0066)
12 |
13 | - (void)addOutOfBandURL:(NSURL *)URL desc:(NSString *)desc
14 | {
15 | NSXMLElement *outOfBand = [NSXMLElement elementWithName:NAME_OUT_OF_BAND xmlns:XMLNS_OUT_OF_BAND];
16 |
17 | if([[URL path] length])
18 | {
19 | NSXMLElement *URLElement = [NSXMLElement elementWithName:@"url" stringValue:[URL path]];
20 | [outOfBand addChild:URLElement];
21 | }
22 |
23 | if([desc length])
24 | {
25 | NSXMLElement *descElement = [NSXMLElement elementWithName:@"desc" stringValue:desc];
26 | [outOfBand addChild:descElement];
27 | }
28 |
29 | [self addChild:outOfBand];
30 | }
31 |
32 | - (void)addOutOfBandURI:(NSString *)URI desc:(NSString *)desc
33 | {
34 | NSXMLElement *outOfBand = [NSXMLElement elementWithName:NAME_OUT_OF_BAND xmlns:XMLNS_OUT_OF_BAND];
35 |
36 | if([URI length])
37 | {
38 | NSXMLElement *URLElement = [NSXMLElement elementWithName:@"url" stringValue:URI];
39 | [outOfBand addChild:URLElement];
40 | }
41 |
42 | if([desc length])
43 | {
44 | NSXMLElement *descElement = [NSXMLElement elementWithName:@"desc" stringValue:desc];
45 | [outOfBand addChild:descElement];
46 | }
47 |
48 | [self addChild:outOfBand];
49 | }
50 |
51 | - (BOOL)hasOutOfBandData
52 | {
53 | return ([self elementForName:NAME_OUT_OF_BAND xmlns:XMLNS_OUT_OF_BAND] ? YES : NO);
54 | }
55 |
56 | - (NSURL *)outOfBandURL
57 | {
58 | NSURL *URL = nil;
59 |
60 | NSXMLElement *outOfBand = [self elementForName:NAME_OUT_OF_BAND xmlns:XMLNS_OUT_OF_BAND];
61 |
62 | NSXMLElement *URLElement = [outOfBand elementForName:@"url"];
63 |
64 | NSString *URLString = [URLElement stringValue];
65 |
66 | if([URLString length])
67 | {
68 | URL = [NSURL URLWithString:URLString];
69 | }
70 |
71 | return URL;
72 |
73 | }
74 |
75 | - (NSString *)outOfBandURI
76 | {
77 | NSXMLElement *outOfBand = [self elementForName:NAME_OUT_OF_BAND xmlns:XMLNS_OUT_OF_BAND];
78 |
79 | NSXMLElement *URLElement = [outOfBand elementForName:@"url"];
80 |
81 | NSString *URI= [URLElement stringValue];
82 |
83 | return URI;
84 | }
85 |
86 | - (NSString *)outOfBandDesc
87 | {
88 | NSXMLElement *outOfBand = [self elementForName:NAME_OUT_OF_BAND xmlns:XMLNS_OUT_OF_BAND];
89 |
90 | NSXMLElement *descElement = [outOfBand elementForName:@"desc"];
91 |
92 | NSString *desc = [descElement stringValue];
93 |
94 | return desc;
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0082/NSDate+XMPPDateTimeProfiles.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate+XMPPDateTimeProfiles.h
3 | //
4 | // NSDate category to implement XEP-0082.
5 | //
6 | // Created by Eric Chamberlain on 3/9/11.
7 | // Copyright 2011 RF.com. All rights reserved.
8 | // Copyright 2010 Martin Morrison. All rights reserved.
9 | //
10 |
11 | #import
12 |
13 | @interface NSDate(XMPPDateTimeProfiles)
14 |
15 |
16 | + (NSDate *)dateWithXmppDateString:(NSString *)str;
17 | + (NSDate *)dateWithXmppTimeString:(NSString *)str;
18 | + (NSDate *)dateWithXmppDateTimeString:(NSString *)str;
19 |
20 |
21 | - (NSString *)xmppDateString;
22 | - (NSString *)xmppTimeString;
23 | - (NSString *)xmppDateTimeString;
24 |
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0082/NSDate+XMPPDateTimeProfiles.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSDate+XMPPDateTimeProfiles.m
3 | //
4 | // NSDate category to implement XEP-0082.
5 | //
6 | // Created by Eric Chamberlain on 3/9/11.
7 | // Copyright 2011 RF.com. All rights reserved.
8 | // Copyright 2010 Martin Morrison. All rights reserved.
9 | //
10 |
11 | #import "NSDate+XMPPDateTimeProfiles.h"
12 | #import "XMPPDateTimeProfiles.h"
13 |
14 | #if ! __has_feature(objc_arc)
15 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
16 | #endif
17 |
18 | @interface NSDate(XMPPDateTimeProfilesPrivate)
19 | - (NSString *)xmppStringWithDateFormat:(NSString *)dateFormat;
20 | @end
21 |
22 | #pragma mark -
23 |
24 | @implementation NSDate(XMPPDateTimeProfiles)
25 |
26 |
27 | #pragma mark Convert from XMPP string to NSDate
28 |
29 |
30 | + (NSDate *)dateWithXmppDateString:(NSString *)str {
31 | return [XMPPDateTimeProfiles parseDate:str];
32 | }
33 |
34 |
35 | + (NSDate *)dateWithXmppTimeString:(NSString *)str {
36 | return [XMPPDateTimeProfiles parseTime:str];
37 | }
38 |
39 |
40 | + (NSDate *)dateWithXmppDateTimeString:(NSString *)str {
41 | return [XMPPDateTimeProfiles parseDateTime:str];
42 | }
43 |
44 |
45 | #pragma mark Convert from NSDate to XMPP string
46 |
47 |
48 | - (NSString *)xmppDateString {
49 | return [self xmppStringWithDateFormat:@"yyyy-MM-dd"];
50 | }
51 |
52 |
53 | - (NSString *)xmppTimeString {
54 | return [self xmppStringWithDateFormat:@"HH:mm:ss'Z'"];
55 | }
56 |
57 |
58 | - (NSString *)xmppDateTimeString {
59 | return [self xmppStringWithDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"];
60 | }
61 |
62 |
63 | #pragma mark XMPPDateTimeProfilesPrivate methods
64 |
65 |
66 | - (NSString *)xmppStringWithDateFormat:(NSString *)dateFormat
67 | {
68 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
69 | [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
70 | [dateFormatter setDateFormat:dateFormat];
71 | [dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
72 |
73 | NSString *str = [dateFormatter stringFromDate:self];
74 |
75 | return str;
76 | }
77 |
78 |
79 | @end
80 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0082/XMPPDateTimeProfiles.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "NSDate+XMPPDateTimeProfiles.h"
3 |
4 | @interface XMPPDateTimeProfiles : NSObject
5 |
6 | /**
7 | * The following methods attempt to parse the given string following XEP-0082.
8 | * They return nil if the given string doesn't follow the spec.
9 | **/
10 |
11 | + (NSDate *)parseDate:(NSString *)dateStr;
12 | + (NSDate *)parseTime:(NSString *)timeStr;
13 | + (NSDate *)parseDateTime:(NSString *)dateTimeStr;
14 |
15 | + (NSTimeZone *)parseTimeZoneOffset:(NSString *)tzo;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0085/XMPPMessage+XEP_0085.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPMessage.h"
3 |
4 |
5 | @interface XMPPMessage (XEP_0085)
6 |
7 | - (NSString *)chatState;
8 |
9 | - (BOOL)hasChatState;
10 |
11 | - (BOOL)hasActiveChatState;
12 | - (BOOL)hasComposingChatState;
13 | - (BOOL)hasPausedChatState;
14 | - (BOOL)hasInactiveChatState;
15 | - (BOOL)hasGoneChatState;
16 |
17 | - (void)addActiveChatState;
18 | - (void)addComposingChatState;
19 | - (void)addPausedChatState;
20 | - (void)addInactiveChatState;
21 | - (void)addGoneChatState;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0085/XMPPMessage+XEP_0085.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP_0085.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 |
5 | static NSString *const xmlns_chatstates = @"http://jabber.org/protocol/chatstates";
6 |
7 | @implementation XMPPMessage (XEP_0085)
8 |
9 | - (NSString *)chatState{
10 | return [[[self elementsForXmlns:xmlns_chatstates] lastObject] name];
11 | }
12 |
13 | - (BOOL)hasChatState
14 | {
15 | return ([[self elementsForXmlns:xmlns_chatstates] count] > 0);
16 | }
17 |
18 | - (BOOL)hasActiveChatState
19 | {
20 | return ([self elementForName:@"active" xmlns:xmlns_chatstates] != nil);
21 | }
22 |
23 | - (BOOL)hasComposingChatState
24 | {
25 | return ([self elementForName:@"composing" xmlns:xmlns_chatstates] != nil);
26 | }
27 |
28 | - (BOOL)hasPausedChatState
29 | {
30 | return ([self elementForName:@"paused" xmlns:xmlns_chatstates] != nil);
31 | }
32 |
33 | - (BOOL)hasInactiveChatState
34 | {
35 | return ([self elementForName:@"inactive" xmlns:xmlns_chatstates] != nil);
36 | }
37 |
38 | - (BOOL)hasGoneChatState
39 | {
40 | return ([self elementForName:@"gone" xmlns:xmlns_chatstates] != nil);
41 | }
42 |
43 |
44 | - (void)addActiveChatState
45 | {
46 | [self addChild:[NSXMLElement elementWithName:@"active" xmlns:xmlns_chatstates]];
47 | }
48 |
49 | - (void)addComposingChatState
50 | {
51 | [self addChild:[NSXMLElement elementWithName:@"composing" xmlns:xmlns_chatstates]];
52 | }
53 |
54 | - (void)addPausedChatState
55 | {
56 | [self addChild:[NSXMLElement elementWithName:@"paused" xmlns:xmlns_chatstates]];
57 | }
58 |
59 | - (void)addInactiveChatState
60 | {
61 | [self addChild:[NSXMLElement elementWithName:@"inactive" xmlns:xmlns_chatstates]];
62 | }
63 |
64 | - (void)addGoneChatState
65 | {
66 | [self addChild:[NSXMLElement elementWithName:@"gone" xmlns:xmlns_chatstates]];
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0092/XMPPSoftwareVersion.h:
--------------------------------------------------------------------------------
1 | #import "XMPPModule.h"
2 |
3 | @interface XMPPSoftwareVersion : XMPPModule
4 |
5 | @property (copy,readonly) NSString *name;
6 | @property (copy,readonly) NSString *version;
7 | @property (copy,readonly) NSString *os;
8 |
9 | - (id)initWithDispatchQueue:(dispatch_queue_t)queue;
10 |
11 | - (id)initWithName:(NSString *)name
12 | version:(NSString *)version
13 | os:(NSString *)os
14 | dispatchQueue:(dispatch_queue_t)queue;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0100/XMPPTransports.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #define _XMPP_TRANSPORTS_H
4 |
5 | @class XMPPStream;
6 |
7 |
8 | @interface XMPPTransports : NSObject
9 | {
10 | XMPPStream *xmppStream;
11 | }
12 |
13 | - (id)initWithStream:(XMPPStream *)xmppStream;
14 |
15 | @property (nonatomic, strong, readonly) XMPPStream *xmppStream;
16 |
17 | - (void)queryGatewayDiscoveryIdentityForLegacyService:(NSString *)service;
18 | - (void)queryGatewayAgentInfo;
19 | - (void)queryRegistrationRequirementsForLegacyService:(NSString *)service;
20 | - (void)registerLegacyService:(NSString *)service username:(NSString *)username password:(NSString *)password;
21 | - (void)unregisterLegacyService:(NSString *)service;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0106/NSString+XEP_0106.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface NSString (XEP_0106)
4 |
5 | - (NSString *)jidEscapedString;
6 |
7 | - (NSString *)jidUnescapedString;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapabilities.xcdatamodel/elements:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapabilities.xcdatamodel/elements
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapabilities.xcdatamodel/layout:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapabilities.xcdatamodel/layout
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapabilitiesCoreDataStorage.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import "XMPPCapabilities.h"
5 | #import "XMPPCoreDataStorage.h"
6 |
7 | /**
8 | * This class is an example implementation of XMPPCapabilitiesStorage using core data.
9 | * You are free to substitute your own storage class.
10 | **/
11 |
12 | @interface XMPPCapabilitiesCoreDataStorage : XMPPCoreDataStorage
13 | {
14 | /* Inherited protected variables from XMPPCoreDataStorage
15 |
16 | NSString *databaseFileName;
17 | NSUInteger saveThreshold;
18 |
19 | dispatch_queue_t storageQueue;
20 |
21 | */
22 | }
23 |
24 | /**
25 | * XEP-0115 provides a mechanism for hashing a list of capabilities.
26 | * Clients then broadcast this hash instead of the entire list to save bandwidth.
27 | * Because the hashing is standardized, it is safe to persistently store the linked hash & capabilities.
28 | *
29 | * For this reason, it is recommended you use this sharedInstance across all your xmppStreams.
30 | * This way all streams can shared a knowledgebase concerning known hashes.
31 | *
32 | * All other aspects of capabilities handling (such as JID's, lookup failures, etc) are kept separate between streams.
33 | **/
34 | + (instancetype)sharedInstance;
35 |
36 |
37 | /* Inherited from XMPPCoreDataStorage
38 | * Please see the XMPPCoreDataStorage header file for extensive documentation.
39 |
40 | - (id)initWithDatabaseFilename:(NSString *)databaseFileName storeOptions:(NSDictionary *)storeOptions;
41 | - (id)initWithInMemoryStore;
42 |
43 | @property (readonly) NSString *databaseFileName;
44 |
45 | @property (readwrite) NSUInteger saveThreshold;
46 |
47 | @property (readonly) NSManagedObjectModel *managedObjectModel;
48 | @property (readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
49 |
50 | @property (readonly) NSManagedObjectContext *mainThreadManagedObjectContext;
51 |
52 | */
53 |
54 | @end
55 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapsCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #if TARGET_OS_IPHONE
4 | #import "DDXML.h"
5 | #endif
6 |
7 | @class XMPPCapsResourceCoreDataStorageObject;
8 |
9 |
10 | @interface XMPPCapsCoreDataStorageObject : NSManagedObject
11 |
12 | @property (nonatomic, strong) NSXMLElement *capabilities;
13 |
14 | @property (nonatomic, strong) NSString * hashStr;
15 | @property (nonatomic, strong) NSString * hashAlgorithm;
16 | @property (nonatomic, strong) NSString * capabilitiesStr;
17 |
18 | @property (nonatomic, strong) NSSet * resources;
19 |
20 | @end
21 |
22 |
23 | @interface XMPPCapsCoreDataStorageObject (CoreDataGeneratedAccessors)
24 |
25 | - (void)addResourcesObject:(XMPPCapsResourceCoreDataStorageObject *)value;
26 | - (void)removeResourcesObject:(XMPPCapsResourceCoreDataStorageObject *)value;
27 | - (void)addResources:(NSSet *)value;
28 | - (void)removeResources:(NSSet *)value;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapsCoreDataStorageObject.m:
--------------------------------------------------------------------------------
1 | #import "XMPPCapsCoreDataStorageObject.h"
2 | #import "XMPPCapsResourceCoreDataStorageObject.h"
3 | #import "XMPP.h"
4 |
5 | #if ! __has_feature(objc_arc)
6 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
7 | #endif
8 |
9 |
10 | @implementation XMPPCapsCoreDataStorageObject
11 |
12 | @dynamic capabilities;
13 |
14 | @dynamic hashStr;
15 | @dynamic hashAlgorithm;
16 | @dynamic capabilitiesStr;
17 |
18 | @dynamic resources;
19 |
20 | - (NSXMLElement *)capabilities
21 | {
22 | return [[NSXMLElement alloc] initWithXMLString:[self capabilitiesStr] error:nil];
23 | }
24 |
25 | - (void)setCapabilities:(NSXMLElement *)caps
26 | {
27 | self.capabilitiesStr = [caps compactXMLString];
28 | }
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapsResourceCoreDataStorageObject.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class XMPPCapsCoreDataStorageObject;
4 |
5 |
6 | @interface XMPPCapsResourceCoreDataStorageObject : NSManagedObject
7 |
8 | @property (nonatomic, strong) NSString * jidStr;
9 | @property (nonatomic, strong) NSString * streamBareJidStr;
10 |
11 | @property (nonatomic, assign) BOOL haveFailed;
12 | @property (nonatomic, strong) NSNumber * failed;
13 |
14 | @property (nonatomic, strong) NSString * node;
15 | @property (nonatomic, strong) NSString * ver;
16 | @property (nonatomic, strong) NSString * ext;
17 |
18 | @property (nonatomic, strong) NSString * hashStr;
19 | @property (nonatomic, strong) NSString * hashAlgorithm;
20 |
21 | @property (nonatomic, strong) XMPPCapsCoreDataStorageObject * caps;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0115/CoreDataStorage/XMPPCapsResourceCoreDataStorageObject.m:
--------------------------------------------------------------------------------
1 | #import "XMPPCapsResourceCoreDataStorageObject.h"
2 | #import "XMPPCapsCoreDataStorageObject.h"
3 |
4 | #if ! __has_feature(objc_arc)
5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
6 | #endif
7 |
8 |
9 | @implementation XMPPCapsResourceCoreDataStorageObject
10 |
11 | @dynamic jidStr;
12 | @dynamic streamBareJidStr;
13 |
14 | @dynamic haveFailed;
15 | @dynamic failed;
16 |
17 | @dynamic node;
18 | @dynamic ver;
19 | @dynamic ext;
20 |
21 | @dynamic hashStr;
22 | @dynamic hashAlgorithm;
23 |
24 | @dynamic caps;
25 |
26 | - (BOOL)haveFailed
27 | {
28 | return [[self failed] boolValue];
29 | }
30 |
31 | - (void)setHaveFailed:(BOOL)flag
32 | {
33 | self.failed = [NSNumber numberWithBool:flag];
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchiving.xcdatamodeld/.xccurrentversion:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | _XCCurrentVersionName
6 | XMPPMessageArchiving.xcdatamodel
7 |
8 |
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchiving.xcdatamodeld/XMPPMessageArchiving.xcdatamodel/contents:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchivingCoreDataStorage.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "XMPPCoreDataStorage.h"
4 | #import "XMPPMessageArchiving.h"
5 | #import "XMPPMessageArchiving_Message_CoreDataObject.h"
6 | #import "XMPPMessageArchiving_Contact_CoreDataObject.h"
7 |
8 |
9 | @interface XMPPMessageArchivingCoreDataStorage : XMPPCoreDataStorage
10 | {
11 | /* Inherited protected variables from XMPPCoreDataStorage
12 |
13 | NSString *databaseFileName;
14 | NSUInteger saveThreshold;
15 |
16 | dispatch_queue_t storageQueue;
17 |
18 | */
19 | }
20 |
21 | /**
22 | * Convenience method to get an instance with the default database name.
23 | *
24 | * IMPORTANT:
25 | * You are NOT required to use the sharedInstance.
26 | *
27 | * If your application uses multiple xmppStreams, and you use a sharedInstance of this class,
28 | * then all of your streams share the same database store. You might get better performance if you create
29 | * multiple instances of this class instead (using different database filenames), as this way you can have
30 | * concurrent writes to multiple databases.
31 | **/
32 | + (instancetype)sharedInstance;
33 |
34 |
35 | @property (strong) NSString *messageEntityName;
36 | @property (strong) NSString *contactEntityName;
37 |
38 | - (NSEntityDescription *)messageEntity:(NSManagedObjectContext *)moc;
39 | - (NSEntityDescription *)contactEntity:(NSManagedObjectContext *)moc;
40 |
41 | - (XMPPMessageArchiving_Contact_CoreDataObject *)contactForMessage:(XMPPMessageArchiving_Message_CoreDataObject *)msg;
42 |
43 | - (XMPPMessageArchiving_Contact_CoreDataObject *)contactWithJid:(XMPPJID *)contactJid
44 | streamJid:(XMPPJID *)streamJid
45 | managedObjectContext:(NSManagedObjectContext *)moc;
46 |
47 | - (XMPPMessageArchiving_Contact_CoreDataObject *)contactWithBareJidStr:(NSString *)contactBareJidStr
48 | streamBareJidStr:(NSString *)streamBareJidStr
49 | managedObjectContext:(NSManagedObjectContext *)moc;
50 |
51 | /* Inherited from XMPPCoreDataStorage
52 | * Please see the XMPPCoreDataStorage header file for extensive documentation.
53 |
54 | - (id)initWithDatabaseFilename:(NSString *)databaseFileName storeOptions:(NSDictionary *)storeOptions;
55 | - (id)initWithInMemoryStore;
56 |
57 | @property (readonly) NSString *databaseFileName;
58 |
59 | @property (readwrite) NSUInteger saveThreshold;
60 |
61 | @property (readonly) NSManagedObjectModel *managedObjectModel;
62 | @property (readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
63 |
64 | @property (readonly) NSManagedObjectContext *mainThreadManagedObjectContext;
65 |
66 | */
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchiving_Contact_CoreDataObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "XMPP.h"
4 |
5 |
6 | @interface XMPPMessageArchiving_Contact_CoreDataObject : NSManagedObject
7 |
8 | @property (nonatomic, strong) XMPPJID * bareJid; // Transient (proper type, not on disk)
9 | @property (nonatomic, strong) NSString * bareJidStr; // Shadow (binary data, written to disk)
10 |
11 | @property (nonatomic, strong) NSDate * mostRecentMessageTimestamp;
12 | @property (nonatomic, strong) NSString * mostRecentMessageBody;
13 | @property (nonatomic, strong) NSNumber * mostRecentMessageOutgoing;
14 |
15 | @property (nonatomic, strong) NSString * streamBareJidStr;
16 |
17 | /**
18 | * This method is called immediately before the object is inserted into the managedObjectContext.
19 | * At this point, all normal properties have been set.
20 | *
21 | * If you extend XMPPMessageArchiving_Contact_CoreDataObject,
22 | * you can use this method as a hook to set your custom properties.
23 | **/
24 | - (void)willInsertObject;
25 |
26 | /**
27 | * This method is called after any properties on the object have been updated,
28 | * due to a message being added to the conversation.
29 | * At this point, any changed properties have been updated.
30 | *
31 | * If you extend XMPPMessageArchiving_Contact_CoreDataObject,
32 | * you can use this method as a hook to update your custom properties.
33 | **/
34 | - (void)didUpdateObject;
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchiving_Contact_CoreDataObject.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessageArchiving_Contact_CoreDataObject.h"
2 |
3 |
4 | @interface XMPPMessageArchiving_Contact_CoreDataObject ()
5 |
6 | @property (nonatomic, strong) XMPPJID * primitiveBareJid;
7 | @property (nonatomic, strong) NSString * primitiveBareJidStr;
8 |
9 | @end
10 |
11 |
12 | @implementation XMPPMessageArchiving_Contact_CoreDataObject
13 |
14 | @dynamic bareJid, primitiveBareJid;
15 | @dynamic bareJidStr, primitiveBareJidStr;
16 | @dynamic mostRecentMessageTimestamp;
17 | @dynamic mostRecentMessageBody;
18 | @dynamic mostRecentMessageOutgoing;
19 | @dynamic streamBareJidStr;
20 |
21 | #pragma mark Transient bareJid
22 |
23 | - (XMPPJID *)bareJid
24 | {
25 | // Create and cache on demand
26 |
27 | [self willAccessValueForKey:@"bareJid"];
28 | XMPPJID *tmp = self.primitiveBareJid;
29 | [self didAccessValueForKey:@"bareJid"];
30 |
31 | if (tmp == nil)
32 | {
33 | NSString *bareJidStr = self.bareJidStr;
34 | if (bareJidStr)
35 | {
36 | tmp = [XMPPJID jidWithString:bareJidStr];
37 | self.primitiveBareJid = tmp;
38 | }
39 | }
40 |
41 | return tmp;
42 | }
43 |
44 | - (void)setBareJid:(XMPPJID *)bareJid
45 | {
46 | if ([self.bareJid isEqualToJID:bareJid options:XMPPJIDCompareBare])
47 | {
48 | return; // No change
49 | }
50 |
51 | [self willChangeValueForKey:@"bareJid"];
52 | [self willChangeValueForKey:@"bareJidStr"];
53 |
54 | self.primitiveBareJid = [bareJid bareJID];
55 | self.primitiveBareJidStr = [bareJid bare];
56 |
57 | [self didChangeValueForKey:@"bareJid"];
58 | [self didChangeValueForKey:@"bareJidStr"];
59 | }
60 |
61 | - (void)setBareJidStr:(NSString *)bareJidStr
62 | {
63 | if ([self.bareJidStr isEqualToString:bareJidStr])
64 | {
65 | return; // No change
66 | }
67 |
68 | [self willChangeValueForKey:@"bareJid"];
69 | [self willChangeValueForKey:@"bareJidStr"];
70 |
71 | XMPPJID *bareJid = [[XMPPJID jidWithString:bareJidStr] bareJID];
72 |
73 | self.primitiveBareJid = bareJid;
74 | self.primitiveBareJidStr = [bareJid bare];
75 |
76 | [self didChangeValueForKey:@"bareJid"];
77 | [self didChangeValueForKey:@"bareJidStr"];
78 | }
79 |
80 | #pragma mark Hooks
81 |
82 | - (void)willInsertObject
83 | {
84 | // If you extend XMPPMessageArchiving_Contact_CoreDataObject,
85 | // you can override this method to use as a hook to set your own custom properties.
86 | }
87 |
88 | - (void)didUpdateObject
89 | {
90 | // If you extend XMPPMessageArchiving_Contact_CoreDataObject,
91 | // you can override this method to use as a hook to update your own custom properties.
92 | }
93 |
94 | @end
95 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0136/CoreDataStorage/XMPPMessageArchiving_Message_CoreDataObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "XMPP.h"
4 |
5 |
6 | @interface XMPPMessageArchiving_Message_CoreDataObject : NSManagedObject
7 |
8 | @property (nonatomic, strong) XMPPMessage * message; // Transient (proper type, not on disk)
9 | @property (nonatomic, strong) NSString * messageStr; // Shadow (binary data, written to disk)
10 |
11 | /**
12 | * This is the bare jid of the person you're having the conversation with.
13 | * For example: robbiehanson@deusty.com
14 | *
15 | * Regardless of whether the message was incoming or outgoing,
16 | * this will represent the "other" participant in the conversation.
17 | **/
18 | @property (nonatomic, strong) XMPPJID * bareJid; // Transient (proper type, not on disk)
19 | @property (nonatomic, strong) NSString * bareJidStr; // Shadow (binary data, written to disk)
20 |
21 | @property (nonatomic, strong) NSString * body;
22 | @property (nonatomic, strong) NSString * thread;
23 |
24 | @property (nonatomic, strong) NSNumber * outgoing; // Use isOutgoing
25 | @property (nonatomic, assign) BOOL isOutgoing; // Convenience property
26 |
27 | @property (nonatomic, strong) NSNumber * composing; // Use isComposing
28 | @property (nonatomic, assign) BOOL isComposing; // Convenience property
29 |
30 | @property (nonatomic, strong) NSDate * timestamp;
31 |
32 | @property (nonatomic, strong) NSString * streamBareJidStr;
33 |
34 | /**
35 | * This method is called immediately before the object is inserted into the managedObjectContext.
36 | * At this point, all normal properties have been set.
37 | *
38 | * If you extend XMPPMessageArchiving_Message_CoreDataObject,
39 | * you can use this method as a hook to set your custom properties.
40 | **/
41 | - (void)willInsertObject;
42 |
43 | /**
44 | * This method is called immediately after the message has been changed.
45 | * At this point, all normal properties have been updated.
46 | *
47 | * If you extend XMPPMessageArchiving_Message_CoreDataObject,
48 | * you can use this method as a hook to set your custom properties.
49 | **/
50 | - (void)didUpdateObject;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0153/XMPPvCardAvatarModule.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPvCardAvatarModule.h
3 | // XEP-0153 vCard-Based Avatars
4 | //
5 | // Created by Eric Chamberlain on 3/9/11.
6 | // Copyright 2011 RF.com. All rights reserved.
7 |
8 | /*
9 | * NOTE: Currently this implementation only supports downloading and caching avatars.
10 | */
11 |
12 |
13 | #import
14 |
15 | #if !TARGET_OS_IPHONE
16 | #import
17 | #endif
18 |
19 | #import "XMPP.h"
20 | #import "XMPPvCardTempModule.h"
21 |
22 | #define _XMPP_VCARD_AVATAR_MODULE_H
23 |
24 | @protocol XMPPvCardAvatarStorage;
25 |
26 |
27 | @interface XMPPvCardAvatarModule : XMPPModule
28 | {
29 | __strong XMPPvCardTempModule *_xmppvCardTempModule;
30 | __strong id _moduleStorage;
31 |
32 | BOOL _autoClearMyvcard;
33 | }
34 |
35 | @property(nonatomic, strong, readonly) XMPPvCardTempModule *xmppvCardTempModule;
36 |
37 |
38 | /*
39 | * XEP-0153 Section 4.2 rule 1
40 | *
41 | * A client MUST NOT advertise an avatar image without first downloading the current vCard.
42 | * Once it has done this, it MAY advertise an image.
43 | *
44 | * Default YES
45 | */
46 | @property(nonatomic, assign) BOOL autoClearMyvcard;
47 |
48 |
49 | - (id)initWithvCardTempModule:(XMPPvCardTempModule *)xmppvCardTempModule;
50 | - (id)initWithvCardTempModule:(XMPPvCardTempModule *)xmppvCardTempModule dispatchQueue:(dispatch_queue_t)queue;
51 |
52 |
53 | - (NSData *)photoDataForJID:(XMPPJID *)jid;
54 |
55 | @end
56 |
57 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
58 | #pragma mark -
59 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
60 |
61 | @protocol XMPPvCardAvatarDelegate
62 |
63 | #if TARGET_OS_IPHONE
64 | - (void)xmppvCardAvatarModule:(XMPPvCardAvatarModule *)vCardTempModule
65 | didReceivePhoto:(UIImage *)photo
66 | forJID:(XMPPJID *)jid;
67 | #else
68 | - (void)xmppvCardAvatarModule:(XMPPvCardAvatarModule *)vCardTempModule
69 | didReceivePhoto:(NSImage *)photo
70 | forJID:(XMPPJID *)jid;
71 | #endif
72 |
73 | @end
74 |
75 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76 | #pragma mark -
77 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
78 |
79 | @protocol XMPPvCardAvatarStorage
80 |
81 | - (NSData *)photoDataForJID:(XMPPJID *)jid xmppStream:(XMPPStream *)stream;
82 | - (NSString *)photoHashForJID:(XMPPJID *)jid xmppStream:(XMPPStream *)stream;
83 |
84 | /**
85 | * Clears the vCardTemp from the store.
86 | * This is used so we can clear any cached vCardTemp's for the JID.
87 | **/
88 | - (void)clearvCardTempForJID:(XMPPJID *)jid xmppStream:(XMPPStream *)stream;
89 |
90 | @end
91 |
92 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0172/XMPPMessage+XEP_0172.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPMessage.h"
3 |
4 | @interface XMPPMessage (XEP_0172)
5 |
6 | - (NSString *)nick;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0172/XMPPMessage+XEP_0172.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP_0172.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 | #define XMLNS_NICK @"http://jabber.org/protocol/nick"
5 |
6 | @implementation XMPPMessage (XEP_0172)
7 |
8 | - (NSString *)nick
9 | {
10 | return [[self elementForName:@"nick" xmlns:XMLNS_NICK] stringValue];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0172/XMPPPresence+XEP_0172.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPPresence.h"
3 |
4 | @interface XMPPPresence (XEP_0172)
5 |
6 | - (NSString *)nick;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0172/XMPPPresence+XEP_0172.m:
--------------------------------------------------------------------------------
1 | #import "XMPPPresence+XEP_0172.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 | #define XMLNS_NICK @"http://jabber.org/protocol/nick"
5 |
6 | @implementation XMPPPresence (XEP_0172)
7 |
8 | - (NSString *)nick{
9 | return [[self elementForName:@"nick" xmlns:XMLNS_NICK] stringValue];
10 | }
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0184/XMPPMessage+XEP_0184.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPPMessage.h"
3 |
4 |
5 | @interface XMPPMessage (XEP_0184)
6 |
7 | - (BOOL)hasReceiptRequest;
8 | - (BOOL)hasReceiptResponse;
9 | - (NSString *)receiptResponseID;
10 | - (XMPPMessage *)generateReceiptResponse;
11 |
12 | - (void)addReceiptRequest;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0184/XMPPMessage+XEP_0184.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP_0184.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 |
5 | @implementation XMPPMessage (XEP_0184)
6 |
7 | - (BOOL)hasReceiptRequest
8 | {
9 | NSXMLElement *receiptRequest = [self elementForName:@"request" xmlns:@"urn:xmpp:receipts"];
10 |
11 | return (receiptRequest != nil);
12 | }
13 |
14 | - (BOOL)hasReceiptResponse
15 | {
16 | NSXMLElement *receiptResponse = [self elementForName:@"received" xmlns:@"urn:xmpp:receipts"];
17 |
18 | return (receiptResponse != nil);
19 | }
20 |
21 | - (NSString *)receiptResponseID
22 | {
23 | NSXMLElement *receiptResponse = [self elementForName:@"received" xmlns:@"urn:xmpp:receipts"];
24 |
25 | return [receiptResponse attributeStringValueForName:@"id"];
26 | }
27 |
28 | - (XMPPMessage *)generateReceiptResponse
29 | {
30 | // Example:
31 | //
32 | //
33 | //
34 | //
35 |
36 | NSXMLElement *received = [NSXMLElement elementWithName:@"received" xmlns:@"urn:xmpp:receipts"];
37 |
38 | NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
39 |
40 | NSString *to = [self fromStr];
41 | if (to)
42 | {
43 | [message addAttributeWithName:@"to" stringValue:to];
44 | }
45 |
46 | NSString *msgid = [self elementID];
47 | if (msgid)
48 | {
49 | [received addAttributeWithName:@"id" stringValue:msgid];
50 | }
51 |
52 | [message addChild:received];
53 |
54 | return [[self class] messageFromElement:message];
55 | }
56 |
57 |
58 | - (void)addReceiptRequest
59 | {
60 | NSXMLElement *receiptRequest = [NSXMLElement elementWithName:@"request" xmlns:@"urn:xmpp:receipts"];
61 | [self addChild:receiptRequest];
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0184/XMPPMessageDeliveryReceipts.h:
--------------------------------------------------------------------------------
1 | #import "XMPPModule.h"
2 |
3 | #define _XMPP_MESSAGE_DELIVERY_RECEIPTS_H
4 |
5 | /**
6 | * XMPPMessageDeliveryReceipts can be configured to automatically send delivery receipts and requests in accordance to XEP-0184
7 | **/
8 |
9 | @interface XMPPMessageDeliveryReceipts : XMPPModule
10 |
11 | /**
12 | * Automatically add message delivery requests to outgoing messages, in all situations that are permitted in XEP-0184
13 | *
14 | * - Message MUST NOT be of type 'error' or 'groupchat'
15 | * - Message MUST have an id
16 | * - Message MUST NOT have a delivery receipt or request
17 | * - To must either be a bare JID or a full JID that advertises the urn:xmpp:receipts capability
18 | *
19 | * Default NO
20 | **/
21 |
22 | @property (assign) BOOL autoSendMessageDeliveryRequests;
23 |
24 | /**
25 | * Automatically send message delivery receipts when a message with a delivery request is received
26 | *
27 | * Default NO
28 | **/
29 |
30 | @property (assign) BOOL autoSendMessageDeliveryReceipts;
31 |
32 | @end
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0199/XMPPPing.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "XMPP.h"
3 |
4 | #define _XMPP_PING_H
5 |
6 | @class XMPPIDTracker;
7 |
8 |
9 | @interface XMPPPing : XMPPModule
10 | {
11 | BOOL respondsToQueries;
12 | XMPPIDTracker *pingTracker;
13 | }
14 |
15 | /**
16 | * Whether or not the module should respond to incoming ping queries.
17 | * It you create multiple instances of this module, only one instance should respond to queries.
18 | *
19 | * It is recommended you set this (if needed) before you activate the module.
20 | * The default value is YES.
21 | **/
22 | @property (readwrite) BOOL respondsToQueries;
23 |
24 | /**
25 | * Send pings to the server or a specific JID.
26 | * The disco module may be used to detect if the target supports ping.
27 | *
28 | * The returned string is the pingID (the elementID of the query that was sent).
29 | * In other words:
30 | *
31 | * SEND:
32 | * RECV:
33 | *
34 | * This may be helpful if you are sending multiple simultaneous pings to the same target.
35 | **/
36 | - (NSString *)sendPingToServer;
37 | - (NSString *)sendPingToServerWithTimeout:(NSTimeInterval)timeout;
38 | - (NSString *)sendPingToJID:(XMPPJID *)jid;
39 | - (NSString *)sendPingToJID:(XMPPJID *)jid withTimeout:(NSTimeInterval)timeout;
40 |
41 | @end
42 |
43 | @protocol XMPPPingDelegate
44 | @optional
45 |
46 | - (void)xmppPing:(XMPPPing *)sender didReceivePong:(XMPPIQ *)pong withRTT:(NSTimeInterval)rtt;
47 | - (void)xmppPing:(XMPPPing *)sender didNotReceivePong:(NSString *)pingID dueToTimeout:(NSTimeInterval)timeout;
48 |
49 | // Note: If the xmpp stream is disconnected, no delegate methods will be called, and outstanding pings are forgotten.
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0203/NSXMLElement+XEP_0203.h:
--------------------------------------------------------------------------------
1 | #import
2 | #if TARGET_OS_IPHONE
3 | #import "DDXML.h"
4 | #endif
5 |
6 |
7 | @interface NSXMLElement (XEP_0203)
8 |
9 | - (BOOL)wasDelayed;
10 | - (NSDate *)delayedDeliveryDate;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0203/NSXMLElement+XEP_0203.m:
--------------------------------------------------------------------------------
1 | #import "NSXMLElement+XEP_0203.h"
2 | #import "XMPPDateTimeProfiles.h"
3 | #import "NSXMLElement+XMPP.h"
4 |
5 | #if ! __has_feature(objc_arc)
6 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
7 | #endif
8 |
9 | @implementation NSXMLElement (XEP_0203)
10 |
11 | - (BOOL)wasDelayed
12 | {
13 | NSXMLElement *delay;
14 |
15 | delay = [self elementForName:@"delay" xmlns:@"urn:xmpp:delay"];
16 | if (delay)
17 | {
18 | return YES;
19 | }
20 |
21 | delay = [self elementForName:@"x" xmlns:@"jabber:x:delay"];
22 | if (delay)
23 | {
24 | return YES;
25 | }
26 |
27 | return NO;
28 | }
29 |
30 | - (NSDate *)delayedDeliveryDate
31 | {
32 | NSXMLElement *delay;
33 |
34 | // From XEP-0203 (Delayed Delivery)
35 | //
36 | //
39 | //
40 | // The format [of the stamp attribute] MUST adhere to the dateTime format
41 | // specified in XEP-0082 and MUST be expressed in UTC.
42 |
43 | delay = [self elementForName:@"delay" xmlns:@"urn:xmpp:delay"];
44 | if (delay)
45 | {
46 | NSString *stampValue = [delay attributeStringValueForName:@"stamp"];
47 |
48 | // There are other considerations concerning XEP-0082.
49 | // For example, it may optionally contain milliseconds.
50 | // And it may possibly express UTC as "+00:00" instead of "Z".
51 | //
52 | // Thankfully there is already an implementation that takes into account all these possibilities.
53 |
54 | return [XMPPDateTimeProfiles parseDateTime:stampValue];
55 | }
56 |
57 | // From XEP-0091 (Legacy Delayed Delivery)
58 | //
59 | //
62 |
63 | delay = [self elementForName:@"x" xmlns:@"jabber:x:delay"];
64 | if (delay)
65 | {
66 | NSDate *stamp;
67 |
68 | NSString *stampValue = [delay attributeStringValueForName:@"stamp"];
69 |
70 | NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
71 | [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
72 | [dateFormatter setDateFormat:@"yyyyMMdd'T'HH:mm:ss"];
73 | [dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];
74 |
75 | stamp = [dateFormatter dateFromString:stampValue];
76 |
77 | return stamp;
78 | }
79 |
80 | return nil;
81 | }
82 |
83 | @end
84 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0223/XEP_0223.h:
--------------------------------------------------------------------------------
1 | /**
2 | * XEP-0223 : Persistent Storage of Private Data via PubSub
3 | *
4 | * This specification defines best practices for using the XMPP publish-subscribe extension to
5 | * persistently store private information such as bookmarks and client configuration options.
6 | *
7 | * http://xmpp.org/extensions/xep-0223.html
8 | **/
9 |
10 | #import
11 |
12 |
13 | @interface XEP_0223 : NSObject
14 |
15 | /**
16 | * This method returns the recommended configuration options to configure a pubsub node for storing private data.
17 | * It may be passed directly to the publishToNoe:::: method of XMPPPubSub.
18 | **/
19 | + (NSDictionary *)privateStoragePubSubOptions;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0223/XEP_0223.m:
--------------------------------------------------------------------------------
1 | /**
2 | * XEP-0223 : Persistent Storage of Private Data via PubSub
3 | *
4 | * This specification defines best practices for using the XMPP publish-subscribe extension to
5 | * persistently store private information such as bookmarks and client configuration options.
6 | *
7 | * http://xmpp.org/extensions/xep-0223.html
8 | **/
9 |
10 | #import "XEP_0223.h"
11 |
12 | @implementation XEP_0223
13 |
14 | + (NSDictionary *)privateStoragePubSubOptions
15 | {
16 | return @{ @"pubsub#persist_items" : @(YES),
17 | @"pubsub#access_model" : @"whitelist" };
18 | }
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0224/XMPPAttentionModule.h:
--------------------------------------------------------------------------------
1 | #import "XMPPModule.h"
2 | #import "XMPPMessage+XEP_0224.h"
3 |
4 | #define _XMPP_ATTENTION_MODULE_H
5 |
6 | @interface XMPPAttentionModule : XMPPModule {
7 | BOOL respondsToQueries;
8 | }
9 |
10 | /**
11 | * Whether or not the module should respond to incoming attention request queries.
12 | * It you create multiple instances of this module, only one instance should respond to queries.
13 | *
14 | * It is recommended you set this (if needed) before you activate the module.
15 | * The default value is YES.
16 | **/
17 | @property (readwrite) BOOL respondsToQueries;
18 |
19 | @end
20 |
21 | @protocol XMPPAttentionDelegate
22 | @optional
23 | - (void)xmppAttention:(XMPPAttentionModule *)sender didReceiveAttentionHeadlineMessage:(XMPPMessage *)attentionRequest;
24 | @end
25 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0224/XMPPMessage+XEP_0224.h:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage.h"
2 | #define XMLNS_ATTENTION @"urn:xmpp:attention:0"
3 |
4 | @interface XMPPMessage (XEP_0224)
5 | - (BOOL)isHeadLineMessage;
6 | - (BOOL)isAttentionMessage;
7 | - (BOOL)isAttentionMessageWithBody;
8 | @end
9 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0224/XMPPMessage+XEP_0224.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP_0224.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 | @implementation XMPPMessage (XEP_0224)
5 |
6 | - (BOOL)isHeadLineMessage {
7 | return [[[self attributeForName:@"type"] stringValue] isEqualToString:@"headline"];
8 | }
9 |
10 | - (BOOL)isAttentionMessage
11 | {
12 | return [self isHeadLineMessage] && [self elementForName:@"attention" xmlns:XMLNS_ATTENTION];
13 | }
14 |
15 | - (BOOL)isAttentionMessageWithBody
16 | {
17 | if([self isAttentionMessage])
18 | {
19 | return [self isMessageWithBody];
20 | }
21 | return NO;
22 | }
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0297/NSXMLElement+XEP_0297.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #if TARGET_OS_IPHONE
4 | #import "DDXML.h"
5 | #endif
6 |
7 | @class XMPPIQ;
8 | @class XMPPMessage;
9 | @class XMPPPresence;
10 |
11 | @interface NSXMLElement (XEP_0297)
12 |
13 | #pragma mark Forwarded Stanza
14 |
15 | - (NSXMLElement *)forwardedStanza;
16 |
17 | - (BOOL)hasForwardedStanza;
18 |
19 | - (BOOL)isForwardedStanza;
20 |
21 | #pragma mark Delayed Delivery Date
22 |
23 | - (NSDate *)forwardedStanzaDelayedDeliveryDate;
24 |
25 | #pragma mark XMPPElement
26 |
27 | - (XMPPIQ *)forwardedIQ;
28 |
29 | - (BOOL)hasForwardedIQ;
30 |
31 | - (XMPPMessage *)forwardedMessage;
32 |
33 | - (BOOL)hasForwardedMessage;
34 |
35 | - (XMPPPresence *)forwardedPresence;
36 |
37 | - (BOOL)hasForwardedPresence;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0308/XMPPMessage+XEP_0308.h:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage.h"
2 |
3 | @interface XMPPMessage (XEP_0308)
4 |
5 | - (BOOL)isMessageCorrection;
6 |
7 | - (NSString *)correctedMessageID;
8 |
9 | - (void)addMessageCorrectionWithID:(NSString *)messageCorrectionID;
10 |
11 | - (XMPPMessage *)generateCorrectionMessageWithID:(NSString *)elementID;
12 | - (XMPPMessage *)generateCorrectionMessageWithID:(NSString *)elementID body:(NSString *)body;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0308/XMPPMessage+XEP_0308.m:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage+XEP_0308.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 | #if ! __has_feature(objc_arc)
5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
6 | #endif
7 |
8 | #define NAME_XMPP_MESSAGE_CORRECT @"replace"
9 | #define XMLNS_XMPP_MESSAGE_CORRECT @"urn:xmpp:message-correct:0"
10 |
11 | @implementation XMPPMessage (XEP_0308)
12 |
13 | - (BOOL)isMessageCorrection
14 | {
15 | if([[self correctedMessageID] length])
16 | {
17 | return YES;
18 | }
19 | else
20 | {
21 | return NO;
22 | }
23 | }
24 |
25 | - (NSString *)correctedMessageID
26 | {
27 | return [[self elementForName:NAME_XMPP_MESSAGE_CORRECT xmlns:XMLNS_XMPP_MESSAGE_CORRECT] attributeStringValueForName:@"id"];
28 | }
29 |
30 | - (void)addMessageCorrectionWithID:(NSString *)messageCorrectionID
31 | {
32 | NSXMLElement *replace = [NSXMLElement elementWithName:NAME_XMPP_MESSAGE_CORRECT stringValue:XMLNS_XMPP_MESSAGE_CORRECT];
33 | [replace addAttributeWithName:@"id" stringValue:messageCorrectionID];
34 | [self addChild:replace];
35 | }
36 |
37 | - (XMPPMessage *)generateCorrectionMessageWithID:(NSString *)elementID
38 | {
39 | XMPPMessage *correctionMessage = nil;
40 |
41 | if([[self elementID] length] && ![self isMessageCorrection])
42 | {
43 | correctionMessage = [self copy];
44 |
45 | [correctionMessage removeAttributeForName:@"id"];
46 |
47 | if([elementID length])
48 | {
49 | [correctionMessage addAttributeWithName:@"id" stringValue:elementID];
50 | }
51 |
52 | [correctionMessage addMessageCorrectionWithID:[self elementID]];
53 | }
54 |
55 | return correctionMessage;
56 | }
57 |
58 | - (XMPPMessage *)generateCorrectionMessageWithID:(NSString *)elementID body:(NSString *)body
59 | {
60 | XMPPMessage *correctionMessage = nil;
61 |
62 | if([[self elementID] length] && ![self isMessageCorrection])
63 | {
64 | correctionMessage = [self copy];
65 |
66 | [correctionMessage removeAttributeForName:@"id"];
67 |
68 | if([elementID length])
69 | {
70 | [correctionMessage addAttributeWithName:@"id" stringValue:elementID];
71 | }
72 |
73 | NSXMLElement *bodyElement = [correctionMessage elementForName:@"body"];
74 |
75 | if(bodyElement)
76 | {
77 | [correctionMessage removeChildAtIndex:[[correctionMessage children] indexOfObject:bodyElement]];
78 | }
79 |
80 | [self addBody:body];
81 |
82 | [correctionMessage addMessageCorrectionWithID:[self elementID]];
83 | }
84 |
85 | return correctionMessage;
86 | }
87 |
88 | @end
89 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0333/XMPPMessage+XEP_0333.h:
--------------------------------------------------------------------------------
1 | #import "XMPPMessage.h"
2 |
3 | @interface XMPPMessage (XEP_0333)
4 |
5 | - (BOOL)hasChatMarker;
6 |
7 | - (BOOL)hasMarkableChatMarker;
8 | - (BOOL)hasReceivedChatMarker;
9 | - (BOOL)hasDisplayedChatMarker;
10 | - (BOOL)hasAcknowledgedChatMarker;
11 |
12 | - (NSString *)chatMarker;
13 | - (NSString *)chatMarkerID;
14 |
15 | - (void)addMarkableChatMarker;
16 | - (void)addReceivedChatMarkerWithID:(NSString *)elementID;
17 | - (void)addDisplayedChatMarkerWithID:(NSString *)elementID;
18 | - (void)addAcknowledgedChatMarkerWithID:(NSString *)elementID;
19 |
20 | - (XMPPMessage *)generateReceivedChatMarker;
21 | - (XMPPMessage *)generateDisplayedChatMarker;
22 | - (XMPPMessage *)generateAcknowledgedChatMarker;
23 |
24 | - (XMPPMessage *)generateReceivedChatMarkerIncludingThread:(BOOL)includingThread;
25 | - (XMPPMessage *)generateDisplayedChatMarkerIncludingThread:(BOOL)includingThread;
26 | - (XMPPMessage *)generateAcknowledgedChatMarkerIncludingThread:(BOOL)includingThread;
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0335/NSXMLElement+XEP_0335.h:
--------------------------------------------------------------------------------
1 | #import
2 | #if TARGET_OS_IPHONE
3 | #import "DDXML.h"
4 | #endif
5 |
6 | @interface NSXMLElement (XEP_0335)
7 |
8 | - (NSXMLElement *)JSONContainer;
9 |
10 | - (BOOL)isJSONContainer;
11 | - (BOOL)hasJSONContainer;
12 |
13 | - (NSString *)JSONContainerString;
14 | - (NSData *)JSONContainerData;
15 | - (id)JSONContainerObject;
16 |
17 | - (void)addJSONContainerWithString:(NSString *)JSONContainerString;
18 | - (void)addJSONContainerWithData:(NSData *)JSONContainerData;
19 | - (void)addJSONContainerWithObject:(id)JSONContainerObject;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Extensions/XEP-0335/NSXMLElement+XEP_0335.m:
--------------------------------------------------------------------------------
1 | #import "NSXMLElement+XEP_0335.h"
2 | #import "NSXMLElement+XMPP.h"
3 |
4 | #if ! __has_feature(objc_arc)
5 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
6 | #endif
7 |
8 | #define XEP_0335_NAME @"json"
9 | #define XEP_0335_XMLNS @"urn:xmpp:json:0"
10 |
11 | @implementation NSXMLElement (XEP_0335)
12 |
13 | - (NSXMLElement *)JSONContainer
14 | {
15 | if([self isJSONContainer])
16 | {
17 | return self;
18 | }
19 | else
20 | {
21 | return [self elementForName:XEP_0335_NAME xmlns:XEP_0335_XMLNS];
22 | }
23 | }
24 |
25 | - (BOOL)isJSONContainer
26 | {
27 | if([[self name] isEqualToString:XEP_0335_NAME] && [[self xmlns] isEqualToString:XEP_0335_XMLNS])
28 | {
29 | return YES;
30 | }
31 | else
32 | {
33 | return NO;
34 | }
35 | }
36 |
37 | - (BOOL)hasJSONContainer
38 | {
39 | return [self elementForName:XEP_0335_NAME xmlns:XEP_0335_XMLNS] != nil;
40 | }
41 |
42 | - (NSString *)JSONContainerString
43 | {
44 | return [[self JSONContainer] stringValue];
45 | }
46 |
47 | - (NSData *)JSONContainerData
48 | {
49 | NSString *JSONContainerString = [self JSONContainerString];
50 | return [JSONContainerString dataUsingEncoding:NSUTF8StringEncoding];
51 | }
52 |
53 | - (id)JSONContainerObject
54 | {
55 | NSData *JSONData = [self JSONContainerData];
56 | return [NSJSONSerialization JSONObjectWithData:JSONData options:0 error:nil];
57 | }
58 |
59 | - (void)addJSONContainerWithString:(NSString *)JSONContainerString
60 | {
61 | if([JSONContainerString length])
62 | {
63 | NSXMLElement *container = [NSXMLElement elementWithName:XEP_0335_NAME xmlns:XEP_0335_XMLNS];
64 | [container setStringValue:JSONContainerString];
65 | [self addChild:container];
66 | }
67 | }
68 |
69 | - (void)addJSONContainerWithData:(NSData *)JSONContainerData
70 | {
71 | if([JSONContainerData length])
72 | {
73 | NSString *JSONContainerString = [[NSString alloc] initWithData:JSONContainerData encoding:NSUTF8StringEncoding];
74 | [self addJSONContainerWithString:JSONContainerString];
75 | }
76 | }
77 |
78 | - (void)addJSONContainerWithObject:(id)JSONContainerObject
79 | {
80 | if([NSJSONSerialization isValidJSONObject:JSONContainerObject])
81 | {
82 | NSData *JSONContainerData = [NSJSONSerialization dataWithJSONObject:JSONContainerObject options:0 error:nil];
83 | [self addJSONContainerWithData:JSONContainerData];
84 | }
85 | }
86 |
87 | @end
88 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/DDList.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class DDListEnumerator;
4 |
5 | struct DDListNode {
6 | void * element;
7 | struct DDListNode * prev;
8 | struct DDListNode * next;
9 | };
10 | typedef struct DDListNode DDListNode;
11 |
12 |
13 | /**
14 | * The DDList class is designed as a simple list class.
15 | * It can store objective-c objects as well as non-objective-c pointers.
16 | * It does not retain objective-c objects as it treats all elements as simple pointers.
17 | *
18 | * Example usages:
19 | * - Storing a list of delegates, where there is a desire to not retain the individual delegates.
20 | * - Storing a list of dispatch timers, which are not NSObjects, and cannot be stored in NSCollection classes.
21 | *
22 | * This class is NOT thread-safe.
23 | * It is designed to be used within a thread-safe context (e.g. within a single dispatch_queue).
24 | **/
25 | @interface DDList : NSObject
26 | {
27 | DDListNode *listHead;
28 | DDListNode *listTail;
29 | }
30 |
31 | - (void)add:(void *)element;
32 | - (void)remove:(void *)element;
33 | - (void)removeAll:(void *)element;
34 | - (void)removeAllElements;
35 |
36 | - (BOOL)contains:(void *)element;
37 |
38 | - (NSUInteger)count;
39 |
40 | /**
41 | * The enumerators return a snapshot of the list that can be enumerated.
42 | * The list can later be altered (elements added/removed) without affecting enumerator snapshots.
43 | **/
44 | - (DDListEnumerator *)listEnumerator;
45 | - (DDListEnumerator *)reverseListEnumerator;
46 |
47 | @end
48 |
49 | @interface DDListEnumerator : NSObject
50 | {
51 | NSUInteger numElements;
52 | NSUInteger currentElementIndex;
53 | void **elements;
54 | }
55 |
56 | - (NSUInteger)numTotal;
57 | - (NSUInteger)numLeft;
58 |
59 | - (void *)nextElement;
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/GCDMulticastDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class GCDMulticastDelegateEnumerator;
4 |
5 | /**
6 | * This class provides multicast delegate functionality. That is:
7 | * - it provides a means for managing a list of delegates
8 | * - any method invocations to an instance of this class are automatically forwarded to all delegates
9 | *
10 | * For example:
11 | *
12 | * // Make this method call on every added delegate (there may be several)
13 | * [multicastDelegate cog:self didFindThing:thing];
14 | *
15 | * This allows multiple delegates to be added to an xmpp stream or any xmpp module,
16 | * which in turn makes development easier as there can be proper separation of logically different code sections.
17 | *
18 | * In addition, this makes module development easier,
19 | * as multiple delegates can usually be handled in a manner similar to the traditional single delegate paradigm.
20 | *
21 | * This class also provides proper support for GCD queues.
22 | * So each delegate specifies which queue they would like their delegate invocations to be dispatched onto.
23 | *
24 | * All delegate dispatching is done asynchronously (which is a critically important architectural design).
25 | **/
26 |
27 | @interface GCDMulticastDelegate : NSObject
28 |
29 | - (void)addDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
30 | - (void)removeDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue;
31 | - (void)removeDelegate:(id)delegate;
32 |
33 | - (void)removeAllDelegates;
34 |
35 | - (NSUInteger)count;
36 | - (NSUInteger)countOfClass:(Class)aClass;
37 | - (NSUInteger)countForSelector:(SEL)aSelector;
38 |
39 | - (BOOL)hasDelegateThatRespondsToSelector:(SEL)aSelector;
40 |
41 | - (GCDMulticastDelegateEnumerator *)delegateEnumerator;
42 |
43 | @end
44 |
45 |
46 | @interface GCDMulticastDelegateEnumerator : NSObject
47 |
48 | - (NSUInteger)count;
49 | - (NSUInteger)countOfClass:(Class)aClass;
50 | - (NSUInteger)countForSelector:(SEL)aSelector;
51 |
52 | - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr;
53 | - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr ofClass:(Class)aClass;
54 | - (BOOL)getNextDelegate:(id *)delPtr delegateQueue:(dispatch_queue_t *)dqPtr forSelector:(SEL)aSelector;
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/RFImageToDataTransformer.h:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | File: RFImageToDataTransformer.h
4 | Abstract: A value transformer, which transforms a UIImage or NSImage object into an NSData object.
5 |
6 | Based on Apple's UIImageToDataTransformer
7 |
8 | Copyright (C) 2010 Apple Inc. All Rights Reserved.
9 | Copyright (C) 2011 RF.com All Rights Reserved.
10 | */
11 |
12 | #import
13 |
14 |
15 | @interface RFImageToDataTransformer : NSValueTransformer {
16 |
17 | }
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/RFImageToDataTransformer.m:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | File: RFImageToDataTransformer.m
4 | Abstract: A value transformer, which transforms a UIImage or NSImage object into an NSData object.
5 |
6 | Based on Apple's UIImageToDataTransformer
7 |
8 | Copyright (C) 2010 Apple Inc. All Rights Reserved.
9 | Copyright (C) 2011 RF.com All Rights Reserved.
10 | */
11 |
12 | #import "RFImageToDataTransformer.h"
13 |
14 | #if TARGET_OS_IPHONE
15 | #import
16 | #else
17 |
18 | #endif
19 |
20 |
21 | @implementation RFImageToDataTransformer
22 |
23 | + (BOOL)allowsReverseTransformation {
24 | return YES;
25 | }
26 |
27 | + (Class)transformedValueClass {
28 | return [NSData class];
29 | }
30 |
31 | - (id)transformedValue:(id)value {
32 | #if TARGET_OS_IPHONE
33 | return UIImagePNGRepresentation(value);
34 | #else
35 | return [(NSImage *)value TIFFRepresentation];
36 | #endif
37 | }
38 |
39 | - (id)reverseTransformedValue:(id)value {
40 | #if TARGET_OS_IPHONE
41 | return [[UIImage alloc] initWithData:value];
42 | #else
43 | return [[NSImage alloc] initWithData:value];
44 | #endif
45 | }
46 |
47 | @end
48 |
49 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/XMPPSRVResolver.h:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPSRVResolver.h
3 | //
4 | // Originally created by Eric Chamberlain on 6/15/10.
5 | // Based on SRVResolver by Apple, Inc.
6 | //
7 |
8 | #import
9 | #import
10 |
11 | extern NSString *const XMPPSRVResolverErrorDomain;
12 |
13 |
14 | @interface XMPPSRVResolver : NSObject
15 | {
16 | __unsafe_unretained id delegate;
17 | dispatch_queue_t delegateQueue;
18 |
19 | dispatch_queue_t resolverQueue;
20 | void *resolverQueueTag;
21 |
22 | __strong NSString *srvName;
23 | NSTimeInterval timeout;
24 |
25 | BOOL resolveInProgress;
26 |
27 | NSMutableArray *results;
28 | DNSServiceRef sdRef;
29 |
30 | int sdFd;
31 | dispatch_source_t sdReadSource;
32 | dispatch_source_t timeoutTimer;
33 | }
34 |
35 | /**
36 | * The delegate & delegateQueue are mandatory.
37 | * The resolverQueue is optional. If NULL, it will automatically create it's own internal queue.
38 | **/
39 | - (id)initWithdDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq resolverQueue:(dispatch_queue_t)rq;
40 |
41 | @property (strong, readonly) NSString *srvName;
42 | @property (readonly) NSTimeInterval timeout;
43 |
44 | - (void)startWithSRVName:(NSString *)aSRVName timeout:(NSTimeInterval)aTimeout;
45 | - (void)stop;
46 |
47 | + (NSString *)srvNameFromXMPPDomain:(NSString *)xmppDomain;
48 |
49 | @end
50 |
51 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
52 | #pragma mark -
53 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54 |
55 | @protocol XMPPSRVResolverDelegate
56 |
57 | - (void)xmppSRVResolver:(XMPPSRVResolver *)sender didResolveRecords:(NSArray *)records;
58 | - (void)xmppSRVResolver:(XMPPSRVResolver *)sender didNotResolveDueToError:(NSError *)error;
59 |
60 | @end
61 |
62 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
63 | #pragma mark -
64 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
65 |
66 | @interface XMPPSRVRecord : NSObject
67 | {
68 | UInt16 priority;
69 | UInt16 weight;
70 | UInt16 port;
71 | NSString *target;
72 |
73 | NSUInteger sum;
74 | NSUInteger srvResultsIndex;
75 | }
76 |
77 | + (XMPPSRVRecord *)recordWithPriority:(UInt16)priority weight:(UInt16)weight port:(UInt16)port target:(NSString *)target;
78 |
79 | - (id)initWithPriority:(UInt16)priority weight:(UInt16)weight port:(UInt16)port target:(NSString *)target;
80 |
81 | @property (nonatomic, readonly) UInt16 priority;
82 | @property (nonatomic, readonly) UInt16 weight;
83 | @property (nonatomic, readonly) UInt16 port;
84 | @property (nonatomic, readonly) NSString *target;
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/XMPPStringPrep.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 |
4 | @interface XMPPStringPrep : NSObject
5 |
6 | /**
7 | * Preps a node identifier for use in a JID.
8 | * If the given node is invalid, this method returns nil.
9 | *
10 | * See the XMPP RFC (3920) for details.
11 | *
12 | * Note: The prep properly converts the string to lowercase, as per the RFC.
13 | **/
14 | + (NSString *)prepNode:(NSString *)node;
15 |
16 | /**
17 | * Preps a domain name for use in a JID.
18 | * If the given domain is invalid, this method returns nil.
19 | *
20 | * See the XMPP RFC (3920) for details.
21 | **/
22 | + (NSString *)prepDomain:(NSString *)domain;
23 |
24 | /**
25 | * Preps a resource identifier for use in a JID.
26 | * If the given node is invalid, this method returns nil.
27 | *
28 | * See the XMPP RFC (3920) for details.
29 | **/
30 | + (NSString *)prepResource:(NSString *)resource;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Utilities/XMPPStringPrep.m:
--------------------------------------------------------------------------------
1 | #import "XMPPStringPrep.h"
2 | #import "stringprep.h"
3 |
4 |
5 | @implementation XMPPStringPrep
6 |
7 | + (NSString *)prepNode:(NSString *)node
8 | {
9 | if(node == nil) return nil;
10 |
11 | // Each allowable portion of a JID MUST NOT be more than 1023 bytes in length.
12 | // We make the buffer just big enough to hold a null-terminated string of this length.
13 | char buf[1024];
14 |
15 | strncpy(buf, [node UTF8String], sizeof(buf));
16 |
17 | if(stringprep_xmpp_nodeprep(buf, sizeof(buf)) != 0) return nil;
18 |
19 | return [NSString stringWithUTF8String:buf];
20 | }
21 |
22 | + (NSString *)prepDomain:(NSString *)domain
23 | {
24 | if(domain == nil) return nil;
25 |
26 | // Each allowable portion of a JID MUST NOT be more than 1023 bytes in length.
27 | // We make the buffer just big enough to hold a null-terminated string of this length.
28 | char buf[1024];
29 |
30 | strncpy(buf, [domain UTF8String], sizeof(buf));
31 |
32 | if(stringprep_nameprep(buf, sizeof(buf)) != 0) return nil;
33 |
34 | return [NSString stringWithUTF8String:buf];
35 | }
36 |
37 | + (NSString *)prepResource:(NSString *)resource
38 | {
39 | if(resource == nil) return nil;
40 |
41 | // Each allowable portion of a JID MUST NOT be more than 1023 bytes in length.
42 | // We make the buffer just big enough to hold a null-terminated string of this length.
43 | char buf[1024];
44 |
45 | strncpy(buf, [resource UTF8String], sizeof(buf));
46 |
47 | if(stringprep_xmpp_resourceprep(buf, sizeof(buf)) != 0) return nil;
48 |
49 | return [NSString stringWithUTF8String:buf];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/.DS_Store
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/CocoaLumberjack/DDASLLogger.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import "DDLog.h"
5 |
6 | /**
7 | * Welcome to Cocoa Lumberjack!
8 | *
9 | * The project page has a wealth of documentation if you have any questions.
10 | * https://github.com/robbiehanson/CocoaLumberjack
11 | *
12 | * If you're new to the project you may wish to read the "Getting Started" wiki.
13 | * https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
14 | *
15 | *
16 | * This class provides a logger for the Apple System Log facility.
17 | *
18 | * As described in the "Getting Started" page,
19 | * the traditional NSLog() function directs it's output to two places:
20 | *
21 | * - Apple System Log
22 | * - StdErr (if stderr is a TTY) so log statements show up in Xcode console
23 | *
24 | * To duplicate NSLog() functionality you can simply add this logger and a tty logger.
25 | * However, if you instead choose to use file logging (for faster performance),
26 | * you may choose to use a file logger and a tty logger.
27 | **/
28 |
29 | @interface DDASLLogger : DDAbstractLogger
30 | {
31 | aslclient client;
32 | }
33 |
34 | + (DDASLLogger *)sharedInstance;
35 |
36 | // Inherited from DDAbstractLogger
37 |
38 | // - (id )logFormatter;
39 | // - (void)setLogFormatter:(id )formatter;
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/CocoaLumberjack/DDASLLogger.m:
--------------------------------------------------------------------------------
1 | #import "DDASLLogger.h"
2 |
3 | #import
4 |
5 | /**
6 | * Welcome to Cocoa Lumberjack!
7 | *
8 | * The project page has a wealth of documentation if you have any questions.
9 | * https://github.com/robbiehanson/CocoaLumberjack
10 | *
11 | * If you're new to the project you may wish to read the "Getting Started" wiki.
12 | * https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
13 | **/
14 |
15 | #if ! __has_feature(objc_arc)
16 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
17 | #endif
18 |
19 |
20 | @implementation DDASLLogger
21 |
22 | static DDASLLogger *sharedInstance;
23 |
24 | /**
25 | * The runtime sends initialize to each class in a program exactly one time just before the class,
26 | * or any class that inherits from it, is sent its first message from within the program. (Thus the
27 | * method may never be invoked if the class is not used.) The runtime sends the initialize message to
28 | * classes in a thread-safe manner. Superclasses receive this message before their subclasses.
29 | *
30 | * This method may also be called directly (assumably by accident), hence the safety mechanism.
31 | **/
32 | + (void)initialize
33 | {
34 | static BOOL initialized = NO;
35 | if (!initialized)
36 | {
37 | initialized = YES;
38 |
39 | sharedInstance = [[DDASLLogger alloc] init];
40 | }
41 | }
42 |
43 | + (DDASLLogger *)sharedInstance
44 | {
45 | return sharedInstance;
46 | }
47 |
48 | - (id)init
49 | {
50 | if (sharedInstance != nil)
51 | {
52 | return nil;
53 | }
54 |
55 | if ((self = [super init]))
56 | {
57 | // A default asl client is provided for the main thread,
58 | // but background threads need to create their own client.
59 |
60 | client = asl_open(NULL, "com.apple.console", 0);
61 | }
62 | return self;
63 | }
64 |
65 | - (void)logMessage:(DDLogMessage *)logMessage
66 | {
67 | NSString *logMsg = logMessage->logMsg;
68 |
69 | if (formatter)
70 | {
71 | logMsg = [formatter formatLogMessage:logMessage];
72 | }
73 |
74 | if (logMsg)
75 | {
76 | const char *msg = [logMsg UTF8String];
77 |
78 | int aslLogLevel;
79 | switch (logMessage->logFlag)
80 | {
81 | // Note: By default ASL will filter anything above level 5 (Notice).
82 | // So our mappings shouldn't go above that level.
83 |
84 | case LOG_FLAG_ERROR : aslLogLevel = ASL_LEVEL_CRIT; break;
85 | case LOG_FLAG_WARN : aslLogLevel = ASL_LEVEL_ERR; break;
86 | case LOG_FLAG_INFO : aslLogLevel = ASL_LEVEL_WARNING; break;
87 | default : aslLogLevel = ASL_LEVEL_NOTICE; break;
88 | }
89 |
90 | asl_log(client, NULL, aslLogLevel, "%s", msg);
91 | }
92 | }
93 |
94 | - (NSString *)loggerName
95 | {
96 | return @"cocoa.lumberjack.aslLogger";
97 | }
98 |
99 | @end
100 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/CocoaLumberjack/Extensions/ContextFilterLogFormatter.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "DDLog.h"
3 |
4 | @class ContextFilterLogFormatter;
5 |
6 | /**
7 | * Welcome to Cocoa Lumberjack!
8 | *
9 | * The project page has a wealth of documentation if you have any questions.
10 | * https://github.com/robbiehanson/CocoaLumberjack
11 | *
12 | * If you're new to the project you may wish to read the "Getting Started" page.
13 | * https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
14 | *
15 | *
16 | * This class provides a log formatter that filters log statements from a logging context not on the whitelist.
17 | *
18 | * A log formatter can be added to any logger to format and/or filter its output.
19 | * You can learn more about log formatters here:
20 | * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomFormatters
21 | *
22 | * You can learn more about logging context's here:
23 | * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomContext
24 | *
25 | * But here's a quick overview / refresher:
26 | *
27 | * Every log statement has a logging context.
28 | * These come from the underlying logging macros defined in DDLog.h.
29 | * The default logging context is zero.
30 | * You can define multiple logging context's for use in your application.
31 | * For example, logically separate parts of your app each have a different logging context.
32 | * Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
33 | **/
34 | @interface ContextWhitelistFilterLogFormatter : NSObject
35 |
36 | - (id)init;
37 |
38 | - (void)addToWhitelist:(int)loggingContext;
39 | - (void)removeFromWhitelist:(int)loggingContext;
40 |
41 | - (NSArray *)whitelist;
42 |
43 | - (BOOL)isOnWhitelist:(int)loggingContext;
44 |
45 | @end
46 |
47 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
48 | #pragma mark -
49 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
50 |
51 | /**
52 | * This class provides a log formatter that filters log statements from a logging context on the blacklist.
53 | **/
54 | @interface ContextBlacklistFilterLogFormatter : NSObject
55 |
56 | - (id)init;
57 |
58 | - (void)addToBlacklist:(int)loggingContext;
59 | - (void)removeFromBlacklist:(int)loggingContext;
60 |
61 | - (NSArray *)blacklist;
62 |
63 | - (BOOL)isOnBlacklist:(int)loggingContext;
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/CocoaLumberjack/Extensions/README.txt:
--------------------------------------------------------------------------------
1 | This folder contains some sample formatters that may be helpful.
2 |
3 | Feel free to change them, extend them, or use them as the basis for your own custom formatter(s).
4 |
5 | More information about creating your own custom formatters can be found on the wiki:
6 | https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomFormatters
7 |
8 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/KissXML/Categories/NSString+DDXML.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 |
5 | @interface NSString (DDXML)
6 |
7 | /**
8 | * xmlChar - A basic replacement for char, a byte in a UTF-8 encoded string.
9 | **/
10 | - (const xmlChar *)xmlChar;
11 |
12 | - (NSString *)stringByTrimming;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/KissXML/Categories/NSString+DDXML.m:
--------------------------------------------------------------------------------
1 | #import "NSString+DDXML.h"
2 |
3 | #if ! __has_feature(objc_arc)
4 | #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
5 | #endif
6 |
7 | @implementation NSString (DDXML)
8 |
9 | - (const xmlChar *)xmlChar
10 | {
11 | return (const xmlChar *)[self UTF8String];
12 | }
13 |
14 | #ifdef GNUSTEP
15 | - (NSString *)stringByTrimming
16 | {
17 | return [self stringByTrimmingSpaces];
18 | }
19 | #else
20 | - (NSString *)stringByTrimming
21 | {
22 | NSMutableString *mStr = [self mutableCopy];
23 | CFStringTrimWhitespace((__bridge CFMutableStringRef)mStr);
24 |
25 | NSString *result = [mStr copy];
26 |
27 | return result;
28 | }
29 | #endif
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/KissXML/DDXMLDocument.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "DDXMLElement.h"
3 | #import "DDXMLNode.h"
4 |
5 | /**
6 | * Welcome to KissXML.
7 | *
8 | * The project page has documentation if you have questions.
9 | * https://github.com/robbiehanson/KissXML
10 | *
11 | * If you're new to the project you may wish to read the "Getting Started" wiki.
12 | * https://github.com/robbiehanson/KissXML/wiki/GettingStarted
13 | *
14 | * KissXML provides a drop-in replacement for Apple's NSXML class cluster.
15 | * The goal is to get the exact same behavior as the NSXML classes.
16 | *
17 | * For API Reference, see Apple's excellent documentation,
18 | * either via Xcode's Mac OS X documentation, or via the web:
19 | *
20 | * https://github.com/robbiehanson/KissXML/wiki/Reference
21 | **/
22 |
23 | enum {
24 | DDXMLDocumentXMLKind = 0,
25 | DDXMLDocumentXHTMLKind,
26 | DDXMLDocumentHTMLKind,
27 | DDXMLDocumentTextKind
28 | };
29 | typedef NSUInteger DDXMLDocumentContentKind;
30 |
31 | @interface DDXMLDocument : DDXMLNode
32 | {
33 | }
34 |
35 | - (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSError **)error;
36 | //- (id)initWithContentsOfURL:(NSURL *)url options:(NSUInteger)mask error:(NSError **)error;
37 | - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)error;
38 | //- (id)initWithRootElement:(DDXMLElement *)element;
39 |
40 | //+ (Class)replacementClassForClass:(Class)cls;
41 |
42 | //- (void)setCharacterEncoding:(NSString *)encoding; //primitive
43 | //- (NSString *)characterEncoding; //primitive
44 |
45 | //- (void)setVersion:(NSString *)version;
46 | //- (NSString *)version;
47 |
48 | //- (void)setStandalone:(BOOL)standalone;
49 | //- (BOOL)isStandalone;
50 |
51 | //- (void)setDocumentContentKind:(DDXMLDocumentContentKind)kind;
52 | //- (DDXMLDocumentContentKind)documentContentKind;
53 |
54 | //- (void)setMIMEType:(NSString *)MIMEType;
55 | //- (NSString *)MIMEType;
56 |
57 | //- (void)setDTD:(DDXMLDTD *)documentTypeDeclaration;
58 | //- (DDXMLDTD *)DTD;
59 |
60 | //- (void)setRootElement:(DDXMLNode *)root;
61 | - (DDXMLElement *)rootElement;
62 |
63 | //- (void)insertChild:(DDXMLNode *)child atIndex:(NSUInteger)index;
64 |
65 | //- (void)insertChildren:(NSArray *)children atIndex:(NSUInteger)index;
66 |
67 | //- (void)removeChildAtIndex:(NSUInteger)index;
68 |
69 | //- (void)setChildren:(NSArray *)children;
70 |
71 | //- (void)addChild:(DDXMLNode *)child;
72 |
73 | //- (void)replaceChildAtIndex:(NSUInteger)index withNode:(DDXMLNode *)node;
74 |
75 | - (NSData *)XMLData;
76 | - (NSData *)XMLDataWithOptions:(NSUInteger)options;
77 |
78 | //- (id)objectByApplyingXSLT:(NSData *)xslt arguments:(NSDictionary *)arguments error:(NSError **)error;
79 | //- (id)objectByApplyingXSLTString:(NSString *)xslt arguments:(NSDictionary *)arguments error:(NSError **)error;
80 | //- (id)objectByApplyingXSLTAtURL:(NSURL *)xsltURL arguments:(NSDictionary *)argument error:(NSError **)error;
81 |
82 | //- (BOOL)validateAndReturnError:(NSError **)error;
83 |
84 | @end
85 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/KissXML/DDXMLElement.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "DDXMLNode.h"
3 |
4 | /**
5 | * Welcome to KissXML.
6 | *
7 | * The project page has documentation if you have questions.
8 | * https://github.com/robbiehanson/KissXML
9 | *
10 | * If you're new to the project you may wish to read the "Getting Started" wiki.
11 | * https://github.com/robbiehanson/KissXML/wiki/GettingStarted
12 | *
13 | * KissXML provides a drop-in replacement for Apple's NSXML class cluster.
14 | * The goal is to get the exact same behavior as the NSXML classes.
15 | *
16 | * For API Reference, see Apple's excellent documentation,
17 | * either via Xcode's Mac OS X documentation, or via the web:
18 | *
19 | * https://github.com/robbiehanson/KissXML/wiki/Reference
20 | **/
21 |
22 | @interface DDXMLElement : DDXMLNode
23 | {
24 | }
25 |
26 | - (id)initWithName:(NSString *)name;
27 | - (id)initWithName:(NSString *)name URI:(NSString *)URI;
28 | - (id)initWithName:(NSString *)name stringValue:(NSString *)string;
29 | - (id)initWithXMLString:(NSString *)string error:(NSError **)error;
30 |
31 | #pragma mark --- Elements by name ---
32 |
33 | - (NSArray *)elementsForName:(NSString *)name;
34 | - (NSArray *)elementsForLocalName:(NSString *)localName URI:(NSString *)URI;
35 |
36 | #pragma mark --- Attributes ---
37 |
38 | - (void)addAttribute:(DDXMLNode *)attribute;
39 | - (void)removeAttributeForName:(NSString *)name;
40 | - (void)setAttributes:(NSArray *)attributes;
41 | //- (void)setAttributesAsDictionary:(NSDictionary *)attributes;
42 | - (NSArray *)attributes;
43 | - (DDXMLNode *)attributeForName:(NSString *)name;
44 | //- (DDXMLNode *)attributeForLocalName:(NSString *)localName URI:(NSString *)URI;
45 |
46 | #pragma mark --- Namespaces ---
47 |
48 | - (void)addNamespace:(DDXMLNode *)aNamespace;
49 | - (void)removeNamespaceForPrefix:(NSString *)name;
50 | - (void)setNamespaces:(NSArray *)namespaces;
51 | - (NSArray *)namespaces;
52 | - (DDXMLNode *)namespaceForPrefix:(NSString *)prefix;
53 | - (DDXMLNode *)resolveNamespaceForName:(NSString *)name;
54 | - (NSString *)resolvePrefixForNamespaceURI:(NSString *)namespaceURI;
55 |
56 | #pragma mark --- Children ---
57 |
58 | - (void)insertChild:(DDXMLNode *)child atIndex:(NSUInteger)index;
59 | //- (void)insertChildren:(NSArray *)children atIndex:(NSUInteger)index;
60 | - (void)removeChildAtIndex:(NSUInteger)index;
61 | - (void)setChildren:(NSArray *)children;
62 | - (void)addChild:(DDXMLNode *)child;
63 | //- (void)replaceChildAtIndex:(NSUInteger)index withNode:(DDXMLNode *)node;
64 | //- (void)normalizeAdjacentTextNodesPreservingCDATA:(BOOL)preserve;
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/KissXML/DDXMLNode.m:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/KissXML/DDXMLNode.m
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/libidn/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/libidn/.DS_Store
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/libidn/libidn.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/XMPPManagerDemo/XMPPManager/xmppFrameWork/Vendor/libidn/libidn.a
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManager/xmppFrameWork/XMPPFramework.h:
--------------------------------------------------------------------------------
1 | //
2 | // This file is designed to be customized by YOU.
3 | //
4 | // As you pick and choose which parts of the framework you need for your application, add them to this header file.
5 | //
6 | // Various modules available within the framework optionally interact with each other.
7 | // E.g. The XMPPPing module will utilize the XMPPCapabilities module (if available) to advertise support XEP-0199.
8 | //
9 | // However, the modules can only interact if they're both added to your xcode project.
10 | // E.g. If XMPPCapabilities isn't a part of your xcode project, then XMPPPing shouldn't attempt to reference it.
11 | //
12 | // So how do the individual modules know if other modules are available?
13 | // Via this header file.
14 | //
15 | // If you #import "XMPPCapabilities.h" in this file, then _XMPP_CAPABILITIES_H will be defined for other modules.
16 | // And they can automatically take advantage of it.
17 | //
18 |
19 |
20 | // CUSTOMIZE ME !
21 | //
22 | // THIS HEADER FILE SHOULD BE TAILORED TO MATCH YOUR APPLICATION.
23 |
24 |
25 | #import "XMPP.h"
26 |
27 | // List the modules you're using here.
28 |
29 | #import "XMPPReconnect.h"
30 |
31 | #import "XMPPRoster.h"
32 | #import "XMPPRosterCoreDataStorage.h"
33 |
34 | #import "XMPPvCardTempModule.h"
35 | #import "XMPPvCardAvatarModule.h"
36 | #import "XMPPvCardCoreDataStorage.h"
37 |
38 | #import "XMPPCapabilities.h"
39 | #import "XMPPCapabilitiesCoreDataStorage.h"
40 |
41 | #import "XMPPMUC.h"
42 | #import "XMPPRoomCoreDataStorage.h"
43 |
44 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManagerTests/XMPPManagerTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | www.zhgu.net.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManagerTests/XMPPManagerTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // XMPPManagerTests.m
3 | // XMPPManagerTests
4 | //
5 | // Created by cocoajin on 14-4-17.
6 | // Copyright (c) 2014年 com.9ask. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface XMPPManagerTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation XMPPManagerTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/XMPPManagerDemo/XMPPManagerTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/login2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoajin/XMPPManager/21a537d976baedb503b421637cbe429b93cdc55d/login2.png
--------------------------------------------------------------------------------