summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/AdHoc/OutgoingAdHocCommandSession.cpp100
-rw-r--r--Swiften/AdHoc/OutgoingAdHocCommandSession.h138
-rw-r--r--Swiften/Avatars/AvatarManager.h16
-rw-r--r--Swiften/Avatars/AvatarManagerImpl.cpp56
-rw-r--r--Swiften/Avatars/AvatarManagerImpl.h56
-rw-r--r--Swiften/Avatars/AvatarMemoryStorage.h52
-rw-r--r--Swiften/Avatars/AvatarProvider.h14
-rw-r--r--Swiften/Avatars/AvatarStorage.h22
-rw-r--r--Swiften/Avatars/CombinedAvatarProvider.cpp60
-rw-r--r--Swiften/Avatars/CombinedAvatarProvider.h24
-rw-r--r--Swiften/Avatars/DummyAvatarManager.h32
-rw-r--r--Swiften/Avatars/NullAvatarManager.h18
-rw-r--r--Swiften/Avatars/OfflineAvatarManager.cpp10
-rw-r--r--Swiften/Avatars/OfflineAvatarManager.h20
-rw-r--r--Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp214
-rw-r--r--Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp690
-rw-r--r--Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp288
-rw-r--r--Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp360
-rw-r--r--Swiften/Avatars/VCardAvatarManager.cpp58
-rw-r--r--Swiften/Avatars/VCardAvatarManager.h34
-rw-r--r--Swiften/Avatars/VCardUpdateAvatarManager.cpp108
-rw-r--r--Swiften/Avatars/VCardUpdateAvatarManager.h52
-rw-r--r--Swiften/Base/API.h8
-rw-r--r--Swiften/Base/Algorithm.h276
-rw-r--r--Swiften/Base/Atomic.h50
-rw-r--r--Swiften/Base/BoostRandomGenerator.cpp8
-rw-r--r--Swiften/Base/BoostRandomGenerator.h14
-rw-r--r--Swiften/Base/ByteArray.cpp44
-rw-r--r--Swiften/Base/ByteArray.h46
-rw-r--r--Swiften/Base/Concat.h112
-rw-r--r--Swiften/Base/DateTime.cpp36
-rw-r--r--Swiften/Base/DateTime.h26
-rw-r--r--Swiften/Base/Debug.cpp234
-rw-r--r--Swiften/Base/Debug.h6
-rw-r--r--Swiften/Base/Error.h12
-rw-r--r--Swiften/Base/FileSize.cpp16
-rw-r--r--Swiften/Base/IDGenerator.cpp4
-rw-r--r--Swiften/Base/IDGenerator.h10
-rw-r--r--Swiften/Base/Listenable.h74
-rw-r--r--Swiften/Base/Log.cpp26
-rw-r--r--Swiften/Base/Log.h52
-rw-r--r--Swiften/Base/Path.cpp8
-rw-r--r--Swiften/Base/Path.h22
-rw-r--r--Swiften/Base/Paths.cpp38
-rw-r--r--Swiften/Base/Paths.h8
-rw-r--r--Swiften/Base/RandomGenerator.h18
-rw-r--r--Swiften/Base/Regex.cpp30
-rw-r--r--Swiften/Base/Regex.h6
-rw-r--r--Swiften/Base/SafeAllocator.cpp10
-rw-r--r--Swiften/Base/SafeAllocator.h42
-rw-r--r--Swiften/Base/SafeByteArray.cpp12
-rw-r--r--Swiften/Base/SafeByteArray.h62
-rw-r--r--Swiften/Base/SafeString.h32
-rw-r--r--Swiften/Base/SimpleIDGenerator.cpp34
-rw-r--r--Swiften/Base/SimpleIDGenerator.h22
-rw-r--r--Swiften/Base/StartStopper.h24
-rw-r--r--Swiften/Base/String.cpp200
-rw-r--r--Swiften/Base/String.h58
-rw-r--r--Swiften/Base/URL.cpp278
-rw-r--r--Swiften/Base/URL.h124
-rw-r--r--Swiften/Base/UnitTest/ByteArrayTest.cpp56
-rw-r--r--Swiften/Base/UnitTest/DateTimeTest.cpp46
-rw-r--r--Swiften/Base/UnitTest/IDGeneratorTest.cpp42
-rw-r--r--Swiften/Base/UnitTest/PathTest.cpp24
-rw-r--r--Swiften/Base/UnitTest/SimpleIDGeneratorTest.cpp42
-rw-r--r--Swiften/Base/UnitTest/StringTest.cpp168
-rw-r--r--Swiften/Base/UnitTest/URLTest.cpp192
-rw-r--r--Swiften/Base/WindowsRegistry.h90
-rw-r--r--Swiften/Base/boost_bsignals.h2
-rw-r--r--Swiften/Base/format.h24
-rw-r--r--Swiften/Base/sleep.cpp10
-rw-r--r--Swiften/Base/sleep.h2
-rw-r--r--Swiften/Chat/ChatStateNotifier.cpp74
-rw-r--r--Swiften/Chat/ChatStateNotifier.h66
-rw-r--r--Swiften/Chat/ChatStateTracker.cpp30
-rw-r--r--Swiften/Chat/ChatStateTracker.h20
-rw-r--r--Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp292
-rw-r--r--Swiften/Client/BlockList.cpp8
-rw-r--r--Swiften/Client/BlockList.h42
-rw-r--r--Swiften/Client/BlockListImpl.cpp68
-rw-r--r--Swiften/Client/BlockListImpl.h50
-rw-r--r--Swiften/Client/Client.cpp172
-rw-r--r--Swiften/Client/Client.h384
-rw-r--r--Swiften/Client/ClientBlockListManager.cpp174
-rw-r--r--Swiften/Client/ClientBlockListManager.h66
-rw-r--r--Swiften/Client/ClientError.h90
-rw-r--r--Swiften/Client/ClientOptions.h290
-rw-r--r--Swiften/Client/ClientSession.cpp776
-rw-r--r--Swiften/Client/ClientSession.h356
-rw-r--r--Swiften/Client/ClientSessionStanzaChannel.cpp110
-rw-r--r--Swiften/Client/ClientSessionStanzaChannel.h62
-rw-r--r--Swiften/Client/ClientXMLTracer.cpp46
-rw-r--r--Swiften/Client/ClientXMLTracer.h26
-rw-r--r--Swiften/Client/CoreClient.cpp706
-rw-r--r--Swiften/Client/CoreClient.h438
-rw-r--r--Swiften/Client/DummyNickManager.h18
-rw-r--r--Swiften/Client/DummyStanzaChannel.h150
-rw-r--r--Swiften/Client/MemoryStorages.cpp34
-rw-r--r--Swiften/Client/MemoryStorages.h44
-rw-r--r--Swiften/Client/NickManager.h14
-rw-r--r--Swiften/Client/NickManagerImpl.cpp32
-rw-r--r--Swiften/Client/NickManagerImpl.h30
-rw-r--r--Swiften/Client/NickResolver.cpp76
-rw-r--r--Swiften/Client/NickResolver.h48
-rw-r--r--Swiften/Client/StanzaChannel.h24
-rw-r--r--Swiften/Client/Storages.h36
-rw-r--r--Swiften/Client/UnitTest/BlockListImplTest.cpp138
-rw-r--r--Swiften/Client/UnitTest/ClientBlockListManagerTest.cpp328
-rw-r--r--Swiften/Client/UnitTest/ClientSessionTest.cpp1560
-rw-r--r--Swiften/Client/UnitTest/NickResolverTest.cpp256
-rw-r--r--Swiften/Client/XMLBeautifier.cpp132
-rw-r--r--Swiften/Client/XMLBeautifier.h40
-rw-r--r--Swiften/Component/Component.cpp10
-rw-r--r--Swiften/Component/Component.h40
-rw-r--r--Swiften/Component/ComponentConnector.cpp114
-rw-r--r--Swiften/Component/ComponentConnector.h68
-rw-r--r--Swiften/Component/ComponentError.h32
-rw-r--r--Swiften/Component/ComponentHandshakeGenerator.cpp14
-rw-r--r--Swiften/Component/ComponentHandshakeGenerator.h10
-rw-r--r--Swiften/Component/ComponentSession.cpp130
-rw-r--r--Swiften/Component/ComponentSession.h128
-rw-r--r--Swiften/Component/ComponentSessionStanzaChannel.cpp74
-rw-r--r--Swiften/Component/ComponentSessionStanzaChannel.h70
-rw-r--r--Swiften/Component/ComponentXMLTracer.cpp16
-rw-r--r--Swiften/Component/ComponentXMLTracer.h14
-rw-r--r--Swiften/Component/CoreComponent.cpp216
-rw-r--r--Swiften/Component/CoreComponent.h150
-rw-r--r--Swiften/Component/UnitTest/ComponentConnectorTest.cpp368
-rw-r--r--Swiften/Component/UnitTest/ComponentHandshakeGeneratorTest.cpp44
-rw-r--r--Swiften/Component/UnitTest/ComponentSessionTest.cpp390
-rw-r--r--Swiften/Compress/UnitTest/ZLibCompressorTest.cpp34
-rw-r--r--Swiften/Compress/UnitTest/ZLibDecompressorTest.cpp112
-rw-r--r--Swiften/Compress/ZLibCodecompressor.cpp48
-rw-r--r--Swiften/Compress/ZLibCodecompressor.h20
-rw-r--r--Swiften/Compress/ZLibCodecompressor_Private.h6
-rw-r--r--Swiften/Compress/ZLibCompressor.cpp10
-rw-r--r--Swiften/Compress/ZLibCompressor.h16
-rw-r--r--Swiften/Compress/ZLibDecompressor.cpp10
-rw-r--r--Swiften/Compress/ZLibDecompressor.h12
-rw-r--r--Swiften/Compress/ZLibException.h8
-rw-r--r--Swiften/Config/swiften-config.cpp174
-rw-r--r--Swiften/Crypto/CommonCryptoCryptoProvider.cpp186
-rw-r--r--Swiften/Crypto/CommonCryptoCryptoProvider.h20
-rw-r--r--Swiften/Crypto/CryptoProvider.h34
-rw-r--r--Swiften/Crypto/Hash.h14
-rw-r--r--Swiften/Crypto/OpenSSLCryptoProvider.cpp190
-rw-r--r--Swiften/Crypto/OpenSSLCryptoProvider.h20
-rw-r--r--Swiften/Crypto/PlatformCryptoProvider.cpp10
-rw-r--r--Swiften/Crypto/PlatformCryptoProvider.h8
-rw-r--r--Swiften/Crypto/UnitTest/CryptoProviderTest.cpp176
-rw-r--r--Swiften/Crypto/WindowsCryptoProvider.cpp328
-rw-r--r--Swiften/Crypto/WindowsCryptoProvider.h26
-rw-r--r--Swiften/Disco/CapsInfoGenerator.cpp64
-rw-r--r--Swiften/Disco/CapsInfoGenerator.h20
-rw-r--r--Swiften/Disco/CapsManager.cpp90
-rw-r--r--Swiften/Disco/CapsManager.h64
-rw-r--r--Swiften/Disco/CapsMemoryStorage.h44
-rw-r--r--Swiften/Disco/CapsProvider.h14
-rw-r--r--Swiften/Disco/CapsStorage.h12
-rw-r--r--Swiften/Disco/ClientDiscoManager.cpp26
-rw-r--r--Swiften/Disco/ClientDiscoManager.h112
-rw-r--r--Swiften/Disco/DiscoInfoResponder.cpp38
-rw-r--r--Swiften/Disco/DiscoInfoResponder.h26
-rw-r--r--Swiften/Disco/DiscoServiceWalker.cpp188
-rw-r--r--Swiften/Disco/DiscoServiceWalker.h86
-rw-r--r--Swiften/Disco/DummyEntityCapsProvider.cpp10
-rw-r--r--Swiften/Disco/DummyEntityCapsProvider.h14
-rw-r--r--Swiften/Disco/EntityCapsManager.cpp96
-rw-r--r--Swiften/Disco/EntityCapsManager.h54
-rw-r--r--Swiften/Disco/EntityCapsProvider.h34
-rw-r--r--Swiften/Disco/FeatureOracle.cpp112
-rw-r--r--Swiften/Disco/FeatureOracle.h42
-rw-r--r--Swiften/Disco/GetDiscoInfoRequest.h44
-rw-r--r--Swiften/Disco/GetDiscoItemsRequest.h44
-rw-r--r--Swiften/Disco/JIDDiscoInfoResponder.cpp52
-rw-r--r--Swiften/Disco/JIDDiscoInfoResponder.h42
-rw-r--r--Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp116
-rw-r--r--Swiften/Disco/UnitTest/CapsManagerTest.cpp526
-rw-r--r--Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp152
-rw-r--r--Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp336
-rw-r--r--Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp196
-rw-r--r--Swiften/Elements/AuthChallenge.h30
-rw-r--r--Swiften/Elements/AuthFailure.h10
-rw-r--r--Swiften/Elements/AuthRequest.h66
-rw-r--r--Swiften/Elements/AuthResponse.h34
-rw-r--r--Swiften/Elements/AuthSuccess.h24
-rw-r--r--Swiften/Elements/BlockListPayload.h26
-rw-r--r--Swiften/Elements/BlockPayload.h26
-rw-r--r--Swiften/Elements/Body.h26
-rw-r--r--Swiften/Elements/Bytestreams.h66
-rw-r--r--Swiften/Elements/CapsInfo.h88
-rw-r--r--Swiften/Elements/CarbonsDisable.cpp4
-rw-r--r--Swiften/Elements/CarbonsDisable.h12
-rw-r--r--Swiften/Elements/CarbonsEnable.cpp4
-rw-r--r--Swiften/Elements/CarbonsEnable.h12
-rw-r--r--Swiften/Elements/CarbonsPrivate.cpp4
-rw-r--r--Swiften/Elements/CarbonsPrivate.h12
-rw-r--r--Swiften/Elements/CarbonsReceived.cpp16
-rw-r--r--Swiften/Elements/CarbonsReceived.h20
-rw-r--r--Swiften/Elements/CarbonsSent.cpp18
-rw-r--r--Swiften/Elements/CarbonsSent.h20
-rw-r--r--Swiften/Elements/ChatState.h26
-rw-r--r--Swiften/Elements/Command.h130
-rw-r--r--Swiften/Elements/ComponentHandshake.h28
-rw-r--r--Swiften/Elements/CompressFailure.h8
-rw-r--r--Swiften/Elements/CompressRequest.h26
-rw-r--r--Swiften/Elements/Compressed.h8
-rw-r--r--Swiften/Elements/ContainerPayload.h34
-rw-r--r--Swiften/Elements/Delay.h24
-rw-r--r--Swiften/Elements/DeliveryReceipt.h26
-rw-r--r--Swiften/Elements/DeliveryReceiptRequest.h8
-rw-r--r--Swiften/Elements/DiscoInfo.cpp34
-rw-r--r--Swiften/Elements/DiscoInfo.h192
-rw-r--r--Swiften/Elements/DiscoItems.h88
-rw-r--r--Swiften/Elements/Element.h14
-rw-r--r--Swiften/Elements/EnableStreamManagement.h8
-rw-r--r--Swiften/Elements/ErrorPayload.h142
-rw-r--r--Swiften/Elements/Form.cpp64
-rw-r--r--Swiften/Elements/Form.h206
-rw-r--r--Swiften/Elements/FormField.cpp14
-rw-r--r--Swiften/Elements/FormField.h242
-rw-r--r--Swiften/Elements/FormPage.cpp24
-rw-r--r--Swiften/Elements/FormPage.h50
-rw-r--r--Swiften/Elements/FormReportedRef.h8
-rw-r--r--Swiften/Elements/FormSection.cpp24
-rw-r--r--Swiften/Elements/FormSection.h50
-rw-r--r--Swiften/Elements/FormText.cpp4
-rw-r--r--Swiften/Elements/FormText.h20
-rw-r--r--Swiften/Elements/Forwarded.h26
-rw-r--r--Swiften/Elements/HashElement.h60
-rw-r--r--Swiften/Elements/IBB.h180
-rw-r--r--Swiften/Elements/IQ.cpp80
-rw-r--r--Swiften/Elements/IQ.h84
-rw-r--r--Swiften/Elements/Idle.h40
-rw-r--r--Swiften/Elements/InBandRegistrationPayload.h346
-rw-r--r--Swiften/Elements/IsodeIQDelegation.h30
-rw-r--r--Swiften/Elements/JingleContentPayload.h162
-rw-r--r--Swiften/Elements/JingleDescription.h8
-rw-r--r--Swiften/Elements/JingleFileTransferDescription.h24
-rw-r--r--Swiften/Elements/JingleFileTransferFileInfo.h196
-rw-r--r--Swiften/Elements/JingleFileTransferHash.h18
-rw-r--r--Swiften/Elements/JingleIBBTransportPayload.h64
-rw-r--r--Swiften/Elements/JinglePayload.h292
-rw-r--r--Swiften/Elements/JingleS5BTransportPayload.h204
-rw-r--r--Swiften/Elements/JingleTransportPayload.h26
-rw-r--r--Swiften/Elements/Last.h16
-rw-r--r--Swiften/Elements/MAMFin.h88
-rw-r--r--Swiften/Elements/MAMQuery.h34
-rw-r--r--Swiften/Elements/MAMResult.h22
-rw-r--r--Swiften/Elements/MUCAdminPayload.h20
-rw-r--r--Swiften/Elements/MUCDestroyPayload.h42
-rw-r--r--Swiften/Elements/MUCInvitationPayload.h124
-rw-r--r--Swiften/Elements/MUCItem.h14
-rw-r--r--Swiften/Elements/MUCOccupant.cpp12
-rw-r--r--Swiften/Elements/MUCOccupant.h50
-rw-r--r--Swiften/Elements/MUCOwnerPayload.h34
-rw-r--r--Swiften/Elements/MUCPayload.h114
-rw-r--r--Swiften/Elements/MUCUserPayload.h112
-rw-r--r--Swiften/Elements/Message.h118
-rw-r--r--Swiften/Elements/Nickname.h26
-rw-r--r--Swiften/Elements/Payload.h18
-rw-r--r--Swiften/Elements/Presence.cpp24
-rw-r--r--Swiften/Elements/Presence.h84
-rw-r--r--Swiften/Elements/Priority.h26
-rw-r--r--Swiften/Elements/PrivateStorage.h26
-rw-r--r--Swiften/Elements/ProtocolHeader.h60
-rw-r--r--Swiften/Elements/PubSub.h10
-rw-r--r--Swiften/Elements/PubSubAffiliation.h72
-rw-r--r--Swiften/Elements/PubSubAffiliations.h64
-rw-r--r--Swiften/Elements/PubSubConfigure.h30
-rw-r--r--Swiften/Elements/PubSubCreate.h56
-rw-r--r--Swiften/Elements/PubSubDefault.h66
-rw-r--r--Swiften/Elements/PubSubError.h182
-rw-r--r--Swiften/Elements/PubSubEvent.h10
-rw-r--r--Swiften/Elements/PubSubEventAssociate.h30
-rw-r--r--Swiften/Elements/PubSubEventCollection.h74
-rw-r--r--Swiften/Elements/PubSubEventConfiguration.h56
-rw-r--r--Swiften/Elements/PubSubEventDelete.h56
-rw-r--r--Swiften/Elements/PubSubEventDisassociate.h30
-rw-r--r--Swiften/Elements/PubSubEventItem.h100
-rw-r--r--Swiften/Elements/PubSubEventItems.h90
-rw-r--r--Swiften/Elements/PubSubEventPayload.h8
-rw-r--r--Swiften/Elements/PubSubEventPurge.h30
-rw-r--r--Swiften/Elements/PubSubEventRedirect.h30
-rw-r--r--Swiften/Elements/PubSubEventRetract.h30
-rw-r--r--Swiften/Elements/PubSubEventSubscription.h122
-rw-r--r--Swiften/Elements/PubSubItem.h64
-rw-r--r--Swiften/Elements/PubSubItems.h100
-rw-r--r--Swiften/Elements/PubSubOptions.h92
-rw-r--r--Swiften/Elements/PubSubOwnerAffiliation.h72
-rw-r--r--Swiften/Elements/PubSubOwnerAffiliations.h64
-rw-r--r--Swiften/Elements/PubSubOwnerConfigure.h56
-rw-r--r--Swiften/Elements/PubSubOwnerDefault.h30
-rw-r--r--Swiften/Elements/PubSubOwnerDelete.h56
-rw-r--r--Swiften/Elements/PubSubOwnerPayload.h8
-rw-r--r--Swiften/Elements/PubSubOwnerPubSub.h10
-rw-r--r--Swiften/Elements/PubSubOwnerPurge.h30
-rw-r--r--Swiften/Elements/PubSubOwnerRedirect.h30
-rw-r--r--Swiften/Elements/PubSubOwnerSubscription.h68
-rw-r--r--Swiften/Elements/PubSubOwnerSubscriptions.h64
-rw-r--r--Swiften/Elements/PubSubPayload.h8
-rw-r--r--Swiften/Elements/PubSubPublish.h64
-rw-r--r--Swiften/Elements/PubSubRetract.h82
-rw-r--r--Swiften/Elements/PubSubSubscribe.h74
-rw-r--r--Swiften/Elements/PubSubSubscribeOptions.h30
-rw-r--r--Swiften/Elements/PubSubSubscription.h122
-rw-r--r--Swiften/Elements/PubSubSubscriptions.h64
-rw-r--r--Swiften/Elements/PubSubUnsubscribe.h74
-rw-r--r--Swiften/Elements/RawXMLPayload.h24
-rw-r--r--Swiften/Elements/Replace.h26
-rw-r--r--Swiften/Elements/ResourceBind.h50
-rw-r--r--Swiften/Elements/ResultSet.h58
-rw-r--r--Swiften/Elements/RosterItemExchangePayload.h104
-rw-r--r--Swiften/Elements/RosterItemPayload.h72
-rw-r--r--Swiften/Elements/RosterPayload.cpp16
-rw-r--r--Swiften/Elements/RosterPayload.h46
-rw-r--r--Swiften/Elements/S5BProxyRequest.h54
-rw-r--r--Swiften/Elements/SearchPayload.h154
-rw-r--r--Swiften/Elements/SecurityLabel.h118
-rw-r--r--Swiften/Elements/SecurityLabelsCatalog.h140
-rw-r--r--Swiften/Elements/SoftwareVersion.h78
-rw-r--r--Swiften/Elements/Stanza.cpp56
-rw-r--r--Swiften/Elements/Stanza.h150
-rw-r--r--Swiften/Elements/StanzaAck.cpp4
-rw-r--r--Swiften/Elements/StanzaAck.h34
-rw-r--r--Swiften/Elements/StanzaAckRequest.h4
-rw-r--r--Swiften/Elements/StartSession.h8
-rw-r--r--Swiften/Elements/StartTLSFailure.h8
-rw-r--r--Swiften/Elements/StartTLSRequest.h8
-rw-r--r--Swiften/Elements/Status.h26
-rw-r--r--Swiften/Elements/StatusShow.h68
-rw-r--r--Swiften/Elements/Storage.h94
-rw-r--r--Swiften/Elements/StreamError.h94
-rw-r--r--Swiften/Elements/StreamFeatures.cpp4
-rw-r--r--Swiften/Elements/StreamFeatures.h176
-rw-r--r--Swiften/Elements/StreamInitiation.h106
-rw-r--r--Swiften/Elements/StreamInitiationFileInfo.h156
-rw-r--r--Swiften/Elements/StreamManagementEnabled.h50
-rw-r--r--Swiften/Elements/StreamManagementFailed.h8
-rw-r--r--Swiften/Elements/StreamResume.h50
-rw-r--r--Swiften/Elements/StreamResumed.h50
-rw-r--r--Swiften/Elements/StreamType.h10
-rw-r--r--Swiften/Elements/Subject.h26
-rw-r--r--Swiften/Elements/TLSProceed.h8
-rw-r--r--Swiften/Elements/Thread.cpp34
-rw-r--r--Swiften/Elements/Thread.h24
-rw-r--r--Swiften/Elements/ToplevelElement.h12
-rw-r--r--Swiften/Elements/UnblockPayload.h26
-rw-r--r--Swiften/Elements/UnitTest/FormTest.cpp54
-rw-r--r--Swiften/Elements/UnitTest/IQTest.cpp74
-rw-r--r--Swiften/Elements/UnitTest/StanzaTest.cpp416
-rw-r--r--Swiften/Elements/UnknownElement.h8
-rw-r--r--Swiften/Elements/UserLocation.h374
-rw-r--r--Swiften/Elements/UserTune.h146
-rw-r--r--Swiften/Elements/VCard.cpp18
-rw-r--r--Swiften/Elements/VCard.h548
-rw-r--r--Swiften/Elements/VCardUpdate.h16
-rw-r--r--Swiften/Elements/Version.h22
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardColor.cpp80
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardColor.h30
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h26
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardElement.h30
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h32
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h122
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h66
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h26
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardLineElement.h84
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardOperation.h74
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h80
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardRectElement.h122
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardTextElement.h82
-rw-r--r--Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h48
-rw-r--r--Swiften/Elements/WhiteboardPayload.h96
-rw-r--r--Swiften/Entity/Entity.cpp20
-rw-r--r--Swiften/Entity/Entity.h58
-rw-r--r--Swiften/Entity/GenericPayloadPersister.h38
-rw-r--r--Swiften/Entity/PayloadPersister.cpp50
-rw-r--r--Swiften/Entity/PayloadPersister.h26
-rw-r--r--Swiften/EventLoop/BoostASIOEventLoop.cpp20
-rw-r--r--Swiften/EventLoop/BoostASIOEventLoop.h24
-rw-r--r--Swiften/EventLoop/Cocoa/CocoaEvent.h4
-rw-r--r--Swiften/EventLoop/Cocoa/CocoaEvent.mm14
-rw-r--r--Swiften/EventLoop/Cocoa/CocoaEventLoop.h24
-rw-r--r--Swiften/EventLoop/Cocoa/CocoaEventLoop.mm32
-rw-r--r--Swiften/EventLoop/DummyEventLoop.cpp22
-rw-r--r--Swiften/EventLoop/DummyEventLoop.h22
-rw-r--r--Swiften/EventLoop/Event.cpp18
-rw-r--r--Swiften/EventLoop/Event.h22
-rw-r--r--Swiften/EventLoop/EventLoop.cpp114
-rw-r--r--Swiften/EventLoop/EventLoop.h94
-rw-r--r--Swiften/EventLoop/EventOwner.h8
-rw-r--r--Swiften/EventLoop/Qt/QtEventLoop.h82
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.cpp44
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.h48
-rw-r--r--Swiften/EventLoop/SingleThreadedEventLoop.cpp36
-rw-r--r--Swiften/EventLoop/SingleThreadedEventLoop.h48
-rw-r--r--Swiften/EventLoop/UnitTest/EventLoopTest.cpp136
-rw-r--r--Swiften/EventLoop/UnitTest/SimpleEventLoopTest.cpp76
-rw-r--r--Swiften/Examples/BenchTool/BenchTool.cpp58
-rw-r--r--Swiften/Examples/ConnectivityTest/ConnectivityTest.cpp114
-rw-r--r--Swiften/Examples/LinkLocalTool/main.cpp58
-rw-r--r--Swiften/Examples/MUCListAndJoin/MUCListAndJoin.cpp126
-rw-r--r--Swiften/Examples/NetworkTool/main.cpp106
-rw-r--r--Swiften/Examples/ParserTester/ParserTester.cpp72
-rw-r--r--Swiften/Examples/SendFile/ReceiveFile.cpp180
-rw-r--r--Swiften/Examples/SendFile/SendFile.cpp204
-rw-r--r--Swiften/Examples/SendMessage/SendMessage.cpp104
-rw-r--r--Swiften/FileTransfer/ByteArrayReadBytestream.cpp24
-rw-r--r--Swiften/FileTransfer/ByteArrayReadBytestream.h34
-rw-r--r--Swiften/FileTransfer/ByteArrayWriteBytestream.h30
-rw-r--r--Swiften/FileTransfer/BytestreamException.h10
-rw-r--r--Swiften/FileTransfer/BytestreamsRequest.h30
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporter.cpp366
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporter.h172
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporterFactory.cpp96
-rw-r--r--Swiften/FileTransfer/DefaultFileTransferTransporterFactory.h68
-rw-r--r--Swiften/FileTransfer/FailingTransportSession.h18
-rw-r--r--Swiften/FileTransfer/FileReadBytestream.cpp32
-rw-r--r--Swiften/FileTransfer/FileReadBytestream.h20
-rw-r--r--Swiften/FileTransfer/FileTransfer.cpp10
-rw-r--r--Swiften/FileTransfer/FileTransfer.h128
-rw-r--r--Swiften/FileTransfer/FileTransferError.h32
-rw-r--r--Swiften/FileTransfer/FileTransferManager.cpp12
-rw-r--r--Swiften/FileTransfer/FileTransferManager.h50
-rw-r--r--Swiften/FileTransfer/FileTransferManagerImpl.cpp238
-rw-r--r--Swiften/FileTransfer/FileTransferManagerImpl.h136
-rw-r--r--Swiften/FileTransfer/FileTransferOptions.h82
-rw-r--r--Swiften/FileTransfer/FileTransferTransporter.h84
-rw-r--r--Swiften/FileTransfer/FileTransferTransporterFactory.h32
-rw-r--r--Swiften/FileTransfer/FileWriteBytestream.cpp48
-rw-r--r--Swiften/FileTransfer/FileWriteBytestream.h20
-rw-r--r--Swiften/FileTransfer/IBBReceiveSession.cpp152
-rw-r--r--Swiften/FileTransfer/IBBReceiveSession.h86
-rw-r--r--Swiften/FileTransfer/IBBReceiveTransportSession.cpp6
-rw-r--r--Swiften/FileTransfer/IBBReceiveTransportSession.h18
-rw-r--r--Swiften/FileTransfer/IBBRequest.h20
-rw-r--r--Swiften/FileTransfer/IBBSendSession.cpp128
-rw-r--r--Swiften/FileTransfer/IBBSendSession.h82
-rw-r--r--Swiften/FileTransfer/IBBSendTransportSession.cpp8
-rw-r--r--Swiften/FileTransfer/IBBSendTransportSession.h18
-rw-r--r--Swiften/FileTransfer/IncomingFileTransfer.h40
-rw-r--r--Swiften/FileTransfer/IncomingFileTransferManager.cpp68
-rw-r--r--Swiften/FileTransfer/IncomingFileTransferManager.h56
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.cpp564
-rw-r--r--Swiften/FileTransfer/IncomingJingleFileTransfer.h210
-rw-r--r--Swiften/FileTransfer/IncrementalBytestreamHashCalculator.cpp60
-rw-r--r--Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h36
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.cpp338
-rw-r--r--Swiften/FileTransfer/JingleFileTransfer.h130
-rw-r--r--Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.cpp262
-rw-r--r--Swiften/FileTransfer/LocalJingleTransportCandidateGenerator.h74
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransfer.h14
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransferManager.cpp60
-rw-r--r--Swiften/FileTransfer/OutgoingFileTransferManager.h74
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp540
-rw-r--r--Swiften/FileTransfer/OutgoingJingleFileTransfer.h186
-rw-r--r--Swiften/FileTransfer/ReadBytestream.h32
-rw-r--r--Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.cpp96
-rw-r--r--Swiften/FileTransfer/RemoteJingleTransportCandidateSelector.h66
-rw-r--r--Swiften/FileTransfer/S5BTransportSession.h78
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp392
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamClientSession.h98
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.cpp270
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxiesManager.h84
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.cpp72
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamProxyFinder.h34
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.cpp16
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamRegistry.h28
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServer.cpp54
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServer.h40
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp330
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerManager.h148
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.cpp28
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h20
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp16
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h20
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp264
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.h128
-rw-r--r--Swiften/FileTransfer/StreamInitiationRequest.h30
-rw-r--r--Swiften/FileTransfer/TransportSession.h16
-rw-r--r--Swiften/FileTransfer/UnitTest/DummyFileTransferManager.h64
-rw-r--r--Swiften/FileTransfer/UnitTest/DummyFileTransferTransporterFactory.h312
-rw-r--r--Swiften/FileTransfer/UnitTest/IBBReceiveSessionTest.cpp294
-rw-r--r--Swiften/FileTransfer/UnitTest/IBBSendSessionTest.cpp414
-rw-r--r--Swiften/FileTransfer/UnitTest/IncomingJingleFileTransferTest.cpp372
-rw-r--r--Swiften/FileTransfer/UnitTest/OutgoingJingleFileTransferTest.cpp434
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamClientSessionTest.cpp506
-rw-r--r--Swiften/FileTransfer/UnitTest/SOCKS5BytestreamServerSessionTest.cpp374
-rw-r--r--Swiften/FileTransfer/WriteBytestream.h24
-rw-r--r--Swiften/History/HistoryMessage.h100
-rw-r--r--Swiften/History/HistoryStorage.h28
-rw-r--r--Swiften/History/SQLiteHistoryStorage.cpp616
-rw-r--r--Swiften/History/SQLiteHistoryStorage.h48
-rw-r--r--Swiften/History/UnitTest/SQLiteHistoryManagerTest.cpp194
-rw-r--r--Swiften/IDN/ICUConverter.cpp244
-rw-r--r--Swiften/IDN/ICUConverter.h12
-rw-r--r--Swiften/IDN/IDNConverter.h34
-rw-r--r--Swiften/IDN/LibIDNConverter.cpp92
-rw-r--r--Swiften/IDN/LibIDNConverter.h12
-rw-r--r--Swiften/IDN/PlatformIDNConverter.cpp6
-rw-r--r--Swiften/IDN/PlatformIDNConverter.h8
-rw-r--r--Swiften/IDN/UTF8Validator.h98
-rw-r--r--Swiften/IDN/UnitTest/IDNConverterTest.cpp72
-rw-r--r--Swiften/IDN/UnitTest/UTF8ValidatorTest.cpp64
-rw-r--r--Swiften/JID/JID.cpp418
-rw-r--r--Swiften/JID/JID.h362
-rw-r--r--Swiften/JID/UnitTest/JIDTest.cpp706
-rw-r--r--Swiften/Jingle/AbstractJingleSessionListener.cpp14
-rw-r--r--Swiften/Jingle/AbstractJingleSessionListener.h22
-rw-r--r--Swiften/Jingle/FakeJingleSession.cpp28
-rw-r--r--Swiften/Jingle/FakeJingleSession.h166
-rw-r--r--Swiften/Jingle/IncomingJingleSessionHandler.h10
-rw-r--r--Swiften/Jingle/Jingle.h22
-rw-r--r--Swiften/Jingle/JingleContentID.h32
-rw-r--r--Swiften/Jingle/JingleResponder.cpp70
-rw-r--r--Swiften/Jingle/JingleResponder.h24
-rw-r--r--Swiften/Jingle/JingleSession.cpp6
-rw-r--r--Swiften/Jingle/JingleSession.h64
-rw-r--r--Swiften/Jingle/JingleSessionImpl.cpp262
-rw-r--r--Swiften/Jingle/JingleSessionImpl.h68
-rw-r--r--Swiften/Jingle/JingleSessionListener.h48
-rw-r--r--Swiften/Jingle/JingleSessionManager.cpp34
-rw-r--r--Swiften/Jingle/JingleSessionManager.h68
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.cpp70
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiBrowseQuery.h32
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp48
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiQuerier.h66
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiQuery.h26
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.cpp138
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiRegisterQuery.h66
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.cpp4
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveHostnameQuery.h22
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.cpp76
-rw-r--r--Swiften/LinkLocal/DNSSD/Avahi/AvahiResolveServiceQuery.h32
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h94
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp156
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuerier.h72
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp14
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourQuery.h46
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourRegisterQuery.h80
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveHostnameQuery.h92
-rw-r--r--Swiften/LinkLocal/DNSSD/Bonjour/BonjourResolveServiceQuery.h86
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDBrowseQuery.h18
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDQuerier.h36
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDRegisterQuery.h16
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h14
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDResolveServiceQuery.h30
-rw-r--r--Swiften/LinkLocal/DNSSD/DNSSDServiceID.h104
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDBrowseQuery.h24
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp144
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h128
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.cpp4
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuery.h30
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDRegisterQuery.h36
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveHostnameQuery.h28
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDResolveServiceQuery.h26
-rw-r--r--Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.cpp12
-rw-r--r--Swiften/LinkLocal/DNSSD/PlatformDNSSDQuerierFactory.h20
-rw-r--r--Swiften/LinkLocal/IncomingLinkLocalSession.cpp64
-rw-r--r--Swiften/LinkLocal/IncomingLinkLocalSession.h54
-rw-r--r--Swiften/LinkLocal/LinkLocalConnector.cpp74
-rw-r--r--Swiften/LinkLocal/LinkLocalConnector.h78
-rw-r--r--Swiften/LinkLocal/LinkLocalService.cpp32
-rw-r--r--Swiften/LinkLocal/LinkLocalService.h72
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceBrowser.cpp178
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceBrowser.h86
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceInfo.cpp184
-rw-r--r--Swiften/LinkLocal/LinkLocalServiceInfo.h70
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.cpp36
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.h52
-rw-r--r--Swiften/LinkLocal/UnitTest/LinkLocalConnectorTest.cpp236
-rw-r--r--Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp772
-rw-r--r--Swiften/LinkLocal/UnitTest/LinkLocalServiceInfoTest.cpp88
-rw-r--r--Swiften/LinkLocal/UnitTest/LinkLocalServiceTest.cpp102
-rw-r--r--Swiften/MUC/MUC.h130
-rw-r--r--Swiften/MUC/MUCBookmark.h142
-rw-r--r--Swiften/MUC/MUCBookmarkManager.cpp150
-rw-r--r--Swiften/MUC/MUCBookmarkManager.h62
-rw-r--r--Swiften/MUC/MUCImpl.cpp658
-rw-r--r--Swiften/MUC/MUCImpl.h204
-rw-r--r--Swiften/MUC/MUCManager.cpp2
-rw-r--r--Swiften/MUC/MUCManager.h28
-rw-r--r--Swiften/MUC/MUCRegistry.cpp6
-rw-r--r--Swiften/MUC/MUCRegistry.h20
-rw-r--r--Swiften/MUC/UnitTest/MUCTest.cpp496
-rw-r--r--Swiften/MUC/UnitTest/MockMUC.cpp32
-rw-r--r--Swiften/MUC/UnitTest/MockMUC.h124
-rw-r--r--Swiften/Network/BOSHConnection.cpp528
-rw-r--r--Swiften/Network/BOSHConnection.h184
-rw-r--r--Swiften/Network/BOSHConnectionPool.cpp418
-rw-r--r--Swiften/Network/BOSHConnectionPool.h124
-rw-r--r--Swiften/Network/BoostConnection.cpp194
-rw-r--r--Swiften/Network/BoostConnection.h110
-rw-r--r--Swiften/Network/BoostConnectionFactory.cpp2
-rw-r--r--Swiften/Network/BoostConnectionFactory.h18
-rw-r--r--Swiften/Network/BoostConnectionServer.cpp118
-rw-r--r--Swiften/Network/BoostConnectionServer.h54
-rw-r--r--Swiften/Network/BoostConnectionServerFactory.cpp4
-rw-r--r--Swiften/Network/BoostConnectionServerFactory.h20
-rw-r--r--Swiften/Network/BoostIOServiceThread.cpp30
-rw-r--r--Swiften/Network/BoostIOServiceThread.h42
-rw-r--r--Swiften/Network/BoostNetworkFactories.cpp52
-rw-r--r--Swiften/Network/BoostNetworkFactories.h158
-rw-r--r--Swiften/Network/BoostTimer.cpp60
-rw-r--r--Swiften/Network/BoostTimer.h42
-rw-r--r--Swiften/Network/BoostTimerFactory.cpp2
-rw-r--r--Swiften/Network/BoostTimerFactory.h20
-rw-r--r--Swiften/Network/CachingDomainNameResolver.cpp8
-rw-r--r--Swiften/Network/CachingDomainNameResolver.h20
-rw-r--r--Swiften/Network/ChainedConnector.cpp106
-rw-r--r--Swiften/Network/ChainedConnector.h68
-rw-r--r--Swiften/Network/Connection.h56
-rw-r--r--Swiften/Network/ConnectionFactory.h12
-rw-r--r--Swiften/Network/ConnectionServer.h26
-rw-r--r--Swiften/Network/ConnectionServerFactory.h16
-rw-r--r--Swiften/Network/Connector.cpp270
-rw-r--r--Swiften/Network/Connector.h94
-rw-r--r--Swiften/Network/DomainNameAddressQuery.h14
-rw-r--r--Swiften/Network/DomainNameResolveError.h8
-rw-r--r--Swiften/Network/DomainNameResolver.h18
-rw-r--r--Swiften/Network/DomainNameServiceQuery.cpp58
-rw-r--r--Swiften/Network/DomainNameServiceQuery.h32
-rw-r--r--Swiften/Network/DummyConnection.cpp6
-rw-r--r--Swiften/Network/DummyConnection.h48
-rw-r--r--Swiften/Network/DummyConnectionFactory.h12
-rw-r--r--Swiften/Network/DummyConnectionServer.h36
-rw-r--r--Swiften/Network/DummyConnectionServerFactory.h18
-rw-r--r--Swiften/Network/DummyTimerFactory.cpp62
-rw-r--r--Swiften/Network/DummyTimerFactory.h22
-rw-r--r--Swiften/Network/EnvironmentProxyProvider.cpp34
-rw-r--r--Swiften/Network/EnvironmentProxyProvider.h20
-rw-r--r--Swiften/Network/FakeConnection.cpp66
-rw-r--r--Swiften/Network/FakeConnection.h74
-rw-r--r--Swiften/Network/GConfProxyProvider.cpp48
-rw-r--r--Swiften/Network/GConfProxyProvider.h20
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.cpp220
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.h52
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnectionFactory.cpp6
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnectionFactory.h38
-rw-r--r--Swiften/Network/HTTPTrafficFilter.h18
-rw-r--r--Swiften/Network/HostAddress.cpp48
-rw-r--r--Swiften/Network/HostAddress.h40
-rw-r--r--Swiften/Network/HostAddressPort.cpp6
-rw-r--r--Swiften/Network/HostAddressPort.h54
-rw-r--r--Swiften/Network/HostNameOrAddress.cpp20
-rw-r--r--Swiften/Network/HostNameOrAddress.h4
-rw-r--r--Swiften/Network/MacOSXProxyProvider.cpp114
-rw-r--r--Swiften/Network/MacOSXProxyProvider.h12
-rw-r--r--Swiften/Network/MiniUPnPInterface.cpp136
-rw-r--r--Swiften/Network/MiniUPnPInterface.h24
-rw-r--r--Swiften/Network/NATPMPInterface.cpp186
-rw-r--r--Swiften/Network/NATPMPInterface.h24
-rw-r--r--Swiften/Network/NATPortMapping.h68
-rw-r--r--Swiften/Network/NATTraversalForwardPortRequest.h14
-rw-r--r--Swiften/Network/NATTraversalGetPublicIPRequest.h14
-rw-r--r--Swiften/Network/NATTraversalInterface.h16
-rw-r--r--Swiften/Network/NATTraversalRemovePortForwardingRequest.h44
-rw-r--r--Swiften/Network/NATTraverser.h20
-rw-r--r--Swiften/Network/NetworkEnvironment.cpp22
-rw-r--r--Swiften/Network/NetworkEnvironment.h12
-rw-r--r--Swiften/Network/NetworkFactories.h64
-rw-r--r--Swiften/Network/NetworkInterface.h52
-rw-r--r--Swiften/Network/NullNATTraversalInterface.h30
-rw-r--r--Swiften/Network/NullNATTraverser.cpp66
-rw-r--r--Swiften/Network/NullNATTraverser.h20
-rw-r--r--Swiften/Network/NullProxyProvider.cpp4
-rw-r--r--Swiften/Network/NullProxyProvider.h12
-rw-r--r--Swiften/Network/PlatformDomainNameAddressQuery.cpp76
-rw-r--r--Swiften/Network/PlatformDomainNameAddressQuery.h40
-rw-r--r--Swiften/Network/PlatformDomainNameQuery.h28
-rw-r--r--Swiften/Network/PlatformDomainNameResolver.cpp66
-rw-r--r--Swiften/Network/PlatformDomainNameResolver.h52
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.cpp244
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.h28
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.cpp238
-rw-r--r--Swiften/Network/PlatformNATTraversalWorker.h76
-rw-r--r--Swiften/Network/PlatformNetworkEnvironment.h8
-rw-r--r--Swiften/Network/PlatformProxyProvider.h6
-rw-r--r--Swiften/Network/ProxiedConnection.cpp136
-rw-r--r--Swiften/Network/ProxiedConnection.h96
-rw-r--r--Swiften/Network/ProxyProvider.h14
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnection.cpp174
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnection.h50
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnectionFactory.cpp2
-rw-r--r--Swiften/Network/SOCKS5ProxiedConnectionFactory.h26
-rw-r--r--Swiften/Network/SolarisNetworkEnvironment.cpp384
-rw-r--r--Swiften/Network/SolarisNetworkEnvironment.h8
-rw-r--r--Swiften/Network/StaticDomainNameResolver.cpp132
-rw-r--r--Swiften/Network/StaticDomainNameResolver.h78
-rw-r--r--Swiften/Network/TLSConnection.cpp72
-rw-r--r--Swiften/Network/TLSConnection.h66
-rw-r--r--Swiften/Network/TLSConnectionFactory.cpp2
-rw-r--r--Swiften/Network/TLSConnectionFactory.h22
-rw-r--r--Swiften/Network/Timer.h48
-rw-r--r--Swiften/Network/TimerFactory.h10
-rwxr-xr-xSwiften/Network/UnboundDomainNameResolver.cpp350
-rwxr-xr-xSwiften/Network/UnboundDomainNameResolver.h48
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp860
-rw-r--r--Swiften/Network/UnitTest/BOSHConnectionTest.cpp540
-rw-r--r--Swiften/Network/UnitTest/ChainedConnectorTest.cpp320
-rw-r--r--Swiften/Network/UnitTest/ConnectorTest.cpp704
-rw-r--r--Swiften/Network/UnitTest/DomainNameServiceQueryTest.cpp102
-rw-r--r--Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp784
-rw-r--r--Swiften/Network/UnitTest/HostAddressTest.cpp72
-rw-r--r--Swiften/Network/UnixNetworkEnvironment.cpp60
-rw-r--r--Swiften/Network/UnixNetworkEnvironment.h4
-rw-r--r--Swiften/Network/UnixProxyProvider.cpp48
-rw-r--r--Swiften/Network/UnixProxyProvider.h22
-rw-r--r--Swiften/Network/WindowsNetworkEnvironment.cpp74
-rw-r--r--Swiften/Network/WindowsNetworkEnvironment.h8
-rw-r--r--Swiften/Network/WindowsProxyProvider.cpp146
-rw-r--r--Swiften/Network/WindowsProxyProvider.h22
-rw-r--r--Swiften/Parser/Attribute.h34
-rw-r--r--Swiften/Parser/AttributeMap.cpp50
-rw-r--r--Swiften/Parser/AttributeMap.h72
-rw-r--r--Swiften/Parser/AuthChallengeParser.cpp12
-rw-r--r--Swiften/Parser/AuthChallengeParser.h20
-rw-r--r--Swiften/Parser/AuthFailureParser.h8
-rw-r--r--Swiften/Parser/AuthRequestParser.cpp18
-rw-r--r--Swiften/Parser/AuthRequestParser.h20
-rw-r--r--Swiften/Parser/AuthResponseParser.cpp12
-rw-r--r--Swiften/Parser/AuthResponseParser.h20
-rw-r--r--Swiften/Parser/AuthSuccessParser.cpp12
-rw-r--r--Swiften/Parser/AuthSuccessParser.h20
-rw-r--r--Swiften/Parser/BOSHBodyExtractor.cpp216
-rw-r--r--Swiften/Parser/BOSHBodyExtractor.h38
-rw-r--r--Swiften/Parser/ComponentHandshakeParser.cpp12
-rw-r--r--Swiften/Parser/ComponentHandshakeParser.h20
-rw-r--r--Swiften/Parser/CompressFailureParser.h8
-rw-r--r--Swiften/Parser/CompressParser.cpp22
-rw-r--r--Swiften/Parser/CompressParser.h24
-rw-r--r--Swiften/Parser/CompressedParser.h8
-rw-r--r--Swiften/Parser/ElementParser.h16
-rw-r--r--Swiften/Parser/EnableStreamManagementParser.h8
-rw-r--r--Swiften/Parser/EnumParser.h38
-rw-r--r--Swiften/Parser/ExpatParser.cpp82
-rw-r--r--Swiften/Parser/ExpatParser.h20
-rw-r--r--Swiften/Parser/GenericElementParser.h48
-rw-r--r--Swiften/Parser/GenericPayloadParser.h54
-rw-r--r--Swiften/Parser/GenericPayloadParserFactory.h46
-rw-r--r--Swiften/Parser/GenericPayloadParserFactory2.h52
-rw-r--r--Swiften/Parser/GenericPayloadTreeParser.h70
-rw-r--r--Swiften/Parser/GenericStanzaParser.h44
-rw-r--r--Swiften/Parser/IQParser.cpp42
-rw-r--r--Swiften/Parser/IQParser.h12
-rw-r--r--Swiften/Parser/LibXMLParser.cpp114
-rw-r--r--Swiften/Parser/LibXMLParser.h28
-rw-r--r--Swiften/Parser/MessageParser.cpp42
-rw-r--r--Swiften/Parser/MessageParser.h12
-rw-r--r--Swiften/Parser/PayloadParser.h68
-rw-r--r--Swiften/Parser/PayloadParserFactory.h34
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.cpp14
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.h24
-rw-r--r--Swiften/Parser/PayloadParsers/BlockParser.h44
-rw-r--r--Swiften/Parser/PayloadParsers/BodyParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/BodyParser.h20
-rw-r--r--Swiften/Parser/PayloadParsers/BytestreamsParser.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/BytestreamsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/CapsInfoParser.cpp14
-rw-r--r--Swiften/Parser/PayloadParsers/CapsInfoParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsDisableParser.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsDisableParser.h16
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsEnableParser.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsEnableParser.h16
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsPrivateParser.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsPrivateParser.h16
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp62
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h34
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp62
-rw-r--r--Swiften/Parser/PayloadParsers/CarbonsSentParser.h34
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParser.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParserFactory.h28
-rw-r--r--Swiften/Parser/PayloadParsers/CommandParser.cpp210
-rw-r--r--Swiften/Parser/PayloadParsers/CommandParser.h60
-rw-r--r--Swiften/Parser/PayloadParsers/DelayParser.cpp20
-rw-r--r--Swiften/Parser/PayloadParsers/DelayParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptParser.cpp18
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h24
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h14
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h24
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp24
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoItemsParser.h26
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParser.cpp236
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParser.h34
-rw-r--r--Swiften/Parser/PayloadParsers/ErrorParserFactory.h28
-rw-r--r--Swiften/Parser/PayloadParsers/FormParser.cpp456
-rw-r--r--Swiften/Parser/PayloadParsers/FormParser.h60
-rw-r--r--Swiften/Parser/PayloadParsers/FormParserFactory.h24
-rw-r--r--Swiften/Parser/PayloadParsers/ForwardedParser.cpp82
-rw-r--r--Swiften/Parser/PayloadParsers/ForwardedParser.h46
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp168
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h16
-rw-r--r--Swiften/Parser/PayloadParsers/IBBParser.cpp90
-rw-r--r--Swiften/Parser/PayloadParsers/IBBParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/IdleParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/IdleParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp192
-rw-r--r--Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h38
-rw-r--r--Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp118
-rw-r--r--Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h40
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp50
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h40
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp92
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp46
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h16
-rw-r--r--Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h14
-rw-r--r--Swiften/Parser/PayloadParsers/JingleParser.cpp192
-rw-r--r--Swiften/Parser/PayloadParsers/JingleParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/JingleParserFactory.h40
-rw-r--r--Swiften/Parser/PayloadParsers/JingleReasonParser.cpp138
-rw-r--r--Swiften/Parser/PayloadParsers/JingleReasonParser.h26
-rw-r--r--Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp148
-rw-r--r--Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/LastParser.cpp20
-rw-r--r--Swiften/Parser/PayloadParsers/LastParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/MAMFinParser.cpp64
-rw-r--r--Swiften/Parser/PayloadParsers/MAMFinParser.h30
-rw-r--r--Swiften/Parser/PayloadParsers/MAMQueryParser.cpp90
-rw-r--r--Swiften/Parser/PayloadParsers/MAMQueryParser.h42
-rw-r--r--Swiften/Parser/PayloadParsers/MAMResultParser.cpp64
-rw-r--r--Swiften/Parser/PayloadParsers/MAMResultParser.h42
-rw-r--r--Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp8
-rw-r--r--Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h8
-rw-r--r--Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h8
-rw-r--r--Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp16
-rw-r--r--Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h8
-rw-r--r--Swiften/Parser/PayloadParsers/MUCItemParser.cpp104
-rw-r--r--Swiften/Parser/PayloadParsers/MUCItemParser.h14
-rw-r--r--Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.cpp48
-rw-r--r--Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h26
-rw-r--r--Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h28
-rw-r--r--Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp72
-rw-r--r--Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h16
-rw-r--r--Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h26
-rw-r--r--Swiften/Parser/PayloadParsers/NicknameParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/NicknameParser.h20
-rw-r--r--Swiften/Parser/PayloadParsers/PriorityParser.cpp24
-rw-r--r--Swiften/Parser/PayloadParsers/PriorityParser.h20
-rw-r--r--Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp48
-rw-r--r--Swiften/Parser/PayloadParsers/PrivateStorageParser.h26
-rw-r--r--Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h30
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubAffiliationParser.cpp62
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp56
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubConfigureParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubCreateParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubCreateParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubDefaultParser.cpp62
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubDefaultParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubErrorParser.cpp160
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubErrorParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h24
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp70
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventItemParser.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventItemParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp70
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventParser.cpp80
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventRetractParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.cpp84
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubItemParser.cpp60
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubItemParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp78
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubItemsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp74
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOptionsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp56
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp80
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.cpp52
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubParser.cpp154
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubParser.h36
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubPublishParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp64
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubRetractParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.cpp44
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscribeParser.cpp62
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp84
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.cpp68
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp16
-rw-r--r--Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h20
-rw-r--r--Swiften/Parser/PayloadParsers/ReplaceParser.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/ReplaceParser.h18
-rw-r--r--Swiften/Parser/PayloadParsers/ResourceBindParser.cpp40
-rw-r--r--Swiften/Parser/PayloadParsers/ResourceBindParser.h24
-rw-r--r--Swiften/Parser/PayloadParsers/ResultSetParser.cpp80
-rw-r--r--Swiften/Parser/PayloadParsers/ResultSetParser.h30
-rw-r--r--Swiften/Parser/PayloadParsers/RosterItemExchangeParser.cpp82
-rw-r--r--Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h36
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParser.cpp148
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParser.h38
-rw-r--r--Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp70
-rw-r--r--Swiften/Parser/PayloadParsers/S5BProxyRequestParser.h14
-rw-r--r--Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp156
-rw-r--r--Swiften/Parser/PayloadParsers/SearchPayloadParser.h42
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.cpp82
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParser.h38
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h8
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp86
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h42
-rw-r--r--Swiften/Parser/PayloadParsers/SoftwareVersionParser.cpp30
-rw-r--r--Swiften/Parser/PayloadParsers/SoftwareVersionParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/StartSessionParser.h14
-rw-r--r--Swiften/Parser/PayloadParsers/StatusParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/StatusParser.h20
-rw-r--r--Swiften/Parser/PayloadParsers/StatusShowParser.cpp40
-rw-r--r--Swiften/Parser/PayloadParsers/StatusShowParser.h20
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParser.cpp82
-rw-r--r--Swiften/Parser/PayloadParsers/StorageParser.h34
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.cpp80
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp164
-rw-r--r--Swiften/Parser/PayloadParsers/StreamInitiationParser.h48
-rw-r--r--Swiften/Parser/PayloadParsers/SubjectParser.cpp16
-rw-r--r--Swiften/Parser/PayloadParsers/SubjectParser.h20
-rw-r--r--Swiften/Parser/PayloadParsers/ThreadParser.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/ThreadParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/BlockParserTest.cpp98
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/BodyParserTest.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/CarbonsParserTest.cpp204
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/CommandParserTest.cpp118
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DeliveryReceiptParserTest.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp152
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DiscoItemsParserTest.cpp48
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp76
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/FormParserTest.cpp420
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ForwardedParserTest.cpp188
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/IBBParserTest.cpp40
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/IdleParserTest.cpp36
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/InBandRegistrationPayloadParserTest.cpp80
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp1172
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMFinParserTest.cpp80
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMQueryParserTest.cpp204
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MAMResultParserTest.cpp70
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MUCAdminPayloadParserTest.cpp30
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MUCUserPayloadParserTest.cpp144
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h2
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h82
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PrivateStorageParserTest.cpp150
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RawXMLPayloadParserTest.cpp42
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ReplaceTest.cpp34
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ResourceBindParserTest.cpp36
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ResultSetParserTest.cpp96
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RosterItemExchangeParserTest.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp164
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SearchPayloadParserTest.cpp326
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelParserTest.cpp64
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp88
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SoftwareVersionParserTest.cpp44
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StatusParserTest.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StatusShowParserTest.cpp110
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp136
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/StreamInitiationParserTest.cpp102
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/UserLocationParserTest.cpp154
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/UserTuneParserTest.cpp74
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/VCardParserTest.cpp368
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/VCardUpdateParserTest.cpp28
-rw-r--r--Swiften/Parser/PayloadParsers/UserLocationParser.cpp156
-rw-r--r--Swiften/Parser/PayloadParsers/UserLocationParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/UserTuneParser.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/UserTuneParser.h22
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParser.cpp510
-rw-r--r--Swiften/Parser/PayloadParsers/VCardParser.h38
-rw-r--r--Swiften/Parser/PayloadParsers/VCardUpdateParser.cpp18
-rw-r--r--Swiften/Parser/PayloadParsers/VCardUpdateParser.h30
-rw-r--r--Swiften/Parser/PayloadParsers/WhiteboardParser.cpp536
-rw-r--r--Swiften/Parser/PayloadParsers/WhiteboardParser.h32
-rw-r--r--Swiften/Parser/PlatformXMLParserFactory.cpp4
-rw-r--r--Swiften/Parser/PlatformXMLParserFactory.h10
-rw-r--r--Swiften/Parser/PresenceParser.cpp66
-rw-r--r--Swiften/Parser/PresenceParser.h12
-rw-r--r--Swiften/Parser/SerializingParser.cpp38
-rw-r--r--Swiften/Parser/SerializingParser.h22
-rw-r--r--Swiften/Parser/StanzaAckParser.cpp20
-rw-r--r--Swiften/Parser/StanzaAckParser.h16
-rw-r--r--Swiften/Parser/StanzaAckRequestParser.h8
-rw-r--r--Swiften/Parser/StanzaParser.cpp102
-rw-r--r--Swiften/Parser/StanzaParser.h52
-rw-r--r--Swiften/Parser/StartTLSFailureParser.h8
-rw-r--r--Swiften/Parser/StartTLSParser.h8
-rw-r--r--Swiften/Parser/StreamErrorParser.cpp172
-rw-r--r--Swiften/Parser/StreamErrorParser.h28
-rw-r--r--Swiften/Parser/StreamFeaturesParser.cpp116
-rw-r--r--Swiften/Parser/StreamFeaturesParser.h32
-rw-r--r--Swiften/Parser/StreamManagementEnabledParser.cpp16
-rw-r--r--Swiften/Parser/StreamManagementEnabledParser.h24
-rw-r--r--Swiften/Parser/StreamManagementFailedParser.h8
-rw-r--r--Swiften/Parser/StreamResumeParser.cpp26
-rw-r--r--Swiften/Parser/StreamResumeParser.h24
-rw-r--r--Swiften/Parser/StreamResumedParser.cpp26
-rw-r--r--Swiften/Parser/StreamResumedParser.h24
-rw-r--r--Swiften/Parser/TLSProceedParser.h8
-rw-r--r--Swiften/Parser/Tree/NullParserElement.h12
-rw-r--r--Swiften/Parser/Tree/ParserElement.cpp22
-rw-r--r--Swiften/Parser/Tree/ParserElement.h60
-rw-r--r--Swiften/Parser/Tree/TreeReparser.cpp44
-rw-r--r--Swiften/Parser/Tree/TreeReparser.h10
-rw-r--r--Swiften/Parser/UnitTest/AttributeMapTest.cpp102
-rw-r--r--Swiften/Parser/UnitTest/BOSHBodyExtractorTest.cpp172
-rw-r--r--Swiften/Parser/UnitTest/ElementParserTester.h2
-rw-r--r--Swiften/Parser/UnitTest/EnumParserTest.cpp38
-rw-r--r--Swiften/Parser/UnitTest/GenericPayloadTreeParserTest.cpp76
-rw-r--r--Swiften/Parser/UnitTest/IQParserTest.cpp78
-rw-r--r--Swiften/Parser/UnitTest/MessageParserTest.cpp92
-rw-r--r--Swiften/Parser/UnitTest/ParserTester.h66
-rw-r--r--Swiften/Parser/UnitTest/PayloadParserFactoryCollectionTest.cpp168
-rw-r--r--Swiften/Parser/UnitTest/PresenceParserTest.cpp134
-rw-r--r--Swiften/Parser/UnitTest/SerializingParserTest.cpp74
-rw-r--r--Swiften/Parser/UnitTest/StanzaAckParserTest.cpp50
-rw-r--r--Swiften/Parser/UnitTest/StanzaParserTest.cpp380
-rw-r--r--Swiften/Parser/UnitTest/StanzaParserTester.h2
-rw-r--r--Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp180
-rw-r--r--Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp32
-rw-r--r--Swiften/Parser/UnitTest/XMLParserTest.cpp548
-rw-r--r--Swiften/Parser/UnitTest/XMPPParserTest.cpp324
-rw-r--r--Swiften/Parser/UnknownElementParser.h8
-rw-r--r--Swiften/Parser/UnknownPayloadParser.h20
-rw-r--r--Swiften/Parser/XMLParser.h24
-rw-r--r--Swiften/Parser/XMLParserClient.h14
-rw-r--r--Swiften/Parser/XMLParserFactory.h14
-rw-r--r--Swiften/Parser/XMPPParser.cpp270
-rw-r--r--Swiften/Parser/XMPPParser.h78
-rw-r--r--Swiften/Parser/XMPPParserClient.h18
-rw-r--r--Swiften/Presence/DirectedPresenceSender.cpp60
-rw-r--r--Swiften/Presence/DirectedPresenceSender.h28
-rw-r--r--Swiften/Presence/PayloadAddingPresenceSender.cpp44
-rw-r--r--Swiften/Presence/PayloadAddingPresenceSender.h70
-rw-r--r--Swiften/Presence/PresenceOracle.cpp324
-rw-r--r--Swiften/Presence/PresenceOracle.h106
-rw-r--r--Swiften/Presence/PresenceSender.h12
-rw-r--r--Swiften/Presence/StanzaChannelPresenceSender.cpp4
-rw-r--r--Swiften/Presence/StanzaChannelPresenceSender.h18
-rw-r--r--Swiften/Presence/SubscriptionManager.cpp42
-rw-r--r--Swiften/Presence/SubscriptionManager.h58
-rw-r--r--Swiften/Presence/UnitTest/DirectedPresenceSenderTest.cpp268
-rw-r--r--Swiften/Presence/UnitTest/PayloadAddingPresenceSenderTest.cpp182
-rw-r--r--Swiften/Presence/UnitTest/PresenceOracleTest.cpp448
-rw-r--r--Swiften/PubSub/PubSubManager.h22
-rw-r--r--Swiften/PubSub/PubSubManagerImpl.cpp16
-rw-r--r--Swiften/PubSub/PubSubManagerImpl.h38
-rw-r--r--Swiften/PubSub/PubSubUtil.h34
-rw-r--r--Swiften/QA/ClientTest/ClientTest.cpp114
-rw-r--r--Swiften/QA/ConcurrentFileTransferTest/ConcurrentFileTransferTest.cpp40
-rw-r--r--Swiften/QA/DNSSDTest/DNSSDTest.cpp228
-rw-r--r--Swiften/QA/FileTransferTest/FileTransferTest.cpp672
-rw-r--r--Swiften/QA/NetworkTest/BoostConnectionServerTest.cpp384
-rwxr-xr-xSwiften/QA/NetworkTest/BoostConnectionTest.cpp276
-rw-r--r--Swiften/QA/NetworkTest/DomainNameResolverTest.cpp410
-rw-r--r--Swiften/QA/ProxyProviderTest/ProxyProviderTest.cpp38
-rw-r--r--Swiften/QA/ReconnectTest/ReconnectTest.cpp78
-rw-r--r--Swiften/QA/StorageTest/FileReadBytestreamTest.cpp78
-rw-r--r--Swiften/QA/StorageTest/FileWriteBytestreamTest.cpp54
-rw-r--r--Swiften/QA/StorageTest/VCardFileStorageTest.cpp182
-rw-r--r--Swiften/QA/TLSTest/CertificateErrorTest.cpp364
-rw-r--r--Swiften/QA/TLSTest/CertificateTest.cpp146
-rw-r--r--Swiften/Queries/DummyIQChannel.h28
-rw-r--r--Swiften/Queries/GenericRequest.h120
-rw-r--r--Swiften/Queries/GetResponder.h14
-rw-r--r--Swiften/Queries/IQChannel.h18
-rw-r--r--Swiften/Queries/IQHandler.h12
-rw-r--r--Swiften/Queries/IQRouter.cpp80
-rw-r--r--Swiften/Queries/IQRouter.h126
-rw-r--r--Swiften/Queries/PubSubRequest.h94
-rw-r--r--Swiften/Queries/RawRequest.h58
-rw-r--r--Swiften/Queries/Request.cpp108
-rw-r--r--Swiften/Queries/Request.h168
-rw-r--r--Swiften/Queries/Requests/GetInBandRegistrationFormRequest.h20
-rw-r--r--Swiften/Queries/Requests/GetPrivateStorageRequest.h52
-rw-r--r--Swiften/Queries/Requests/GetSecurityLabelsCatalogRequest.h28
-rw-r--r--Swiften/Queries/Requests/GetSoftwareVersionRequest.h28
-rw-r--r--Swiften/Queries/Requests/SetPrivateStorageRequest.h40
-rw-r--r--Swiften/Queries/Requests/SubmitInBandRegistrationFormRequest.h30
-rw-r--r--Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp174
-rw-r--r--Swiften/Queries/Responder.h242
-rw-r--r--Swiften/Queries/Responders/SoftwareVersionResponder.cpp10
-rw-r--r--Swiften/Queries/Responders/SoftwareVersionResponder.h24
-rw-r--r--Swiften/Queries/SetResponder.h14
-rw-r--r--Swiften/Queries/UnitTest/IQRouterTest.cpp274
-rw-r--r--Swiften/Queries/UnitTest/RequestTest.cpp684
-rw-r--r--Swiften/Queries/UnitTest/ResponderTest.cpp258
-rw-r--r--Swiften/Roster/GetRosterRequest.h32
-rw-r--r--Swiften/Roster/RosterMemoryStorage.cpp8
-rw-r--r--Swiften/Roster/RosterMemoryStorage.h20
-rw-r--r--Swiften/Roster/RosterPushResponder.h34
-rw-r--r--Swiften/Roster/RosterStorage.h12
-rw-r--r--Swiften/Roster/SetRosterRequest.h36
-rw-r--r--Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp668
-rw-r--r--Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp166
-rw-r--r--Swiften/Roster/UnitTest/XMPPRosterSignalHandler.cpp20
-rw-r--r--Swiften/Roster/UnitTest/XMPPRosterSignalHandler.h76
-rw-r--r--Swiften/Roster/XMPPRoster.h152
-rw-r--r--Swiften/Roster/XMPPRosterController.cpp106
-rw-r--r--Swiften/Roster/XMPPRosterController.h52
-rw-r--r--Swiften/Roster/XMPPRosterImpl.cpp112
-rw-r--r--Swiften/Roster/XMPPRosterImpl.h44
-rw-r--r--Swiften/Roster/XMPPRosterItem.h70
-rw-r--r--Swiften/SASL/ClientAuthenticator.h72
-rw-r--r--Swiften/SASL/DIGESTMD5ClientAuthenticator.cpp128
-rw-r--r--Swiften/SASL/DIGESTMD5ClientAuthenticator.h36
-rw-r--r--Swiften/SASL/DIGESTMD5Properties.cpp188
-rw-r--r--Swiften/SASL/DIGESTMD5Properties.h28
-rw-r--r--Swiften/SASL/EXTERNALClientAuthenticator.cpp12
-rw-r--r--Swiften/SASL/EXTERNALClientAuthenticator.h16
-rw-r--r--Swiften/SASL/PLAINClientAuthenticator.cpp4
-rw-r--r--Swiften/SASL/PLAINClientAuthenticator.h12
-rw-r--r--Swiften/SASL/PLAINMessage.cpp46
-rw-r--r--Swiften/SASL/PLAINMessage.h48
-rw-r--r--Swiften/SASL/SCRAMSHA1ClientAuthenticator.cpp266
-rw-r--r--Swiften/SASL/SCRAMSHA1ClientAuthenticator.h72
-rw-r--r--Swiften/SASL/UnitTest/DIGESTMD5ClientAuthenticatorTest.cpp96
-rw-r--r--Swiften/SASL/UnitTest/DIGESTMD5PropertiesTest.cpp76
-rw-r--r--Swiften/SASL/UnitTest/PLAINClientAuthenticatorTest.cpp30
-rw-r--r--Swiften/SASL/UnitTest/PLAINMessageTest.cpp98
-rw-r--r--Swiften/SASL/UnitTest/SCRAMSHA1ClientAuthenticatorTest.cpp304
-rw-r--r--Swiften/SASL/UnitTest/WindowsServicePrincipalNameTest.cpp284
-rw-r--r--Swiften/SASL/WindowsAuthentication.cpp502
-rw-r--r--Swiften/SASL/WindowsAuthentication.h280
-rw-r--r--Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp318
-rw-r--r--Swiften/SASL/WindowsGSSAPIClientAuthenticator.h176
-rw-r--r--Swiften/SASL/WindowsServicePrincipalName.cpp104
-rw-r--r--Swiften/SASL/WindowsServicePrincipalName.h94
-rw-r--r--Swiften/Serializer/AuthChallengeSerializer.cpp24
-rw-r--r--Swiften/Serializer/AuthChallengeSerializer.h10
-rw-r--r--Swiften/Serializer/AuthFailureSerializer.h16
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.cpp24
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.h10
-rw-r--r--Swiften/Serializer/AuthResponseSerializer.cpp26
-rw-r--r--Swiften/Serializer/AuthResponseSerializer.h10
-rw-r--r--Swiften/Serializer/AuthSuccessSerializer.cpp24
-rw-r--r--Swiften/Serializer/AuthSuccessSerializer.h10
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.cpp4
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.h10
-rw-r--r--Swiften/Serializer/CompressFailureSerializer.h16
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.cpp6
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.h12
-rw-r--r--Swiften/Serializer/ElementSerializer.h12
-rw-r--r--Swiften/Serializer/EnableStreamManagementSerializer.h16
-rw-r--r--Swiften/Serializer/GenericElementSerializer.h16
-rw-r--r--Swiften/Serializer/GenericPayloadSerializer.h22
-rw-r--r--Swiften/Serializer/GenericStanzaSerializer.h34
-rw-r--r--Swiften/Serializer/IQSerializer.h34
-rw-r--r--Swiften/Serializer/MessageSerializer.cpp30
-rw-r--r--Swiften/Serializer/MessageSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/BlockSerializer.h36
-rw-r--r--Swiften/Serializer/PayloadSerializers/BodySerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsDisableSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsEnableSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsPrivateSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/CarbonsSentSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp124
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/DelaySerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp46
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp28
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp94
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.cpp322
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.h28
-rw-r--r--Swiften/Serializer/PayloadSerializers/ForwardedSerializer.cpp50
-rw-r--r--Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp166
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp58
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/IdleSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp132
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp88
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp74
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp204
-rw-r--r--Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h32
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp114
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h26
-rw-r--r--Swiften/Serializer/PayloadSerializers/LastSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMFinSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMResultSerializer.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.cpp40
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCItemSerializer.h100
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp18
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp64
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp76
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrioritySerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.cpp32
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.cpp168
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h20
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.cpp14
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.cpp14
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h24
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.cpp40
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp36
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.cpp18
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.cpp18
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.cpp14
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h24
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.cpp30
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.cpp18
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.cpp18
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp56
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSerializer.h20
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp18
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.cpp44
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp60
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp44
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp72
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h38
-rw-r--r--Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp60
-rw-r--r--Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp46
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp46
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp24
-rw-r--r--Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h14
-rw-r--r--Swiften/Serializer/PayloadSerializers/StatusSerializer.h18
-rw-r--r--Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h44
-rw-r--r--Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp58
-rw-r--r--Swiften/Serializer/PayloadSerializers/StorageSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp56
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp84
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/SubjectSerializer.h16
-rw-r--r--Swiften/Serializer/PayloadSerializers/ThreadSerializer.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/ThreadSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/BlockSerializerTest.cpp66
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/CarbonsSerializerTest.cpp212
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ChatStateSerializerTest.cpp72
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/DeliveryReceiptSerializerTest.cpp34
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp82
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp50
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp562
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ForwardedSerializerTest.cpp186
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/IBBSerializerTest.cpp36
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/IdleSerializerTest.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp88
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/IsodeIQDelegationSerializerTest.cpp196
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp742
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MAMFinSerializerTest.cpp70
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MAMQuerySerializerTest.cpp80
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MAMResultSerializerTest.cpp76
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MUCAdminPayloadSerializerTest.cpp38
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h12
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp62
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemSerializerTest.cpp54
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PubSubItemsSerializerTest.cpp84
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp26
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp74
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ResultSetSerializerTest.cpp144
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp72
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp168
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp316
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp86
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp102
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp20
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp78
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp96
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp94
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/UserLocationSerializerTest.cpp142
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/UserTuneSerializerTest.cpp72
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp260
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp30
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserLocationSerializer.cpp142
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp52
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp448
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp364
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h46
-rw-r--r--Swiften/Serializer/PresenceSerializer.cpp26
-rw-r--r--Swiften/Serializer/PresenceSerializer.h18
-rw-r--r--Swiften/Serializer/StanzaAckRequestSerializer.h16
-rw-r--r--Swiften/Serializer/StanzaAckSerializer.h24
-rw-r--r--Swiften/Serializer/StanzaSerializer.cpp64
-rw-r--r--Swiften/Serializer/StanzaSerializer.h32
-rw-r--r--Swiften/Serializer/StartTLSFailureSerializer.h16
-rw-r--r--Swiften/Serializer/StartTLSRequestSerializer.h16
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.cpp76
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.h10
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.cpp74
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.h10
-rw-r--r--Swiften/Serializer/StreamManagementEnabledSerializer.cpp18
-rw-r--r--Swiften/Serializer/StreamManagementEnabledSerializer.h10
-rw-r--r--Swiften/Serializer/StreamManagementFailedSerializer.h16
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.cpp14
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.h10
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.cpp14
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.h10
-rw-r--r--Swiften/Serializer/TLSProceedSerializer.h16
-rw-r--r--Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp74
-rw-r--r--Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp74
-rw-r--r--Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp74
-rw-r--r--Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp74
-rw-r--r--Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp74
-rw-r--r--Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp90
-rw-r--r--Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp98
-rw-r--r--Swiften/Serializer/XML/XMLElement.cpp68
-rw-r--r--Swiften/Serializer/XML/XMLElement.h24
-rw-r--r--Swiften/Serializer/XML/XMLNode.h10
-rw-r--r--Swiften/Serializer/XML/XMLRawTextNode.h20
-rw-r--r--Swiften/Serializer/XML/XMLTextNode.h42
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp108
-rw-r--r--Swiften/Serializer/XMPPSerializer.h38
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp192
-rw-r--r--Swiften/Session/BOSHSessionStream.h140
-rw-r--r--Swiften/Session/BasicSessionStream.cpp210
-rw-r--r--Swiften/Session/BasicSessionStream.h126
-rw-r--r--Swiften/Session/Session.cpp130
-rw-r--r--Swiften/Session/Session.h186
-rw-r--r--Swiften/Session/SessionStream.h136
-rw-r--r--Swiften/Session/SessionTracer.cpp16
-rw-r--r--Swiften/Session/SessionTracer.h14
-rw-r--r--Swiften/StreamManagement/StanzaAckRequester.cpp32
-rw-r--r--Swiften/StreamManagement/StanzaAckRequester.h32
-rw-r--r--Swiften/StreamManagement/StanzaAckResponder.cpp4
-rw-r--r--Swiften/StreamManagement/StanzaAckResponder.h22
-rw-r--r--Swiften/StreamManagement/UnitTest/StanzaAckRequesterTest.cpp278
-rw-r--r--Swiften/StreamManagement/UnitTest/StanzaAckResponderTest.cpp148
-rw-r--r--Swiften/StreamStack/CompressionLayer.h64
-rw-r--r--Swiften/StreamStack/ConnectionLayer.cpp6
-rw-r--r--Swiften/StreamStack/ConnectionLayer.h24
-rw-r--r--Swiften/StreamStack/DummyStreamLayer.h28
-rw-r--r--Swiften/StreamStack/HighLayer.cpp8
-rw-r--r--Swiften/StreamStack/HighLayer.h38
-rw-r--r--Swiften/StreamStack/LowLayer.cpp4
-rw-r--r--Swiften/StreamStack/LowLayer.h40
-rw-r--r--Swiften/StreamStack/StreamLayer.h8
-rw-r--r--Swiften/StreamStack/StreamStack.cpp18
-rw-r--r--Swiften/StreamStack/StreamStack.h60
-rw-r--r--Swiften/StreamStack/TLSLayer.cpp26
-rw-r--r--Swiften/StreamStack/TLSLayer.h44
-rw-r--r--Swiften/StreamStack/UnitTest/StreamStackTest.cpp302
-rw-r--r--Swiften/StreamStack/UnitTest/XMPPLayerTest.cpp230
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp32
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.h48
-rw-r--r--Swiften/StreamStack/XMPPLayer.cpp92
-rw-r--r--Swiften/StreamStack/XMPPLayer.h92
-rw-r--r--Swiften/StringCodecs/Base64.cpp150
-rw-r--r--Swiften/StringCodecs/Base64.h12
-rw-r--r--Swiften/StringCodecs/Hexify.cpp76
-rw-r--r--Swiften/StringCodecs/Hexify.h12
-rw-r--r--Swiften/StringCodecs/PBKDF2.h32
-rw-r--r--Swiften/StringCodecs/SHA1_Windows.cpp128
-rw-r--r--Swiften/StringCodecs/SHA1_Windows.h38
-rw-r--r--Swiften/StringCodecs/UnitTest/Base64Test.cpp94
-rw-r--r--Swiften/StringCodecs/UnitTest/HexifyTest.cpp38
-rw-r--r--Swiften/StringCodecs/UnitTest/PBKDF2Test.cpp48
-rw-r--r--Swiften/TLS/BlindCertificateTrustChecker.h28
-rw-r--r--Swiften/TLS/CAPICertificate.cpp570
-rw-r--r--Swiften/TLS/CAPICertificate.h60
-rw-r--r--Swiften/TLS/Certificate.cpp18
-rw-r--r--Swiften/TLS/Certificate.h40
-rw-r--r--Swiften/TLS/CertificateFactory.h10
-rw-r--r--Swiften/TLS/CertificateTrustChecker.h32
-rw-r--r--Swiften/TLS/CertificateVerificationError.h58
-rw-r--r--Swiften/TLS/CertificateWithKey.h14
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificate.cpp140
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificate.h108
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLCertificateFactory.h12
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.cpp496
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContext.h50
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContextFactory.cpp18
-rw-r--r--Swiften/TLS/OpenSSL/OpenSSLContextFactory.h16
-rw-r--r--Swiften/TLS/PKCS12Certificate.h82
-rw-r--r--Swiften/TLS/PlatformTLSFactories.cpp34
-rw-r--r--Swiften/TLS/PlatformTLSFactories.h24
-rw-r--r--Swiften/TLS/Schannel/SchannelCertificate.cpp284
-rw-r--r--Swiften/TLS/Schannel/SchannelCertificate.h140
-rw-r--r--Swiften/TLS/Schannel/SchannelCertificateFactory.h12
-rw-r--r--Swiften/TLS/Schannel/SchannelContext.cpp1080
-rw-r--r--Swiften/TLS/Schannel/SchannelContext.h122
-rw-r--r--Swiften/TLS/Schannel/SchannelContextFactory.cpp14
-rw-r--r--Swiften/TLS/Schannel/SchannelContextFactory.h22
-rw-r--r--Swiften/TLS/Schannel/SchannelUtil.h814
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportCertificate.h34
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportCertificate.mm164
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportCertificateFactory.h12
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContext.h60
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContext.mm778
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContextFactory.cpp14
-rw-r--r--Swiften/TLS/SecureTransport/SecureTransportContextFactory.h20
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.cpp124
-rw-r--r--Swiften/TLS/ServerIdentityVerifier.h26
-rw-r--r--Swiften/TLS/SimpleCertificate.h126
-rw-r--r--Swiften/TLS/TLSContext.cpp4
-rw-r--r--Swiften/TLS/TLSContext.h34
-rw-r--r--Swiften/TLS/TLSContextFactory.h18
-rw-r--r--Swiften/TLS/TLSError.h28
-rw-r--r--Swiften/TLS/TLSOptions.h22
-rw-r--r--Swiften/TLS/UnitTest/CertificateTest.cpp18
-rw-r--r--Swiften/TLS/UnitTest/ServerIdentityVerifierTest.cpp290
-rw-r--r--Swiften/VCards/GetVCardRequest.h20
-rw-r--r--Swiften/VCards/SetVCardRequest.h20
-rw-r--r--Swiften/VCards/UnitTest/VCardManagerTest.cpp366
-rw-r--r--Swiften/VCards/VCardManager.cpp80
-rw-r--r--Swiften/VCards/VCardManager.h76
-rw-r--r--Swiften/VCards/VCardMemoryStorage.h68
-rw-r--r--Swiften/VCards/VCardStorage.cpp14
-rw-r--r--Swiften/VCards/VCardStorage.h26
-rw-r--r--Swiften/Whiteboard/IncomingWhiteboardSession.cpp70
-rw-r--r--Swiften/Whiteboard/IncomingWhiteboardSession.h24
-rw-r--r--Swiften/Whiteboard/OutgoingWhiteboardSession.cpp68
-rw-r--r--Swiften/Whiteboard/OutgoingWhiteboardSession.h32
-rw-r--r--Swiften/Whiteboard/UnitTest/WhiteboardClientTest.cpp1302
-rw-r--r--Swiften/Whiteboard/UnitTest/WhiteboardServerTest.cpp200
-rw-r--r--Swiften/Whiteboard/WhiteboardClient.cpp216
-rw-r--r--Swiften/Whiteboard/WhiteboardClient.h42
-rw-r--r--Swiften/Whiteboard/WhiteboardResponder.cpp40
-rw-r--r--Swiften/Whiteboard/WhiteboardResponder.h20
-rw-r--r--Swiften/Whiteboard/WhiteboardServer.cpp72
-rw-r--r--Swiften/Whiteboard/WhiteboardServer.h16
-rw-r--r--Swiften/Whiteboard/WhiteboardSession.cpp84
-rw-r--r--Swiften/Whiteboard/WhiteboardSession.h70
-rw-r--r--Swiften/Whiteboard/WhiteboardSessionManager.cpp184
-rw-r--r--Swiften/Whiteboard/WhiteboardSessionManager.h66
-rw-r--r--Swiften/Whiteboard/WhiteboardTransformer.cpp404
-rw-r--r--Swiften/Whiteboard/WhiteboardTransformer.h26
1592 files changed, 62941 insertions, 62941 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp
index a1f3d4c..1cdf467 100644
--- a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp
+++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp
@@ -18,83 +18,83 @@ OutgoingAdHocCommandSession::OutgoingAdHocCommandSession(const JID& to, const st
}
OutgoingAdHocCommandSession::~OutgoingAdHocCommandSession() {
- connection_.disconnect();
+ connection_.disconnect();
}
void OutgoingAdHocCommandSession::handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error) {
- if (error) {
- onError(error);
- } else {
- const std::vector<Command::Action>& actions = payload->getAvailableActions();
- actionStates_.clear();
- if (payload->getStatus() == Command::Executing ) {
- actionStates_[Command::Cancel] = EnabledAndPresent;
- actionStates_[Command::Complete] = Present;
- if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) {
- actionStates_[Command::Complete] = EnabledAndPresent;
- }
-
- if (getIsMultiStage()) {
- actionStates_[Command::Next] = Present;
- actionStates_[Command::Prev] = Present;
- }
-
- if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()) {
- actionStates_[Command::Next] = EnabledAndPresent;
- }
- if (std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
- actionStates_[Command::Prev] = EnabledAndPresent;
- }
- }
-
- sessionID_ = payload->getSessionID();
- if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()
- || std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
- isMultiStage_ = true;
- }
- onNextStageReceived(payload);
- }
+ if (error) {
+ onError(error);
+ } else {
+ const std::vector<Command::Action>& actions = payload->getAvailableActions();
+ actionStates_.clear();
+ if (payload->getStatus() == Command::Executing ) {
+ actionStates_[Command::Cancel] = EnabledAndPresent;
+ actionStates_[Command::Complete] = Present;
+ if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) {
+ actionStates_[Command::Complete] = EnabledAndPresent;
+ }
+
+ if (getIsMultiStage()) {
+ actionStates_[Command::Next] = Present;
+ actionStates_[Command::Prev] = Present;
+ }
+
+ if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()) {
+ actionStates_[Command::Next] = EnabledAndPresent;
+ }
+ if (std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
+ actionStates_[Command::Prev] = EnabledAndPresent;
+ }
+ }
+
+ sessionID_ = payload->getSessionID();
+ if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()
+ || std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {
+ isMultiStage_ = true;
+ }
+ onNextStageReceived(payload);
+ }
}
bool OutgoingAdHocCommandSession::getIsMultiStage() const {
- return isMultiStage_;
+ return isMultiStage_;
}
void OutgoingAdHocCommandSession::start() {
- boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, boost::make_shared<Command>(commandNode_), iqRouter_);
- connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
- commandRequest->send();
+ boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, boost::make_shared<Command>(commandNode_), iqRouter_);
+ connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
+ commandRequest->send();
}
void OutgoingAdHocCommandSession::cancel() {
- if (!sessionID_.empty()) {
- submitForm(Form::ref(), Command::Cancel);
- }
+ if (!sessionID_.empty()) {
+ submitForm(Form::ref(), Command::Cancel);
+ }
}
void OutgoingAdHocCommandSession::goBack() {
- submitForm(Form::ref(), Command::Prev);
+ submitForm(Form::ref(), Command::Prev);
}
void OutgoingAdHocCommandSession::complete(Form::ref form) {
- submitForm(form, Command::Complete);
+ submitForm(form, Command::Complete);
}
void OutgoingAdHocCommandSession::goNext(Form::ref form) {
- submitForm(form, Command::Next);
+ submitForm(form, Command::Next);
}
void OutgoingAdHocCommandSession::submitForm(Form::ref form, Command::Action action) {
- boost::shared_ptr<Command> command(boost::make_shared<Command>(commandNode_, sessionID_, action));
- command->setForm(form);
- boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_);
- connection_.disconnect();
- connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
- commandRequest->send();
+ boost::shared_ptr<Command> command(boost::make_shared<Command>(commandNode_, sessionID_, action));
+ command->setForm(form);
+ boost::shared_ptr<GenericRequest<Command> > commandRequest = boost::make_shared< GenericRequest<Command> >(IQ::Set, to_, command, iqRouter_);
+ connection_.disconnect();
+ connection_ = commandRequest->onResponse.connect(boost::bind(&OutgoingAdHocCommandSession::handleResponse, this, _1, _2));
+ commandRequest->send();
}
OutgoingAdHocCommandSession::ActionState OutgoingAdHocCommandSession::getActionState(Command::Action action) const {
- return get(actionStates_, action, Absent);
+ return get(actionStates_, action, Absent);
}
}
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.h b/Swiften/AdHoc/OutgoingAdHocCommandSession.h
index 73dc7a1..fdb6e35 100644
--- a/Swiften/AdHoc/OutgoingAdHocCommandSession.h
+++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.h
@@ -18,82 +18,82 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class IQRouter;
- class MainWindow;
- class UIEventStream;
+ class IQRouter;
+ class MainWindow;
+ class UIEventStream;
- class SWIFTEN_API OutgoingAdHocCommandSession {
- public:
+ class SWIFTEN_API OutgoingAdHocCommandSession {
+ public:
- /**
- * Availability of action.
- */
- enum ActionState {
- Absent /** Action isn't applicable to this command. */ = 0,
- Present /** Action is applicable to this command */= 1,
- Enabled /** Action is applicable and currently available */ = 2,
- EnabledAndPresent = 3};
+ /**
+ * Availability of action.
+ */
+ enum ActionState {
+ Absent /** Action isn't applicable to this command. */ = 0,
+ Present /** Action is applicable to this command */= 1,
+ Enabled /** Action is applicable and currently available */ = 2,
+ EnabledAndPresent = 3};
- OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter);
- ~OutgoingAdHocCommandSession();
- /**
- * Send initial request to the target.
- */
- void start();
- /**
- * Cancel command session with the target.
- */
- void cancel();
- /**
- * Return to the previous stage.
- */
- void goBack();
- /**
- * Send the form to complete the command.
- * \param form Form for submission - if missing the command will be submitted with no form.
- */
- void complete(Form::ref form);
- /**
- * Send the form to advance to the next stage of the command.
- * \param form Form for submission - if missing the command will be submitted with no form.
- */
- void goNext(Form::ref form);
+ OutgoingAdHocCommandSession(const JID& to, const std::string& commandNode, IQRouter* iqRouter);
+ ~OutgoingAdHocCommandSession();
+ /**
+ * Send initial request to the target.
+ */
+ void start();
+ /**
+ * Cancel command session with the target.
+ */
+ void cancel();
+ /**
+ * Return to the previous stage.
+ */
+ void goBack();
+ /**
+ * Send the form to complete the command.
+ * \param form Form for submission - if missing the command will be submitted with no form.
+ */
+ void complete(Form::ref form);
+ /**
+ * Send the form to advance to the next stage of the command.
+ * \param form Form for submission - if missing the command will be submitted with no form.
+ */
+ void goNext(Form::ref form);
- /**
- * Is the form multi-stage?
- */
- bool getIsMultiStage() const;
+ /**
+ * Is the form multi-stage?
+ */
+ bool getIsMultiStage() const;
- /**
- * Emitted when the form for the next stage is available.
- */
- boost::signal<void (Command::ref)> onNextStageReceived;
+ /**
+ * Emitted when the form for the next stage is available.
+ */
+ boost::signal<void (Command::ref)> onNextStageReceived;
- /**
- * Emitted on error.
- */
- boost::signal<void (ErrorPayload::ref)> onError;
+ /**
+ * Emitted on error.
+ */
+ boost::signal<void (ErrorPayload::ref)> onError;
- /**
- * Get the state of a given action.
- * This is useful for a UI to determine which buttons should be visible,
- * and which enabled.
- * Use for Next, Prev, Cancel and Complete only.
- * If no actions are available, the command has completed.
- */
- ActionState getActionState(Command::Action action) const;
+ /**
+ * Get the state of a given action.
+ * This is useful for a UI to determine which buttons should be visible,
+ * and which enabled.
+ * Use for Next, Prev, Cancel and Complete only.
+ * If no actions are available, the command has completed.
+ */
+ ActionState getActionState(Command::Action action) const;
- private:
- void handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error);
- void submitForm(Form::ref, Command::Action action);
+ private:
+ void handleResponse(boost::shared_ptr<Command> payload, ErrorPayload::ref error);
+ void submitForm(Form::ref, Command::Action action);
- private:
- JID to_;
- std::string commandNode_;
- IQRouter* iqRouter_;
- bool isMultiStage_;
- std::string sessionID_;
- std::map<Command::Action, ActionState> actionStates_;
- boost::bsignals::connection connection_;
- };
+ private:
+ JID to_;
+ std::string commandNode_;
+ IQRouter* iqRouter_;
+ bool isMultiStage_;
+ std::string sessionID_;
+ std::map<Command::Action, ActionState> actionStates_;
+ boost::bsignals::connection connection_;
+ };
}
diff --git a/Swiften/Avatars/AvatarManager.h b/Swiften/Avatars/AvatarManager.h
index 20b4725..ffd6608 100644
--- a/Swiften/Avatars/AvatarManager.h
+++ b/Swiften/Avatars/AvatarManager.h
@@ -13,15 +13,15 @@
#include <Swiften/Base/boost_bsignals.h>
namespace Swift {
- class JID;
+ class JID;
- class SWIFTEN_API AvatarManager {
- public:
- virtual ~AvatarManager();
+ class SWIFTEN_API AvatarManager {
+ public:
+ virtual ~AvatarManager();
- virtual ByteArray getAvatar(const JID&) const = 0;
- virtual boost::filesystem::path getAvatarPath(const JID&) const = 0;
+ virtual ByteArray getAvatar(const JID&) const = 0;
+ virtual boost::filesystem::path getAvatarPath(const JID&) const = 0;
- boost::signal<void (const JID&)> onAvatarChanged;
- };
+ boost::signal<void (const JID&)> onAvatarChanged;
+ };
}
diff --git a/Swiften/Avatars/AvatarManagerImpl.cpp b/Swiften/Avatars/AvatarManagerImpl.cpp
index f15c16c..6e98b1b 100644
--- a/Swiften/Avatars/AvatarManagerImpl.cpp
+++ b/Swiften/Avatars/AvatarManagerImpl.cpp
@@ -17,50 +17,50 @@
namespace Swift {
AvatarManagerImpl::AvatarManagerImpl(VCardManager* vcardManager, StanzaChannel* stanzaChannel, AvatarStorage* avatarStorage, CryptoProvider* crypto, MUCRegistry* mucRegistry) : avatarStorage(avatarStorage) {
- vcardUpdateAvatarManager = new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto, mucRegistry);
- combinedAvatarProvider.addProvider(vcardUpdateAvatarManager);
+ vcardUpdateAvatarManager = new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto, mucRegistry);
+ combinedAvatarProvider.addProvider(vcardUpdateAvatarManager);
- vcardAvatarManager = new VCardAvatarManager(vcardManager, avatarStorage, crypto, mucRegistry);
- combinedAvatarProvider.addProvider(vcardAvatarManager);
+ vcardAvatarManager = new VCardAvatarManager(vcardManager, avatarStorage, crypto, mucRegistry);
+ combinedAvatarProvider.addProvider(vcardAvatarManager);
- offlineAvatarManager = new OfflineAvatarManager(avatarStorage);
- combinedAvatarProvider.addProvider(offlineAvatarManager);
+ offlineAvatarManager = new OfflineAvatarManager(avatarStorage);
+ combinedAvatarProvider.addProvider(offlineAvatarManager);
- combinedAvatarProvider.onAvatarChanged.connect(boost::bind(&AvatarManagerImpl::handleCombinedAvatarChanged, this, _1));
+ combinedAvatarProvider.onAvatarChanged.connect(boost::bind(&AvatarManagerImpl::handleCombinedAvatarChanged, this, _1));
}
AvatarManagerImpl::~AvatarManagerImpl() {
- combinedAvatarProvider.onAvatarChanged.disconnect(boost::bind(&AvatarManagerImpl::handleCombinedAvatarChanged, this, _1));
+ combinedAvatarProvider.onAvatarChanged.disconnect(boost::bind(&AvatarManagerImpl::handleCombinedAvatarChanged, this, _1));
- combinedAvatarProvider.removeProvider(offlineAvatarManager);
- delete offlineAvatarManager;
- combinedAvatarProvider.removeProvider(vcardAvatarManager);
- delete vcardAvatarManager;
- combinedAvatarProvider.removeProvider(vcardUpdateAvatarManager);
- delete vcardUpdateAvatarManager;
+ combinedAvatarProvider.removeProvider(offlineAvatarManager);
+ delete offlineAvatarManager;
+ combinedAvatarProvider.removeProvider(vcardAvatarManager);
+ delete vcardAvatarManager;
+ combinedAvatarProvider.removeProvider(vcardUpdateAvatarManager);
+ delete vcardUpdateAvatarManager;
}
boost::filesystem::path AvatarManagerImpl::getAvatarPath(const JID& jid) const {
- boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid);
- if (hash && !hash->empty()) {
- return avatarStorage->getAvatarPath(*hash);
- }
- return boost::filesystem::path();
+ boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid);
+ if (hash && !hash->empty()) {
+ return avatarStorage->getAvatarPath(*hash);
+ }
+ return boost::filesystem::path();
}
ByteArray AvatarManagerImpl::getAvatar(const JID& jid) const {
- boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid);
- if (hash && !hash->empty()) {
- return avatarStorage->getAvatar(*hash);
- }
- return ByteArray();
+ boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid);
+ if (hash && !hash->empty()) {
+ return avatarStorage->getAvatar(*hash);
+ }
+ return ByteArray();
}
void AvatarManagerImpl::handleCombinedAvatarChanged(const JID& jid) {
- boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid);
- assert(hash);
- offlineAvatarManager->setAvatar(jid, *hash);
- onAvatarChanged(jid);
+ boost::optional<std::string> hash = combinedAvatarProvider.getAvatarHash(jid);
+ assert(hash);
+ offlineAvatarManager->setAvatar(jid, *hash);
+ onAvatarChanged(jid);
}
}
diff --git a/Swiften/Avatars/AvatarManagerImpl.h b/Swiften/Avatars/AvatarManagerImpl.h
index 69af924..7176c25 100644
--- a/Swiften/Avatars/AvatarManagerImpl.h
+++ b/Swiften/Avatars/AvatarManagerImpl.h
@@ -10,32 +10,32 @@
#include <Swiften/Avatars/CombinedAvatarProvider.h>
namespace Swift {
- class MUCRegistry;
- class AvatarStorage;
- class StanzaChannel;
- class VCardManager;
- class VCardUpdateAvatarManager;
- class VCardAvatarManager;
- class OfflineAvatarManager;
- class CryptoProvider;
-
- class AvatarManagerImpl : public AvatarManager {
- public:
- AvatarManagerImpl(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
- virtual ~AvatarManagerImpl();
-
- virtual boost::filesystem::path getAvatarPath(const JID&) const;
- virtual ByteArray getAvatar(const JID&) const;
-
- private:
- void handleCombinedAvatarChanged(const JID& jid);
-
-
- private:
- CombinedAvatarProvider combinedAvatarProvider;
- AvatarStorage* avatarStorage;
- VCardUpdateAvatarManager* vcardUpdateAvatarManager;
- VCardAvatarManager* vcardAvatarManager;
- OfflineAvatarManager* offlineAvatarManager;
- };
+ class MUCRegistry;
+ class AvatarStorage;
+ class StanzaChannel;
+ class VCardManager;
+ class VCardUpdateAvatarManager;
+ class VCardAvatarManager;
+ class OfflineAvatarManager;
+ class CryptoProvider;
+
+ class AvatarManagerImpl : public AvatarManager {
+ public:
+ AvatarManagerImpl(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
+ virtual ~AvatarManagerImpl();
+
+ virtual boost::filesystem::path getAvatarPath(const JID&) const;
+ virtual ByteArray getAvatar(const JID&) const;
+
+ private:
+ void handleCombinedAvatarChanged(const JID& jid);
+
+
+ private:
+ CombinedAvatarProvider combinedAvatarProvider;
+ AvatarStorage* avatarStorage;
+ VCardUpdateAvatarManager* vcardUpdateAvatarManager;
+ VCardAvatarManager* vcardAvatarManager;
+ OfflineAvatarManager* offlineAvatarManager;
+ };
}
diff --git a/Swiften/Avatars/AvatarMemoryStorage.h b/Swiften/Avatars/AvatarMemoryStorage.h
index 7a4bdd3..bc40a26 100644
--- a/Swiften/Avatars/AvatarMemoryStorage.h
+++ b/Swiften/Avatars/AvatarMemoryStorage.h
@@ -15,30 +15,30 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class SWIFTEN_API AvatarMemoryStorage : public AvatarStorage {
- public:
- virtual bool hasAvatar(const std::string& hash) const { return avatars.find(hash) != avatars.end(); }
- virtual void addAvatar(const std::string& hash, const ByteArray& avatar) { avatars[hash] = avatar; }
- virtual ByteArray getAvatar(const std::string& hash) const {
- std::map<std::string, ByteArray>::const_iterator i = avatars.find(hash);
- return i == avatars.end() ? ByteArray() : i->second;
- }
-
- virtual boost::filesystem::path getAvatarPath(const std::string& hash) const {
- return boost::filesystem::path("/avatars") / hash;
- }
-
- virtual void setAvatarForJID(const JID& jid, const std::string& hash) {
- jidAvatars[jid] = hash;
- }
-
- virtual std::string getAvatarForJID(const JID& jid) const {
- std::map<JID, std::string>::const_iterator i = jidAvatars.find(jid);
- return i == jidAvatars.end() ? "" : i->second;
- }
-
- private:
- std::map<std::string, ByteArray> avatars;
- std::map<JID, std::string> jidAvatars;
- };
+ class SWIFTEN_API AvatarMemoryStorage : public AvatarStorage {
+ public:
+ virtual bool hasAvatar(const std::string& hash) const { return avatars.find(hash) != avatars.end(); }
+ virtual void addAvatar(const std::string& hash, const ByteArray& avatar) { avatars[hash] = avatar; }
+ virtual ByteArray getAvatar(const std::string& hash) const {
+ std::map<std::string, ByteArray>::const_iterator i = avatars.find(hash);
+ return i == avatars.end() ? ByteArray() : i->second;
+ }
+
+ virtual boost::filesystem::path getAvatarPath(const std::string& hash) const {
+ return boost::filesystem::path("/avatars") / hash;
+ }
+
+ virtual void setAvatarForJID(const JID& jid, const std::string& hash) {
+ jidAvatars[jid] = hash;
+ }
+
+ virtual std::string getAvatarForJID(const JID& jid) const {
+ std::map<JID, std::string>::const_iterator i = jidAvatars.find(jid);
+ return i == jidAvatars.end() ? "" : i->second;
+ }
+
+ private:
+ std::map<std::string, ByteArray> avatars;
+ std::map<JID, std::string> jidAvatars;
+ };
}
diff --git a/Swiften/Avatars/AvatarProvider.h b/Swiften/Avatars/AvatarProvider.h
index 8289ecd..77d9cba 100644
--- a/Swiften/Avatars/AvatarProvider.h
+++ b/Swiften/Avatars/AvatarProvider.h
@@ -12,14 +12,14 @@
#include <Swiften/Base/boost_bsignals.h>
namespace Swift {
- class JID;
+ class JID;
- class SWIFTEN_API AvatarProvider {
- public:
- virtual ~AvatarProvider();
+ class SWIFTEN_API AvatarProvider {
+ public:
+ virtual ~AvatarProvider();
- virtual boost::optional<std::string> getAvatarHash(const JID&) const = 0;
+ virtual boost::optional<std::string> getAvatarHash(const JID&) const = 0;
- boost::signal<void (const JID&)> onAvatarChanged;
- };
+ boost::signal<void (const JID&)> onAvatarChanged;
+ };
}
diff --git a/Swiften/Avatars/AvatarStorage.h b/Swiften/Avatars/AvatarStorage.h
index 2885dd0..dc3eb34 100644
--- a/Swiften/Avatars/AvatarStorage.h
+++ b/Swiften/Avatars/AvatarStorage.h
@@ -14,19 +14,19 @@
#include <Swiften/Base/ByteArray.h>
namespace Swift {
- class JID;
+ class JID;
- class SWIFTEN_API AvatarStorage {
- public:
- virtual ~AvatarStorage();
+ class SWIFTEN_API AvatarStorage {
+ public:
+ virtual ~AvatarStorage();
- virtual bool hasAvatar(const std::string& hash) const = 0;
- virtual void addAvatar(const std::string& hash, const ByteArray& avatar) = 0;
- virtual ByteArray getAvatar(const std::string& hash) const = 0;
- virtual boost::filesystem::path getAvatarPath(const std::string& hash) const = 0;
+ virtual bool hasAvatar(const std::string& hash) const = 0;
+ virtual void addAvatar(const std::string& hash, const ByteArray& avatar) = 0;
+ virtual ByteArray getAvatar(const std::string& hash) const = 0;
+ virtual boost::filesystem::path getAvatarPath(const std::string& hash) const = 0;
- virtual void setAvatarForJID(const JID& jid, const std::string& hash) = 0;
- virtual std::string getAvatarForJID(const JID& jid) const = 0;
- };
+ virtual void setAvatarForJID(const JID& jid, const std::string& hash) = 0;
+ virtual std::string getAvatarForJID(const JID& jid) const = 0;
+ };
}
diff --git a/Swiften/Avatars/CombinedAvatarProvider.cpp b/Swiften/Avatars/CombinedAvatarProvider.cpp
index 896346f..465512f 100644
--- a/Swiften/Avatars/CombinedAvatarProvider.cpp
+++ b/Swiften/Avatars/CombinedAvatarProvider.cpp
@@ -15,48 +15,48 @@
namespace Swift {
boost::optional<std::string> CombinedAvatarProvider::getAvatarHash(const JID& jid) const {
- return getCombinedAvatarAndCache(jid);
+ return getCombinedAvatarAndCache(jid);
}
void CombinedAvatarProvider::addProvider(AvatarProvider* provider) {
- provider->onAvatarChanged.connect(boost::bind(&CombinedAvatarProvider::handleAvatarChanged, this, _1));
- providers.push_back(provider);
+ provider->onAvatarChanged.connect(boost::bind(&CombinedAvatarProvider::handleAvatarChanged, this, _1));
+ providers.push_back(provider);
}
void CombinedAvatarProvider::removeProvider(AvatarProvider* provider) {
- std::vector<AvatarProvider*>::iterator i = std::remove(providers.begin(), providers.end(), provider);
- for(std::vector<AvatarProvider*>::iterator j = i; j < providers.end(); ++j) {
- provider->onAvatarChanged.disconnect(boost::bind(&CombinedAvatarProvider::handleAvatarChanged, this, _1));
- }
- providers.erase(i, providers.end());
+ std::vector<AvatarProvider*>::iterator i = std::remove(providers.begin(), providers.end(), provider);
+ for(std::vector<AvatarProvider*>::iterator j = i; j < providers.end(); ++j) {
+ provider->onAvatarChanged.disconnect(boost::bind(&CombinedAvatarProvider::handleAvatarChanged, this, _1));
+ }
+ providers.erase(i, providers.end());
}
void CombinedAvatarProvider::handleAvatarChanged(const JID& jid) {
- std::string oldHash;
- std::map<JID, std::string>::const_iterator i = avatars.find(jid);
- if (i != avatars.end()) {
- oldHash = i->second;
- }
- boost::optional<std::string> newHash = getCombinedAvatarAndCache(jid);
- if (newHash != oldHash) {
- SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << (newHash ? newHash.get() : "NULL") << std::endl;
- onAvatarChanged(jid);
- }
+ std::string oldHash;
+ std::map<JID, std::string>::const_iterator i = avatars.find(jid);
+ if (i != avatars.end()) {
+ oldHash = i->second;
+ }
+ boost::optional<std::string> newHash = getCombinedAvatarAndCache(jid);
+ if (newHash != oldHash) {
+ SWIFT_LOG(debug) << "Avatar changed: " << jid << ": " << oldHash << " -> " << (newHash ? newHash.get() : "NULL") << std::endl;
+ onAvatarChanged(jid);
+ }
}
boost::optional<std::string> CombinedAvatarProvider::getCombinedAvatarAndCache(const JID& jid) const {
- SWIFT_LOG(debug) << "JID: " << jid << std::endl;
- boost::optional<std::string> hash;
- for (size_t i = 0; i < providers.size() && !hash; ++i) {
- hash = providers[i]->getAvatarHash(jid);
- SWIFT_LOG(debug) << "Provider " << providers[i] << ": " << (hash ? hash.get() : "NULL") << std::endl;
- }
- if (hash) {
- avatars[jid] = *hash;
- } else {
- avatars[jid] = "";
- }
- return hash;
+ SWIFT_LOG(debug) << "JID: " << jid << std::endl;
+ boost::optional<std::string> hash;
+ for (size_t i = 0; i < providers.size() && !hash; ++i) {
+ hash = providers[i]->getAvatarHash(jid);
+ SWIFT_LOG(debug) << "Provider " << providers[i] << ": " << (hash ? hash.get() : "NULL") << std::endl;
+ }
+ if (hash) {
+ avatars[jid] = *hash;
+ } else {
+ avatars[jid] = "";
+ }
+ return hash;
}
}
diff --git a/Swiften/Avatars/CombinedAvatarProvider.h b/Swiften/Avatars/CombinedAvatarProvider.h
index c458514..f667ad2 100644
--- a/Swiften/Avatars/CombinedAvatarProvider.h
+++ b/Swiften/Avatars/CombinedAvatarProvider.h
@@ -14,19 +14,19 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class SWIFTEN_API CombinedAvatarProvider : public AvatarProvider {
- public:
- virtual boost::optional<std::string> getAvatarHash(const JID&) const;
+ class SWIFTEN_API CombinedAvatarProvider : public AvatarProvider {
+ public:
+ virtual boost::optional<std::string> getAvatarHash(const JID&) const;
- void addProvider(AvatarProvider*);
- void removeProvider(AvatarProvider*);
+ void addProvider(AvatarProvider*);
+ void removeProvider(AvatarProvider*);
- private:
- void handleAvatarChanged(const JID&);
- boost::optional<std::string> getCombinedAvatarAndCache(const JID&) const;
+ private:
+ void handleAvatarChanged(const JID&);
+ boost::optional<std::string> getCombinedAvatarAndCache(const JID&) const;
- private:
- std::vector<AvatarProvider*> providers;
- mutable std::map<JID, std::string> avatars;
- };
+ private:
+ std::vector<AvatarProvider*> providers;
+ mutable std::map<JID, std::string> avatars;
+ };
}
diff --git a/Swiften/Avatars/DummyAvatarManager.h b/Swiften/Avatars/DummyAvatarManager.h
index 7d0793c..f079be1 100644
--- a/Swiften/Avatars/DummyAvatarManager.h
+++ b/Swiften/Avatars/DummyAvatarManager.h
@@ -12,22 +12,22 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class DummyAvatarManager : public AvatarManager {
- public:
- virtual boost::filesystem::path getAvatarPath(const JID& j) const {
- return boost::filesystem::path("/avatars") / j.toString();
- }
+ class DummyAvatarManager : public AvatarManager {
+ public:
+ virtual boost::filesystem::path getAvatarPath(const JID& j) const {
+ return boost::filesystem::path("/avatars") / j.toString();
+ }
- virtual ByteArray getAvatar(const JID& jid) const {
- std::map<JID, ByteArray>::const_iterator i = avatars.find(jid);
- if (i != avatars.end()) {
- return i->second;
- }
- else {
- return ByteArray();
- }
- }
+ virtual ByteArray getAvatar(const JID& jid) const {
+ std::map<JID, ByteArray>::const_iterator i = avatars.find(jid);
+ if (i != avatars.end()) {
+ return i->second;
+ }
+ else {
+ return ByteArray();
+ }
+ }
- std::map<JID, ByteArray> avatars;
- };
+ std::map<JID, ByteArray> avatars;
+ };
}
diff --git a/Swiften/Avatars/NullAvatarManager.h b/Swiften/Avatars/NullAvatarManager.h
index e9f3028..adc1acc 100644
--- a/Swiften/Avatars/NullAvatarManager.h
+++ b/Swiften/Avatars/NullAvatarManager.h
@@ -9,14 +9,14 @@
#include <Swiften/Avatars/AvatarManager.h>
namespace Swift {
- class NullAvatarManager : public AvatarManager {
- public:
- virtual boost::filesystem::path getAvatarPath(const JID&) const {
- return boost::filesystem::path();
- }
+ class NullAvatarManager : public AvatarManager {
+ public:
+ virtual boost::filesystem::path getAvatarPath(const JID&) const {
+ return boost::filesystem::path();
+ }
- virtual ByteArray getAvatar(const JID&) const {
- return ByteArray();
- }
- };
+ virtual ByteArray getAvatar(const JID&) const {
+ return ByteArray();
+ }
+ };
}
diff --git a/Swiften/Avatars/OfflineAvatarManager.cpp b/Swiften/Avatars/OfflineAvatarManager.cpp
index d462f08..e2468e6 100644
--- a/Swiften/Avatars/OfflineAvatarManager.cpp
+++ b/Swiften/Avatars/OfflineAvatarManager.cpp
@@ -19,14 +19,14 @@ OfflineAvatarManager::~OfflineAvatarManager() {
}
boost::optional<std::string> OfflineAvatarManager::getAvatarHash(const JID& jid) const {
- return avatarStorage->getAvatarForJID(jid);
+ return avatarStorage->getAvatarForJID(jid);
}
void OfflineAvatarManager::setAvatar(const JID& jid, const std::string& hash) {
- if (getAvatarHash(jid) != hash) {
- avatarStorage->setAvatarForJID(jid, hash);
- onAvatarChanged(jid);
- }
+ if (getAvatarHash(jid) != hash) {
+ avatarStorage->setAvatarForJID(jid, hash);
+ onAvatarChanged(jid);
+ }
}
}
diff --git a/Swiften/Avatars/OfflineAvatarManager.h b/Swiften/Avatars/OfflineAvatarManager.h
index 22345ae..11b1d5f 100644
--- a/Swiften/Avatars/OfflineAvatarManager.h
+++ b/Swiften/Avatars/OfflineAvatarManager.h
@@ -10,17 +10,17 @@
#include <Swiften/Base/API.h>
namespace Swift {
- class AvatarStorage;
+ class AvatarStorage;
- class SWIFTEN_API OfflineAvatarManager : public AvatarProvider {
- public:
- OfflineAvatarManager(AvatarStorage*);
- ~OfflineAvatarManager();
+ class SWIFTEN_API OfflineAvatarManager : public AvatarProvider {
+ public:
+ OfflineAvatarManager(AvatarStorage*);
+ ~OfflineAvatarManager();
- virtual boost::optional<std::string> getAvatarHash(const JID&) const;
- void setAvatar(const JID&, const std::string& hash);
+ virtual boost::optional<std::string> getAvatarHash(const JID&) const;
+ void setAvatar(const JID&, const std::string& hash);
- private:
- AvatarStorage* avatarStorage;
- };
+ private:
+ AvatarStorage* avatarStorage;
+ };
}
diff --git a/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp b/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp
index d3004cd..79769a8 100644
--- a/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp
+++ b/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp
@@ -31,113 +31,113 @@
using namespace Swift;
class AvatarManagerImplTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(AvatarManagerImplTest);
- CPPUNIT_TEST(testGetSetAvatar);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void setUp() {
- ownerJID = JID("owner@domain.com/theowner");
- stanzaChannel = boost::make_shared<DummyStanzaChannel>();
- iqRouter = boost::make_shared<IQRouter>(stanzaChannel.get());
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
- vcardStorage = boost::make_shared<VCardMemoryStorage>(crypto.get());
- vcardManager = boost::make_shared<VCardManager>(ownerJID, iqRouter.get(), vcardStorage.get());
- avatarStorage = boost::make_shared<AvatarMemoryStorage>();
- mucRegistry = boost::make_shared<DummyMUCRegistry>();
- avatarManager = boost::make_shared<AvatarManagerImpl>(vcardManager.get(), stanzaChannel.get(), avatarStorage.get(), crypto.get(), mucRegistry.get());
- }
-
- void testGetSetAvatar() {
- /* initially we have no knowledge of the user or their avatar */
- JID personJID("person@domain.com/theperson");
- ByteArray avatar = avatarManager->getAvatar(personJID.toBare());
- CPPUNIT_ASSERT(!avatar.size());
-
- /* notify the 'owner' JID that our avatar has changed */
-
- ByteArray fullAvatar = createByteArray("abcdefg");
- boost::shared_ptr<VCardUpdate> vcardUpdate = boost::make_shared<VCardUpdate>();
- vcardUpdate->setPhotoHash(Hexify::hexify(crypto->getSHA1Hash(fullAvatar)));
- boost::shared_ptr<Presence> presence = boost::make_shared<Presence>();
- presence->setTo(ownerJID);
- presence->setFrom(personJID);
- presence->setType(Presence::Available);
- presence->addPayload(vcardUpdate);
- stanzaChannel->onPresenceReceived(presence);
-
- /* reply to the avatar request with our new avatar */
-
- CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
- boost::shared_ptr<IQ> request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]);
- stanzaChannel->sentStanzas.pop_back();
- CPPUNIT_ASSERT(!!request);
- boost::shared_ptr<VCard> vcard = request->getPayload<VCard>();
- CPPUNIT_ASSERT(!!vcard);
-
- boost::shared_ptr<IQ> reply = boost::make_shared<IQ>(IQ::Result);
- reply->setTo(request->getFrom());
- reply->setFrom(request->getTo());
- reply->setID(request->getID());
- vcard->setPhoto(fullAvatar);
- reply->addPayload(vcard);
- stanzaChannel->onIQReceived(reply);
-
- /* check hash through avatarManager that it received the correct photo */
-
- ByteArray reportedAvatar = avatarManager->getAvatar(personJID.toBare());
- CPPUNIT_ASSERT_EQUAL(byteArrayToString(fullAvatar), byteArrayToString(reportedAvatar));
-
- /* send new presence to notify of blank avatar */
-
- vcardUpdate = boost::make_shared<VCardUpdate>();
- presence = boost::make_shared<Presence>();
- presence->setTo(ownerJID);
- presence->setFrom(personJID);
- presence->setType(Presence::Available);
- presence->addPayload(vcardUpdate);
- stanzaChannel->onPresenceReceived(presence);
-
- /* reply to the avatar request with our EMPTY avatar */
-
- CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
- request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]);
- stanzaChannel->sentStanzas.pop_back();
- CPPUNIT_ASSERT(!!request);
- vcard = request->getPayload<VCard>();
- CPPUNIT_ASSERT(!!vcard);
-
- ByteArray blankAvatar = createByteArray("");
- reply = boost::make_shared<IQ>(IQ::Result);
- reply->setTo(request->getFrom());
- reply->setFrom(request->getTo());
- reply->setID(request->getID());
- vcard->setPhoto(blankAvatar);
- reply->addPayload(vcard);
- stanzaChannel->onIQReceived(reply);
-
- /* check hash through avatarManager that it received the correct photo */
-
- reportedAvatar = avatarManager->getAvatar(personJID.toBare());
- CPPUNIT_ASSERT_EQUAL(byteArrayToString(blankAvatar), byteArrayToString(reportedAvatar));
- }
-
- struct DummyMUCRegistry : public MUCRegistry {
- bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
- std::vector<JID> mucs_;
- };
-
- private:
-
- JID ownerJID;
- boost::shared_ptr<DummyStanzaChannel> stanzaChannel;
- boost::shared_ptr<IQRouter> iqRouter;
- boost::shared_ptr<CryptoProvider> crypto;
- boost::shared_ptr<VCardMemoryStorage> vcardStorage;
- boost::shared_ptr<VCardManager> vcardManager;
- boost::shared_ptr<AvatarMemoryStorage> avatarStorage;
- boost::shared_ptr<DummyMUCRegistry> mucRegistry;
- boost::shared_ptr<AvatarManagerImpl> avatarManager;
+ CPPUNIT_TEST_SUITE(AvatarManagerImplTest);
+ CPPUNIT_TEST(testGetSetAvatar);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void setUp() {
+ ownerJID = JID("owner@domain.com/theowner");
+ stanzaChannel = boost::make_shared<DummyStanzaChannel>();
+ iqRouter = boost::make_shared<IQRouter>(stanzaChannel.get());
+ crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ vcardStorage = boost::make_shared<VCardMemoryStorage>(crypto.get());
+ vcardManager = boost::make_shared<VCardManager>(ownerJID, iqRouter.get(), vcardStorage.get());
+ avatarStorage = boost::make_shared<AvatarMemoryStorage>();
+ mucRegistry = boost::make_shared<DummyMUCRegistry>();
+ avatarManager = boost::make_shared<AvatarManagerImpl>(vcardManager.get(), stanzaChannel.get(), avatarStorage.get(), crypto.get(), mucRegistry.get());
+ }
+
+ void testGetSetAvatar() {
+ /* initially we have no knowledge of the user or their avatar */
+ JID personJID("person@domain.com/theperson");
+ ByteArray avatar = avatarManager->getAvatar(personJID.toBare());
+ CPPUNIT_ASSERT(!avatar.size());
+
+ /* notify the 'owner' JID that our avatar has changed */
+
+ ByteArray fullAvatar = createByteArray("abcdefg");
+ boost::shared_ptr<VCardUpdate> vcardUpdate = boost::make_shared<VCardUpdate>();
+ vcardUpdate->setPhotoHash(Hexify::hexify(crypto->getSHA1Hash(fullAvatar)));
+ boost::shared_ptr<Presence> presence = boost::make_shared<Presence>();
+ presence->setTo(ownerJID);
+ presence->setFrom(personJID);
+ presence->setType(Presence::Available);
+ presence->addPayload(vcardUpdate);
+ stanzaChannel->onPresenceReceived(presence);
+
+ /* reply to the avatar request with our new avatar */
+
+ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
+ boost::shared_ptr<IQ> request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]);
+ stanzaChannel->sentStanzas.pop_back();
+ CPPUNIT_ASSERT(!!request);
+ boost::shared_ptr<VCard> vcard = request->getPayload<VCard>();
+ CPPUNIT_ASSERT(!!vcard);
+
+ boost::shared_ptr<IQ> reply = boost::make_shared<IQ>(IQ::Result);
+ reply->setTo(request->getFrom());
+ reply->setFrom(request->getTo());
+ reply->setID(request->getID());
+ vcard->setPhoto(fullAvatar);
+ reply->addPayload(vcard);
+ stanzaChannel->onIQReceived(reply);
+
+ /* check hash through avatarManager that it received the correct photo */
+
+ ByteArray reportedAvatar = avatarManager->getAvatar(personJID.toBare());
+ CPPUNIT_ASSERT_EQUAL(byteArrayToString(fullAvatar), byteArrayToString(reportedAvatar));
+
+ /* send new presence to notify of blank avatar */
+
+ vcardUpdate = boost::make_shared<VCardUpdate>();
+ presence = boost::make_shared<Presence>();
+ presence->setTo(ownerJID);
+ presence->setFrom(personJID);
+ presence->setType(Presence::Available);
+ presence->addPayload(vcardUpdate);
+ stanzaChannel->onPresenceReceived(presence);
+
+ /* reply to the avatar request with our EMPTY avatar */
+
+ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
+ request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]);
+ stanzaChannel->sentStanzas.pop_back();
+ CPPUNIT_ASSERT(!!request);
+ vcard = request->getPayload<VCard>();
+ CPPUNIT_ASSERT(!!vcard);
+
+ ByteArray blankAvatar = createByteArray("");
+ reply = boost::make_shared<IQ>(IQ::Result);
+ reply->setTo(request->getFrom());
+ reply->setFrom(request->getTo());
+ reply->setID(request->getID());
+ vcard->setPhoto(blankAvatar);
+ reply->addPayload(vcard);
+ stanzaChannel->onIQReceived(reply);
+
+ /* check hash through avatarManager that it received the correct photo */
+
+ reportedAvatar = avatarManager->getAvatar(personJID.toBare());
+ CPPUNIT_ASSERT_EQUAL(byteArrayToString(blankAvatar), byteArrayToString(reportedAvatar));
+ }
+
+ struct DummyMUCRegistry : public MUCRegistry {
+ bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
+ std::vector<JID> mucs_;
+ };
+
+ private:
+
+ JID ownerJID;
+ boost::shared_ptr<DummyStanzaChannel> stanzaChannel;
+ boost::shared_ptr<IQRouter> iqRouter;
+ boost::shared_ptr<CryptoProvider> crypto;
+ boost::shared_ptr<VCardMemoryStorage> vcardStorage;
+ boost::shared_ptr<VCardManager> vcardManager;
+ boost::shared_ptr<AvatarMemoryStorage> avatarStorage;
+ boost::shared_ptr<DummyMUCRegistry> mucRegistry;
+ boost::shared_ptr<AvatarManagerImpl> avatarManager;
};
diff --git a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp
index 1a18585..fb4cd8f 100644
--- a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp
+++ b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp
@@ -29,351 +29,351 @@
using namespace Swift;
class CombinedAvatarProviderTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(CombinedAvatarProviderTest);
- CPPUNIT_TEST(testGetAvatarWithNoAvatarProviderReturnsEmpty);
- CPPUNIT_TEST(testGetAvatarWithSingleAvatarProvider);
- CPPUNIT_TEST(testGetAvatarWithMultipleAvatarProviderReturnsFirstAvatar);
- CPPUNIT_TEST(testGetAvatarWithMultipleAvatarProviderAndFailingFirstProviderReturnsSecondAvatar);
- CPPUNIT_TEST(testProviderUpdateTriggersChange);
- CPPUNIT_TEST(testProviderUpdateWithoutChangeDoesNotTriggerChange);
- CPPUNIT_TEST(testProviderSecondUpdateTriggersChange);
- CPPUNIT_TEST(testProviderUpdateWithAvatarDisappearingTriggersChange);
- CPPUNIT_TEST(testProviderUpdateAfterAvatarDisappearedTriggersChange);
- CPPUNIT_TEST(testProviderUpdateAfterGetDoesNotTriggerChange);
- CPPUNIT_TEST(testProviderUpdateBareJIDAfterGetFullJID);
- CPPUNIT_TEST(testRemoveProviderDisconnectsUpdates);
- CPPUNIT_TEST(testAddRemoveFallthrough);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void setUp() {
- avatarProvider1 = new DummyAvatarProvider();
- avatarProvider2 = new DummyAvatarProvider();
- user1 = JID("user1@bar.com/bla");
- user2 = JID("user2@foo.com/baz");
- avatarHash1 = "ABCDEFG";
- avatarHash2 = "XYZU";
- avatarHash3 = "IDGH";
- }
-
- void tearDown() {
- delete avatarProvider1;
- delete avatarProvider2;
- }
-
- void testGetAvatarWithNoAvatarProviderReturnsEmpty() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
-
- boost::optional<std::string> hash = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT(!hash);
- }
-
- void testGetAvatarWithSingleAvatarProvider() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- avatarProvider1->avatars[user1] = avatarHash1;
- testling->addProvider(avatarProvider1);
-
- boost::optional<std::string> hash = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatarHash1, *hash);
- }
-
- void testGetAvatarWithMultipleAvatarProviderReturnsFirstAvatar() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider2->avatars[user1] = avatarHash2;
- testling->addProvider(avatarProvider1);
- testling->addProvider(avatarProvider2);
-
- boost::optional<std::string> hash = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatarHash1, *hash);
- }
-
- void testGetAvatarWithMultipleAvatarProviderAndFailingFirstProviderReturnsSecondAvatar() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- avatarProvider2->avatars[user1] = avatarHash2;
- testling->addProvider(avatarProvider1);
- testling->addProvider(avatarProvider2);
-
- boost::optional<std::string> hash = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatarHash2, *hash);
- }
-
- void testProviderUpdateTriggersChange() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider1->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
- }
-
- void testProviderUpdateWithoutChangeDoesNotTriggerChange() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- testling->addProvider(avatarProvider2);
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider1->onAvatarChanged(user1);
- changes.clear();
-
- avatarProvider2->avatars[user1] = avatarHash2;
- avatarProvider2->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
- }
-
- void testProviderSecondUpdateTriggersChange() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider1->onAvatarChanged(user1);
- changes.clear();
- avatarProvider1->avatars[user1] = avatarHash2;
- avatarProvider1->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
- }
-
-
- void testProviderUpdateWithAvatarDisappearingTriggersChange() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider1->onAvatarChanged(user1);
- changes.clear();
- avatarProvider1->avatars.clear();
- avatarProvider1->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
- }
-
- void testProviderUpdateAfterAvatarDisappearedTriggersChange() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider1->onAvatarChanged(user1);
- avatarProvider1->avatars.clear();
- avatarProvider1->onAvatarChanged(user1);
- changes.clear();
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider1->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
- }
-
-
- void testProviderUpdateAfterGetDoesNotTriggerChange() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- avatarProvider1->avatars[user1] = avatarHash1;
-
- testling->getAvatarHash(user1);
- avatarProvider1->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
- }
-
- void testRemoveProviderDisconnectsUpdates() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- testling->addProvider(avatarProvider1);
- testling->addProvider(avatarProvider2);
- testling->removeProvider(avatarProvider1);
- avatarProvider1->avatars[user1] = avatarHash1;
- avatarProvider2->avatars[user1] = avatarHash2;
- avatarProvider1->onAvatarChanged(user1);
-
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
- }
-
- void testProviderUpdateBareJIDAfterGetFullJID() {
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- avatarProvider1->useBare = true;
- testling->addProvider(avatarProvider1);
-
- avatarProvider1->avatars[user1.toBare()] = avatarHash1;
- testling->getAvatarHash(user1);
- avatarProvider1->avatars[user1.toBare()] = avatarHash2;
- avatarProvider1->onAvatarChanged(user1.toBare());
-
- boost::optional<std::string> hash = testling->getAvatarHash(user1);
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatarHash2, *hash);
- }
-
- void testAddRemoveFallthrough() {
- JID ownJID = JID("user0@own.com/res");
- JID user1 = JID("user1@bar.com/bla");
-
- boost::shared_ptr<CryptoProvider> crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
- DummyStanzaChannel* stanzaChannel = new DummyStanzaChannel();
- stanzaChannel->setAvailable(true);
- IQRouter* iqRouter = new IQRouter(stanzaChannel);
- DummyMUCRegistry* mucRegistry = new DummyMUCRegistry();
- AvatarMemoryStorage* avatarStorage = new AvatarMemoryStorage();
- VCardMemoryStorage* vcardStorage = new VCardMemoryStorage(crypto.get());
- VCardManager* vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage);
-
- boost::shared_ptr<VCardUpdateAvatarManager> updateManager(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry));
- updateManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
-
- boost::shared_ptr<VCardAvatarManager> manager(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry));
- manager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
-
- boost::shared_ptr<OfflineAvatarManager> offlineManager(new OfflineAvatarManager(avatarStorage));
- offlineManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
-
- boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
- avatarProvider1->useBare = true;
- testling->addProvider(updateManager.get());
- testling->addProvider(manager.get());
- testling->addProvider(offlineManager.get());
-
- /* place an avatar in the cache, check that it reads back OK */
-
- CPPUNIT_ASSERT_EQUAL(size_t(0), changes.size());
-
- ByteArray avatar1 = createByteArray("abcdefg");
- std::string avatar1Hash = Hexify::hexify(crypto->getSHA1Hash(avatar1));
- VCard::ref vcard1(new VCard());
- vcard1->setPhoto(avatar1);
-
- vcardStorage->setVCard(user1.toBare(), vcard1);
- boost::optional<std::string> testHash = testling->getAvatarHash(user1.toBare());
- CPPUNIT_ASSERT(testHash);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *testHash);
-
- VCard::ref storedVCard = vcardStorage->getVCard(user1.toBare());
- CPPUNIT_ASSERT(!!storedVCard);
- testHash = Hexify::hexify(crypto->getSHA1Hash(storedVCard->getPhoto()));
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *testHash);
-
- /* change the avatar by sending an VCard IQ */
-
- vcardManager->requestVCard(user1.toBare());
- CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
- IQ::ref request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back());
- VCard::ref payload = request->getPayload<VCard>();
- CPPUNIT_ASSERT(!!payload);
- stanzaChannel->sentStanzas.pop_back();
-
- ByteArray avatar2 = createByteArray("1234567");
- std::string avatar2Hash = Hexify::hexify(crypto->getSHA1Hash(avatar2));
- VCard::ref vcard2(new VCard());
- vcard2->setPhoto(avatar2);
-
- IQ::ref reply = boost::make_shared<IQ>();
- reply->setTo(request->getFrom());
- reply->setFrom(request->getTo());
- reply->setID(request->getID());
- reply->addPayload(vcard2);
- reply->setType(IQ::Result);
-
- stanzaChannel->onIQReceived(reply);
-
- /* check that we changed the avatar successfully and that we were notified about the changes */
-
- testHash = testling->getAvatarHash(user1.toBare());
- CPPUNIT_ASSERT(testHash);
- CPPUNIT_ASSERT_EQUAL(avatar2Hash, *testHash);
- CPPUNIT_ASSERT_EQUAL(size_t(3), changes.size());
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]);
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[2]);
- changes.clear();
- storedVCard = vcardStorage->getVCard(user1.toBare());
- CPPUNIT_ASSERT(!!storedVCard);
- testHash = Hexify::hexify(crypto->getSHA1Hash(storedVCard->getPhoto()));
- CPPUNIT_ASSERT_EQUAL(avatar2Hash, *testHash);
-
- /* change the avatar to the empty avatar */
-
- vcardManager->requestVCard(user1.toBare());
- CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
- request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back());
- payload = request->getPayload<VCard>();
- CPPUNIT_ASSERT(!!payload);
- stanzaChannel->sentStanzas.pop_back();
-
- VCard::ref vcard3(new VCard());
- reply = boost::make_shared<IQ>();
- reply->setTo(request->getFrom());
- reply->setFrom(request->getTo());
- reply->setID(request->getID());
- reply->addPayload(vcard3);
- reply->setType(IQ::Result);
- stanzaChannel->onIQReceived(reply);
-
- /* check that we changed the avatar successfully */
-
- testHash = testling->getAvatarHash(user1.toBare());
- CPPUNIT_ASSERT(testHash);
- CPPUNIT_ASSERT_EQUAL(std::string(""), *testHash);
- CPPUNIT_ASSERT_EQUAL(size_t(3), changes.size());
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]);
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[2]);
- changes.clear();
- storedVCard = vcardStorage->getVCard(user1.toBare());
- CPPUNIT_ASSERT(!!storedVCard);
- CPPUNIT_ASSERT(!storedVCard->getPhoto().size());
-
- delete vcardManager;
- delete vcardStorage;
- delete mucRegistry;
- delete iqRouter;
- delete stanzaChannel;
- }
-
- private:
- boost::shared_ptr<CombinedAvatarProvider> createProvider() {
- boost::shared_ptr<CombinedAvatarProvider> result(new CombinedAvatarProvider());
- result->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
- return result;
- }
-
- void handleAvatarChanged(const JID& jid) {
- changes.push_back(jid);
- }
-
- private:
- struct DummyAvatarProvider : public AvatarProvider {
- DummyAvatarProvider() : useBare(false) {
- }
-
- boost::optional<std::string> getAvatarHash(const JID& jid) const {
- JID actualJID = useBare ? jid.toBare() : jid;
- std::map<JID, std::string>::const_iterator i = avatars.find(actualJID);
- if (i != avatars.end()) {
- return i->second;
- }
- else {
- return boost::optional<std::string>();
- }
- }
-
- bool useBare;
- std::map<JID, std::string> avatars;
- };
-
- struct DummyMUCRegistry : public MUCRegistry {
- bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
- std::vector<JID> mucs_;
- };
-
- DummyAvatarProvider* avatarProvider1;
- DummyAvatarProvider* avatarProvider2;
- JID user1;
- JID user2;
- std::string avatarHash1;
- std::string avatarHash2;
- std::string avatarHash3;
- std::vector<JID> changes;
+ CPPUNIT_TEST_SUITE(CombinedAvatarProviderTest);
+ CPPUNIT_TEST(testGetAvatarWithNoAvatarProviderReturnsEmpty);
+ CPPUNIT_TEST(testGetAvatarWithSingleAvatarProvider);
+ CPPUNIT_TEST(testGetAvatarWithMultipleAvatarProviderReturnsFirstAvatar);
+ CPPUNIT_TEST(testGetAvatarWithMultipleAvatarProviderAndFailingFirstProviderReturnsSecondAvatar);
+ CPPUNIT_TEST(testProviderUpdateTriggersChange);
+ CPPUNIT_TEST(testProviderUpdateWithoutChangeDoesNotTriggerChange);
+ CPPUNIT_TEST(testProviderSecondUpdateTriggersChange);
+ CPPUNIT_TEST(testProviderUpdateWithAvatarDisappearingTriggersChange);
+ CPPUNIT_TEST(testProviderUpdateAfterAvatarDisappearedTriggersChange);
+ CPPUNIT_TEST(testProviderUpdateAfterGetDoesNotTriggerChange);
+ CPPUNIT_TEST(testProviderUpdateBareJIDAfterGetFullJID);
+ CPPUNIT_TEST(testRemoveProviderDisconnectsUpdates);
+ CPPUNIT_TEST(testAddRemoveFallthrough);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void setUp() {
+ avatarProvider1 = new DummyAvatarProvider();
+ avatarProvider2 = new DummyAvatarProvider();
+ user1 = JID("user1@bar.com/bla");
+ user2 = JID("user2@foo.com/baz");
+ avatarHash1 = "ABCDEFG";
+ avatarHash2 = "XYZU";
+ avatarHash3 = "IDGH";
+ }
+
+ void tearDown() {
+ delete avatarProvider1;
+ delete avatarProvider2;
+ }
+
+ void testGetAvatarWithNoAvatarProviderReturnsEmpty() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+
+ boost::optional<std::string> hash = testling->getAvatarHash(user1);
+ CPPUNIT_ASSERT(!hash);
+ }
+
+ void testGetAvatarWithSingleAvatarProvider() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ avatarProvider1->avatars[user1] = avatarHash1;
+ testling->addProvider(avatarProvider1);
+
+ boost::optional<std::string> hash = testling->getAvatarHash(user1);
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatarHash1, *hash);
+ }
+
+ void testGetAvatarWithMultipleAvatarProviderReturnsFirstAvatar() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider2->avatars[user1] = avatarHash2;
+ testling->addProvider(avatarProvider1);
+ testling->addProvider(avatarProvider2);
+
+ boost::optional<std::string> hash = testling->getAvatarHash(user1);
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatarHash1, *hash);
+ }
+
+ void testGetAvatarWithMultipleAvatarProviderAndFailingFirstProviderReturnsSecondAvatar() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ avatarProvider2->avatars[user1] = avatarHash2;
+ testling->addProvider(avatarProvider1);
+ testling->addProvider(avatarProvider2);
+
+ boost::optional<std::string> hash = testling->getAvatarHash(user1);
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatarHash2, *hash);
+ }
+
+ void testProviderUpdateTriggersChange() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider1->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
+ }
+
+ void testProviderUpdateWithoutChangeDoesNotTriggerChange() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ testling->addProvider(avatarProvider2);
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider1->onAvatarChanged(user1);
+ changes.clear();
+
+ avatarProvider2->avatars[user1] = avatarHash2;
+ avatarProvider2->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
+ }
+
+ void testProviderSecondUpdateTriggersChange() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider1->onAvatarChanged(user1);
+ changes.clear();
+ avatarProvider1->avatars[user1] = avatarHash2;
+ avatarProvider1->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
+ }
+
+
+ void testProviderUpdateWithAvatarDisappearingTriggersChange() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider1->onAvatarChanged(user1);
+ changes.clear();
+ avatarProvider1->avatars.clear();
+ avatarProvider1->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
+ }
+
+ void testProviderUpdateAfterAvatarDisappearedTriggersChange() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider1->onAvatarChanged(user1);
+ avatarProvider1->avatars.clear();
+ avatarProvider1->onAvatarChanged(user1);
+ changes.clear();
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider1->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1, changes[0]);
+ }
+
+
+ void testProviderUpdateAfterGetDoesNotTriggerChange() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ avatarProvider1->avatars[user1] = avatarHash1;
+
+ testling->getAvatarHash(user1);
+ avatarProvider1->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
+ }
+
+ void testRemoveProviderDisconnectsUpdates() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ testling->addProvider(avatarProvider1);
+ testling->addProvider(avatarProvider2);
+ testling->removeProvider(avatarProvider1);
+ avatarProvider1->avatars[user1] = avatarHash1;
+ avatarProvider2->avatars[user1] = avatarHash2;
+ avatarProvider1->onAvatarChanged(user1);
+
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
+ }
+
+ void testProviderUpdateBareJIDAfterGetFullJID() {
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ avatarProvider1->useBare = true;
+ testling->addProvider(avatarProvider1);
+
+ avatarProvider1->avatars[user1.toBare()] = avatarHash1;
+ testling->getAvatarHash(user1);
+ avatarProvider1->avatars[user1.toBare()] = avatarHash2;
+ avatarProvider1->onAvatarChanged(user1.toBare());
+
+ boost::optional<std::string> hash = testling->getAvatarHash(user1);
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatarHash2, *hash);
+ }
+
+ void testAddRemoveFallthrough() {
+ JID ownJID = JID("user0@own.com/res");
+ JID user1 = JID("user1@bar.com/bla");
+
+ boost::shared_ptr<CryptoProvider> crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ DummyStanzaChannel* stanzaChannel = new DummyStanzaChannel();
+ stanzaChannel->setAvailable(true);
+ IQRouter* iqRouter = new IQRouter(stanzaChannel);
+ DummyMUCRegistry* mucRegistry = new DummyMUCRegistry();
+ AvatarMemoryStorage* avatarStorage = new AvatarMemoryStorage();
+ VCardMemoryStorage* vcardStorage = new VCardMemoryStorage(crypto.get());
+ VCardManager* vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage);
+
+ boost::shared_ptr<VCardUpdateAvatarManager> updateManager(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry));
+ updateManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
+
+ boost::shared_ptr<VCardAvatarManager> manager(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry));
+ manager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
+
+ boost::shared_ptr<OfflineAvatarManager> offlineManager(new OfflineAvatarManager(avatarStorage));
+ offlineManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
+
+ boost::shared_ptr<CombinedAvatarProvider> testling(createProvider());
+ avatarProvider1->useBare = true;
+ testling->addProvider(updateManager.get());
+ testling->addProvider(manager.get());
+ testling->addProvider(offlineManager.get());
+
+ /* place an avatar in the cache, check that it reads back OK */
+
+ CPPUNIT_ASSERT_EQUAL(size_t(0), changes.size());
+
+ ByteArray avatar1 = createByteArray("abcdefg");
+ std::string avatar1Hash = Hexify::hexify(crypto->getSHA1Hash(avatar1));
+ VCard::ref vcard1(new VCard());
+ vcard1->setPhoto(avatar1);
+
+ vcardStorage->setVCard(user1.toBare(), vcard1);
+ boost::optional<std::string> testHash = testling->getAvatarHash(user1.toBare());
+ CPPUNIT_ASSERT(testHash);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *testHash);
+
+ VCard::ref storedVCard = vcardStorage->getVCard(user1.toBare());
+ CPPUNIT_ASSERT(!!storedVCard);
+ testHash = Hexify::hexify(crypto->getSHA1Hash(storedVCard->getPhoto()));
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *testHash);
+
+ /* change the avatar by sending an VCard IQ */
+
+ vcardManager->requestVCard(user1.toBare());
+ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
+ IQ::ref request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back());
+ VCard::ref payload = request->getPayload<VCard>();
+ CPPUNIT_ASSERT(!!payload);
+ stanzaChannel->sentStanzas.pop_back();
+
+ ByteArray avatar2 = createByteArray("1234567");
+ std::string avatar2Hash = Hexify::hexify(crypto->getSHA1Hash(avatar2));
+ VCard::ref vcard2(new VCard());
+ vcard2->setPhoto(avatar2);
+
+ IQ::ref reply = boost::make_shared<IQ>();
+ reply->setTo(request->getFrom());
+ reply->setFrom(request->getTo());
+ reply->setID(request->getID());
+ reply->addPayload(vcard2);
+ reply->setType(IQ::Result);
+
+ stanzaChannel->onIQReceived(reply);
+
+ /* check that we changed the avatar successfully and that we were notified about the changes */
+
+ testHash = testling->getAvatarHash(user1.toBare());
+ CPPUNIT_ASSERT(testHash);
+ CPPUNIT_ASSERT_EQUAL(avatar2Hash, *testHash);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), changes.size());
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]);
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[2]);
+ changes.clear();
+ storedVCard = vcardStorage->getVCard(user1.toBare());
+ CPPUNIT_ASSERT(!!storedVCard);
+ testHash = Hexify::hexify(crypto->getSHA1Hash(storedVCard->getPhoto()));
+ CPPUNIT_ASSERT_EQUAL(avatar2Hash, *testHash);
+
+ /* change the avatar to the empty avatar */
+
+ vcardManager->requestVCard(user1.toBare());
+ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size());
+ request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back());
+ payload = request->getPayload<VCard>();
+ CPPUNIT_ASSERT(!!payload);
+ stanzaChannel->sentStanzas.pop_back();
+
+ VCard::ref vcard3(new VCard());
+ reply = boost::make_shared<IQ>();
+ reply->setTo(request->getFrom());
+ reply->setFrom(request->getTo());
+ reply->setID(request->getID());
+ reply->addPayload(vcard3);
+ reply->setType(IQ::Result);
+ stanzaChannel->onIQReceived(reply);
+
+ /* check that we changed the avatar successfully */
+
+ testHash = testling->getAvatarHash(user1.toBare());
+ CPPUNIT_ASSERT(testHash);
+ CPPUNIT_ASSERT_EQUAL(std::string(""), *testHash);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), changes.size());
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]);
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[2]);
+ changes.clear();
+ storedVCard = vcardStorage->getVCard(user1.toBare());
+ CPPUNIT_ASSERT(!!storedVCard);
+ CPPUNIT_ASSERT(!storedVCard->getPhoto().size());
+
+ delete vcardManager;
+ delete vcardStorage;
+ delete mucRegistry;
+ delete iqRouter;
+ delete stanzaChannel;
+ }
+
+ private:
+ boost::shared_ptr<CombinedAvatarProvider> createProvider() {
+ boost::shared_ptr<CombinedAvatarProvider> result(new CombinedAvatarProvider());
+ result->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1));
+ return result;
+ }
+
+ void handleAvatarChanged(const JID& jid) {
+ changes.push_back(jid);
+ }
+
+ private:
+ struct DummyAvatarProvider : public AvatarProvider {
+ DummyAvatarProvider() : useBare(false) {
+ }
+
+ boost::optional<std::string> getAvatarHash(const JID& jid) const {
+ JID actualJID = useBare ? jid.toBare() : jid;
+ std::map<JID, std::string>::const_iterator i = avatars.find(actualJID);
+ if (i != avatars.end()) {
+ return i->second;
+ }
+ else {
+ return boost::optional<std::string>();
+ }
+ }
+
+ bool useBare;
+ std::map<JID, std::string> avatars;
+ };
+
+ struct DummyMUCRegistry : public MUCRegistry {
+ bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
+ std::vector<JID> mucs_;
+ };
+
+ DummyAvatarProvider* avatarProvider1;
+ DummyAvatarProvider* avatarProvider2;
+ JID user1;
+ JID user2;
+ std::string avatarHash1;
+ std::string avatarHash2;
+ std::string avatarHash3;
+ std::vector<JID> changes;
};
CPPUNIT_TEST_SUITE_REGISTRATION(CombinedAvatarProviderTest);
diff --git a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
index 2f585aa..5a28995 100644
--- a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
+++ b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp
@@ -27,150 +27,150 @@
using namespace Swift;
class VCardAvatarManagerTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(VCardAvatarManagerTest);
- CPPUNIT_TEST(testGetAvatarHashKnownAvatar);
- CPPUNIT_TEST(testGetAvatarHashEmptyAvatar);
- CPPUNIT_TEST(testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar);
- CPPUNIT_TEST(testGetAvatarHashUnknownAvatarUnknownVCard);
- CPPUNIT_TEST(testVCardUpdateTriggersUpdate);
- CPPUNIT_TEST(testGetAvatarHashKnownAvatarUnknownVCard);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
- ownJID = JID("foo@fum.com/bum");
- stanzaChannel = new DummyStanzaChannel();
- stanzaChannel->setAvailable(true);
- iqRouter = new IQRouter(stanzaChannel);
- mucRegistry = new DummyMUCRegistry();
- avatarStorage = new AvatarMemoryStorage();
- vcardStorage = new VCardMemoryStorage(crypto.get());
- vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage);
- avatar1 = createByteArray("abcdefg");
- avatar1Hash = Hexify::hexify(crypto->getSHA1Hash(avatar1));
- user1 = JID("user1@bar.com/bla");
- user2 = JID("user2@foo.com/baz");
- }
-
- void tearDown() {
- delete vcardManager;
- delete vcardStorage;
- delete avatarStorage;
- delete mucRegistry;
- delete iqRouter;
- delete stanzaChannel;
- }
-
- void testGetAvatarHashKnownAvatar() {
- boost::shared_ptr<VCardAvatarManager> testling = createManager();
- storeVCardWithPhoto(user1.toBare(), avatar1);
- avatarStorage->addAvatar(avatar1Hash, avatar1);
-
- boost::optional<std::string> result = testling->getAvatarHash(user1);
-
- CPPUNIT_ASSERT(result);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *result);
- }
-
- void testGetAvatarHashEmptyAvatar() {
- boost::shared_ptr<VCardAvatarManager> testling = createManager();
- storeEmptyVCard(user1.toBare());
-
- boost::optional<std::string> result = testling->getAvatarHash(user1);
-
- CPPUNIT_ASSERT(result);
- CPPUNIT_ASSERT_EQUAL(std::string(), *result);
- }
-
- void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() {
- boost::shared_ptr<VCardAvatarManager> testling = createManager();
- storeVCardWithPhoto(user1.toBare(), avatar1);
-
- boost::optional<std::string> result = testling->getAvatarHash(user1);
-
- CPPUNIT_ASSERT(result);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *result);
- CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash));
- CPPUNIT_ASSERT_EQUAL(avatar1, avatarStorage->getAvatar(avatar1Hash));
- }
-
- void testGetAvatarHashUnknownAvatarUnknownVCard() {
- boost::shared_ptr<VCardAvatarManager> testling = createManager();
-
- boost::optional<std::string> result = testling->getAvatarHash(user1);
-
- CPPUNIT_ASSERT(result);
- CPPUNIT_ASSERT_EQUAL(std::string(), *result);
- }
-
- void testGetAvatarHashKnownAvatarUnknownVCard() {
- boost::shared_ptr<VCardAvatarManager> testling = createManager();
-
- avatarStorage->setAvatarForJID(user1, avatar1Hash);
-
- boost::optional<std::string> result = testling->getAvatarHash(user1);
-
- CPPUNIT_ASSERT(result);
- CPPUNIT_ASSERT_EQUAL(std::string(), *result);
- }
-
-
- void testVCardUpdateTriggersUpdate() {
- boost::shared_ptr<VCardAvatarManager> testling = createManager();
- vcardManager->requestVCard(user1);
- sendVCardResult();
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- }
-
- private:
- boost::shared_ptr<VCardAvatarManager> createManager() {
- boost::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry));
- result->onAvatarChanged.connect(boost::bind(&VCardAvatarManagerTest::handleAvatarChanged, this, _1));
- return result;
- }
-
- void storeVCardWithPhoto(const JID& jid, const ByteArray& avatar) {
- VCard::ref vcard(new VCard());
- vcard->setPhoto(avatar);
- vcardStorage->setVCard(jid, vcard);
- }
-
- void storeEmptyVCard(const JID& jid) {
- VCard::ref vcard(new VCard());
- vcardStorage->setVCard(jid, vcard);
- }
-
- void handleAvatarChanged(const JID& jid) {
- changes.push_back(jid);
- }
-
- void sendVCardResult() {
- VCard::ref vcard(new VCard());
- vcard->setFullName("Foo Bar");
- stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), vcard));
- }
-
- private:
- struct DummyMUCRegistry : public MUCRegistry {
- bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
- std::vector<JID> mucs_;
- };
-
- JID ownJID;
- DummyStanzaChannel* stanzaChannel;
- IQRouter* iqRouter;
- DummyMUCRegistry* mucRegistry;
- AvatarMemoryStorage* avatarStorage;
- VCardManager* vcardManager;
- VCardMemoryStorage* vcardStorage;
- ByteArray avatar1;
- std::string avatar1Hash;
- std::vector<JID> changes;
- JID user1;
- JID user2;
- boost::shared_ptr<CryptoProvider> crypto;
+ CPPUNIT_TEST_SUITE(VCardAvatarManagerTest);
+ CPPUNIT_TEST(testGetAvatarHashKnownAvatar);
+ CPPUNIT_TEST(testGetAvatarHashEmptyAvatar);
+ CPPUNIT_TEST(testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar);
+ CPPUNIT_TEST(testGetAvatarHashUnknownAvatarUnknownVCard);
+ CPPUNIT_TEST(testVCardUpdateTriggersUpdate);
+ CPPUNIT_TEST(testGetAvatarHashKnownAvatarUnknownVCard);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void setUp() {
+ crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ ownJID = JID("foo@fum.com/bum");
+ stanzaChannel = new DummyStanzaChannel();
+ stanzaChannel->setAvailable(true);
+ iqRouter = new IQRouter(stanzaChannel);
+ mucRegistry = new DummyMUCRegistry();
+ avatarStorage = new AvatarMemoryStorage();
+ vcardStorage = new VCardMemoryStorage(crypto.get());
+ vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage);
+ avatar1 = createByteArray("abcdefg");
+ avatar1Hash = Hexify::hexify(crypto->getSHA1Hash(avatar1));
+ user1 = JID("user1@bar.com/bla");
+ user2 = JID("user2@foo.com/baz");
+ }
+
+ void tearDown() {
+ delete vcardManager;
+ delete vcardStorage;
+ delete avatarStorage;
+ delete mucRegistry;
+ delete iqRouter;
+ delete stanzaChannel;
+ }
+
+ void testGetAvatarHashKnownAvatar() {
+ boost::shared_ptr<VCardAvatarManager> testling = createManager();
+ storeVCardWithPhoto(user1.toBare(), avatar1);
+ avatarStorage->addAvatar(avatar1Hash, avatar1);
+
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
+
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *result);
+ }
+
+ void testGetAvatarHashEmptyAvatar() {
+ boost::shared_ptr<VCardAvatarManager> testling = createManager();
+ storeEmptyVCard(user1.toBare());
+
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
+
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *result);
+ }
+
+ void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() {
+ boost::shared_ptr<VCardAvatarManager> testling = createManager();
+ storeVCardWithPhoto(user1.toBare(), avatar1);
+
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
+
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *result);
+ CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash));
+ CPPUNIT_ASSERT_EQUAL(avatar1, avatarStorage->getAvatar(avatar1Hash));
+ }
+
+ void testGetAvatarHashUnknownAvatarUnknownVCard() {
+ boost::shared_ptr<VCardAvatarManager> testling = createManager();
+
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
+
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *result);
+ }
+
+ void testGetAvatarHashKnownAvatarUnknownVCard() {
+ boost::shared_ptr<VCardAvatarManager> testling = createManager();
+
+ avatarStorage->setAvatarForJID(user1, avatar1Hash);
+
+ boost::optional<std::string> result = testling->getAvatarHash(user1);
+
+ CPPUNIT_ASSERT(result);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *result);
+ }
+
+
+ void testVCardUpdateTriggersUpdate() {
+ boost::shared_ptr<VCardAvatarManager> testling = createManager();
+ vcardManager->requestVCard(user1);
+ sendVCardResult();
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ }
+
+ private:
+ boost::shared_ptr<VCardAvatarManager> createManager() {
+ boost::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry));
+ result->onAvatarChanged.connect(boost::bind(&VCardAvatarManagerTest::handleAvatarChanged, this, _1));
+ return result;
+ }
+
+ void storeVCardWithPhoto(const JID& jid, const ByteArray& avatar) {
+ VCard::ref vcard(new VCard());
+ vcard->setPhoto(avatar);
+ vcardStorage->setVCard(jid, vcard);
+ }
+
+ void storeEmptyVCard(const JID& jid) {
+ VCard::ref vcard(new VCard());
+ vcardStorage->setVCard(jid, vcard);
+ }
+
+ void handleAvatarChanged(const JID& jid) {
+ changes.push_back(jid);
+ }
+
+ void sendVCardResult() {
+ VCard::ref vcard(new VCard());
+ vcard->setFullName("Foo Bar");
+ stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), vcard));
+ }
+
+ private:
+ struct DummyMUCRegistry : public MUCRegistry {
+ bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
+ std::vector<JID> mucs_;
+ };
+
+ JID ownJID;
+ DummyStanzaChannel* stanzaChannel;
+ IQRouter* iqRouter;
+ DummyMUCRegistry* mucRegistry;
+ AvatarMemoryStorage* avatarStorage;
+ VCardManager* vcardManager;
+ VCardMemoryStorage* vcardStorage;
+ ByteArray avatar1;
+ std::string avatar1Hash;
+ std::vector<JID> changes;
+ JID user1;
+ JID user2;
+ boost::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(VCardAvatarManagerTest);
diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp
index f9747a1..5f6c691 100644
--- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp
+++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp
@@ -27,186 +27,186 @@
using namespace Swift;
class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture {
- CPPUNIT_TEST_SUITE(VCardUpdateAvatarManagerTest);
- CPPUNIT_TEST(testUpdate_NewHashNewVCardRequestsVCard);
- CPPUNIT_TEST(testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive);
- CPPUNIT_TEST(testUpdate_KnownHash);
- CPPUNIT_TEST(testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification);
- CPPUNIT_TEST(testVCardWithEmptyPhoto);
- CPPUNIT_TEST(testStanzaChannelReset_ClearsHash);
- CPPUNIT_TEST(testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash);
- CPPUNIT_TEST_SUITE_END();
-
- public:
- void setUp() {
- crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
- ownJID = JID("foo@fum.com/bum");
- stanzaChannel = new DummyStanzaChannel();
- stanzaChannel->setAvailable(true);
- iqRouter = new IQRouter(stanzaChannel);
- mucRegistry = new DummyMUCRegistry();
- avatarStorage = new AvatarMemoryStorage();
- vcardStorage = new VCardMemoryStorage(crypto.get());
- vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage);
- avatar1 = createByteArray("abcdefg");
- avatar1Hash = Hexify::hexify(crypto->getSHA1Hash(avatar1));
- user1 = JID("user1@bar.com/bla");
- user2 = JID("user2@foo.com/baz");
- }
-
-
- void tearDown() {
- delete vcardManager;
- delete vcardStorage;
- delete avatarStorage;
- delete mucRegistry;
- delete iqRouter;
- delete stanzaChannel;
- }
-
- void testUpdate_NewHashNewVCardRequestsVCard() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel->sentStanzas.size()));
- CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<VCard>(0, user1.toBare(), IQ::Get));
- }
-
- void testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
- stanzaChannel->onIQReceived(createVCardResult(avatar1));
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
- boost::optional<std::string> hash = testling->getAvatarHash(user1.toBare());
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *hash);
- CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash));
- CPPUNIT_ASSERT_EQUAL(avatar1, avatarStorage->getAvatar(avatar1Hash));
- }
-
- void testUpdate_KnownHash() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
- stanzaChannel->onIQReceived(createVCardResult(avatar1));
- changes.clear();
- stanzaChannel->sentStanzas.clear();
-
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
-
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size()));
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
- }
-
- void testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
- stanzaChannel->onIQReceived(createVCardResult(avatar1));
- changes.clear();
- stanzaChannel->sentStanzas.clear();
-
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user2, avatar1Hash));
-
- CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size()));
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user2.toBare(), changes[0]);
- boost::optional<std::string> hash = testling->getAvatarHash(user2.toBare());
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *hash);
- }
-
- void testVCardWithEmptyPhoto() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- vcardManager->requestVCard(JID("foo@bar.com"));
- stanzaChannel->onIQReceived(createVCardResult(ByteArray()));
-
- CPPUNIT_ASSERT(!avatarStorage->hasAvatar(Hexify::hexify(crypto->getSHA1Hash(ByteArray()))));
- boost::optional<std::string> hash = testling->getAvatarHash(JID("foo@bar.com"));
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(std::string(), *hash);
- }
-
- void testStanzaChannelReset_ClearsHash() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
- stanzaChannel->onIQReceived(createVCardResult(avatar1));
- changes.clear();
- stanzaChannel->sentStanzas.clear();
-
- stanzaChannel->setAvailable(false);
- stanzaChannel->setAvailable(true);
-
- CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
- boost::optional<std::string> hash = testling->getAvatarHash(user1.toBare());
- CPPUNIT_ASSERT(!hash);
- //CPPUNIT_ASSERT_EQUAL(std::string(""), *hash);
- }
-
- void testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash() {
- boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
- stanzaChannel->onIQReceived(createVCardResult(avatar1));
- changes.clear();
- stanzaChannel->sentStanzas.clear();
-
- stanzaChannel->setAvailable(false);
- stanzaChannel->setAvailable(true);
- stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
-
- CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(changes.size()));
- CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]);
- boost::optional<std::string> hash = testling->getAvatarHash(user1.toBare());
- CPPUNIT_ASSERT(hash);
- CPPUNIT_ASSERT_EQUAL(avatar1Hash, *hash);
- }
-
- private:
- boost::shared_ptr<VCardUpdateAvatarManager> createManager() {
- boost::shared_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry));
- result->onAvatarChanged.connect(boost::bind(&VCardUpdateAvatarManagerTest::handleAvatarChanged, this, _1));
- return result;
- }
-
- boost::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) {
- boost::shared_ptr<Presence> presence(new Presence());
- presence->setFrom(jid);
- presence->addPayload(boost::make_shared<VCardUpdate>(hash));
- return presence;
- }
-
- IQ::ref createVCardResult(const ByteArray& avatar) {
- VCard::ref vcard(new VCard());
- if (!avatar.empty()) {
- vcard->setPhoto(avatar);
- }
- return IQ::createResult(JID("baz@fum.com"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), vcard);
- }
-
- void handleAvatarChanged(const JID& jid) {
- changes.push_back(jid);
- }
-
- private:
- struct DummyMUCRegistry : public MUCRegistry {
- bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
- std::vector<JID> mucs_;
- };
-
- JID ownJID;
- DummyStanzaChannel* stanzaChannel;
- IQRouter* iqRouter;
- DummyMUCRegistry* mucRegistry;
- AvatarMemoryStorage* avatarStorage;
- VCardManager* vcardManager;
- VCardMemoryStorage* vcardStorage;
- ByteArray avatar1;
- std::string avatar1Hash;
- std::vector<JID> changes;
- JID user1;
- JID user2;
- boost::shared_ptr<CryptoProvider> crypto;
+ CPPUNIT_TEST_SUITE(VCardUpdateAvatarManagerTest);
+ CPPUNIT_TEST(testUpdate_NewHashNewVCardRequestsVCard);
+ CPPUNIT_TEST(testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive);
+ CPPUNIT_TEST(testUpdate_KnownHash);
+ CPPUNIT_TEST(testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification);
+ CPPUNIT_TEST(testVCardWithEmptyPhoto);
+ CPPUNIT_TEST(testStanzaChannelReset_ClearsHash);
+ CPPUNIT_TEST(testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ void setUp() {
+ crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create());
+ ownJID = JID("foo@fum.com/bum");
+ stanzaChannel = new DummyStanzaChannel();
+ stanzaChannel->setAvailable(true);
+ iqRouter = new IQRouter(stanzaChannel);
+ mucRegistry = new DummyMUCRegistry();
+ avatarStorage = new AvatarMemoryStorage();
+ vcardStorage = new VCardMemoryStorage(crypto.get());
+ vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage);
+ avatar1 = createByteArray("abcdefg");
+ avatar1Hash = Hexify::hexify(crypto->getSHA1Hash(avatar1));
+ user1 = JID("user1@bar.com/bla");
+ user2 = JID("user2@foo.com/baz");
+ }
+
+
+ void tearDown() {
+ delete vcardManager;
+ delete vcardStorage;
+ delete avatarStorage;
+ delete mucRegistry;
+ delete iqRouter;
+ delete stanzaChannel;
+ }
+
+ void testUpdate_NewHashNewVCardRequestsVCard() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel->sentStanzas.size()));
+ CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<VCard>(0, user1.toBare(), IQ::Get));
+ }
+
+ void testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+ stanzaChannel->onIQReceived(createVCardResult(avatar1));
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
+ boost::optional<std::string> hash = testling->getAvatarHash(user1.toBare());
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *hash);
+ CPPUNIT_ASSERT(avatarStorage->hasAvatar(avatar1Hash));
+ CPPUNIT_ASSERT_EQUAL(avatar1, avatarStorage->getAvatar(avatar1Hash));
+ }
+
+ void testUpdate_KnownHash() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+ stanzaChannel->onIQReceived(createVCardResult(avatar1));
+ changes.clear();
+ stanzaChannel->sentStanzas.clear();
+
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size()));
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size()));
+ }
+
+ void testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+ stanzaChannel->onIQReceived(createVCardResult(avatar1));
+ changes.clear();
+ stanzaChannel->sentStanzas.clear();
+
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user2, avatar1Hash));
+
+ CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size()));
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user2.toBare(), changes[0]);
+ boost::optional<std::string> hash = testling->getAvatarHash(user2.toBare());
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *hash);
+ }
+
+ void testVCardWithEmptyPhoto() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ vcardManager->requestVCard(JID("foo@bar.com"));
+ stanzaChannel->onIQReceived(createVCardResult(ByteArray()));
+
+ CPPUNIT_ASSERT(!avatarStorage->hasAvatar(Hexify::hexify(crypto->getSHA1Hash(ByteArray()))));
+ boost::optional<std::string> hash = testling->getAvatarHash(JID("foo@bar.com"));
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(std::string(), *hash);
+ }
+
+ void testStanzaChannelReset_ClearsHash() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+ stanzaChannel->onIQReceived(createVCardResult(avatar1));
+ changes.clear();
+ stanzaChannel->sentStanzas.clear();
+
+ stanzaChannel->setAvailable(false);
+ stanzaChannel->setAvailable(true);
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[0]);
+ boost::optional<std::string> hash = testling->getAvatarHash(user1.toBare());
+ CPPUNIT_ASSERT(!hash);
+ //CPPUNIT_ASSERT_EQUAL(std::string(""), *hash);
+ }
+
+ void testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash() {
+ boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager();
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+ stanzaChannel->onIQReceived(createVCardResult(avatar1));
+ changes.clear();
+ stanzaChannel->sentStanzas.clear();
+
+ stanzaChannel->setAvailable(false);
+ stanzaChannel->setAvailable(true);
+ stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash));
+
+ CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(changes.size()));
+ CPPUNIT_ASSERT_EQUAL(user1.toBare(), changes[1]);
+ boost::optional<std::string> hash = testling->getAvatarHash(user1.toBare());
+ CPPUNIT_ASSERT(hash);
+ CPPUNIT_ASSERT_EQUAL(avatar1Hash, *hash);
+ }
+
+ private:
+ boost::shared_ptr<VCardUpdateAvatarManager> createManager() {
+ boost::shared_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry));
+ result->onAvatarChanged.connect(boost::bind(&VCardUpdateAvatarManagerTest::handleAvatarChanged, this, _1));
+ return result;
+ }
+
+ boost::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) {
+ boost::shared_ptr<Presence> presence(new Presence());
+ presence->setFrom(jid);
+ presence->addPayload(boost::make_shared<VCardUpdate>(hash));
+ return presence;
+ }
+
+ IQ::ref createVCardResult(const ByteArray& avatar) {
+ VCard::ref vcard(new VCard());
+ if (!avatar.empty()) {
+ vcard->setPhoto(avatar);
+ }
+ return IQ::createResult(JID("baz@fum.com"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), vcard);
+ }
+
+ void handleAvatarChanged(const JID& jid) {
+ changes.push_back(jid);
+ }
+
+ private:
+ struct DummyMUCRegistry : public MUCRegistry {
+ bool isMUC(const JID& jid) const { return std::find(mucs_.begin(), mucs_.end(), jid) != mucs_.end(); }
+ std::vector<JID> mucs_;
+ };
+
+ JID ownJID;
+ DummyStanzaChannel* stanzaChannel;
+ IQRouter* iqRouter;
+ DummyMUCRegistry* mucRegistry;
+ AvatarMemoryStorage* avatarStorage;
+ VCardManager* vcardManager;
+ VCardMemoryStorage* vcardStorage;
+ ByteArray avatar1;
+ std::string avatar1Hash;
+ std::vector<JID> changes;
+ JID user1;
+ JID user2;
+ boost::shared_ptr<CryptoProvider> crypto;
};
CPPUNIT_TEST_SUITE_REGISTRATION(VCardUpdateAvatarManagerTest);
diff --git a/Swiften/Avatars/VCardAvatarManager.cpp b/Swiften/Avatars/VCardAvatarManager.cpp
index 675cd00..919d833 100644
--- a/Swiften/Avatars/VCardAvatarManager.cpp
+++ b/Swiften/Avatars/VCardAvatarManager.cpp
@@ -19,44 +19,44 @@
namespace Swift {
VCardAvatarManager::VCardAvatarManager(VCardManager* vcardManager, AvatarStorage* avatarStorage, CryptoProvider* crypto, MUCRegistry* mucRegistry) : vcardManager_(vcardManager), avatarStorage_(avatarStorage), crypto_(crypto), mucRegistry_(mucRegistry) {
- vcardManager_->onVCardChanged.connect(boost::bind(&VCardAvatarManager::handleVCardChanged, this, _1));
+ vcardManager_->onVCardChanged.connect(boost::bind(&VCardAvatarManager::handleVCardChanged, this, _1));
}
void VCardAvatarManager::handleVCardChanged(const JID& from) {
- // We don't check whether the avatar actually changed. Direct use of this
- // manager could cause unnecessary updates, but in practice, this will be
- // caught by the wrapping CombinedAvatarManager anyway.
- onAvatarChanged(from);
+ // We don't check whether the avatar actually changed. Direct use of this
+ // manager could cause unnecessary updates, but in practice, this will be
+ // caught by the wrapping CombinedAvatarManager anyway.
+ onAvatarChanged(from);
}
boost::optional<std::string> VCardAvatarManager::getAvatarHash(const JID& jid) const {
- JID avatarJID = getAvatarJID(jid);
- std::string hash = vcardManager_->getPhotoHash(avatarJID);
- if (!hash.empty()) {
- if (!avatarStorage_->hasAvatar(hash)) {
- VCard::ref vCard = vcardManager_->getVCard(avatarJID);
- if (vCard) {
- std::string newHash = Hexify::hexify(crypto_->getSHA1Hash(vCard->getPhoto()));
- if (newHash != hash) {
- // Shouldn't happen, but sometimes seem to. Might be fixed if we
- // move to a safer backend.
- SWIFT_LOG(warning) << "Inconsistent vCard photo hash cache";
- hash = newHash;
- }
- avatarStorage_->addAvatar(hash, vCard->getPhoto());
- }
- else {
- // Can happen if the cache is inconsistent.
- hash = "";
- }
- }
- }
- return hash;
+ JID avatarJID = getAvatarJID(jid);
+ std::string hash = vcardManager_->getPhotoHash(avatarJID);
+ if (!hash.empty()) {
+ if (!avatarStorage_->hasAvatar(hash)) {
+ VCard::ref vCard = vcardManager_->getVCard(avatarJID);
+ if (vCard) {
+ std::string newHash = Hexify::hexify(crypto_->getSHA1Hash(vCard->getPhoto()));
+ if (newHash != hash) {
+ // Shouldn't happen, but sometimes seem to. Might be fixed if we
+ // move to a safer backend.
+ SWIFT_LOG(warning) << "Inconsistent vCard photo hash cache";
+ hash = newHash;
+ }
+ avatarStorage_->addAvatar(hash, vCard->getPhoto());
+ }
+ else {
+ // Can happen if the cache is inconsistent.
+ hash = "";
+ }
+ }
+ }
+ return hash;
}
JID VCardAvatarManager::getAvatarJID(const JID& jid) const {
- JID bareFrom = jid.toBare();
- return (mucRegistry_ && mucRegistry_->isMUC(bareFrom)) ? jid : bareFrom;
+ JID bareFrom = jid.toBare();
+ return (mucRegistry_ && mucRegistry_->isMUC(bareFrom)) ? jid : bareFrom;
}
}
diff --git a/Swiften/Avatars/VCardAvatarManager.h b/Swiften/Avatars/VCardAvatarManager.h
index d914da3..03b3afa 100644
--- a/Swiften/Avatars/VCardAvatarManager.h
+++ b/Swiften/Avatars/VCardAvatarManager.h
@@ -11,25 +11,25 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class MUCRegistry;
- class AvatarStorage;
- class VCardManager;
- class CryptoProvider;
+ class MUCRegistry;
+ class AvatarStorage;
+ class VCardManager;
+ class CryptoProvider;
- class SWIFTEN_API VCardAvatarManager : public AvatarProvider {
- public:
- VCardAvatarManager(VCardManager*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
+ class SWIFTEN_API VCardAvatarManager : public AvatarProvider {
+ public:
+ VCardAvatarManager(VCardManager*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
- boost::optional<std::string> getAvatarHash(const JID&) const;
+ boost::optional<std::string> getAvatarHash(const JID&) const;
- private:
- void handleVCardChanged(const JID& from);
- JID getAvatarJID(const JID& o) const;
+ private:
+ void handleVCardChanged(const JID& from);
+ JID getAvatarJID(const JID& o) const;
- private:
- VCardManager* vcardManager_;
- AvatarStorage* avatarStorage_;
- CryptoProvider* crypto_;
- MUCRegistry* mucRegistry_;
- };
+ private:
+ VCardManager* vcardManager_;
+ AvatarStorage* avatarStorage_;
+ CryptoProvider* crypto_;
+ MUCRegistry* mucRegistry_;
+ };
}
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.cpp b/Swiften/Avatars/VCardUpdateAvatarManager.cpp
index 42c210d..e40eee3 100644
--- a/Swiften/Avatars/VCardUpdateAvatarManager.cpp
+++ b/Swiften/Avatars/VCardUpdateAvatarManager.cpp
@@ -21,84 +21,84 @@
namespace Swift {
VCardUpdateAvatarManager::VCardUpdateAvatarManager(VCardManager* vcardManager, StanzaChannel* stanzaChannel, AvatarStorage* avatarStorage, CryptoProvider* crypto, MUCRegistry* mucRegistry) : vcardManager_(vcardManager), avatarStorage_(avatarStorage), crypto_(crypto), mucRegistry_(mucRegistry) {
- stanzaChannel->onPresenceReceived.connect(boost::bind(&VCardUpdateAvatarManager::handlePresenceReceived, this, _1));
- stanzaChannel->onAvailableChanged.connect(boost::bind(&VCardUpdateAvatarManager::handleStanzaChannelAvailableChanged, this, _1));
- vcardManager_->onVCardChanged.connect(boost::bind(&VCardUpdateAvatarManager::handleVCardChanged, this, _1, _2));
+ stanzaChannel->onPresenceReceived.connect(boost::bind(&VCardUpdateAvatarManager::handlePresenceReceived, this, _1));
+ stanzaChannel->onAvailableChanged.connect(boost::bind(&VCardUpdateAvatarManager::handleStanzaChannelAvailableChanged, this, _1));
+ vcardManager_->onVCardChanged.connect(boost::bind(&VCardUpdateAvatarManager::handleVCardChanged, this, _1, _2));
}
void VCardUpdateAvatarManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) {
- boost::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>();
- if (!update || presence->getPayload<ErrorPayload>()) {
- return;
- }
- JID from = getAvatarJID(presence->getFrom());
- if (getAvatarHash(from) == update->getPhotoHash()) {
- return;
- }
- SWIFT_LOG(debug) << "Updated hash: " << from << " -> " << update->getPhotoHash() << std::endl;
- if (avatarStorage_->hasAvatar(update->getPhotoHash())) {
- setAvatarHash(from, update->getPhotoHash());
- }
- else {
- vcardManager_->requestVCard(from);
- }
+ boost::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>();
+ if (!update || presence->getPayload<ErrorPayload>()) {
+ return;
+ }
+ JID from = getAvatarJID(presence->getFrom());
+ if (getAvatarHash(from) == update->getPhotoHash()) {
+ return;
+ }
+ SWIFT_LOG(debug) << "Updated hash: " << from << " -> " << update->getPhotoHash() << std::endl;
+ if (avatarStorage_->hasAvatar(update->getPhotoHash())) {
+ setAvatarHash(from, update->getPhotoHash());
+ }
+ else {
+ vcardManager_->requestVCard(from);
+ }
}
void VCardUpdateAvatarManager::handleVCardChanged(const JID& from, VCard::ref vCard) {
- if (!vCard) {
- SWIFT_LOG(debug) << "Missing element: " << from << ": null vcard payload" << std::endl;
- return;
- }
+ if (!vCard) {
+ SWIFT_LOG(debug) << "Missing element: " << from << ": null vcard payload" << std::endl;
+ return;
+ }
- if (vCard->getPhoto().empty()) {
- setAvatarHash(from, "");
- }
- else {
- std::string hash = Hexify::hexify(crypto_->getSHA1Hash(vCard->getPhoto()));
- if (!avatarStorage_->hasAvatar(hash)) {
- avatarStorage_->addAvatar(hash, vCard->getPhoto());
- }
- setAvatarHash(from, hash);
- }
+ if (vCard->getPhoto().empty()) {
+ setAvatarHash(from, "");
+ }
+ else {
+ std::string hash = Hexify::hexify(crypto_->getSHA1Hash(vCard->getPhoto()));
+ if (!avatarStorage_->hasAvatar(hash)) {
+ avatarStorage_->addAvatar(hash, vCard->getPhoto());
+ }
+ setAvatarHash(from, hash);
+ }
}
void VCardUpdateAvatarManager::setAvatarHash(const JID& from, const std::string& hash) {
- SWIFT_LOG(debug) << "Updating hash: " << from << " -> " << hash << std::endl;
- avatarHashes_[from] = hash;
- onAvatarChanged(from);
+ SWIFT_LOG(debug) << "Updating hash: " << from << " -> " << hash << std::endl;
+ avatarHashes_[from] = hash;
+ onAvatarChanged(from);
}
/*
void VCardUpdateAvatarManager::setAvatar(const JID& jid, const ByteArray& avatar) {
- std::string hash = Hexify::hexify(SHA1::getHash(avatar));
- avatarStorage_->addAvatar(hash, avatar);
- setAvatarHash(getAvatarJID(jid), hash);
+ std::string hash = Hexify::hexify(SHA1::getHash(avatar));
+ avatarStorage_->addAvatar(hash, avatar);
+ setAvatarHash(getAvatarJID(jid), hash);
}
*/
boost::optional<std::string> VCardUpdateAvatarManager::getAvatarHash(const JID& jid) const {
- std::map<JID, std::string>::const_iterator i = avatarHashes_.find(getAvatarJID(jid));
- if (i != avatarHashes_.end()) {
- return i->second;
- }
- else {
- return boost::optional<std::string>();
- }
+ std::map<JID, std::string>::const_iterator i = avatarHashes_.find(getAvatarJID(jid));
+ if (i != avatarHashes_.end()) {
+ return i->second;
+ }
+ else {
+ return boost::optional<std::string>();
+ }
}
JID VCardUpdateAvatarManager::getAvatarJID(const JID& jid) const {
- JID bareFrom = jid.toBare();
- return (mucRegistry_ && mucRegistry_->isMUC(bareFrom)) ? jid : bareFrom;
+ JID bareFrom = jid.toBare();
+ return (mucRegistry_ && mucRegistry_->isMUC(bareFrom)) ? jid : bareFrom;
}
void VCardUpdateAvatarManager::handleStanzaChannelAvailableChanged(bool available) {
- if (available) {
- std::map<JID, std::string> oldAvatarHashes;
- avatarHashes_.swap(oldAvatarHashes);
- for(std::map<JID, std::string>::const_iterator i = oldAvatarHashes.begin(); i != oldAvatarHashes.end(); ++i) {
- onAvatarChanged(i->first);
- }
- }
+ if (available) {
+ std::map<JID, std::string> oldAvatarHashes;
+ avatarHashes_.swap(oldAvatarHashes);
+ for(std::map<JID, std::string>::const_iterator i = oldAvatarHashes.begin(); i != oldAvatarHashes.end(); ++i) {
+ onAvatarChanged(i->first);
+ }
+ }
}
diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h
index ffc615e..07fe011 100644
--- a/Swiften/Avatars/VCardUpdateAvatarManager.h
+++ b/Swiften/Avatars/VCardUpdateAvatarManager.h
@@ -18,30 +18,30 @@
#include <Swiften/JID/JID.h>
namespace Swift {
- class MUCRegistry;
- class AvatarStorage;
- class StanzaChannel;
- class VCardManager;
- class CryptoProvider;
-
- class SWIFTEN_API VCardUpdateAvatarManager : public AvatarProvider, public boost::bsignals::trackable {
- public:
- VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
-
- boost::optional<std::string> getAvatarHash(const JID&) const;
-
- private:
- void handlePresenceReceived(boost::shared_ptr<Presence>);
- void handleStanzaChannelAvailableChanged(bool);
- void handleVCardChanged(const JID& from, VCard::ref);
- void setAvatarHash(const JID& from, const std::string& hash);
- JID getAvatarJID(const JID& o) const;
-
- private:
- VCardManager* vcardManager_;
- AvatarStorage* avatarStorage_;
- CryptoProvider* crypto_;
- MUCRegistry* mucRegistry_;
- std::map<JID, std::string> avatarHashes_;
- };
+ class MUCRegistry;
+ class AvatarStorage;
+ class StanzaChannel;
+ class VCardManager;
+ class CryptoProvider;
+
+ class SWIFTEN_API VCardUpdateAvatarManager : public AvatarProvider, public boost::bsignals::trackable {
+ public:
+ VCardUpdateAvatarManager(VCardManager*, StanzaChannel*, AvatarStorage*, CryptoProvider* crypto, MUCRegistry* = NULL);
+
+ boost::optional<std::string> getAvatarHash(const JID&) const;
+
+ private:
+ void handlePresenceReceived(boost::shared_ptr<Presence>);
+ void handleStanzaChannelAvailableChanged(bool);
+ void handleVCardChanged(const JID& from, VCard::ref);
+ void setAvatarHash(const JID& from, const std::string& hash);
+ JID getAvatarJID(const JID& o) const;
+
+ private:
+ VCardManager* vcardManager_;
+ AvatarStorage* avatarStorage_;
+ CryptoProvider* crypto_;
+ MUCRegistry* mucRegistry_;
+ std::map<JID, std::string> avatarHashes_;
+ };
}
diff --git a/Swiften/Base/API.h b/Swiften/Base/API.h
index 729b88b..06359ba 100644
--- a/Swiften/Base/API.h
+++ b/Swiften/Base/API.h
@@ -10,7 +10,7 @@
#include <boost/config.hpp>
#ifdef SWIFTEN_STATIC
-# define SWIFTEN_API
+# define SWIFTEN_API
#else
# ifdef SWIFTEN_PLATFORM_WINDOWS
# ifdef SWIFTEN_BUILDING
@@ -21,7 +21,7 @@
# elif __GNUC__ >= 4
# define SWIFTEN_API __attribute__((visibility("default")))
# else
-# define SWIFTEN_API
+# define SWIFTEN_API
# endif
#endif
@@ -30,9 +30,9 @@
# define SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(cls)
#else
# define SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(cls) \
- cls(const cls&) = default;
+ cls(const cls&) = default;
# define SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(cls) \
- cls& operator=(const cls&) = default;
+ cls& operator=(const cls&) = default;
#endif
#ifdef BOOST_NO_NOEXCEPT
diff --git a/Swiften/Base/Algorithm.h b/Swiften/Base/Algorithm.h
index 99a0053..c481aa8 100644
--- a/Swiften/Base/Algorithm.h
+++ b/Swiften/Base/Algorithm.h
@@ -14,142 +14,142 @@
namespace Swift {
- /*
- * Generic erase()
- */
- namespace Detail {
- struct VectorCategory {};
- struct ListCategory {};
- struct MapCategory {};
-
- template<typename T>
- struct ContainerTraits;
-
- template<typename A, typename B>
- struct ContainerTraits< std::vector<A, B> > {
- typedef VectorCategory Category;
- };
-
- template<>
- struct ContainerTraits< std::string > {
- typedef VectorCategory Category;
- };
-
- template<typename A, typename B>
- struct ContainerTraits< std::list<A, B> > {
- typedef ListCategory Category;
- };
-
- template<typename A, typename B, typename C, typename D>
- struct ContainerTraits< std::map<A, B, C, D> > {
- typedef MapCategory Category;
- };
-
- template<typename C, typename V>
- void eraseImpl(C& c, const V& v, VectorCategory) {
- c.erase(std::remove(c.begin(), c.end(), v), c.end());
- }
-
- template<typename C, typename V>
- void eraseImpl(C& c, const V& v, ListCategory) {
- c.remove(v);
- }
-
- template<typename C, typename V>
- void eraseImpl(C& c, const V& v, MapCategory) {
- for (typename C::iterator it = c.begin(); it != c.end(); ) {
- if (it->second == v) {
- c.erase(it++);
- }
- else {
- ++it;
- }
- }
- }
-
- template<typename C, typename P>
- void eraseIfImpl(C& c, const P& p, MapCategory) {
- for (typename C::iterator it = c.begin(); it != c.end(); ) {
- if (p(*it)) {
- c.erase(it++);
- }
- else {
- ++it;
- }
- }
- }
-
- template<typename C, typename P>
- void eraseIfImpl(C& c, const P& p, VectorCategory) {
- c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
- }
- }
-
- template<typename C, typename V>
- void erase(C& container, const V& value) {
- Detail::eraseImpl(container, value, typename Detail::ContainerTraits<C>::Category());
- }
-
- template<typename C, typename P>
- void eraseIf(C& container, const P& predicate) {
- Detail::eraseIfImpl(container, predicate, typename Detail::ContainerTraits<C>::Category());
- }
-
- template<typename Source, typename Target>
- void append(Target& target, const Source& source) {
- target.insert(target.end(), source.begin(), source.end());
- }
-
- template<typename Source, typename Target>
- void assign(Target& target, const Source& source) {
- target.assign(source.begin(), source.end());
- }
-
- template<typename A, typename B, typename C, typename D>
- B get(const std::map<A, B, C, D>& map, const A& key, const B& defaultValue) {
- typename std::map<A, B, C, D>::const_iterator i = map.find(key);
- if (i != map.end()) {
- return i->second;
- }
- else {
- return defaultValue;
- }
- }
-
- template<typename Container>
- void safeClear(Container& c) {
- std::fill(c.begin(), c.end(), 0);
- c.clear();
- }
-
- /*
- * Functors
- */
- template<typename K, typename V>
- class PairFirstEquals {
- public:
- PairFirstEquals(const K& value) : value(value) {
- }
-
- bool operator()(const std::pair<K,V>& pair) const {
- return pair.first == value;
- }
-
- private:
- K value;
- };
-
- template<typename K, typename V>
- class PairSecondEquals {
- public:
- PairSecondEquals(const V& value) : value(value) {
- }
-
- bool operator()(const std::pair<K,V>& pair) const {
- return pair.second == value;
- }
-
- private:
- V value;
- };
+ /*
+ * Generic erase()
+ */
+ namespace Detail {
+ struct VectorCategory {};
+ struct ListCategory {};
+ struct MapCategory {};
+
+ template<typename T>
+ struct ContainerTraits;
+
+ template<typename A, typename B>
+ struct ContainerTraits< std::vector<A, B> > {
+ typedef VectorCategory Category;
+ };
+
+ template<>
+ struct ContainerTraits< std::string > {
+ typedef VectorCategory Category;
+ };
+
+ template<typename A, typename B>
+ struct ContainerTraits< std::list<A, B> > {
+ typedef ListCategory Category;
+ };
+
+ template<typename A, typename B, typename C, typename D>
+ struct ContainerTraits< std::map<A, B, C, D> > {
+ typedef MapCategory Category;
+ };
+
+ template<typename C, typename V>
+ void eraseImpl(C& c, const V& v, VectorCategory) {
+ c.erase(std::remove(c.begin(), c.end(), v), c.end());
+ }
+
+ template<typename C, typename V>
+ void eraseImpl(C& c, const V& v, ListCategory) {
+ c.remove(v);
+ }
+
+ template<typename C, typename V>
+ void eraseImpl(C& c, const V& v, MapCategory) {
+ for (typename C::iterator it = c.begin(); it != c.end(); ) {
+ if (it->second == v) {
+ c.erase(it++);
+ }
+ else {
+ ++it;
+ }
+ }
+ }
+
+ template<typename C, typename P>
+ void eraseIfImpl(C& c, const P& p, MapCategory) {
+ for (typename C::iterator it = c.begin(); it != c.end(); ) {
+ if (p(*it)) {
+ c.erase(it++);
+ }
+ else {
+ ++it;
+ }
+ }
+ }
+
+ template<typename C, typename P>
+ void eraseIfImpl(C& c, const P& p, VectorCategory) {
+ c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
+ }
+ }
+
+ template<typename C, typename V>
+ void erase(C& container, const V& value) {
+ Detail::eraseImpl(container, value, typename Detail::ContainerTraits<C>::Category());
+ }
+
+ template<typename C, typename P>
+ void eraseIf(C& container, const P& predicate) {
+ Detail::eraseIfImpl(container, predicate, typename Detail::ContainerTraits<C>::Category());
+ }
+
+ template<typename Source, typename Target>
+ void append(Target& target, const Source& source) {
+ target.insert(target.end(), source.begin(), source.end());
+ }
+
+ template<typename Source, typename Target>
+ void assign(Target& target, const Source& source) {
+ target.assign(source.begin(), source.end());
+ }
+
+ template<typename A, typename B, typename C, typename D>
+ B get(const std::map<A, B, C, D>& map, const A& key, const B& defaultValue) {
+ typename std::map<A, B, C, D>::const_iterator i = map.find(key);
+ if (i != map.end()) {
+ return i->second;
+ }
+ else {
+ return defaultValue;
+ }
+ }
+
+ template<typename Container>
+ void safeClear(Container& c) {
+ std::fill(c.begin(), c.end(), 0);
+ c.clear();
+ }
+
+ /*
+ * Functors
+ */
+ template<typename K, typename V>
+ class PairFirstEquals {
+ public:
+ PairFirstEquals(const K& value) : value(value) {
+ }
+
+ bool operator()(const std::pair<K,V>& pair) const {
+ return pair.first == value;
+ }
+
+ private:
+ K value;
+ };
+
+ template<typename K, typename V>
+ class PairSecondEquals {
+ public:
+ PairSecondEquals(const V& value) : value(value) {
+ }
+
+ bool operator()(const std::pair<K,V>& pair) const {
+ return pair.second == value;
+ }
+
+ private:
+ V value;
+ };
}
diff --git a/Swiften/Base/Atomic.h b/Swiften/Base/Atomic.h
index bca3683..9640500 100644
--- a/Swiften/Base/Atomic.h
+++ b/Swiften/Base/Atomic.h
@@ -12,34 +12,34 @@
namespace Swift {
/**
- * This class template provides a read/write access synchronized wrapper for other types.
+ * This class template provides a read/write access synchronized wrapper for other types.
*/
template <typename ValueType>
class Atomic {
- public:
- Atomic(const ValueType& v) : value_(v) {
- }
-
- /**
- * Synchronized write access.
- */
- Atomic<ValueType>& operator=(const ValueType& newValue) {
- boost::lock_guard<boost::mutex> lock(valueMutex_);
- value_ = newValue;
- return *this;
- }
-
- /**
- * Synchronized read access.
- */
- operator ValueType() {
- boost::lock_guard<boost::mutex> lock(valueMutex_);
- return value_;
- }
-
- private:
- boost::mutex valueMutex_;
- ValueType value_;
+ public:
+ Atomic(const ValueType& v) : value_(v) {
+ }
+
+ /**
+ * Synchronized write access.
+ */
+ Atomic<ValueType>& operator=(const ValueType& newValue) {
+ boost::lock_guard<boost::mutex> lock(valueMutex_);
+ value_ = newValue;
+ return *this;
+ }
+
+ /**
+ * Synchronized read access.
+ */
+ operator ValueType() {
+ boost::lock_guard<boost::mutex> lock(valueMutex_);
+ return value_;
+ }
+
+ private:
+ boost::mutex valueMutex_;
+ ValueType value_;
};
}
diff --git a/Swiften/Base/BoostRandomGenerator.cpp b/Swiften/Base/BoostRandomGenerator.cpp
index 8826680..8db3ca6 100644
--- a/Swiften/Base/BoostRandomGenerator.cpp
+++ b/Swiften/Base/BoostRandomGenerator.cpp
@@ -15,13 +15,13 @@
namespace Swift {
BoostRandomGenerator::BoostRandomGenerator() {
- // FIXME: Not a good seed
- generator.seed(static_cast<unsigned int>(std::time(0)));
+ // FIXME: Not a good seed
+ generator.seed(static_cast<unsigned int>(std::time(0)));
}
int BoostRandomGenerator::generateRandomInteger(int maximum) {
- boost::uniform_int<> distribution(0, maximum);
- return distribution(generator);
+ boost::uniform_int<> distribution(0, maximum);
+ return distribution(generator);
}
}
diff --git a/Swiften/Base/BoostRandomGenerator.h b/Swiften/Base/BoostRandomGenerator.h
index 5f1786b..ff715c3 100644
--- a/Swiften/Base/BoostRandomGenerator.h
+++ b/Swiften/Base/BoostRandomGenerator.h
@@ -13,13 +13,13 @@
#include <Swiften/Base/RandomGenerator.h>
namespace Swift {
- class SWIFTEN_API BoostRandomGenerator : public RandomGenerator {
- public:
- BoostRandomGenerator();
+ class SWIFTEN_API BoostRandomGenerator : public RandomGenerator {
+ public:
+ BoostRandomGenerator();
- int generateRandomInteger(int max) SWIFTEN_OVERRIDE;
+ int generateRandomInteger(int max) SWIFTEN_OVERRIDE;
- private:
- boost::mt19937 generator;
- };
+ private:
+ boost::mt19937 generator;
+ };
}
diff --git a/Swiften/Base/ByteArray.cpp b/Swiften/Base/ByteArray.cpp
index 5fc0752..882421d 100644
--- a/Swiften/Base/ByteArray.cpp
+++ b/Swiften/Base/ByteArray.cpp
@@ -14,37 +14,37 @@ namespace Swift {
static const int BUFFER_SIZE = 4096;
void readByteArrayFromFile(ByteArray& data, const boost::filesystem::path& file) {
- boost::filesystem::ifstream input(file, std::ios_base::in|std::ios_base::binary);
- while (input.good()) {
- size_t oldSize = data.size();
- data.resize(oldSize + BUFFER_SIZE);
- input.read(reinterpret_cast<char*>(&data[oldSize]), BUFFER_SIZE);
- data.resize(oldSize + boost::numeric_cast<size_t>(input.gcount()));
- }
- input.close();
+ boost::filesystem::ifstream input(file, std::ios_base::in|std::ios_base::binary);
+ while (input.good()) {
+ size_t oldSize = data.size();
+ data.resize(oldSize + BUFFER_SIZE);
+ input.read(reinterpret_cast<char*>(&data[oldSize]), BUFFER_SIZE);
+ data.resize(oldSize + boost::numeric_cast<size_t>(input.gcount()));
+ }
+ input.close();
}
std::vector<unsigned char> createByteArray(const std::string& s) {
- return std::vector<unsigned char>(s.begin(), s.end());
+ return std::vector<unsigned char>(s.begin(), s.end());
}
std::vector<unsigned char> createByteArray(const char* c) {
- std::vector<unsigned char> data;
- while (*c) {
- data.push_back(static_cast<unsigned char>(*c));
- ++c;
- }
- return data;
+ std::vector<unsigned char> data;
+ while (*c) {
+ data.push_back(static_cast<unsigned char>(*c));
+ ++c;
+ }
+ return data;
}
std::string byteArrayToString(const ByteArray& b) {
- size_t i;
- for (i = b.size(); i > 0; --i) {
- if (b[i - 1] != 0) {
- break;
- }
- }
- return i > 0 ? std::string(reinterpret_cast<const char*>(vecptr(b)), i) : "";
+ size_t i;
+ for (i = b.size(); i > 0; --i) {
+ if (b[i - 1] != 0) {
+ break;
+ }
+ }
+ return i > 0 ? std::string(reinterpret_cast<const char*>(vecptr(b)), i) : "";
}
}
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h
index 75f184a..c0babdf 100644
--- a/Swiften/Base/ByteArray.h
+++ b/Swiften/Base/ByteArray.h
@@ -14,35 +14,35 @@
#include <Swiften/Base/API.h>
namespace Swift {
- typedef std::vector<unsigned char> ByteArray;
+ typedef std::vector<unsigned char> ByteArray;
- SWIFTEN_API ByteArray createByteArray(const std::string& s);
- SWIFTEN_API ByteArray createByteArray(const char* c);
+ SWIFTEN_API ByteArray createByteArray(const std::string& s);
+ SWIFTEN_API ByteArray createByteArray(const char* c);
- inline ByteArray createByteArray(const unsigned char* c, size_t n) {
- return ByteArray(c, c + n);
- }
+ inline ByteArray createByteArray(const unsigned char* c, size_t n) {
+ return ByteArray(c, c + n);
+ }
- inline ByteArray createByteArray(const char* c, size_t n) {
- return ByteArray(c, c + n);
- }
+ inline ByteArray createByteArray(const char* c, size_t n) {
+ return ByteArray(c, c + n);
+ }
- inline ByteArray createByteArray(char c) {
- return std::vector<unsigned char>(1, static_cast<unsigned char>(c));
- }
+ inline ByteArray createByteArray(char c) {
+ return std::vector<unsigned char>(1, static_cast<unsigned char>(c));
+ }
- template<typename T, typename A>
- static const T* vecptr(const std::vector<T, A>& v) {
- return v.empty() ? NULL : &v[0];
- }
+ template<typename T, typename A>
+ static const T* vecptr(const std::vector<T, A>& v) {
+ return v.empty() ? NULL : &v[0];
+ }
- template<typename T, typename A>
- static T* vecptr(std::vector<T, A>& v) {
- return v.empty() ? NULL : &v[0];
- }
-
- SWIFTEN_API std::string byteArrayToString(const ByteArray& b);
+ template<typename T, typename A>
+ static T* vecptr(std::vector<T, A>& v) {
+ return v.empty() ? NULL : &v[0];
+ }
- SWIFTEN_API void readByteArrayFromFile(ByteArray&, const boost::filesystem::path& file);
+ SWIFTEN_API std::string byteArrayToString(const ByteArray& b);
+
+ SWIFTEN_API void readByteArrayFromFile(ByteArray&, const boost::filesystem::path& file);
}
diff --git a/Swiften/Base/Concat.h b/Swiften/Base/Concat.h
index 1d158d5..df5d77b 100644
--- a/Swiften/Base/Concat.h
+++ b/Swiften/Base/Concat.h
@@ -9,67 +9,67 @@
#include <algorithm>
namespace Swift {
- template<typename C>
- C concat(const C& c1, const C& c2) {
- C result;
- result.resize(c1.size() + c2.size());
- std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2) {
+ C result;
+ result.resize(c1.size() + c2.size());
+ std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size());
- std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size());
+ std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3, const C& c4) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size() + c4.size());
- std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3, const C& c4) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size() + c4.size());
+ std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size());
- std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size());
+ std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size());
- std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))))));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size());
+ std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))))));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size());
- std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))))));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size());
+ std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))))));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7, const C& c8) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size() + c8.size());
- std::copy(c8.begin(), c8.end(), std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))))))));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7, const C& c8) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size() + c8.size());
+ std::copy(c8.begin(), c8.end(), std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin()))))))));
+ return result;
+ }
- template<typename C>
- C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7, const C& c8, const C& c9) {
- C result;
- result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size() + c8.size() + c9.size());
- std::copy(c9.begin(), c9.end(), std::copy(c8.begin(), c8.end(), std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))))))));
- return result;
- }
+ template<typename C>
+ C concat(const C& c1, const C& c2, const C& c3, const C& c4, const C& c5, const C& c6, const C& c7, const C& c8, const C& c9) {
+ C result;
+ result.resize(c1.size() + c2.size() + c3.size() + c4.size() + c5.size() + c6.size() + c7.size() + c8.size() + c9.size());
+ std::copy(c9.begin(), c9.end(), std::copy(c8.begin(), c8.end(), std::copy(c7.begin(), c7.end(), std::copy(c6.begin(), c6.end(), std::copy(c5.begin(), c5.end(), std::copy(c4.begin(), c4.end(), std::copy(c3.begin(), c3.end(), std::copy(c2.begin(), c2.end(), std::copy(c1.begin(), c1.end(), result.begin())))))))));
+ return result;
+ }
}
diff --git a/Swiften/Base/DateTime.cpp b/Swiften/Base/DateTime.cpp
index 9ca5fac..4443566 100644
--- a/Swiften/Base/DateTime.cpp
+++ b/Swiften/Base/DateTime.cpp
@@ -19,30 +19,30 @@
namespace Swift {
boost::posix_time::ptime stringToDateTime(const std::string& string) {
- static std::locale locale(std::locale::classic(), new boost::local_time::local_time_input_facet("%Y-%m-%d %H:%M:%S%F%ZP"));
- std::istringstream stream(string);
- stream.imbue(locale);
- boost::local_time::local_date_time result(boost::date_time::not_a_date_time);
- stream >> result;
- return result.utc_time();
+ static std::locale locale(std::locale::classic(), new boost::local_time::local_time_input_facet("%Y-%m-%d %H:%M:%S%F%ZP"));
+ std::istringstream stream(string);
+ stream.imbue(locale);
+ boost::local_time::local_date_time result(boost::date_time::not_a_date_time);
+ stream >> result;
+ return result.utc_time();
}
std::string dateTimeToString(const boost::posix_time::ptime& time) {
- std::string stampString = std::string(boost::posix_time::to_iso_extended_string(time));
- String::replaceAll(stampString, ',', ".");
- stampString += "Z";
- return stampString;
+ std::string stampString = std::string(boost::posix_time::to_iso_extended_string(time));
+ String::replaceAll(stampString, ',', ".");
+ stampString += "Z";
+ return stampString;
}
std::string dateTimeToLocalString(const boost::posix_time::ptime& time) {
- std::string localString;
- try {
- localString = boost::posix_time::to_simple_string(boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(time));
- }
- catch(std::out_of_range& exception) {
- SWIFT_LOG(debug) << exception.what() << std::endl;
- }
- return localString;
+ std::string localString;
+ try {
+ localString = boost::posix_time::to_simple_string(boost::date_time::c_local_adjustor<boost::posix_time::ptime>::utc_to_local(time));
+ }
+ catch(std::out_of_range& exception) {
+ SWIFT_LOG(debug) << exception.what() << std::endl;
+ }
+ return localString;
}
}
diff --git a/Swiften/Base/DateTime.h b/Swiften/Base/DateTime.h
index 8f07982..36cff65 100644
--- a/Swiften/Base/DateTime.h
+++ b/Swiften/Base/DateTime.h
@@ -11,19 +11,19 @@
#include <Swiften/Base/API.h>
namespace Swift {
- /**
- * Converts a date formatted according to XEP-0082 into a ptime
- * object (in UTC).
- */
- SWIFTEN_API boost::posix_time::ptime stringToDateTime(const std::string& string);
+ /**
+ * Converts a date formatted according to XEP-0082 into a ptime
+ * object (in UTC).
+ */
+ SWIFTEN_API boost::posix_time::ptime stringToDateTime(const std::string& string);
- /**
- * Converts a UTC ptime object to a XEP-0082 formatted string.
- */
- SWIFTEN_API std::string dateTimeToString(const boost::posix_time::ptime& time);
+ /**
+ * Converts a UTC ptime object to a XEP-0082 formatted string.
+ */
+ SWIFTEN_API std::string dateTimeToString(const boost::posix_time::ptime& time);
- /**
- * Converts a UTC ptime object to a localized human readable string.
- */
- SWIFTEN_API std::string dateTimeToLocalString(const boost::posix_time::ptime& time);
+ /**
+ * Converts a UTC ptime object to a localized human readable string.
+ */
+ SWIFTEN_API std::string dateTimeToLocalString(const boost::posix_time::ptime& time);
}
diff --git a/Swiften/Base/Debug.cpp b/Swiften/Base/Debug.cpp
index 82dbec6..2d306d5 100644
--- a/Swiften/Base/Debug.cpp
+++ b/Swiften/Base/Debug.cpp
@@ -16,126 +16,126 @@
#include <Swiften/Serializer/XMPPSerializer.h>
std::ostream& operator<<(std::ostream& os, const Swift::ClientError& error) {
- os << "ClientError(";
- switch(error.getType()) {
- case Swift::ClientError::UnknownError:
- os << "UnknownError";
- break;
- case Swift::ClientError::DomainNameResolveError:
- os << "DomainNameResolveError";
- break;
- case Swift::ClientError::ConnectionError:
- os << "ConnectionError";
- break;
- case Swift::ClientError::ConnectionReadError:
- os << "ConnectionReadError";
- break;
- case Swift::ClientError::ConnectionWriteError:
- os << "ConnectionWriteError";
- break;
- case Swift::ClientError::XMLError:
- os << "XMLError";
- break;
- case Swift::ClientError::AuthenticationFailedError:
- os << "AuthenticationFailedError";
- break;
- case Swift::ClientError::CompressionFailedError:
- os << "CompressionFailedError";
- break;
- case Swift::ClientError::ServerVerificationFailedError:
- os << "ServerVerificationFailedError";
- break;
- case Swift::ClientError::NoSupportedAuthMechanismsError:
- os << "NoSupportedAuthMechanismsError";
- break;
- case Swift::ClientError::UnexpectedElementError:
- os << "UnexpectedElementError";
- break;
- case Swift::ClientError::ResourceBindError:
- os << "ResourceBindError";
- break;
- case Swift::ClientError::SessionStartError:
- os << "SessionStartError";
- break;
- case Swift::ClientError::StreamError:
- os << "StreamError";
- break;
- case Swift::ClientError::TLSError:
- os << "TLSError";
- break;
- case Swift::ClientError::ClientCertificateLoadError:
- os << "ClientCertificateLoadError";
- break;
- case Swift::ClientError::ClientCertificateError:
- os << "ClientCertificateError";
- break;
- case Swift::ClientError::CertificateCardRemoved:
- os << "CertificateCardRemoved";
- break;
- case Swift::ClientError::UnknownCertificateError:
- os << "UnknownCertificateError";
- break;
- case Swift::ClientError::CertificateExpiredError:
- os << "CertificateExpiredError";
- break;
- case Swift::ClientError::CertificateNotYetValidError:
- os << "CertificateNotYetValidError";
- break;
- case Swift::ClientError::CertificateSelfSignedError:
- os << "CertificateSelfSignedError";
- break;
- case Swift::ClientError::CertificateRejectedError:
- os << "CertificateRejectedError";
- break;
- case Swift::ClientError::CertificateUntrustedError:
- os << "CertificateUntrustedError";
- break;
- case Swift::ClientError::InvalidCertificatePurposeError:
- os << "InvalidCertificatePurposeError";
- break;
- case Swift::ClientError::CertificatePathLengthExceededError:
- os << "CertificatePathLengthExceededError";
- break;
- case Swift::ClientError::InvalidCertificateSignatureError:
- os << "InvalidCertificateSignatureError";
- break;
- case Swift::ClientError::InvalidCAError:
- os << "InvalidCAError";
- break;
- case Swift::ClientError::InvalidServerIdentityError:
- os << "InvalidServerIdentityError";
- break;
- case Swift::ClientError::RevokedError:
- os << "RevokedError";
- break;
- case Swift::ClientError::RevocationCheckFailedError:
- os << "RevocationCheckFailedError";
- break;
- }
- os << ")";
- return os;
+ os << "ClientError(";
+ switch(error.getType()) {
+ case Swift::ClientError::UnknownError:
+ os << "UnknownError";
+ break;
+ case Swift::ClientError::DomainNameResolveError:
+ os << "DomainNameResolveError";
+ break;
+ case Swift::ClientError::ConnectionError:
+ os << "ConnectionError";
+ break;
+ case Swift::ClientError::ConnectionReadError:
+ os << "ConnectionReadError";
+ break;
+ case Swift::ClientError::ConnectionWriteError:
+ os << "ConnectionWriteError";
+ break;
+ case Swift::ClientError::XMLError:
+ os << "XMLError";
+ break;
+ case Swift::ClientError::AuthenticationFailedError:
+ os << "AuthenticationFailedError";
+ break;
+ case Swift::ClientError::CompressionFailedError:
+ os << "CompressionFailedError";
+ break;
+ case Swift::ClientError::ServerVerificationFailedError:
+ os << "ServerVerificationFailedError";
+ break;
+ case Swift::ClientError::NoSupportedAuthMechanismsError:
+ os << "NoSupportedAuthMechanismsError";
+ break;
+ case Swift::ClientError::UnexpectedElementError:
+ os << "UnexpectedElementError";
+ break;
+ case Swift::ClientError::ResourceBindError:
+ os << "ResourceBindError";
+ break;
+ case Swift::ClientError::SessionStartError:
+ os << "SessionStartError";
+ break;
+ case Swift::ClientError::StreamError:
+ os << "StreamError";
+ break;
+ case Swift::ClientError::TLSError:
+ os << "TLSError";
+ break;
+ case Swift::ClientError::ClientCertificateLoadError:
+ os << "ClientCertificateLoadError";
+ break;
+ case Swift::ClientError::ClientCertificateError:
+ os << "ClientCertificateError";
+ break;
+ case Swift::ClientError::CertificateCardRemoved:
+ os << "CertificateCardRemoved";
+ break;
+ case Swift::ClientError::UnknownCertificateError:
+ os << "UnknownCertificateError";
+ break;
+ case Swift::ClientError::CertificateExpiredError:
+ os << "CertificateExpiredError";
+ break;
+ case Swift::ClientError::CertificateNotYetValidError:
+ os << "CertificateNotYetValidError";
+ break;
+ case Swift::ClientError::CertificateSelfSignedError:
+ os << "CertificateSelfSignedError";
+ break;
+ case Swift::ClientError::CertificateRejectedError:
+ os << "CertificateRejectedError";
+ break;
+ case Swift::ClientError::CertificateUntrustedError:
+ os << "CertificateUntrustedError";
+ break;
+ case Swift::ClientError::InvalidCertificatePurposeError:
+ os << "InvalidCertificatePurposeError";
+ break;
+ case Swift::ClientError::CertificatePathLengthExceededError:
+ os << "CertificatePathLengthExceededError";
+ break;
+ case Swift::ClientError::InvalidCertificateSignatureError:
+ os << "InvalidCertificateSignatureError";
+ break;
+ case Swift::ClientError::InvalidCAError:
+ os << "InvalidCAError";
+ break;
+ case Swift::ClientError::InvalidServerIdentityError:
+ os << "InvalidServerIdentityError";
+ break;
+ case Swift::ClientError::RevokedError:
+ os << "RevokedError";
+ break;
+ case Swift::ClientError::RevocationCheckFailedError:
+ os << "RevocationCheckFailedError";
+ break;
+ }
+ os << ")";
+ return os;
}
std::ostream& operator<<(std::ostream& os, Swift::Element* ele) {
- using namespace Swift;
+ using namespace Swift;
- boost::shared_ptr<Element> element = boost::shared_ptr<Element>(ele);
+ boost::shared_ptr<Element> element = boost::shared_ptr<Element>(ele);
- boost::shared_ptr<Payload> payload = boost::dynamic_pointer_cast<Payload>(element);
- if (payload) {
- FullPayloadSerializerCollection payloadSerializerCollection;
- PayloadSerializer *serializer = payloadSerializerCollection.getPayloadSerializer(payload);
- os << "Payload(" << serializer->serialize(payload) << ")";
- return os;
- }
- boost::shared_ptr<ToplevelElement> topLevelElement = boost::dynamic_pointer_cast<ToplevelElement>(element);
- if (topLevelElement) {
- FullPayloadSerializerCollection payloadSerializerCollection;
- XMPPSerializer xmppSerializer(&payloadSerializerCollection, ClientStreamType, false);
- SafeByteArray serialized = xmppSerializer.serializeElement(topLevelElement);
- os << "TopLevelElement(" << safeByteArrayToString(serialized) << ")";
- return os;
- }
- os << "Element(Unknown)";
- return os;
+ boost::shared_ptr<Payload> payload = boost::dynamic_pointer_cast<Payload>(element);
+ if (payload) {
+ FullPayloadSerializerCollection payloadSerializerCollection;
+ PayloadSerializer *serializer = payloadSerializerCollection.getPayloadSerializer(payload);
+ os << "Payload(" << serializer->serialize(payload) << ")";
+ return os;
+ }
+ boost::shared_ptr<ToplevelElement> topLevelElement = boost::dynamic_pointer_cast<ToplevelElement>(element);
+ if (topLevelElement) {
+ FullPayloadSerializerCollection payloadSerializerCollection;
+ XMPPSerializer xmppSerializer(&payloadSerializerCollection, ClientStreamType, false);
+ SafeByteArray serialized = xmppSerializer.serializeElement(topLevelElement);
+ os << "TopLevelElement(" << safeByteArrayToString(serialized) << ")";
+ return os;
+ }
+ os << "Element(Unknown)";
+ return os;
}
diff --git a/Swiften/Base/Debug.h b/Swiften/Base/Debug.h
index 33d439e..18e7fb4 100644
--- a/Swiften/Base/Debug.h
+++ b/Swiften/Base/Debug.h
@@ -7,12 +7,12 @@
#include <iosfwd>
namespace Swift {
- class ClientError;
- class Element;
+ class ClientError;
+ class Element;
}
namespace boost {
- template<class T> class shared_ptr;
+ template<class T> class shared_ptr;
}
std::ostream& operator<<(std::ostream& os, const Swift::ClientError& error);
diff --git a/Swiften/Base/Error.h b/Swiften/Base/Error.h
index 3589bf0..d470b89 100644
--- a/Swiften/Base/Error.h
+++ b/Swiften/Base/Error.h
@@ -9,10 +9,10 @@
#include <Swiften/Base/API.h>
namespace Swift {
- class SWIFTEN_API Error {
- public:
- Error() {}
- SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Error)
- virtual ~Error();
- };
+ class SWIFTEN_API Error {
+ public:
+ Error() {}
+ SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Error)
+ virtual ~Error();
+ };
}
diff --git a/Swiften/Base/FileSize.cpp b/Swiften/Base/FileSize.cpp
index 32ab5f5..d9ab5ec 100644
--- a/Swiften/Base/FileSize.cpp
+++ b/Swiften/Base/FileSize.cpp
@@ -11,14 +11,14 @@
namespace Swift {
std::string formatSize(const boost::uintmax_t bytes) {
- static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL};
- int power = 0;
- double engBytes = bytes;
- while (engBytes >= 1000) {
- ++power;
- engBytes = engBytes / 1000.0;
- }
- return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") );
+ static const char *siPrefix[] = {"k", "M", "G", "T", "P", "E", "Z", "Y", NULL};
+ int power = 0;
+ double engBytes = bytes;
+ while (engBytes >= 1000) {
+ ++power;
+ engBytes = engBytes / 1000.0;
+ }
+ return str( boost::format("%.1lf %sB") % engBytes % (power > 0 ? siPrefix[power-1] : "") );
}
}
diff --git a/Swiften/Base/IDGenerator.cpp b/Swiften/Base/IDGenerator.cpp
index 6e5ed88..5aa471c 100644
--- a/Swiften/Base/IDGenerator.cpp
+++ b/Swiften/Base/IDGenerator.cpp
@@ -17,8 +17,8 @@ IDGenerator::IDGenerator() {
}
std::string IDGenerator::generateID() {
- static boost::uuids::random_generator generator;
- return boost::lexical_cast<std::string>(generator());
+ static boost::uuids::random_generator generator;
+ return boost::lexical_cast<std::string>(generator());
}
}
diff --git a/Swiften/Base/IDGenerator.h b/Swiften/Base/IDGenerator.h
index d5407df..d1b5964 100644
--- a/Swiften/Base/IDGenerator.h
+++ b/Swiften/Base/IDGenerator.h
@@ -11,10 +11,10 @@
#include <Swiften/Base/API.h>
namespace Swift {
- class SWIFTEN_API IDGenerator {
- public:
- IDGenerator();
+ class SWIFTEN_API IDGenerator {
+ public:
+ IDGenerator();
- std::string generateID();
- };
+ std::string generateID();
+ };
}
diff --git a/Swiften/Base/Listenable.h b/Swiften/Base/Listenable.h
index 655599a..ae83f4e 100644
--- a/Swiften/Base/Listenable.h
+++ b/Swiften/Base/Listenable.h
@@ -14,42 +14,42 @@
#include <Swiften/Base/API.h>
namespace Swift {
- template<typename T>
- class SWIFTEN_API Listenable {
- public:
- void addListener(T* listener) {
- listeners.push_back(listener);
- }
-
- void removeListener(T* listener) {
- listeners.erase(std::remove(listeners.begin(), listeners.end(), listener), listeners.end());
- }
-
- protected:
- template<typename F>
- void notifyListeners(F event) {
- for (typename std::vector<T*>::iterator i = listeners.begin(); i != listeners.end(); ++i) {
- event(*i);
- }
- }
-
- template<typename F, typename A1>
- void notifyListeners(F f, const A1& a1) {
- notifyListeners(boost::bind(f, _1, a1));
- }
-
- template<typename F, typename A1, typename A2>
- void notifyListeners(F f, const A1& a1, const A2& a2) {
- notifyListeners(boost::bind(f, _1, a1, a2));
- }
-
- template<typename F, typename A1, typename A2, typename A3>
- void notifyListeners(F f, const A1& a1, const A2& a2, const A3& a3) {
- notifyListeners(boost::bind(f, _1, a1, a2, a3));
- }
-
- private:
- std::vector<T*> listeners;
- };
+ template<typename T>
+ class SWIFTEN_API Listenable {
+ public:
+ void addListener(T* listener) {
+ listeners.push_back(listener);
+ }
+
+ void removeListener(T* listener) {
+ listeners.erase(std::remove(listeners.begin(), listeners.end(), listener), listeners.end());
+ }
+
+ protected:
+ template<typename F>
+ void notifyListeners(F event) {
+ for (typename std::vector<T*>::iterator i = listeners.begin(); i != listeners.end(); ++i) {
+ event(*i);
+ }
+ }
+
+ template<typename F, typename A1>
+ void notifyListeners(F f, const A1& a1) {
+ notifyListeners(boost::bind(f, _1, a1));
+ }
+
+ template<typename F, typename A1, typename A2>
+ void notifyListeners(F f, const A1& a1, const A2& a2) {
+ notifyListeners(boost::bind(f, _1, a1, a2));
+ }
+
+ template<typename F, typename A1, typename A2, typename A3>
+ void notifyListeners(F f, const A1& a1, const A2& a2, const A3& a3) {
+ notifyListeners(boost::bind(f, _1, a1, a2, a3));
+ }
+
+ private:
+ std::vector<T*> listeners;
+ };
}
diff --git a/Swiften/Base/Log.cpp b/Swiften/Base/Log.cpp
index 4879766..0efac7e 100644
--- a/Swiften/Base/Log.cpp
+++ b/Swiften/Base/Log.cpp
@@ -22,30 +22,30 @@ Log::Log() {
Log::~Log() {
#if defined(SWIFT_ANDROID_LOGGING) && defined(__ANDROID__)
- __android_log_print(ANDROID_LOG_VERBOSE, "Swift", stream.str().c_str(), 1);
+ __android_log_print(ANDROID_LOG_VERBOSE, "Swift", stream.str().c_str(), 1);
#else
- // Using stdio for thread safety (POSIX file i/o calls are guaranteed to be atomic)
- fprintf(stderr, "%s", stream.str().c_str());
- fflush(stderr);
+ // Using stdio for thread safety (POSIX file i/o calls are guaranteed to be atomic)
+ fprintf(stderr, "%s", stream.str().c_str());
+ fflush(stderr);
#endif
}
std::ostringstream& Log::getStream(
- Severity /*severity*/,
- const std::string& severityString,
- const std::string& file,
- int line,
- const std::string& function) {
- stream << "[" << severityString << "] " << file << ":" << line << " " << function << ": ";
- return stream;
+ Severity /*severity*/,
+ const std::string& severityString,
+ const std::string& file,
+ int line,
+ const std::string& function) {
+ stream << "[" << severityString << "] " << file << ":" << line << " " << function << ": ";
+ return stream;
}
Log::Severity Log::getLogLevel() {
- return logLevel;
+ return logLevel;
}
void Log::setLogLevel(Severity level) {
- logLevel = level;
+ logLevel = level;
}
}
diff --git a/Swiften/Base/Log.h b/Swiften/Base/Log.h
index 76251df..33c969d 100644
--- a/Swiften/Base/Log.h
+++ b/Swiften/Base/Log.h
@@ -11,34 +11,34 @@
#include <Swiften/Base/API.h>
namespace Swift {
- class SWIFTEN_API Log {
- public:
- enum Severity {
- error, warning, info, debug
- };
-
- Log();
- ~Log();
-
- std::ostringstream& getStream(
- Severity severity,
- const std::string& severityString,
- const std::string& file,
- int line,
- const std::string& function);
-
- static Severity getLogLevel();
- static void setLogLevel(Severity level);
-
- private:
- std::ostringstream stream;
- };
+ class SWIFTEN_API Log {
+ public:
+ enum Severity {
+ error, warning, info, debug
+ };
+
+ Log();
+ ~Log();
+
+ std::ostringstream& getStream(
+ Severity severity,
+ const std::string& severityString,
+ const std::string& file,
+ int line,
+ const std::string& function);
+
+ static Severity getLogLevel();
+ static void setLogLevel(Severity level);
+
+ private:
+ std::ostringstream stream;
+ };
}
#define SWIFT_LOG(severity) \
- if (Log::severity > Log::getLogLevel()) ; \
- else Log().getStream(Log::severity, #severity, __FILE__, __LINE__, __FUNCTION__)
+ if (Log::severity > Log::getLogLevel()) ; \
+ else Log().getStream(Log::severity, #severity, __FILE__, __LINE__, __FUNCTION__)
#define SWIFT_LOG_ASSERT(test, severity) \
- if (Log::severity > Log::getLogLevel() || (test)) ; \
- else Log().getStream(Log::severity, #severity, __FILE__, __LINE__, __FUNCTION__) << "Assertion failed: " << #test << ". "
+ if (Log::severity > Log::getLogLevel() || (test)) ; \
+ else Log().getStream(Log::severity, #severity, __FILE__, __LINE__, __FUNCTION__) << "Assertion failed: " << #test << ". "
diff --git a/Swiften/Base/Path.cpp b/Swiften/Base/Path.cpp
index 448efd8..ffee09b 100644
--- a/Swiften/Base/Path.cpp
+++ b/Swiften/Base/Path.cpp
@@ -13,16 +13,16 @@ using namespace Swift;
boost::filesystem::path Swift::stringToPath(const std::string& path) {
#ifdef SWIFTEN_PLATFORM_WINDOWS
- return boost::filesystem::path(convertStringToWString(path));
+ return boost::filesystem::path(convertStringToWString(path));
#else
- return boost::filesystem::path(path);
+ return boost::filesystem::path(path);
#endif
}
std::string Swift::pathToString(const boost::filesystem::path& path) {
#ifdef SWIFTEN_PLATFORM_WINDOWS
- return convertWStringToString(path.native());
+ return convertWStringToString(path.native());
#else
- return path.native();
+ return path.native();
#endif
}
diff --git a/Swiften/Base/Path.h b/Swiften/Base/Path.h
index 1567a1d..40141b5 100644
--- a/Swiften/Base/Path.h
+++ b/Swiften/Base/Path.h
@@ -13,17 +13,17 @@
#include <Swiften/Base/API.h>
namespace Swift {
- /**
- * Creates a path for the given UTF-8 encoded string.
- * This works independently of global locale settings.
- */
- SWIFTEN_API boost::filesystem::path stringToPath(const std::string&);
-
- /**
- * Returns the UTF-8 representation of the given path
- * This works independently of global locale settings.
- */
- SWIFTEN_API std::string pathToString(const boost::filesystem::path&);
+ /**
+ * Creates a path for the given UTF-8 encoded string.
+ * This works independently of global locale settings.
+ */
+ SWIFTEN_API boost::filesystem::path stringToPath(const std::string&);
+
+ /**
+ * Returns the UTF-8 representation of the given path
+ * This works independently of global locale settings.
+ */
+ SWIFTEN_API std::string pathToString(const boost::filesystem::path&);
}
diff --git a/Swiften/Base/Paths.cpp b/Swiften/Base/Paths.cpp
index c0256e5..cbb16f3 100644
--- a/Swiften/Base/Paths.cpp
+++ b/Swiften/Base/Paths.cpp
@@ -21,28 +21,28 @@ namespace Swift {
boost::filesystem::path Paths::getExecutablePath() {
#if defined(SWIFTEN_PLATFORM_MACOSX)
- ByteArray path;
- uint32_t size = 4096;
- path.resize(size);
- if (_NSGetExecutablePath(const_cast<char*>(reinterpret_cast<const char*>(vecptr(path))), &size) == 0) {
- return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(path)), path.size()).c_str()).parent_path();
- }
+ ByteArray path;
+ uint32_t size = 4096;
+ path.resize(size);
+ if (_NSGetExecutablePath(const_cast<char*>(reinterpret_cast<const char*>(vecptr(path))), &size) == 0) {
+ return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(path)), path.size()).c_str()).parent_path();
+ }
#elif defined(SWIFTEN_PLATFORM_LINUX)
- ByteArray path;
- path.resize(4096);
- size_t size = static_cast<size_t>(readlink("/proc/self/exe", reinterpret_cast<char*>(vecptr(path)), path.size()));
- if (size > 0) {
- path.resize(size);
- return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(path)), path.size()).c_str()).parent_path();
- }
+ ByteArray path;
+ path.resize(4096);
+ size_t size = static_cast<size_t>(readlink("/proc/self/exe", reinterpret_cast<char*>(vecptr(path)), path.size()));
+ if (size > 0) {
+ path.resize(size);
+ return boost::filesystem::path(std::string(reinterpret_cast<const char*>(vecptr(path)), path.size()).c_str()).parent_path();
+ }
#elif defined(SWIFTEN_PLATFORM_WINDOWS)
- std::vector<wchar_t> data;
- data.resize(2048);
- GetModuleFileNameW(NULL, vecptr(data), data.size());
- return boost::filesystem::path(
- std::wstring(vecptr(data), data.size())).parent_path();
+ std::vector<wchar_t> data;
+ data.resize(2048);
+ GetModuleFileNameW(NULL, vecptr(data), data.size());
+ return boost::filesystem::path(
+ std::wstring(vecptr(data), data.size())).parent_path();
#endif
- return boost::filesystem::path();
+ return boost::filesystem::path();
}
}
diff --git a/Swiften/Base/Paths.h b/Swiften/Base/Paths.h
index 0a11b48..71b55fb 100644
--- a/Swiften/Base/Paths.h
+++ b/Swiften/Base/Paths.h
@@ -11,8 +11,8 @@
#include <Swiften/Base/API.h>
namespace Swift {
- class SWIFTEN_API Paths {
- public:
- static boost::filesystem::path getExecutablePath();
- };
+ class SWIFTEN_API Paths {
+ public:
+ static boost::filesystem::path getExecutablePath();
+ };
}
diff --git a/Swiften/Base/RandomGenerator.h b/Swiften/Base/RandomGenerator.h
index b322245..06677ec 100644
--- a/Swiften/Base/RandomGenerator.h
+++ b/Swiften/Base/RandomGenerator.h
@@ -11,14 +11,14 @@
#include <Swiften/Base/API.h>
namespace Swift {
- class SWIFTEN_API RandomGenerator {
- public:
- virtual ~RandomGenerator();
+ class SWIFTEN_API RandomGenerator {
+ public:
+ virtual ~RandomGenerator();
- /**
- * Generates a random integer between 0 and 'max',
- * 'max' inclusive.
- */
- virtual int generateRandomInteger(int max) = 0;
- };
+ /**
+ * Generates a random integer between 0 and 'max',
+ * 'max' inclusive.
+ */
+ virtual int generateRandomInteger(int max) = 0;
+ };
}
diff --git a/Swiften/Base/Regex.cpp b/Swiften/Base/Regex.cpp
index bc7f3ac..7843833 100644
--- a/Swiften/Base/Regex.cpp
+++ b/Swiften/Base/Regex.cpp
@@ -18,20 +18,20 @@
namespace Swift {
- namespace Regex {
- std::string escape(const std::string& source) {
- // escape regex special characters: ^.$| etc
- // these need to be escaped: [\^\$\|.........]
- // and then C++ requires '\' to be escaped, too....
- static const boost::regex esc("([\\^\\.\\$\\|\\(\\)\\[\\]\\*\\+\\?\\/\\{\\}\\\\])");
- // matched character should be prepended with '\'
- // replace matched special character with \\\1
- // and escape once more for C++ rules...
- static const std::string rep("\\\\\\1");
- return boost::regex_replace(source, esc, rep);
- }
-
- }
+ namespace Regex {
+ std::string escape(const std::string& source) {
+ // escape regex special characters: ^.$| etc
+ // these need to be escaped: [\^\$\|.........]
+ // and then C++ requires '\' to be escaped, too....
+ static const boost::regex esc("([\\^\\.\\$\\|\\(\\)\\[\\]\\*\\+\\?\\/\\{\\}\\\\])");
+ // matched character should be prepended with '\'
+ // replace matched special character with \\\1
+ // and escape once more for C++ rules...
+ static const std::string rep("\\\\\\1");
+ return boost::regex_replace(source, esc, rep);
+ }
+
+ }
}
-
+
diff --git a/Swiften/Base/Regex.h b/Swiften/Base/Regex.h
index 4bffc4d..7d352c0 100644
--- a/Swiften/Base/Regex.h
+++ b/Swiften/Base/Regex.h
@@ -12,8 +12,8 @@
namespace Swift {
- namespace Regex {
- SWIFTEN_API std::string escape(const std::string& source);
- }
+ namespace Regex {
+ SWIFTEN_API std::string escape(const std::string& source);
+ }
}
diff --git a/Swiften/Base/SafeAllocator.cpp b/Swiften/Base/SafeAllocator.cpp
index 87d5fbe..446ed2d 100644
--- a/Swiften/Base/SafeAllocator.cpp
+++ b/Swiften/Base/SafeAllocator.cpp
@@ -15,12 +15,12 @@ namespace Swift {
void secureZeroMemory(char* memory, size_t numberOfBytes) {
#ifdef SWIFTEN_PLATFORM_WINDOWS
- SecureZeroMemory(memory, numberOfBytes);
+ SecureZeroMemory(memory, numberOfBytes);
#else
- volatile char* p = memory;
- for (size_t i = 0; i < numberOfBytes; ++i) {
- *(p++) = 0;
- }
+ volatile char* p = memory;
+ for (size_t i = 0; i < numberOfBytes; ++i) {
+ *(p++) = 0;
+ }
#endif
}
diff --git a/Swiften/Base/SafeAllocator.h b/Swiften/Base/SafeAllocator.h
index 07bec70..0369ec4 100644
--- a/Swiften/Base/SafeAllocator.h
+++ b/Swiften/Base/SafeAllocator.h
@@ -12,25 +12,25 @@
#include <Swiften/Base/API.h>
namespace Swift {
- void secureZeroMemory(char* memory, size_t numberOfBytes);
-
- template<typename T>
- class SWIFTEN_API SafeAllocator : public std::allocator<T> {
- public:
- template <class U> struct rebind {
- typedef SafeAllocator<U> other;
- };
-
- SafeAllocator() SWIFTEN_NOEXCEPT {}
- SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator<T>() {}
- template <class U> SafeAllocator(const SafeAllocator<U>&) SWIFTEN_NOEXCEPT {}
- ~SafeAllocator() SWIFTEN_NOEXCEPT {}
-
- void deallocate (T* p, size_t num) {
- secureZeroMemory(reinterpret_cast<char*>(p), num);
- std::allocator<T>::deallocate(p, num);
- }
-
- SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(SafeAllocator)
- };
+ void secureZeroMemory(char* memory, size_t numberOfBytes);
+
+ template<typename T>
+ class SWIFTEN_API SafeAllocator : public std::allocator<T> {
+ public:
+ template <class U> struct rebind {
+ typedef SafeAllocator<U> other;
+ };
+
+ SafeAllocator() SWIFTEN_NOEXCEPT {}
+ SafeAllocator(const SafeAllocator&) SWIFTEN_NOEXCEPT : std::allocator<T>() {}
+ template <class U> SafeAllocator(const SafeAllocator<U>&) SWIFTEN_NOEXCEPT {}
+ ~SafeAllocator() SWIFTEN_NOEXCEPT {}
+
+ void deallocate (T* p, size_t num) {
+ secureZeroMemory(reinterpret_cast<char*>(p), num);
+ std::allocator<T>::deallocate(p, num);
+ }
+
+ SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(SafeAllocator)
+ };
}
diff --git a/Swiften/Base/SafeByteArray.cpp b/Swiften/Base/SafeByteArray.cpp
index 9ae73f6..dd3736e 100644
--- a/Swiften/Base/SafeByteArray.cpp
+++ b/Swiften/Base/SafeByteArray.cpp
@@ -11,12 +11,12 @@ using namespace Swift;
namespace Swift {
SafeByteArray createSafeByteArray(const char* c) {
- SafeByteArray data;
- while (*c) {
- data.push_back(static_cast<unsigned char>(*c));
- ++c;
- }
- return data;
+ SafeByteArray data;
+ while (*c) {
+ data.push_back(static_cast<unsigned char>(*c));
+ ++c;
+ }
+ return data;
}
}
diff --git a/Swiften/Base/SafeByteArray.h b/Swiften/Base/SafeByteArray.h
index 77be012..f824194 100644
--- a/Swiften/Base/SafeByteArray.h
+++ b/Swiften/Base/SafeByteArray.h
@@ -15,46 +15,46 @@
#include <Swiften/Base/SafeAllocator.h>
namespace Swift {
- typedef std::vector<unsigned char, SafeAllocator<unsigned char> > SafeByteArray;
+ typedef std::vector<unsigned char, SafeAllocator<unsigned char> > SafeByteArray;
- inline SafeByteArray createSafeByteArray(const ByteArray& a) {
- return SafeByteArray(a.begin(), a.end());
- }
+ inline SafeByteArray createSafeByteArray(const ByteArray& a) {
+ return SafeByteArray(a.begin(), a.end());
+ }
- SWIFTEN_API SafeByteArray createSafeByteArray(const char* c);
+ SWIFTEN_API SafeByteArray createSafeByteArray(const char* c);
- inline SafeByteArray createSafeByteArray(const std::string& s) {
- return SafeByteArray(s.begin(), s.end());
- }
+ inline SafeByteArray createSafeByteArray(const std::string& s) {
+ return SafeByteArray(s.begin(), s.end());
+ }
- inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const std::string& s) {
- return boost::make_shared<SafeByteArray>(s.begin(), s.end());
- }
+ inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const std::string& s) {
+ return boost::make_shared<SafeByteArray>(s.begin(), s.end());
+ }
- inline SafeByteArray createSafeByteArray(char c) {
- return SafeByteArray(1, static_cast<unsigned char>(c));
- }
+ inline SafeByteArray createSafeByteArray(char c) {
+ return SafeByteArray(1, static_cast<unsigned char>(c));
+ }
- inline SafeByteArray createSafeByteArray(const char* c, size_t n) {
- return SafeByteArray(c, c + n);
- }
+ inline SafeByteArray createSafeByteArray(const char* c, size_t n) {
+ return SafeByteArray(c, c + n);
+ }
- inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const char* c, size_t n) {
- return boost::make_shared<SafeByteArray>(c, c + n);
- }
+ inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const char* c, size_t n) {
+ return boost::make_shared<SafeByteArray>(c, c + n);
+ }
- inline SafeByteArray createSafeByteArray(const unsigned char* c, size_t n) {
- return SafeByteArray(c, c + n);
- }
+ inline SafeByteArray createSafeByteArray(const unsigned char* c, size_t n) {
+ return SafeByteArray(c, c + n);
+ }
- inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const unsigned char* c, size_t n) {
- return boost::make_shared<SafeByteArray>(c, c + n);
- }
+ inline boost::shared_ptr<SafeByteArray> createSafeByteArrayRef(const unsigned char* c, size_t n) {
+ return boost::make_shared<SafeByteArray>(c, c + n);
+ }
- /* WARNING! This breaks the safety of the data in the safe byte array.
- * Do not use in modes that require data safety. */
- inline std::string safeByteArrayToString(const SafeByteArray& b) {
- return byteArrayToString(ByteArray(b.begin(), b.end()));
- }
+ /* WARNING! This breaks the safety of the data in the safe byte array.
+ * Do not use in modes that require data safety. */
+ inline std::string safeByteArrayToString(const SafeByteArray& b) {
+ return byteArrayToString(ByteArray(b.begin(), b.end()));
+ }
}
diff --git a/Swiften/Base/SafeString.h b/Swiften/Base/SafeString.h
index bb5f64f..5e54537 100644
--- a/Swiften/Base/SafeString.h
+++ b/Swiften/Base/SafeString.h
@@ -10,24 +10,24 @@
#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
- class SWIFTEN_API SafeString {
- public:
- SafeString(const SafeByteArray& data) : data(data) {
- }
+ class SWIFTEN_API SafeString {
+ public:
+ SafeString(const SafeByteArray& data) : data(data) {
+ }
- SafeString(const std::string& s) {
- data = createSafeByteArray(s);
- }
+ SafeString(const std::string& s) {
+ data = createSafeByteArray(s);
+ }
- SafeString(const char* s) {
- data = createSafeByteArray(s);
- }
+ SafeString(const char* s) {
+ data = createSafeByteArray(s);
+ }
- operator SafeByteArray () const {
- return data;
- }
+ operator SafeByteArray () const {
+ return data;
+ }
- private:
- SafeByteArray data;
- };
+ private:
+ SafeByteArray data;
+ };
}
diff --git a/Swiften/Base/SimpleIDGenerator.cpp b/Swiften/Base/SimpleIDGenerator.cpp
index 97d59f9..072dd39 100644
--- a/Swiften/Base/SimpleIDGenerator.cpp
+++ b/Swiften/Base/SimpleIDGenerator.cpp
@@ -12,23 +12,23 @@ SimpleIDGenerator::SimpleIDGenerator() {
}
std::string SimpleIDGenerator::generateID() {
- bool carry = true;
- size_t i = 0;
- while (carry && i < currentID.size()) {
- char c = currentID[i];
- if (c >= 'z') {
- currentID[i] = 'a';
- }
- else {
- currentID[i] = c+1;
- carry = false;
- }
- ++i;
- }
- if (carry) {
- currentID += 'a';
- }
- return currentID;
+ bool carry = true;
+ size_t i = 0;
+ while (carry && i < currentID.size()) {
+ char c = currentID[i];
+ if (c >= 'z') {
+ currentID[i] = 'a';
+ }
+ else {
+ currentID[i] = c+1;
+ carry = false;
+ }
+ ++i;
+ }
+ if (carry) {
+ currentID += 'a';
+ }
+ return currentID;
}
}
diff --git a/Swiften/Base/SimpleIDGenerator.h b/Swiften/Base/SimpleIDGenerator.h
index e4fa3f5..49ba59e 100644
--- a/Swiften/Base/SimpleIDGenerator.h
+++ b/Swiften/Base/SimpleIDGenerator.h
@@ -13,18 +13,18 @@
namespace Swift {
- /**
- * @brief The SimpleIDGenerator class implements a IDGenerator generating consecutive ID strings from
- * the lower case latin alphabet.
- */
+ /**
+ * @brief The SimpleIDGenerator class implements a IDGenerator generating consecutive ID strings from
+ * the lower case latin alphabet.
+ */
- class SWIFTEN_API SimpleIDGenerator : public IDGenerator {
- public:
- SimpleIDGenerator();
+ class SWIFTEN_API SimpleIDGenerator : public IDGenerator {
+ public:
+ SimpleIDGenerator();
- std::string generateID();
+ std::string generateID();
- private:
- std::string currentID;
- };
+ private:
+ std::string currentID;
+ };
}
diff --git a/Swiften/Base/StartStopper.h b/Swiften/Base/StartStopper.h
index 1808861..af1a72d 100644
--- a/Swiften/Base/StartStopper.h
+++ b/Swiften/Base/StartStopper.h
@@ -7,17 +7,17 @@
#pragma once
namespace Swift {
- template<typename T> class StartStopper {
- public:
- StartStopper(T* target) : target(target) {
- target->start();
- }
+ template<typename T> class StartStopper {
+ public:
+ StartStopper(T* target) : target(target) {
+ target->start();
+ }
- ~StartStopper() {
- target->stop();
- }
-
- private:
- T* target;
- };
+ ~StartStopper() {
+ target->stop();
+ }
+
+ private:
+ T* target;
+ };
}
diff --git a/Swiften/Base/String.cpp b/Swiften/Base/String.cpp
index 5807957..91128ff 100644
--- a/Swiften/Base/String.cpp
+++ b/Swiften/Base/String.cpp
@@ -20,133 +20,133 @@
namespace Swift {
static inline size_t sequenceLength(char firstByte) {
- if ((firstByte & 0x80) == 0) {
- return 1;
- }
- if ((firstByte & 0xE0) == 0xC0) {
- return 2;
- }
- if ((firstByte & 0xF0) == 0xE0) {
- return 3;
- }
- if ((firstByte & 0xF8) == 0xF0) {
- return 4;
- }
- if ((firstByte & 0xFC) == 0xF8) {
- return 5;
- }
- if ((firstByte & 0xFE) == 0xFC) {
- return 6;
- }
- assert(false);
- return 1;
+ if ((firstByte & 0x80) == 0) {
+ return 1;
+ }
+ if ((firstByte & 0xE0) == 0xC0) {
+ return 2;
+ }
+ if ((firstByte & 0xF0) == 0xE0) {
+ return 3;
+ }
+ if ((firstByte & 0xF8) == 0xF0) {
+ return 4;
+ }
+ if ((firstByte & 0xFC) == 0xF8) {
+ return 5;
+ }
+ if ((firstByte & 0xFE) == 0xFC) {
+ return 6;
+ }
+ assert(false);
+ return 1;
}
std::vector<unsigned int> String::getUnicodeCodePoints(const std::string& s) {
- std::vector<unsigned int> result;
- for (size_t i = 0; i < s.size();) {
- unsigned int codePoint = 0;
- char firstChar = s[i];
- size_t length = sequenceLength(firstChar);
-
- // First character is special
- size_t firstCharBitSize = 7 - length;
- if (length == 1) {
- firstCharBitSize = 7;
- }
- codePoint = firstChar & ((1<<(firstCharBitSize+1)) - 1);
-
- for (size_t j = 1; j < length; ++j) {
- codePoint = (codePoint<<6) | (s[i+j] & 0x3F);
- }
- result.push_back(codePoint);
- i += length;
- }
- return result;
+ std::vector<unsigned int> result;
+ for (size_t i = 0; i < s.size();) {
+ unsigned int codePoint = 0;
+ char firstChar = s[i];
+ size_t length = sequenceLength(firstChar);
+
+ // First character is special
+ size_t firstCharBitSize = 7 - length;
+ if (length == 1) {
+ firstCharBitSize = 7;
+ }
+ codePoint = firstChar & ((1<<(firstCharBitSize+1)) - 1);
+
+ for (size_t j = 1; j < length; ++j) {
+ codePoint = (codePoint<<6) | (s[i+j] & 0x3F);
+ }
+ result.push_back(codePoint);
+ i += length;
+ }
+ return result;
}
std::pair<std::string,std::string> String::getSplittedAtFirst(const std::string& s, char c) {
- assert((c & 0x80) == 0);
- size_t firstMatch = s.find(c);
- if (firstMatch != s.npos) {
- return std::make_pair(s.substr(0,firstMatch),s.substr(firstMatch+1,s.npos));
- }
- else {
- return std::make_pair(s, "");
- }
+ assert((c & 0x80) == 0);
+ size_t firstMatch = s.find(c);
+ if (firstMatch != s.npos) {
+ return std::make_pair(s.substr(0,firstMatch),s.substr(firstMatch+1,s.npos));
+ }
+ else {
+ return std::make_pair(s, "");
+ }
}
void String::replaceAll(std::string& src, char c, const std::string& s) {
- size_t lastPos = 0;
- size_t matchingIndex = 0;
- while ((matchingIndex = src.find(c, lastPos)) != src.npos) {
- src.replace(matchingIndex, 1, s);
- lastPos = matchingIndex + s.size();
- }
+ size_t lastPos = 0;
+ size_t matchingIndex = 0;
+ while ((matchingIndex = src.find(c, lastPos)) != src.npos) {
+ src.replace(matchingIndex, 1, s);
+ lastPos = matchingIndex + s.size();
+ }
}
std::vector<std::string> String::split(const std::string& s, char c) {
- assert((c & 0x80) == 0);
- std::vector<std::string> result;
- std::string accumulator;
- for (size_t i = 0; i < s.size(); ++i) {
- if (s[i] == c) {
- result.push_back(accumulator);
- accumulator = "";
- }
- else {
- accumulator += s[i];
- }
- }
- result.push_back(accumulator);
- return result;
+ assert((c & 0x80) == 0);
+ std::vector<std::string> result;
+ std::string accumulator;
+ for (size_t i = 0; i < s.size(); ++i) {
+ if (s[i] == c) {
+ result.push_back(accumulator);
+ accumulator = "";
+ }
+ else {
+ accumulator += s[i];
+ }
+ }
+ result.push_back(accumulator);
+ return result;
}
std::string String::convertIntToHexString(int h) {
- std::stringstream ss;
- ss << std::setbase(16);
- ss << h;
- return ss.str();
+ std::stringstream ss;
+ ss << std::setbase(16);
+ ss << h;
+ return ss.str();
}
int String::convertHexStringToInt(const std::string& s) {
- std::stringstream ss;
- int h;
- ss << std::setbase(16);
- ss << s;
- ss >> h;
- return h;
+ std::stringstream ss;
+ int h;
+ ss << std::setbase(16);
+ ss << s;
+ ss >> h;
+ return h;
}
#ifdef SWIFTEN_PLATFORM_WINDOWS
std::string convertWStringToString(const std::wstring& s) {
- int utf8Size = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, NULL, 0, NULL, NULL);
- if (utf8Size < 0) {
- throw std::runtime_error("Conversion error");
- }
- std::vector<char> utf8Data(utf8Size);
- int result = WideCharToMultiByte(
- CP_UTF8, 0, s.c_str(), -1, vecptr(utf8Data), utf8Data.size(), NULL, NULL);
- if (result < 0) {
- throw std::runtime_error("Conversion error");
- }
- return std::string(vecptr(utf8Data), utf8Size-1 /* trailing 0 character */);
+ int utf8Size = WideCharToMultiByte(CP_UTF8, 0, s.c_str(), -1, NULL, 0, NULL, NULL);
+ if (utf8Size < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ std::vector<char> utf8Data(utf8Size);
+ int result = WideCharToMultiByte(
+ CP_UTF8, 0, s.c_str(), -1, vecptr(utf8Data), utf8Data.size(), NULL, NULL);
+ if (result < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ return std::string(vecptr(utf8Data), utf8Size-1 /* trailing 0 character */);
}
std::wstring convertStringToWString(const std::string& s) {
- int utf16Size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, NULL, 0);
- if (utf16Size < 0) {
- throw std::runtime_error("Conversion error");
- }
- std::vector<wchar_t> utf16Data(utf16Size);
- int result = MultiByteToWideChar(
- CP_UTF8, 0, s.c_str(), -1, vecptr(utf16Data), utf16Data.size());
- if (result < 0) {
- throw std::runtime_error("Conversion error");
- }
- return std::wstring(vecptr(utf16Data), utf16Size-1 /* trailing 0 character */);
+ int utf16Size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, NULL, 0);
+ if (utf16Size < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ std::vector<wchar_t> utf16Data(utf16Size);
+ int result = MultiByteToWideChar(
+ CP_UTF8, 0, s.c_str(), -1, vecptr(utf16Data), utf16Data.size());
+ if (result < 0) {
+ throw std::runtime_error("Conversion error");
+ }
+ return std::wstring(vecptr(utf16Data), utf16Size-1 /* trailing 0 character */);
}
#endif
diff --git a/Swiften/Base/String.h b/Swiften/Base/String.h
index a82df63..f19dca5 100644
--- a/Swiften/Base/String.h
+++ b/Swiften/Base/String.h
@@ -13,45 +13,45 @@
#include <Swiften/Base/API.h>
#include <Swiften/Base/Platform.h>
#define SWIFTEN_STRING_TO_CFSTRING(a) \
- CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.c_str()), a.size(), kCFStringEncodingUTF8, false)
+ CFStringCreateWithBytes(NULL, reinterpret_cast<const UInt8*>(a.c_str()), a.size(), kCFStringEncodingUTF8, false)
namespace Swift {
- namespace String {
- SWIFTEN_API std::vector<unsigned int> getUnicodeCodePoints(const std::string&);
- SWIFTEN_API std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c);
- SWIFTEN_API std::vector<std::string> split(const std::string&, char c);
- SWIFTEN_API void replaceAll(std::string&, char c, const std::string& s);
+ namespace String {
+ SWIFTEN_API std::vector<unsigned int> getUnicodeCodePoints(const std::string&);
+ SWIFTEN_API std::pair<std::string, std::string> getSplittedAtFirst(const std::string&, char c);
+ SWIFTEN_API std::vector<std::string> split(const std::string&, char c);
+ SWIFTEN_API void replaceAll(std::string&, char c, const std::string& s);
- inline bool beginsWith(const std::string& s, char c) {
- return s.size() > 0 && s[0] == c;
- }
+ inline bool beginsWith(const std::string& s, char c) {
+ return s.size() > 0 && s[0] == c;
+ }
- inline bool endsWith(const std::string& s, char c) {
- return s.size() > 0 && s[s.size()-1] == c;
- }
+ inline bool endsWith(const std::string& s, char c) {
+ return s.size() > 0 && s[s.size()-1] == c;
+ }
- std::string convertIntToHexString(int h);
- int convertHexStringToInt(const std::string& s);
+ std::string convertIntToHexString(int h);
+ int convertHexStringToInt(const std::string& s);
- }
+ }
#ifdef SWIFTEN_PLATFORM_WINDOWS
- SWIFTEN_API std::string convertWStringToString(const std::wstring& s);
- SWIFTEN_API std::wstring convertStringToWString(const std::string& s);
+ SWIFTEN_API std::string convertWStringToString(const std::wstring& s);
+ SWIFTEN_API std::wstring convertStringToWString(const std::string& s);
#endif
- class SWIFTEN_API makeString {
- public:
- template <typename T> makeString& operator<<(T const& v) {
- stream << v;
- return *this;
- }
+ class SWIFTEN_API makeString {
+ public:
+ template <typename T> makeString& operator<<(T const& v) {
+ stream << v;
+ return *this;
+ }
- operator std::string() const {
- return stream.str();
- }
+ operator std::string() const {
+ return stream.str();
+ }
- private:
- std::ostringstream stream;
- };
+ private:
+ std::ostringstream stream;
+ };
}
diff --git a/Swiften/Base/URL.cpp b/Swiften/Base/URL.cpp
index 28eba1e..a9a1140 100644
--- a/Swiften/Base/URL.cpp
+++ b/Swiften/Base/URL.cpp
@@ -11,104 +11,104 @@
namespace Swift {
int URL::getPortOrDefaultPort(const URL& url) {
- if (url.getPort()) {
- return *url.getPort();
- }
- else if (url.getScheme() == "http") {
- return 80;
- }
- else if (url.getScheme() == "https") {
- return 443;
- }
- else {
- std::cerr << "Unknown scheme: " + url.getScheme() << std::endl;
- return 80;
- }
+ if (url.getPort()) {
+ return *url.getPort();
+ }
+ else if (url.getScheme() == "http") {
+ return 80;
+ }
+ else if (url.getScheme() == "https") {
+ return 443;
+ }
+ else {
+ std::cerr << "Unknown scheme: " + url.getScheme() << std::endl;
+ return 80;
+ }
}
URL URL::fromString(const std::string& urlString) {
- size_t colonIndex = urlString.find(':');
- if (colonIndex == std::string::npos) {
- return URL();
- }
- std::string scheme = urlString.substr(0, colonIndex);
+ size_t colonIndex = urlString.find(':');
+ if (colonIndex == std::string::npos) {
+ return URL();
+ }
+ std::string scheme = urlString.substr(0, colonIndex);
- // Authority
- if (urlString.size() > colonIndex + 2 && urlString[colonIndex+1] == '/' && urlString[colonIndex+2] == '/') {
- size_t authorityIndex = colonIndex + 3;
- size_t slashIndex = urlString.find('/', authorityIndex);
- std::string authority;
- std::string path;
- if (slashIndex == std::string::npos) {
- authority = urlString.substr(authorityIndex);
- path = "";
- }
- else {
- authority = urlString.substr(authorityIndex, slashIndex - authorityIndex);
- path = unescape(urlString.substr(slashIndex));
- }
+ // Authority
+ if (urlString.size() > colonIndex + 2 && urlString[colonIndex+1] == '/' && urlString[colonIndex+2] == '/') {
+ size_t authorityIndex = colonIndex + 3;
+ size_t slashIndex = urlString.find('/', authorityIndex);
+ std::string authority;
+ std::string path;
+ if (slashIndex == std::string::npos) {
+ authority = urlString.substr(authorityIndex);
+ path = "";
+ }
+ else {
+ authority = urlString.substr(authorityIndex, slashIndex - authorityIndex);
+ path = unescape(urlString.substr(slashIndex));
+ }
- size_t atIndex = authority.find('@');
- std::string userInfo;
- std::string hostAndPort;
- if (atIndex != std::string::npos) {
- userInfo = authority.substr(0, atIndex);
- hostAndPort = authority.substr(atIndex + 1);
- }
- else {
- userInfo = "";
- hostAndPort = authority;
- }
+ size_t atIndex = authority.find('@');
+ std::string userInfo;
+ std::string hostAndPort;
+ if (atIndex != std::string::npos) {
+ userInfo = authority.substr(0, atIndex);
+ hostAndPort = authority.substr(atIndex + 1);
+ }
+ else {
+ userInfo = "";
+ hostAndPort = authority;
+ }
- std::string host;
- boost::optional<int> port;
- colonIndex = hostAndPort.find(':');
- if (colonIndex != std::string::npos) {
- host = unescape(hostAndPort.substr(0, colonIndex));
- try {
- port = boost::lexical_cast<int>(hostAndPort.substr(colonIndex + 1));
- }
- catch (const boost::bad_lexical_cast&) {
- return URL();
- }
- }
- else {
- host = unescape(hostAndPort);
- }
+ std::string host;
+ boost::optional<int> port;
+ colonIndex = hostAndPort.find(':');
+ if (colonIndex != std::string::npos) {
+ host = unescape(hostAndPort.substr(0, colonIndex));
+ try {
+ port = boost::lexical_cast<int>(hostAndPort.substr(colonIndex + 1));
+ }
+ catch (const boost::bad_lexical_cast&) {
+ return URL();
+ }
+ }
+ else {
+ host = unescape(hostAndPort);
+ }
- if (port) {
- return URL(scheme, host, *port, path);
- }
- else {
- return URL(