summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/Parser
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/Parser')
-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
365 files changed, 11333 insertions, 11333 deletions
diff --git a/Swiften/Parser/Attribute.h b/Swiften/Parser/Attribute.h
index 1c4ad77..f54317e 100644
--- a/Swiften/Parser/Attribute.h
+++ b/Swiften/Parser/Attribute.h
@@ -9,25 +9,25 @@
#include <string>
namespace Swift {
- class Attribute {
- public:
- Attribute(const std::string& name, const std::string& ns) : name(name), ns(ns) {
- }
+ class Attribute {
+ public:
+ Attribute(const std::string& name, const std::string& ns) : name(name), ns(ns) {
+ }
- const std::string& getName() const {
- return name;
- }
+ const std::string& getName() const {
+ return name;
+ }
- const std::string& getNamespace() const {
- return ns;
- }
+ const std::string& getNamespace() const {
+ return ns;
+ }
- bool operator==(const Attribute& o) const {
- return o.name == name && o.ns == ns;
- }
+ bool operator==(const Attribute& o) const {
+ return o.name == name && o.ns == ns;
+ }
- private:
- std::string name;
- std::string ns;
- };
+ private:
+ std::string name;
+ std::string ns;
+ };
}
diff --git a/Swiften/Parser/AttributeMap.cpp b/Swiften/Parser/AttributeMap.cpp
index 3fb8faf..c112d52 100644
--- a/Swiften/Parser/AttributeMap.cpp
+++ b/Swiften/Parser/AttributeMap.cpp
@@ -19,38 +19,38 @@ AttributeMap::AttributeMap() {
}
std::string AttributeMap::getAttribute(const std::string& attribute, const std::string& ns) const {
- AttributeValueMap::const_iterator i = std::find_if(attributes.begin(), attributes.end(),
- lambda::bind(&AttributeMap::Entry::getAttribute, lambda::_1) == Attribute(attribute, ns));
- if (i == attributes.end()) {
- return "";
- }
- else {
- return i->getValue();
- }
+ AttributeValueMap::const_iterator i = std::find_if(attributes.begin(), attributes.end(),
+ lambda::bind(&AttributeMap::Entry::getAttribute, lambda::_1) == Attribute(attribute, ns));
+ if (i == attributes.end()) {
+ return "";
+ }
+ else {
+ return i->getValue();
+ }
}
bool AttributeMap::getBoolAttribute(const std::string& attribute, bool defaultValue) const {
- AttributeValueMap::const_iterator i = std::find_if(attributes.begin(), attributes.end(),
- lambda::bind(&AttributeMap::Entry::getAttribute, lambda::_1) == Attribute(attribute, ""));
- if (i == attributes.end()) {
- return defaultValue;
- }
- else {
- return i->getValue() == "true" || i->getValue() == "1";
- }
+ AttributeValueMap::const_iterator i = std::find_if(attributes.begin(), attributes.end(),
+ lambda::bind(&AttributeMap::Entry::getAttribute, lambda::_1) == Attribute(attribute, ""));
+ if (i == attributes.end()) {
+ return defaultValue;
+ }
+ else {
+ return i->getValue() == "true" || i->getValue() == "1";
+ }
}
boost::optional<std::string> AttributeMap::getAttributeValue(const std::string& attribute) const {
- AttributeValueMap::const_iterator i = std::find_if(attributes.begin(), attributes.end(),
- lambda::bind(&AttributeMap::Entry::getAttribute, lambda::_1) == Attribute(attribute, ""));
- if (i == attributes.end()) {
- return boost::optional<std::string>();
- }
- else {
- return i->getValue();
- }
+ AttributeValueMap::const_iterator i = std::find_if(attributes.begin(), attributes.end(),
+ lambda::bind(&AttributeMap::Entry::getAttribute, lambda::_1) == Attribute(attribute, ""));
+ if (i == attributes.end()) {
+ return boost::optional<std::string>();
+ }
+ else {
+ return i->getValue();
+ }
}
void AttributeMap::addAttribute(const std::string& name, const std::string& ns, const std::string& value) {
- attributes.push_back(Entry(Attribute(name, ns), value));
+ attributes.push_back(Entry(Attribute(name, ns), value));
}
diff --git a/Swiften/Parser/AttributeMap.h b/Swiften/Parser/AttributeMap.h
index 336f4cd..798649a 100644
--- a/Swiften/Parser/AttributeMap.h
+++ b/Swiften/Parser/AttributeMap.h
@@ -16,40 +16,40 @@
#include <Swiften/Parser/Attribute.h>
namespace Swift {
- class SWIFTEN_API AttributeMap {
- public:
- class Entry {
- public:
- Entry(const Attribute& attribute, const std::string& value) : attribute(attribute), value(value) {
- }
-
- const Attribute& getAttribute() const {
- return attribute;
- }
-
- const std::string& getValue() const {
- return value;
- }
-
- private:
- Attribute attribute;
- std::string value;
- };
-
- AttributeMap();
-
- std::string getAttribute(const std::string& attribute, const std::string& ns = "") const;
- bool getBoolAttribute(const std::string& attribute, bool defaultValue = false) const;
- boost::optional<std::string> getAttributeValue(const std::string&) const;
-
- void addAttribute(const std::string& name, const std::string& ns, const std::string& value);
-
- const std::vector<Entry>& getEntries() const {
- return attributes;
- }
-
- private:
- typedef std::vector<Entry> AttributeValueMap;
- AttributeValueMap attributes;
- };
+ class SWIFTEN_API AttributeMap {
+ public:
+ class Entry {
+ public:
+ Entry(const Attribute& attribute, const std::string& value) : attribute(attribute), value(value) {
+ }
+
+ const Attribute& getAttribute() const {
+ return attribute;
+ }
+
+ const std::string& getValue() const {
+ return value;
+ }
+
+ private:
+ Attribute attribute;
+ std::string value;
+ };
+
+ AttributeMap();
+
+ std::string getAttribute(const std::string& attribute, const std::string& ns = "") const;
+ bool getBoolAttribute(const std::string& attribute, bool defaultValue = false) const;
+ boost::optional<std::string> getAttributeValue(const std::string&) const;
+
+ void addAttribute(const std::string& name, const std::string& ns, const std::string& value);
+
+ const std::vector<Entry>& getEntries() const {
+ return attributes;
+ }
+
+ private:
+ typedef std::vector<Entry> AttributeValueMap;
+ AttributeValueMap attributes;
+ };
}
diff --git a/Swiften/Parser/AuthChallengeParser.cpp b/Swiften/Parser/AuthChallengeParser.cpp
index 42f5ca6..cf69672 100644
--- a/Swiften/Parser/AuthChallengeParser.cpp
+++ b/Swiften/Parser/AuthChallengeParser.cpp
@@ -14,18 +14,18 @@ AuthChallengeParser::AuthChallengeParser() : GenericElementParser<AuthChallenge>
}
void AuthChallengeParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++depth;
+ ++depth;
}
void AuthChallengeParser::handleEndElement(const std::string&, const std::string&) {
- --depth;
- if (depth == 0) {
- getElementGeneric()->setValue(Base64::decode(text));
- }
+ --depth;
+ if (depth == 0) {
+ getElementGeneric()->setValue(Base64::decode(text));
+ }
}
void AuthChallengeParser::handleCharacterData(const std::string& text) {
- this->text += text;
+ this->text += text;
}
}
diff --git a/Swiften/Parser/AuthChallengeParser.h b/Swiften/Parser/AuthChallengeParser.h
index 464f0c1..48e2bfb 100644
--- a/Swiften/Parser/AuthChallengeParser.h
+++ b/Swiften/Parser/AuthChallengeParser.h
@@ -13,16 +13,16 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API AuthChallengeParser : public GenericElementParser<AuthChallenge> {
- public:
- AuthChallengeParser();
+ class SWIFTEN_API AuthChallengeParser : public GenericElementParser<AuthChallenge> {
+ public:
+ AuthChallengeParser();
- virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string& ns);
- virtual void handleCharacterData(const std::string&);
+ virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string& ns);
+ virtual void handleCharacterData(const std::string&);
- private:
- int depth;
- std::string text;
- };
+ private:
+ int depth;
+ std::string text;
+ };
}
diff --git a/Swiften/Parser/AuthFailureParser.h b/Swiften/Parser/AuthFailureParser.h
index 3148222..1706290 100644
--- a/Swiften/Parser/AuthFailureParser.h
+++ b/Swiften/Parser/AuthFailureParser.h
@@ -11,8 +11,8 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API AuthFailureParser : public GenericElementParser<AuthFailure> {
- public:
- AuthFailureParser() : GenericElementParser<AuthFailure>() {}
- };
+ class SWIFTEN_API AuthFailureParser : public GenericElementParser<AuthFailure> {
+ public:
+ AuthFailureParser() : GenericElementParser<AuthFailure>() {}
+ };
}
diff --git a/Swiften/Parser/AuthRequestParser.cpp b/Swiften/Parser/AuthRequestParser.cpp
index 2fb311c..a24be8d 100644
--- a/Swiften/Parser/AuthRequestParser.cpp
+++ b/Swiften/Parser/AuthRequestParser.cpp
@@ -14,21 +14,21 @@ AuthRequestParser::AuthRequestParser() : GenericElementParser<AuthRequest>(), de
}
void AuthRequestParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attribute) {
- if (depth_ == 0) {
- getElementGeneric()->setMechanism(attribute.getAttribute("mechanism"));
- }
- ++depth_;
+ if (depth_ == 0) {
+ getElementGeneric()->setMechanism(attribute.getAttribute("mechanism"));
+ }
+ ++depth_;
}
void AuthRequestParser::handleEndElement(const std::string&, const std::string&) {
- --depth_;
- if (depth_ == 0) {
- getElementGeneric()->setMessage(createSafeByteArray(Base64::decode(text_)));
- }
+ --depth_;
+ if (depth_ == 0) {
+ getElementGeneric()->setMessage(createSafeByteArray(Base64::decode(text_)));
+ }
}
void AuthRequestParser::handleCharacterData(const std::string& text) {
- text_ += text;
+ text_ += text;
}
}
diff --git a/Swiften/Parser/AuthRequestParser.h b/Swiften/Parser/AuthRequestParser.h
index 005bd48..ac94abf 100644
--- a/Swiften/Parser/AuthRequestParser.h
+++ b/Swiften/Parser/AuthRequestParser.h
@@ -13,16 +13,16 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API AuthRequestParser : public GenericElementParser<AuthRequest> {
- public:
- AuthRequestParser();
+ class SWIFTEN_API AuthRequestParser : public GenericElementParser<AuthRequest> {
+ public:
+ AuthRequestParser();
- virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string& ns);
- virtual void handleCharacterData(const std::string&);
+ virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string& ns);
+ virtual void handleCharacterData(const std::string&);
- private:
- std::string text_;
- int depth_;
- };
+ private:
+ std::string text_;
+ int depth_;
+ };
}
diff --git a/Swiften/Parser/AuthResponseParser.cpp b/Swiften/Parser/AuthResponseParser.cpp
index 64fe6c8..59f6455 100644
--- a/Swiften/Parser/AuthResponseParser.cpp
+++ b/Swiften/Parser/AuthResponseParser.cpp
@@ -14,18 +14,18 @@ AuthResponseParser::AuthResponseParser() : GenericElementParser<AuthResponse>(),
}
void AuthResponseParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++depth;
+ ++depth;
}
void AuthResponseParser::handleEndElement(const std::string&, const std::string&) {
- --depth;
- if (depth == 0) {
- getElementGeneric()->setValue(createSafeByteArray(Base64::decode(text)));
- }
+ --depth;
+ if (depth == 0) {
+ getElementGeneric()->setValue(createSafeByteArray(Base64::decode(text)));
+ }
}
void AuthResponseParser::handleCharacterData(const std::string& text) {
- this->text += text;
+ this->text += text;
}
}
diff --git a/Swiften/Parser/AuthResponseParser.h b/Swiften/Parser/AuthResponseParser.h
index 1846a41..6cbfa22 100644
--- a/Swiften/Parser/AuthResponseParser.h
+++ b/Swiften/Parser/AuthResponseParser.h
@@ -13,16 +13,16 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API AuthResponseParser : public GenericElementParser<AuthResponse> {
- public:
- AuthResponseParser();
+ class SWIFTEN_API AuthResponseParser : public GenericElementParser<AuthResponse> {
+ public:
+ AuthResponseParser();
- virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string& ns);
- virtual void handleCharacterData(const std::string&);
+ virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string& ns);
+ virtual void handleCharacterData(const std::string&);
- private:
- int depth;
- std::string text;
- };
+ private:
+ int depth;
+ std::string text;
+ };
}
diff --git a/Swiften/Parser/AuthSuccessParser.cpp b/Swiften/Parser/AuthSuccessParser.cpp
index c50fab3..964fd6c 100644
--- a/Swiften/Parser/AuthSuccessParser.cpp
+++ b/Swiften/Parser/AuthSuccessParser.cpp
@@ -14,18 +14,18 @@ AuthSuccessParser::AuthSuccessParser() : GenericElementParser<AuthSuccess>(), de
}
void AuthSuccessParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++depth;
+ ++depth;
}
void AuthSuccessParser::handleEndElement(const std::string&, const std::string&) {
- --depth;
- if (depth == 0) {
- getElementGeneric()->setValue(Base64::decode(text));
- }
+ --depth;
+ if (depth == 0) {
+ getElementGeneric()->setValue(Base64::decode(text));
+ }
}
void AuthSuccessParser::handleCharacterData(const std::string& text) {
- this->text += text;
+ this->text += text;
}
}
diff --git a/Swiften/Parser/AuthSuccessParser.h b/Swiften/Parser/AuthSuccessParser.h
index a35f61e..cedc8d1 100644
--- a/Swiften/Parser/AuthSuccessParser.h
+++ b/Swiften/Parser/AuthSuccessParser.h
@@ -13,16 +13,16 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API AuthSuccessParser : public GenericElementParser<AuthSuccess> {
- public:
- AuthSuccessParser();
+ class SWIFTEN_API AuthSuccessParser : public GenericElementParser<AuthSuccess> {
+ public:
+ AuthSuccessParser();
- virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string& ns);
- virtual void handleCharacterData(const std::string&);
+ virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string& ns);
+ virtual void handleCharacterData(const std::string&);
- private:
- int depth;
- std::string text;
- };
+ private:
+ int depth;
+ std::string text;
+ };
}
diff --git a/Swiften/Parser/BOSHBodyExtractor.cpp b/Swiften/Parser/BOSHBodyExtractor.cpp
index e0a37df..c5723be 100644
--- a/Swiften/Parser/BOSHBodyExtractor.cpp
+++ b/Swiften/Parser/BOSHBodyExtractor.cpp
@@ -16,124 +16,124 @@
namespace Swift {
class BOSHBodyParserClient : public XMLParserClient {
- public:
- BOSHBodyParserClient(BOSHBodyExtractor* bodyExtractor) : bodyExtractor(bodyExtractor) {
- }
+ public:
+ BOSHBodyParserClient(BOSHBodyExtractor* bodyExtractor) : bodyExtractor(bodyExtractor) {
+ }
- virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
- bodyExtractor->body->attributes = attributes;
- }
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
+ bodyExtractor->body->attributes = attributes;
+ }
- virtual void handleEndElement(const std::string&, const std::string&) {
- }
+ virtual void handleEndElement(const std::string&, const std::string&) {
+ }
- virtual void handleCharacterData(const std::string&) {
- }
+ virtual void handleCharacterData(const std::string&) {
+ }
- private:
- BOSHBodyExtractor* bodyExtractor;
+ private:
+ BOSHBodyExtractor* bodyExtractor;
};
inline bool isWhitespace(unsigned char c) {
- return c == ' ' || c == '\n' || c == '\t' || c == '\r';
+ return c == ' ' || c == '\n' || c == '\t' || c == '\r';
}
BOSHBodyExtractor::BOSHBodyExtractor(XMLParserFactory* parserFactory, const ByteArray& data) {
- // Look for the opening body element
- ByteArray::const_iterator i = data.begin();
- while (i < data.end() && isWhitespace(*i)) {
- ++i;
- }
- if (std::distance(i, data.end()) < 6 || *i != '<' || *(i+1) != 'b' || *(i+2) != 'o' || *(i+3) != 'd' || *(i+4) != 'y' || !(isWhitespace(*(i+5)) || *(i+5) == '>' || *(i+5) == '/')) {
- return;
- }
- i += 5;
-
- // Parse until end of element
- bool inSingleQuote = false;
- bool inDoubleQuote = false;
- bool endStartTagSeen = false;
- bool endElementSeen = false;
- for (; i != data.end(); ++i) {
- char c = static_cast<char>(*i);
- if (inSingleQuote) {
- if (c == '\'') {
- inSingleQuote = false;
- }
- }
- else if (inDoubleQuote) {
- if (c == '"') {
- inDoubleQuote = false;
- }
- }
- else if (c == '\'') {
- inSingleQuote = true;
- }
- else if (c == '"') {
- inDoubleQuote = true;
- }
- else if (c == '/') {
- if (i + 1 == data.end() || *(i+1) != '>') {
- return;
- }
- else {
- endElementSeen = true;
- endStartTagSeen = true;
- i += 2;
- break;
- }
- }
- else if (c == '>') {
- endStartTagSeen = true;
- i += 1;
- break;
- }
- }
-
- if (!endStartTagSeen) {
- return;
- }
-
- // Look for the end of the element
- ByteArray::const_reverse_iterator j = data.rbegin();
- if (!endElementSeen) {
- while (isWhitespace(*j) && j < data.rend()) {
- ++j;
- }
-
- if (j == data.rend() || *j != '>') {
- return;
- }
- ++j;
-
- while (j < data.rend() && isWhitespace(*j)) {
- ++j;
- }
-
- if (std::distance(j, data.rend()) < 6 || *(j+5) != '<' || *(j+4) != '/' || *(j+3) != 'b' || *(j+2) != 'o' || *(j+1) != 'd' || *j != 'y') {
- return;
- }
- j += 6;
- }
-
- body = BOSHBody();
- if (!endElementSeen) {
- body->content = std::string(
- reinterpret_cast<const char*>(vecptr(data) + std::distance(data.begin(), i)),
- boost::numeric_cast<size_t>(std::distance(i, j.base())));
- }
-
- // Parse the body element
- BOSHBodyParserClient parserClient(this);
- boost::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient));
- if (!parser->parse(std::string(
- reinterpret_cast<const char*>(vecptr(data)),
- boost::numeric_cast<size_t>(std::distance(data.begin(), i))))) {
- /* TODO: This needs to be only validating the BOSH <body> element, so that XMPP parsing errors are caught at
- the correct higher layer */
- body = boost::optional<BOSHBody>();
- return;
- }
+ // Look for the opening body element
+ ByteArray::const_iterator i = data.begin();
+ while (i < data.end() && isWhitespace(*i)) {
+ ++i;
+ }
+ if (std::distance(i, data.end()) < 6 || *i != '<' || *(i+1) != 'b' || *(i+2) != 'o' || *(i+3) != 'd' || *(i+4) != 'y' || !(isWhitespace(*(i+5)) || *(i+5) == '>' || *(i+5) == '/')) {
+ return;
+ }
+ i += 5;
+
+ // Parse until end of element
+ bool inSingleQuote = false;
+ bool inDoubleQuote = false;
+ bool endStartTagSeen = false;
+ bool endElementSeen = false;
+ for (; i != data.end(); ++i) {
+ char c = static_cast<char>(*i);
+ if (inSingleQuote) {
+ if (c == '\'') {
+ inSingleQuote = false;
+ }
+ }
+ else if (inDoubleQuote) {
+ if (c == '"') {
+ inDoubleQuote = false;
+ }
+ }
+ else if (c == '\'') {
+ inSingleQuote = true;
+ }
+ else if (c == '"') {
+ inDoubleQuote = true;
+ }
+ else if (c == '/') {
+ if (i + 1 == data.end() || *(i+1) != '>') {
+ return;
+ }
+ else {
+ endElementSeen = true;
+ endStartTagSeen = true;
+ i += 2;
+ break;
+ }
+ }
+ else if (c == '>') {
+ endStartTagSeen = true;
+ i += 1;
+ break;
+ }
+ }
+
+ if (!endStartTagSeen) {
+ return;
+ }
+
+ // Look for the end of the element
+ ByteArray::const_reverse_iterator j = data.rbegin();
+ if (!endElementSeen) {
+ while (isWhitespace(*j) && j < data.rend()) {
+ ++j;
+ }
+
+ if (j == data.rend() || *j != '>') {
+ return;
+ }
+ ++j;
+
+ while (j < data.rend() && isWhitespace(*j)) {
+ ++j;
+ }
+
+ if (std::distance(j, data.rend()) < 6 || *(j+5) != '<' || *(j+4) != '/' || *(j+3) != 'b' || *(j+2) != 'o' || *(j+1) != 'd' || *j != 'y') {
+ return;
+ }
+ j += 6;
+ }
+
+ body = BOSHBody();
+ if (!endElementSeen) {
+ body->content = std::string(
+ reinterpret_cast<const char*>(vecptr(data) + std::distance(data.begin(), i)),
+ boost::numeric_cast<size_t>(std::distance(i, j.base())));
+ }
+
+ // Parse the body element
+ BOSHBodyParserClient parserClient(this);
+ boost::shared_ptr<XMLParser> parser(parserFactory->createXMLParser(&parserClient));
+ if (!parser->parse(std::string(
+ reinterpret_cast<const char*>(vecptr(data)),
+ boost::numeric_cast<size_t>(std::distance(data.begin(), i))))) {
+ /* TODO: This needs to be only validating the BOSH <body> element, so that XMPP parsing errors are caught at
+ the correct higher layer */
+ body = boost::optional<BOSHBody>();
+ return;
+ }
}
}
diff --git a/Swiften/Parser/BOSHBodyExtractor.h b/Swiften/Parser/BOSHBodyExtractor.h
index 2112ff7..ba56b41 100644
--- a/Swiften/Parser/BOSHBodyExtractor.h
+++ b/Swiften/Parser/BOSHBodyExtractor.h
@@ -13,23 +13,23 @@
#include <Swiften/Parser/XMLParserClient.h>
namespace Swift {
- class XMLParserFactory;
-
- class SWIFTEN_API BOSHBodyExtractor {
- friend class BOSHBodyParserClient;
- public:
- struct BOSHBody {
- AttributeMap attributes;
- std::string content;
- };
-
- BOSHBodyExtractor(XMLParserFactory* parserFactory, const ByteArray& data);
-
- const boost::optional<BOSHBody>& getBody() const {
- return body;
- }
-
- private:
- boost::optional<BOSHBody> body;
- };
+ class XMLParserFactory;
+
+ class SWIFTEN_API BOSHBodyExtractor {
+ friend class BOSHBodyParserClient;
+ public:
+ struct BOSHBody {
+ AttributeMap attributes;
+ std::string content;
+ };
+
+ BOSHBodyExtractor(XMLParserFactory* parserFactory, const ByteArray& data);
+
+ const boost::optional<BOSHBody>& getBody() const {
+ return body;
+ }
+
+ private:
+ boost::optional<BOSHBody> body;
+ };
}
diff --git a/Swiften/Parser/ComponentHandshakeParser.cpp b/Swiften/Parser/ComponentHandshakeParser.cpp
index 3899763..f98503d 100644
--- a/Swiften/Parser/ComponentHandshakeParser.cpp
+++ b/Swiften/Parser/ComponentHandshakeParser.cpp
@@ -14,18 +14,18 @@ ComponentHandshakeParser::ComponentHandshakeParser() : GenericElementParser<Comp
}
void ComponentHandshakeParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++depth;
+ ++depth;
}
void ComponentHandshakeParser::handleEndElement(const std::string&, const std::string&) {
- --depth;
- if (depth == 0) {
- getElementGeneric()->setData(text);
- }
+ --depth;
+ if (depth == 0) {
+ getElementGeneric()->setData(text);
+ }
}
void ComponentHandshakeParser::handleCharacterData(const std::string& text) {
- this->text += text;
+ this->text += text;
}
}
diff --git a/Swiften/Parser/ComponentHandshakeParser.h b/Swiften/Parser/ComponentHandshakeParser.h
index b9e4e76..5f4af80 100644
--- a/Swiften/Parser/ComponentHandshakeParser.h
+++ b/Swiften/Parser/ComponentHandshakeParser.h
@@ -13,16 +13,16 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API ComponentHandshakeParser : public GenericElementParser<ComponentHandshake> {
- public:
- ComponentHandshakeParser();
+ class SWIFTEN_API ComponentHandshakeParser : public GenericElementParser<ComponentHandshake> {
+ public:
+ ComponentHandshakeParser();
- virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string& ns);
- virtual void handleCharacterData(const std::string&);
+ virtual void handleStartElement(const std::string&, const std::string& ns, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string& ns);
+ virtual void handleCharacterData(const std::string&);
- private:
- int depth;
- std::string text;
- };
+ private:
+ int depth;
+ std::string text;
+ };
}
diff --git a/Swiften/Parser/CompressFailureParser.h b/Swiften/Parser/CompressFailureParser.h
index cee6ade..5c171ee 100644
--- a/Swiften/Parser/CompressFailureParser.h
+++ b/Swiften/Parser/CompressFailureParser.h
@@ -11,8 +11,8 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API CompressFailureParser : public GenericElementParser<CompressFailure> {
- public:
- CompressFailureParser() : GenericElementParser<CompressFailure>() {}
- };
+ class SWIFTEN_API CompressFailureParser : public GenericElementParser<CompressFailure> {
+ public:
+ CompressFailureParser() : GenericElementParser<CompressFailure>() {}
+ };
}
diff --git a/Swiften/Parser/CompressParser.cpp b/Swiften/Parser/CompressParser.cpp
index 1d69af6..00f762f 100644
--- a/Swiften/Parser/CompressParser.cpp
+++ b/Swiften/Parser/CompressParser.cpp
@@ -12,23 +12,23 @@ CompressParser::CompressParser() : GenericElementParser<CompressRequest>(), curr
}
void CompressParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) {
- if (currentDepth_ == 1 && element == "method") {
- inMethod_ = true;
- currentText_ = "";
- }
- ++currentDepth_;
+ if (currentDepth_ == 1 && element == "method") {
+ inMethod_ = true;
+ currentText_ = "";
+ }
+ ++currentDepth_;
}
void CompressParser::handleEndElement(const std::string&, const std::string&) {
- --currentDepth_;
- if (currentDepth_ == 1 && inMethod_) {
- getElementGeneric()->setMethod(currentText_);
- inMethod_ = false;
- }
+ --currentDepth_;
+ if (currentDepth_ == 1 && inMethod_) {
+ getElementGeneric()->setMethod(currentText_);
+ inMethod_ = false;
+ }
}
void CompressParser::handleCharacterData(const std::string& data) {
- currentText_ += data;
+ currentText_ += data;
}
}
diff --git a/Swiften/Parser/CompressParser.h b/Swiften/Parser/CompressParser.h
index 8a546dc..6f0a0cb 100644
--- a/Swiften/Parser/CompressParser.h
+++ b/Swiften/Parser/CompressParser.h
@@ -13,18 +13,18 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API CompressParser : public GenericElementParser<CompressRequest> {
- public:
- CompressParser();
+ class SWIFTEN_API CompressParser : public GenericElementParser<CompressRequest> {
+ public:
+ CompressParser();
- private:
- void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes);
- void handleEndElement(const std::string& element, const std::string& ns);
- void handleCharacterData(const std::string& data);
+ private:
+ void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes);
+ void handleEndElement(const std::string& element, const std::string& ns);
+ void handleCharacterData(const std::string& data);
- private:
- int currentDepth_;
- std::string currentText_;
- bool inMethod_;
- };
+ private:
+ int currentDepth_;
+ std::string currentText_;
+ bool inMethod_;
+ };
}
diff --git a/Swiften/Parser/CompressedParser.h b/Swiften/Parser/CompressedParser.h
index a1cf4ea..859b509 100644
--- a/Swiften/Parser/CompressedParser.h
+++ b/Swiften/Parser/CompressedParser.h
@@ -11,8 +11,8 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API CompressedParser : public GenericElementParser<Compressed> {
- public:
- CompressedParser() : GenericElementParser<Compressed>() {}
- };
+ class SWIFTEN_API CompressedParser : public GenericElementParser<Compressed> {
+ public:
+ CompressedParser() : GenericElementParser<Compressed>() {}
+ };
}
diff --git a/Swiften/Parser/ElementParser.h b/Swiften/Parser/ElementParser.h
index 7653276..12c6c38 100644
--- a/Swiften/Parser/ElementParser.h
+++ b/Swiften/Parser/ElementParser.h
@@ -15,14 +15,14 @@
#include <Swiften/Parser/AttributeMap.h>
namespace Swift {
- class SWIFTEN_API ElementParser {
- public:
- virtual ~ElementParser();
+ class SWIFTEN_API ElementParser {
+ public:
+ virtual ~ElementParser();
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0;
- virtual void handleEndElement(const std::string& element, const std::string& ns) = 0;
- virtual void handleCharacterData(const std::string& data) = 0;
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0;
+ virtual void handleEndElement(const std::string& element, const std::string& ns) = 0;
+ virtual void handleCharacterData(const std::string& data) = 0;
- virtual boost::shared_ptr<ToplevelElement> getElement() const = 0;
- };
+ virtual boost::shared_ptr<ToplevelElement> getElement() const = 0;
+ };
}
diff --git a/Swiften/Parser/EnableStreamManagementParser.h b/Swiften/Parser/EnableStreamManagementParser.h
index 7fa8547..b010740 100644
--- a/Swiften/Parser/EnableStreamManagementParser.h
+++ b/Swiften/Parser/EnableStreamManagementParser.h
@@ -11,8 +11,8 @@
#include <Swiften/Parser/GenericElementParser.h>
namespace Swift {
- class SWIFTEN_API EnableStreamManagementParser : public GenericElementParser<EnableStreamManagement> {
- public:
- EnableStreamManagementParser() : GenericElementParser<EnableStreamManagement>() {}
- };
+ class SWIFTEN_API EnableStreamManagementParser : public GenericElementParser<EnableStreamManagement> {
+ public:
+ EnableStreamManagementParser() : GenericElementParser<EnableStreamManagement>() {}
+ };
}
diff --git a/Swiften/Parser/EnumParser.h b/Swiften/Parser/EnumParser.h
index b49d290..cf17ead 100644
--- a/Swiften/Parser/EnumParser.h
+++ b/Swiften/Parser/EnumParser.h
@@ -16,23 +16,23 @@
#include <Swiften/Base/Override.h>
namespace Swift {
- template<typename T>
- class SWIFTEN_API EnumParser {
- public:
- EnumParser() {
- }
-
- EnumParser& operator()(T value, const std::string& text) {
- values[text] = value;
- return *this;
- }
-
- boost::optional<T> parse(const std::string& value) {
- typename std::map<std::string, T>::const_iterator i = values.find(value);
- return i == values.end() ? boost::optional<T>() : i->second;
- }
-
- private:
- std::map<std::string, T> values;
- };
+ template<typename T>
+ class SWIFTEN_API EnumParser {
+ public:
+ EnumParser() {
+ }
+
+ EnumParser& operator()(T value, const std::string& text) {
+ values[text] = value;
+ return *this;
+ }
+
+ boost::optional<T> parse(const std::string& value) {
+ typename std::map<std::string, T>::const_iterator i = values.find(value);
+ return i == values.end() ? boost::optional<T>() : i->second;
+ }
+
+ private:
+ std::map<std::string, T> values;
+ };
}
diff --git a/Swiften/Parser/ExpatParser.cpp b/Swiften/Parser/ExpatParser.cpp
index 60ee81e..fba82e2 100644
--- a/Swiften/Parser/ExpatParser.cpp
+++ b/Swiften/Parser/ExpatParser.cpp
@@ -21,75 +21,75 @@ namespace Swift {
static const char NAMESPACE_SEPARATOR = '\x01';
struct ExpatParser::Private {
- XML_Parser parser_;
+ XML_Parser parser_;
};
static void handleStartElement(void* parser, const XML_Char* name, const XML_Char** attributes) {
- std::pair<std::string,std::string> nsTagPair = String::getSplittedAtFirst(name, NAMESPACE_SEPARATOR);
- if (nsTagPair.second == "") {
- nsTagPair.second = nsTagPair.first;
- nsTagPair.first = "";
- }
- AttributeMap attributeValues;
- const XML_Char** currentAttribute = attributes;
- while (*currentAttribute) {
- std::pair<std::string,std::string> nsAttributePair = String::getSplittedAtFirst(*currentAttribute, NAMESPACE_SEPARATOR);
- if (nsAttributePair.second == "") {
- nsAttributePair.second = nsAttributePair.first;
- nsAttributePair.first = "";
- }
- attributeValues.addAttribute(nsAttributePair.second, nsAttributePair.first, std::string(*(currentAttribute+1)));
- currentAttribute += 2;
- }
-
- static_cast<XMLParser*>(parser)->getClient()->handleStartElement(nsTagPair.second, nsTagPair.first, attributeValues);
+ std::pair<std::string,std::string> nsTagPair = String::getSplittedAtFirst(name, NAMESPACE_SEPARATOR);
+ if (nsTagPair.second == "") {
+ nsTagPair.second = nsTagPair.first;
+ nsTagPair.first = "";
+ }
+ AttributeMap attributeValues;
+ const XML_Char** currentAttribute = attributes;
+ while (*currentAttribute) {
+ std::pair<std::string,std::string> nsAttributePair = String::getSplittedAtFirst(*currentAttribute, NAMESPACE_SEPARATOR);
+ if (nsAttributePair.second == "") {
+ nsAttributePair.second = nsAttributePair.first;
+ nsAttributePair.first = "";
+ }
+ attributeValues.addAttribute(nsAttributePair.second, nsAttributePair.first, std::string(*(currentAttribute+1)));
+ currentAttribute += 2;
+ }
+
+ static_cast<XMLParser*>(parser)->getClient()->handleStartElement(nsTagPair.second, nsTagPair.first, attributeValues);
}
static void handleEndElement(void* parser, const XML_Char* name) {
- std::pair<std::string,std::string> nsTagPair = String::getSplittedAtFirst(name, NAMESPACE_SEPARATOR);
- if (nsTagPair.second == "") {
- nsTagPair.second = nsTagPair.first;
- nsTagPair.first = "";
- }
- static_cast<XMLParser*>(parser)->getClient()->handleEndElement(nsTagPair.second, nsTagPair.first);
+ std::pair<std::string,std::string> nsTagPair = String::getSplittedAtFirst(name, NAMESPACE_SEPARATOR);
+ if (nsTagPair.second == "") {
+ nsTagPair.second = nsTagPair.first;
+ nsTagPair.first = "";
+ }
+ static_cast<XMLParser*>(parser)->getClient()->handleEndElement(nsTagPair.second, nsTagPair.first);
}
static void handleCharacterData(void* parser, const XML_Char* data, int len) {
- assert(len >= 0);
- static_cast<XMLParser*>(parser)->getClient()->handleCharacterData(std::string(data, static_cast<size_t>(len)));
+ assert(len >= 0);
+ static_cast<XMLParser*>(parser)->getClient()->handleCharacterData(std::string(data, static_cast<size_t>(len)));
}
static void handleXMLDeclaration(void*, const XML_Char*, const XML_Char*, int) {
}
static void handleEntityDeclaration(void* parser, const XML_Char*, int, const XML_Char*, int, const XML_Char*, const XML_Char*, const XML_Char*, const XML_Char*) {
- static_cast<ExpatParser*>(parser)->stopParser();
+ static_cast<ExpatParser*>(parser)->stopParser();
}
ExpatParser::ExpatParser(XMLParserClient* client) : XMLParser(client), p(new Private()) {
- p->parser_ = XML_ParserCreateNS("UTF-8", NAMESPACE_SEPARATOR);
- XML_SetUserData(p->parser_, this);
- XML_SetElementHandler(p->parser_, handleStartElement, handleEndElement);
- XML_SetCharacterDataHandler(p->parser_, handleCharacterData);
- XML_SetXmlDeclHandler(p->parser_, handleXMLDeclaration);
- XML_SetEntityDeclHandler(p->parser_, handleEntityDeclaration);
+ p->parser_ = XML_ParserCreateNS("UTF-8", NAMESPACE_SEPARATOR);
+ XML_SetUserData(p->parser_, this);
+ XML_SetElementHandler(p->parser_, handleStartElement, handleEndElement);
+ XML_SetCharacterDataHandler(p->parser_, handleCharacterData);
+ XML_SetXmlDeclHandler(p->parser_, handleXMLDeclaration);
+ XML_SetEntityDeclHandler(p->parser_, handleEntityDeclaration);
}
ExpatParser::~ExpatParser() {
- XML_ParserFree(p->parser_);
+ XML_ParserFree(p->parser_);
}
bool ExpatParser::parse(const std::string& data) {
- bool success = XML_Parse(p->parser_, data.c_str(), boost::numeric_cast<int>(data.size()), false) == XML_STATUS_OK;
- /*if (!success) {
- std::cout << "ERROR: " << XML_ErrorString(XML_GetErrorCode(p->parser_)) << " while parsing " << data << std::endl;
- }*/
- return success;
+ bool success = XML_Parse(p->parser_, data.c_str(), boost::numeric_cast<int>(data.size()), false) == XML_STATUS_OK;
+ /*if (!success) {
+ std::cout << "ERROR: " << XML_ErrorString(XML_GetErrorCode(p->parser_)) << " while parsing " << data << std::endl;
+ }*/
+ return success;
}
void ExpatParser::stopParser() {
- XML_StopParser(p->parser_, static_cast<XML_Bool>(0));
+ XML_StopParser(p->parser_, static_cast<XML_Bool>(0));
}
}
diff --git a/Swiften/Parser/ExpatParser.h b/Swiften/Parser/ExpatParser.h
index c0c38c1..581847b 100644
--- a/Swiften/Parser/ExpatParser.h
+++ b/Swiften/Parser/ExpatParser.h
@@ -13,17 +13,17 @@
#include <Swiften/Parser/XMLParser.h>
namespace Swift {
- class SWIFTEN_API ExpatParser : public XMLParser, public boost::noncopyable {
- public:
- ExpatParser(XMLParserClient* client);
- ~ExpatParser();
+ class SWIFTEN_API ExpatParser : public XMLParser, public boost::noncopyable {
+ public:
+ ExpatParser(XMLParserClient* client);
+ ~ExpatParser();
- bool parse(const std::string& data);
+ bool parse(const std::string& data);
- void stopParser();
+ void stopParser();
- private:
- struct Private;
- boost::shared_ptr<Private> p;
- };
+ private:
+ struct Private;
+ boost::shared_ptr<Private> p;
+ };
}
diff --git a/Swiften/Parser/GenericElementParser.h b/Swiften/Parser/GenericElementParser.h
index 9cdec23..7a0f989 100644
--- a/Swiften/Parser/GenericElementParser.h
+++ b/Swiften/Parser/GenericElementParser.h
@@ -13,35 +13,35 @@
#include <Swiften/Parser/ElementParser.h>
namespace Swift {
-
- class PayloadParserFactoryCollection;
- template<typename ElementType>
- class SWIFTEN_API GenericElementParser : public ElementParser {
- public:
- GenericElementParser() {
- stanza_ = boost::make_shared<ElementType>();
- }
+ class PayloadParserFactoryCollection;
- virtual boost::shared_ptr<ToplevelElement> getElement() const {
- return stanza_;
- }
+ template<typename ElementType>
+ class SWIFTEN_API GenericElementParser : public ElementParser {
+ public:
+ GenericElementParser() {
+ stanza_ = boost::make_shared<ElementType>();
+ }
- virtual boost::shared_ptr<ElementType> getElementGeneric() const {
- return stanza_;
- }
+ virtual boost::shared_ptr<ToplevelElement> getElement() const {
+ return stanza_;
+ }
- private:
- virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- }
+ virtual boost::shared_ptr<ElementType> getElementGeneric() const {
+ return stanza_;
+ }
- virtual void handleEndElement(const std::string&, const std::string&) {
- }
+ private:
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
+ }
- virtual void handleCharacterData(const std::string&) {
- }
+ virtual void handleEndElement(const std::string&, const std::string&) {
+ }
- private:
- boost::shared_ptr<ElementType> stanza_;
- };
+ virtual void handleCharacterData(const std::string&) {
+ }
+
+ private:
+ boost::shared_ptr<ElementType> stanza_;
+ };
}
diff --git a/Swiften/Parser/GenericPayloadParser.h b/Swiften/Parser/GenericPayloadParser.h
index b6cd2d7..be0172c 100644
--- a/Swiften/Parser/GenericPayloadParser.h
+++ b/Swiften/Parser/GenericPayloadParser.h
@@ -13,31 +13,31 @@
#include <Swiften/Parser/PayloadParser.h>
namespace Swift {
-
- class FormParser;
-
- /**
- * A generic payload parser for payloads of the given type.
- *
- * This class provides getPayloadInternal() for retrieving the actual
- * payload.
- */
- template<typename PAYLOAD_TYPE>
- class GenericPayloadParser : public PayloadParser {
- public:
- GenericPayloadParser() : PayloadParser() {
- payload_ = boost::make_shared<PAYLOAD_TYPE>();
- }
-
- virtual boost::shared_ptr<Payload> getPayload() const {
- return payload_;
- }
-
- virtual boost::shared_ptr<PAYLOAD_TYPE> getPayloadInternal() const {
- return payload_;
- }
-
- private:
- boost::shared_ptr<PAYLOAD_TYPE> payload_;
- };
+
+ class FormParser;
+
+ /**
+ * A generic payload parser for payloads of the given type.
+ *
+ * This class provides getPayloadInternal() for retrieving the actual
+ * payload.
+ */
+ template<typename PAYLOAD_TYPE>
+ class GenericPayloadParser : public PayloadParser {
+ public:
+ GenericPayloadParser() : PayloadParser() {
+ payload_ = boost::make_shared<PAYLOAD_TYPE>();
+ }
+
+ virtual boost::shared_ptr<Payload> getPayload() const {
+ return payload_;
+ }
+
+ virtual boost::shared_ptr<PAYLOAD_TYPE> getPayloadInternal() const {
+ return payload_;
+ }
+
+ private:
+ boost::shared_ptr<PAYLOAD_TYPE> payload_;
+ };
}
diff --git a/Swiften/Parser/GenericPayloadParserFactory.h b/Swiften/Parser/GenericPayloadParserFactory.h
index c980073..fcdec62 100644
--- a/Swiften/Parser/GenericPayloadParserFactory.h
+++ b/Swiften/Parser/GenericPayloadParserFactory.h
@@ -13,27 +13,27 @@
namespace Swift {
- /**
- * A generic class for PayloadParserFactories that parse a specific payload (given as the template parameter of the class).
- */
- template<typename PARSER_TYPE>
- class GenericPayloadParserFactory : public PayloadParserFactory {
- public:
- /**
- * Construct a parser factory that can parse the given top-level tag in the given namespace.
- */
- GenericPayloadParserFactory(const std::string& tag, const std::string& xmlns = "") : tag_(tag), xmlns_(xmlns) {}
-
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return (tag_.empty() ? true : element == tag_) && (xmlns_.empty() ? true : xmlns_ == ns);
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new PARSER_TYPE();
- }
-
- private:
- std::string tag_;
- std::string xmlns_;
- };
+ /**
+ * A generic class for PayloadParserFactories that parse a specific payload (given as the template parameter of the class).
+ */
+ template<typename PARSER_TYPE>
+ class GenericPayloadParserFactory : public PayloadParserFactory {
+ public:
+ /**
+ * Construct a parser factory that can parse the given top-level tag in the given namespace.
+ */
+ GenericPayloadParserFactory(const std::string& tag, const std::string& xmlns = "") : tag_(tag), xmlns_(xmlns) {}
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return (tag_.empty() ? true : element == tag_) && (xmlns_.empty() ? true : xmlns_ == ns);
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new PARSER_TYPE();
+ }
+
+ private:
+ std::string tag_;
+ std::string xmlns_;
+ };
}
diff --git a/Swiften/Parser/GenericPayloadParserFactory2.h b/Swiften/Parser/GenericPayloadParserFactory2.h
index 7591897..f55d317 100644
--- a/Swiften/Parser/GenericPayloadParserFactory2.h
+++ b/Swiften/Parser/GenericPayloadParserFactory2.h
@@ -12,30 +12,30 @@
#include <Swiften/Parser/PayloadParserFactory.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
- /**
- * A generic class for PayloadParserFactories that parse a specific payload (given as the template parameter of the class).
- */
- template<typename PARSER_TYPE>
- class GenericPayloadParserFactory2 : public PayloadParserFactory {
- public:
- /**
- * Construct a parser factory that can parse the given top-level tag in the given namespace.
- */
- GenericPayloadParserFactory2(const std::string& tag, const std::string& xmlns, PayloadParserFactoryCollection* parsers) : tag_(tag), xmlns_(xmlns), parsers_(parsers) {}
-
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return (tag_.empty() ? true : element == tag_) && (xmlns_.empty() ? true : xmlns_ == ns);
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new PARSER_TYPE(parsers_);
- }
-
- private:
- std::string tag_;
- std::string xmlns_;
- PayloadParserFactoryCollection* parsers_;
- };
+ class PayloadParserFactoryCollection;
+
+ /**
+ * A generic class for PayloadParserFactories that parse a specific payload (given as the template parameter of the class).
+ */
+ template<typename PARSER_TYPE>
+ class GenericPayloadParserFactory2 : public PayloadParserFactory {
+ public:
+ /**
+ * Construct a parser factory that can parse the given top-level tag in the given namespace.
+ */
+ GenericPayloadParserFactory2(const std::string& tag, const std::string& xmlns, PayloadParserFactoryCollection* parsers) : tag_(tag), xmlns_(xmlns), parsers_(parsers) {}
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return (tag_.empty() ? true : element == tag_) && (xmlns_.empty() ? true : xmlns_ == ns);
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new PARSER_TYPE(parsers_);
+ }
+
+ private:
+ std::string tag_;
+ std::string xmlns_;
+ PayloadParserFactoryCollection* parsers_;
+ };
}
diff --git a/Swiften/Parser/GenericPayloadTreeParser.h b/Swiften/Parser/GenericPayloadTreeParser.h
index 37505ac..2a7e190 100644
--- a/Swiften/Parser/GenericPayloadTreeParser.h
+++ b/Swiften/Parser/GenericPayloadTreeParser.h
@@ -16,39 +16,39 @@
#include <Swiften/Parser/Tree/ParserElement.h>
namespace Swift {
- /**
- * Generic parser offering something a bit like a DOM to work with.
- */
- template<typename PAYLOAD_TYPE>
- class GenericPayloadTreeParser : public GenericPayloadParser<PAYLOAD_TYPE> {
- public:
- virtual void handleStartElement(const std::string& element, const std::string& xmlns, const AttributeMap& attributes) {
- if (!root_) {
- root_ = boost::make_shared<ParserElement>(element, xmlns, attributes);
- elementStack_.push_back(root_);
- }
- else {
- ParserElement::ref current = *elementStack_.rbegin();
- elementStack_.push_back(current->addChild(element, xmlns, attributes));
- }
- }
-
- virtual void handleEndElement(const std::string& /*element*/, const std::string&) {
- elementStack_.pop_back();
- if (elementStack_.empty()) {
- handleTree(root_);
- }
- }
-
- virtual void handleCharacterData(const std::string& data) {
- ParserElement::ref current = *elementStack_.rbegin();
- current->appendCharacterData(data);
- }
-
- virtual void handleTree(ParserElement::ref root) = 0;
-
- private:
- std::deque<ParserElement::ref> elementStack_;
- ParserElement::ref root_;
- };
+ /**
+ * Generic parser offering something a bit like a DOM to work with.
+ */
+ template<typename PAYLOAD_TYPE>
+ class GenericPayloadTreeParser : public GenericPayloadParser<PAYLOAD_TYPE> {
+ public:
+ virtual void handleStartElement(const std::string& element, const std::string& xmlns, const AttributeMap& attributes) {
+ if (!root_) {
+ root_ = boost::make_shared<ParserElement>(element, xmlns, attributes);
+ elementStack_.push_back(root_);
+ }
+ else {
+ ParserElement::ref current = *elementStack_.rbegin();
+ elementStack_.push_back(current->addChild(element, xmlns, attributes));
+ }
+ }
+
+ virtual void handleEndElement(const std::string& /*element*/, const std::string&) {
+ elementStack_.pop_back();
+ if (elementStack_.empty()) {
+ handleTree(root_);
+ }
+ }
+
+ virtual void handleCharacterData(const std::string& data) {
+ ParserElement::ref current = *elementStack_.rbegin();
+ current->appendCharacterData(data);
+ }
+
+ virtual void handleTree(ParserElement::ref root) = 0;
+
+ private:
+ std::deque<ParserElement::ref> elementStack_;
+ ParserElement::ref root_;
+ };
}
diff --git a/Swiften/Parser/GenericStanzaParser.h b/Swiften/Parser/GenericStanzaParser.h
index c9d7f70..7d16a0c 100644
--- a/Swiften/Parser/GenericStanzaParser.h
+++ b/Swiften/Parser/GenericStanzaParser.h
@@ -13,26 +13,26 @@
#include <Swiften/Parser/StanzaParser.h>
namespace Swift {
-
- class PayloadParserFactoryCollection;
-
- template<typename STANZA_TYPE>
- class SWIFTEN_API GenericStanzaParser : public StanzaParser {
- public:
- GenericStanzaParser(PayloadParserFactoryCollection* collection) :
- StanzaParser(collection) {
- stanza_ = boost::make_shared<STANZA_TYPE>();
- }
-
- virtual boost::shared_ptr<ToplevelElement> getElement() const {
- return stanza_;
- }
-
- virtual boost::shared_ptr<STANZA_TYPE> getStanzaGeneric() const {
- return stanza_;
- }
-
- private:
- boost::shared_ptr<STANZA_TYPE> stanza_;
- };
+
+ class PayloadParserFactoryCollection;
+
+ template<typename STANZA_TYPE>
+ class SWIFTEN_API GenericStanzaParser : public StanzaParser {
+ public:
+ GenericStanzaParser(PayloadParserFactoryCollection* collection) :
+ StanzaParser(collection) {
+ stanza_ = boost::make_shared<STANZA_TYPE>();
+ }
+
+ virtual boost::shared_ptr<ToplevelElement> getElement() const {
+ return stanza_;
+ }
+
+ virtual boost::shared_ptr<STANZA_TYPE> getStanzaGeneric() const {
+ return stanza_;
+ }
+
+ private:
+ boost::shared_ptr<STANZA_TYPE> stanza_;
+ };
}
diff --git a/Swiften/Parser/IQParser.cpp b/Swiften/Parser/IQParser.cpp
index ee8f2ff..573ce07 100644
--- a/Swiften/Parser/IQParser.cpp
+++ b/Swiften/Parser/IQParser.cpp
@@ -12,30 +12,30 @@
namespace Swift {
-IQParser::IQParser(PayloadParserFactoryCollection* factories) :
- GenericStanzaParser<IQ>(factories) {
+IQParser::IQParser(PayloadParserFactoryCollection* factories) :
+ GenericStanzaParser<IQ>(factories) {
}
void IQParser::handleStanzaAttributes(const AttributeMap& attributes) {
- boost::optional<std::string> type = attributes.getAttributeValue("type");
- if (type) {
- if (*type == "set") {
- getStanzaGeneric()->setType(IQ::Set);
- }
- else if (*type == "get") {
- getStanzaGeneric()->setType(IQ::Get);
- }
- else if (*type == "result") {
- getStanzaGeneric()->setType(IQ::Result);
- }
- else if (*type == "error") {
- getStanzaGeneric()->setType(IQ::Error);
- }
- else {
- std::cerr << "Unknown IQ type: " << *type << std::endl;
- getStanzaGeneric()->setType(IQ::Get);
- }
- }
+ boost::optional<std::string> type = attributes.getAttributeValue("type");
+ if (type) {
+ if (*type == "set") {
+ getStanzaGeneric()->setType(IQ::Set);
+ }
+ else if (*type == "get") {
+ getStanzaGeneric()->setType(IQ::Get);
+ }
+ else if (*type == "result") {
+ getStanzaGeneric()->setType(IQ::Result);
+ }
+ else if (*type == "error") {
+ getStanzaGeneric()->setType(IQ::Error);
+ }
+ else {
+ std::cerr << "Unknown IQ type: " << *type << std::endl;
+ getStanzaGeneric()->setType(IQ::Get);
+ }
+ }
}
}
diff --git a/Swiften/Parser/IQParser.h b/Swiften/Parser/IQParser.h
index fa1f66e..5250bfb 100644
--- a/Swiften/Parser/IQParser.h
+++ b/Swiften/Parser/IQParser.h
@@ -11,11 +11,11 @@
#include <Swiften/Parser/GenericStanzaParser.h>
namespace Swift {
- class SWIFTEN_API IQParser : public GenericStanzaParser<IQ> {
- public:
- IQParser(PayloadParserFactoryCollection* factories);
+ class SWIFTEN_API IQParser : public GenericStanzaParser<IQ> {
+ public:
+ IQParser(PayloadParserFactoryCollection* factories);
- private:
- virtual void handleStanzaAttributes(const AttributeMap&);
- };
+ private:
+ virtual void handleStanzaAttributes(const AttributeMap&);
+ };
}
diff --git a/Swiften/Parser/LibXMLParser.cpp b/Swiften/Parser/LibXMLParser.cpp
index db14174..62484fa 100644
--- a/Swiften/Parser/LibXMLParser.cpp
+++ b/Swiften/Parser/LibXMLParser.cpp
@@ -20,45 +20,45 @@
namespace Swift {
struct LibXMLParser::Private {
- xmlSAXHandler handler_;
- xmlParserCtxtPtr context_;
+ xmlSAXHandler handler_;
+ xmlParserCtxtPtr context_;
};
static void handleStartElement(void* parser, const xmlChar* name, const xmlChar*, const xmlChar* xmlns, int, const xmlChar**, int nbAttributes, int nbDefaulted, const xmlChar ** attributes) {
- AttributeMap attributeValues;
- if (nbDefaulted != 0) {
- // Just because i don't understand what this means yet :-)
- std::cerr << "Unexpected nbDefaulted on XML element" << std::endl;
- }
- for (int i = 0; i < nbAttributes*5; i += 5) {
- std::string attributeNS = "";
- if (attributes[i+2]) {
- attributeNS = std::string(reinterpret_cast<const char*>(attributes[i+2]));
- }
- attributeValues.addAttribute(
- std::string(reinterpret_cast<const char*>(attributes[i])),
- attributeNS,
- std::string(reinterpret_cast<const char*>(attributes[i+3]),
- boost::numeric_cast<size_t>(attributes[i+4]-attributes[i+3])));
- }
- static_cast<XMLParser*>(parser)->getClient()->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()), attributeValues);
+ AttributeMap attributeValues;
+ if (nbDefaulted != 0) {
+ // Just because i don't understand what this means yet :-)
+ std::cerr << "Unexpected nbDefaulted on XML element" << std::endl;
+ }
+ for (int i = 0; i < nbAttributes*5; i += 5) {
+ std::string attributeNS = "";
+ if (attributes[i+2]) {
+ attributeNS = std::string(reinterpret_cast<const char*>(attributes[i+2]));
+ }
+ attributeValues.addAttribute(
+ std::string(reinterpret_cast<const char*>(attributes[i])),
+ attributeNS,
+ std::string(reinterpret_cast<const char*>(attributes[i+3]),
+ boost::numeric_cast<size_t>(attributes[i+4]-attributes[i+3])));
+ }
+ static_cast<XMLParser*>(parser)->getClient()->handleStartElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()), attributeValues);
}
static void handleEndElement(void *parser, const xmlChar* name, const xmlChar*, const xmlChar* xmlns) {
- static_cast<XMLParser*>(parser)->getClient()->handleEndElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()));
+ static_cast<XMLParser*>(parser)->getClient()->handleEndElement(reinterpret_cast<const char*>(name), (xmlns ? reinterpret_cast<const char*>(xmlns) : std::string()));
}
static void handleCharacterData(void* parser, const xmlChar* data, int len) {
- static_cast<XMLParser*>(parser)->getClient()->handleCharacterData(std::string(reinterpret_cast<const char*>(data), boost::numeric_cast<size_t>(len)));
+ static_cast<XMLParser*>(parser)->getClient()->handleCharacterData(std::string(reinterpret_cast<const char*>(data), boost::numeric_cast<size_t>(len)));
}
static void handleError(void*, const char* /*m*/, ... ) {
- /*
- va_list args;
- va_start(args, m);
- vfprintf(stdout, m, args);
- va_end(args);
- */
+ /*
+ va_list args;
+ va_start(args, m);
+ vfprintf(stdout, m, args);
+ va_end(args);
+ */
}
static void handleWarning(void*, const char*, ... ) {
@@ -67,42 +67,42 @@ static void handleWarning(void*, const char*, ... ) {
bool LibXMLParser::initialized = false;
LibXMLParser::LibXMLParser(XMLParserClient* client) : XMLParser(client), p(new Private()) {
- // Initialize libXML for multithreaded applications
- if (!initialized) {
- xmlInitParser();
- initialized = true;
- }
-
- memset(&p->handler_, 0, sizeof(p->handler_) );
- p->handler_.initialized = XML_SAX2_MAGIC;
- p->handler_.startElementNs = &handleStartElement;
- p->handler_.endElementNs = &handleEndElement;
- p->handler_.characters = &handleCharacterData;
- p->handler_.warning = &handleWarning;
- p->handler_.error = &handleError;
-
- p->context_ = xmlCreatePushParserCtxt(&p->handler_, this, 0, 0, 0);
- xmlCtxtUseOptions(p->context_, XML_PARSE_NOENT);
- assert(p->context_);
+ // Initialize libXML for multithreaded applications
+ if (!initialized) {
+ xmlInitParser();
+ initialized = true;
+ }
+
+ memset(&p->handler_, 0, sizeof(p->handler_) );
+ p->handler_.initialized = XML_SAX2_MAGIC;
+ p->handler_.startElementNs = &handleStartElement;
+ p->handler_.endElementNs = &handleEndElement;
+ p->handler_.characters = &handleCharacterData;
+ p->handler_.warning = &handleWarning;
+ p->handler_.error = &handleError;
+
+ p->context_ = xmlCreatePushParserCtxt(&p->handler_, this, 0, 0, 0);
+ xmlCtxtUseOptions(p->context_, XML_PARSE_NOENT);
+ assert(p->context_);
}
LibXMLParser::~LibXMLParser() {
- if (p->context_) {
- xmlFreeParserCtxt(p->context_);
- }
+ if (p->context_) {
+ xmlFreeParserCtxt(p->context_);
+ }
}
bool LibXMLParser::parse(const std::string& data) {
- if (xmlParseChunk(p->context_, data.c_str(), boost::numeric_cast<int>(data.size()), false) == XML_ERR_OK) {
- return true;
- }
- xmlError* error = xmlCtxtGetLastError(p->context_);
- if (error->code == XML_WAR_NS_URI || error->code == XML_WAR_NS_URI_RELATIVE) {
- xmlCtxtResetLastError(p->context_);
- p->context_->errNo = XML_ERR_OK;
- return true;
- }
- return false;
+ if (xmlParseChunk(p->context_, data.c_str(), boost::numeric_cast<int>(data.size()), false) == XML_ERR_OK) {
+ return true;
+ }
+ xmlError* error = xmlCtxtGetLastError(p->context_);
+ if (error->code == XML_WAR_NS_URI || error->code == XML_WAR_NS_URI_RELATIVE) {
+ xmlCtxtResetLastError(p->context_);
+ p->context_->errNo = XML_ERR_OK;
+ return true;
+ }
+ return false;
}
}
diff --git a/Swiften/Parser/LibXMLParser.h b/Swiften/Parser/LibXMLParser.h
index c247548..eb2a038 100644
--- a/Swiften/Parser/LibXMLParser.h
+++ b/Swiften/Parser/LibXMLParser.h
@@ -12,21 +12,21 @@
#include <Swiften/Parser/XMLParser.h>
namespace Swift {
- /**
- * Warning: This constructor is not thread-safe, because it depends on global state to
- * check whether it is initialized.
- */
- class LibXMLParser : public XMLParser, public boost::noncopyable {
- public:
- LibXMLParser(XMLParserClient* client);
- virtual ~LibXMLParser();
+ /**
+ * Warning: This constructor is not thread-safe, because it depends on global state to
+ * check whether it is initialized.
+ */
+ class LibXMLParser : public XMLParser, public boost::noncopyable {
+ public:
+ LibXMLParser(XMLParserClient* client);
+ virtual ~LibXMLParser();
- bool parse(const std::string& data);
+ bool parse(const std::string& data);
- private:
- static bool initialized;
+ private:
+ static bool initialized;
- struct Private;
- boost::shared_ptr<Private> p;
- };
+ struct Private;
+ boost::shared_ptr<Private> p;
+ };
}
diff --git a/Swiften/Parser/MessageParser.cpp b/Swiften/Parser/MessageParser.cpp
index 5de0038..1dd7675 100644
--- a/Swiften/Parser/MessageParser.cpp
+++ b/Swiften/Parser/MessageParser.cpp
@@ -10,30 +10,30 @@
namespace Swift {
-MessageParser::MessageParser(PayloadParserFactoryCollection* factories) :
- GenericStanzaParser<Message>(factories) {
- GenericStanzaParser<Message>::getStanzaGeneric()->setType(Message::Normal);
+MessageParser::MessageParser(PayloadParserFactoryCollection* factories) :
+ GenericStanzaParser<Message>(factories) {
+ GenericStanzaParser<Message>::getStanzaGeneric()->setType(Message::Normal);
}
void MessageParser::handleStanzaAttributes(const AttributeMap& attributes) {
- boost::optional<std::string> type = attributes.getAttributeValue("type");
- if (type) {
- if (*type == "chat") {
- getStanzaGeneric()->setType(Message::Chat);
- }
- else if (*type == "error") {
- getStanzaGeneric()->setType(Message::Error);
- }
- else if (*type == "groupchat") {
- getStanzaGeneric()->setType(Message::Groupchat);
- }
- else if (*type == "headline") {
- getStanzaGeneric()->setType(Message::Headline);
- }
- else {
- getStanzaGeneric()->setType(Message::Normal);
- }
- }
+ boost::optional<std::string> type = attributes.getAttributeValue("type");
+ if (type) {
+ if (*type == "chat") {
+ getStanzaGeneric()->setType(Message::Chat);
+ }
+ else if (*type == "error") {
+ getStanzaGeneric()->setType(Message::Error);
+ }
+ else if (*type == "groupchat") {
+ getStanzaGeneric()->setType(Message::Groupchat);
+ }
+ else if (*type == "headline") {
+ getStanzaGeneric()->setType(Message::Headline);
+ }
+ else {
+ getStanzaGeneric()->setType(Message::Normal);
+ }
+ }
}
}
diff --git a/Swiften/Parser/MessageParser.h b/Swiften/Parser/MessageParser.h
index 05e8b20..cfbfc38 100644
--- a/Swiften/Parser/MessageParser.h
+++ b/Swiften/Parser/MessageParser.h
@@ -11,11 +11,11 @@
#include <Swiften/Parser/GenericStanzaParser.h>
namespace Swift {
- class SWIFTEN_API MessageParser : public GenericStanzaParser<Message> {
- public:
- MessageParser(PayloadParserFactoryCollection* factories);
+ class SWIFTEN_API MessageParser : public GenericStanzaParser<Message> {
+ public:
+ MessageParser(PayloadParserFactoryCollection* factories);
- private:
- virtual void handleStanzaAttributes(const AttributeMap&);
- };
+ private:
+ virtual void handleStanzaAttributes(const AttributeMap&);
+ };
}
diff --git a/Swiften/Parser/PayloadParser.h b/Swiften/Parser/PayloadParser.h
index 815d246..cb50061 100644
--- a/Swiften/Parser/PayloadParser.h
+++ b/Swiften/Parser/PayloadParser.h
@@ -13,38 +13,38 @@
#include <Swiften/Parser/AttributeMap.h>
namespace Swift {
-
-
- /**
- * A parser for XMPP stanza payloads.
- *
- * The parser is event driven: handleStartElement, handleEndElement, and handleCharacterData will be called
- * when the parser detects start and end of XML elements, or character data.
- * After the data for the given top-level element is processed, getPayload() will be called to retrieve the
- * payload.
- */
- class SWIFTEN_API PayloadParser {
- public:
- virtual ~PayloadParser();
-
- /**
- * Handle the start of an XML element.
- */
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0;
-
- /**
- * Handle the end of an XML element.
- */
- virtual void handleEndElement(const std::string& element, const std::string& ns) = 0;
-
- /**
- * Handle character data.
- */
- virtual void handleCharacterData(const std::string& data) = 0;
-
- /**
- * Retrieve a pointer to the payload.
- */
- virtual boost::shared_ptr<Payload> getPayload() const = 0;
- };
+
+
+ /**
+ * A parser for XMPP stanza payloads.
+ *
+ * The parser is event driven: handleStartElement, handleEndElement, and handleCharacterData will be called
+ * when the parser detects start and end of XML elements, or character data.
+ * After the data for the given top-level element is processed, getPayload() will be called to retrieve the
+ * payload.
+ */
+ class SWIFTEN_API PayloadParser {
+ public:
+ virtual ~PayloadParser();
+
+ /**
+ * Handle the start of an XML element.
+ */
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) = 0;
+
+ /**
+ * Handle the end of an XML element.
+ */
+ virtual void handleEndElement(const std::string& element, const std::string& ns) = 0;
+
+ /**
+ * Handle character data.
+ */
+ virtual void handleCharacterData(const std::string& data) = 0;
+
+ /**
+ * Retrieve a pointer to the payload.
+ */
+ virtual boost::shared_ptr<Payload> getPayload() const = 0;
+ };
}
diff --git a/Swiften/Parser/PayloadParserFactory.h b/Swiften/Parser/PayloadParserFactory.h
index a73d50d..84f11ff 100644
--- a/Swiften/Parser/PayloadParserFactory.h
+++ b/Swiften/Parser/PayloadParserFactory.h
@@ -10,24 +10,24 @@
#include <Swiften/Parser/AttributeMap.h>
namespace Swift {
-
- class PayloadParser;
- /**
- * A factory for PayloadParsers.
- */
- class SWIFTEN_API PayloadParserFactory {
- public:
- virtual ~PayloadParserFactory();
+ class PayloadParser;
- /**
- * Checks whether this factory can parse the given top-level element in the given namespace (with the given attributes).
- */
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap& attributes) const = 0;
+ /**
+ * A factory for PayloadParsers.
+ */
+ class SWIFTEN_API PayloadParserFactory {
+ public:
+ virtual ~PayloadParserFactory();
- /**
- * Creates a new payload parser.
- */
- virtual PayloadParser* createPayloadParser() = 0;
- };
+ /**
+ * Checks whether this factory can parse the given top-level element in the given namespace (with the given attributes).
+ */
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap& attributes) const = 0;
+
+ /**
+ * Creates a new payload parser.
+ */
+ virtual PayloadParser* createPayloadParser() = 0;
+ };
}
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp
index 6b86305..f1c1c03 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParserFactoryCollection.cpp
@@ -18,22 +18,22 @@ PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactor
}
void PayloadParserFactoryCollection::addFactory(PayloadParserFactory* factory) {
- factories_.push_back(factory);
+ factories_.push_back(factory);
}
void PayloadParserFactoryCollection::removeFactory(PayloadParserFactory* factory) {
- factories_.erase(std::remove(factories_.begin(), factories_.end(), factory), factories_.end());
+ factories_.erase(std::remove(factories_.begin(), factories_.end(), factory), factories_.end());
}
void PayloadParserFactoryCollection::setDefaultFactory(PayloadParserFactory* factory) {
- defaultFactory_ = factory;
+ defaultFactory_ = factory;
}
PayloadParserFactory* PayloadParserFactoryCollection::getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- std::vector<PayloadParserFactory*>::reverse_iterator i = std::find_if(
- factories_.rbegin(), factories_.rend(),
- boost::bind(&PayloadParserFactory::canParse, _1, element, ns, attributes));
- return (i != factories_.rend() ? *i : defaultFactory_);
+ std::vector<PayloadParserFactory*>::reverse_iterator i = std::find_if(
+ factories_.rbegin(), factories_.rend(),
+ boost::bind(&PayloadParserFactory::canParse, _1, element, ns, attributes));
+ return (i != factories_.rend() ? *i : defaultFactory_);
}
}
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParserFactoryCollection.h
index 757b4e7..06e334e 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.h
+++ b/Swiften/Parser/PayloadParserFactoryCollection.h
@@ -12,20 +12,20 @@
#include <Swiften/Parser/AttributeMap.h>
namespace Swift {
- class PayloadParserFactory;
+ class PayloadParserFactory;
- class SWIFTEN_API PayloadParserFactoryCollection {
- public:
- PayloadParserFactoryCollection();
+ class SWIFTEN_API PayloadParserFactoryCollection {
+ public:
+ PayloadParserFactoryCollection();
- void addFactory(PayloadParserFactory* factory);
- void removeFactory(PayloadParserFactory* factory);
- void setDefaultFactory(PayloadParserFactory* factory);
+ void addFactory(PayloadParserFactory* factory);
+ void removeFactory(PayloadParserFactory* factory);
+ void setDefaultFactory(PayloadParserFactory* factory);
- PayloadParserFactory* getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes);
+ PayloadParserFactory* getPayloadParserFactory(const std::string& element, const std::string& ns, const AttributeMap& attributes);
- private:
- std::vector<PayloadParserFactory*> factories_;
- PayloadParserFactory* defaultFactory_;
- };
+ private:
+ std::vector<PayloadParserFactory*> factories_;
+ PayloadParserFactory* defaultFactory_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/BlockParser.h b/Swiften/Parser/PayloadParsers/BlockParser.h
index 2e615a5..1724feb 100644
--- a/Swiften/Parser/PayloadParsers/BlockParser.h
+++ b/Swiften/Parser/PayloadParsers/BlockParser.h
@@ -12,30 +12,30 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- template<typename BLOCK_ELEMENT>
- class SWIFTEN_API BlockParser : public GenericPayloadParser<BLOCK_ELEMENT> {
- public:
- BlockParser() : GenericPayloadParser<BLOCK_ELEMENT>(), level(0) {
- }
+ template<typename BLOCK_ELEMENT>
+ class SWIFTEN_API BlockParser : public GenericPayloadParser<BLOCK_ELEMENT> {
+ public:
+ BlockParser() : GenericPayloadParser<BLOCK_ELEMENT>(), level(0) {
+ }
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level == 1 && element == "item") {
- JID jid(attributes.getAttribute("jid"));
- if (jid.isValid()) {
- GenericPayloadParser<BLOCK_ELEMENT>::getPayloadInternal()->addItem(jid);
- }
- }
- ++level;
- }
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
+ if (level == 1 && element == "item") {
+ JID jid(attributes.getAttribute("jid"));
+ if (jid.isValid()) {
+ GenericPayloadParser<BLOCK_ELEMENT>::getPayloadInternal()->addItem(jid);
+ }
+ }
+ ++level;
+ }
- virtual void handleEndElement(const std::string&, const std::string&) {
- --level;
- }
+ virtual void handleEndElement(const std::string&, const std::string&) {
+ --level;
+ }
- virtual void handleCharacterData(const std::string&) {
- }
+ virtual void handleCharacterData(const std::string&) {
+ }
- private:
- int level;
- };
+ private:
+ int level;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/BodyParser.cpp b/Swiften/Parser/PayloadParsers/BodyParser.cpp
index 96a7b18..5741c90 100644
--- a/Swiften/Parser/PayloadParsers/BodyParser.cpp
+++ b/Swiften/Parser/PayloadParsers/BodyParser.cpp
@@ -12,18 +12,18 @@ BodyParser::BodyParser() : level_(0) {
}
void BodyParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++level_;
+ ++level_;
}
void BodyParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
- if (level_ == 0) {
- getPayloadInternal()->setText(text_);
- }
+ --level_;
+ if (level_ == 0) {
+ getPayloadInternal()->setText(text_);
+ }
}
void BodyParser::handleCharacterData(const std::string& data) {
- text_ += data;
+ text_ += data;
}
}
diff --git a/Swiften/Parser/PayloadParsers/BodyParser.h b/Swiften/Parser/PayloadParsers/BodyParser.h
index 6b6a206..bcf762b 100644
--- a/Swiften/Parser/PayloadParsers/BodyParser.h
+++ b/Swiften/Parser/PayloadParsers/BodyParser.h
@@ -11,16 +11,16 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API BodyParser : public GenericPayloadParser<Body> {
- public:
- BodyParser();
+ class SWIFTEN_API BodyParser : public GenericPayloadParser<Body> {
+ public:
+ BodyParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- std::string text_;
- };
+ private:
+ int level_;
+ std::string text_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
index 35ee1fd..8a0ecd2 100644
--- a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
@@ -19,26 +19,26 @@ BytestreamsParser::~BytestreamsParser() {
}
void BytestreamsParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level == TopLevel) {
- getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
- }
- else if (level == PayloadLevel) {
- if (element == "streamhost") {
- try {
- getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::lexical_cast<int>(attributes.getAttribute("port"))));
- }
- catch (boost::bad_lexical_cast&) {
- }
- }
- else if (element == "streamhost-used") {
- getPayloadInternal()->setUsedStreamHost(JID(attributes.getAttribute("jid")));
- }
- }
- ++level;
+ if (level == TopLevel) {
+ getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
+ }
+ else if (level == PayloadLevel) {
+ if (element == "streamhost") {
+ try {
+ getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::lexical_cast<int>(attributes.getAttribute("port"))));
+ }
+ catch (boost::bad_lexical_cast&) {
+ }
+ }
+ else if (element == "streamhost-used") {
+ getPayloadInternal()->setUsedStreamHost(JID(attributes.getAttribute("jid")));
+ }
+ }
+ ++level;
}
void BytestreamsParser::handleEndElement(const std::string&, const std::string&) {
- --level;
+ --level;
}
void BytestreamsParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.h b/Swiften/Parser/PayloadParsers/BytestreamsParser.h
index 4180ff9..01cb60f 100644
--- a/Swiften/Parser/PayloadParsers/BytestreamsParser.h
+++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.h
@@ -13,20 +13,20 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API BytestreamsParser : public GenericPayloadParser<Bytestreams> {
- public:
- BytestreamsParser();
- ~BytestreamsParser();
+ class SWIFTEN_API BytestreamsParser : public GenericPayloadParser<Bytestreams> {
+ public:
+ BytestreamsParser();
+ ~BytestreamsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level;
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+ int level;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp b/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp
index 7843c78..546df57 100644
--- a/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CapsInfoParser.cpp
@@ -14,16 +14,16 @@ CapsInfoParser::CapsInfoParser() : level(0) {
}
void CapsInfoParser::handleStartElement(const std::string&, const std::string& /*ns*/, const AttributeMap& attributes) {
- if (level == 0) {
- getPayloadInternal()->setHash(attributes.getAttribute("hash"));
- getPayloadInternal()->setNode(attributes.getAttribute("node"));
- getPayloadInternal()->setVersion(attributes.getAttribute("ver"));
- }
- ++level;
+ if (level == 0) {
+ getPayloadInternal()->setHash(attributes.getAttribute("hash"));
+ getPayloadInternal()->setNode(attributes.getAttribute("node"));
+ getPayloadInternal()->setVersion(attributes.getAttribute("ver"));
+ }
+ ++level;
}
void CapsInfoParser::handleEndElement(const std::string&, const std::string&) {
- --level;
+ --level;
}
void CapsInfoParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/CapsInfoParser.h b/Swiften/Parser/PayloadParsers/CapsInfoParser.h
index 6e4610a..9556a4d 100644
--- a/Swiften/Parser/PayloadParsers/CapsInfoParser.h
+++ b/Swiften/Parser/PayloadParsers/CapsInfoParser.h
@@ -11,15 +11,15 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API CapsInfoParser : public GenericPayloadParser<CapsInfo> {
- public:
- CapsInfoParser();
+ class SWIFTEN_API CapsInfoParser : public GenericPayloadParser<CapsInfo> {
+ public:
+ CapsInfoParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level;
- };
+ private:
+ int level;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsDisableParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsDisableParser.cpp
index 7e26f3b..b8bd4b5 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsDisableParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CarbonsDisableParser.cpp
@@ -8,19 +8,19 @@
namespace Swift {
- CarbonsDisableParser::CarbonsDisableParser() : GenericPayloadParser<CarbonsDisable>() {
- }
+ CarbonsDisableParser::CarbonsDisableParser() : GenericPayloadParser<CarbonsDisable>() {
+ }
- CarbonsDisableParser::~CarbonsDisableParser() {
- }
+ CarbonsDisableParser::~CarbonsDisableParser() {
+ }
- void CarbonsDisableParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- }
+ void CarbonsDisableParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
+ }
- void CarbonsDisableParser::handleEndElement(const std::string&, const std::string&) {
- }
+ void CarbonsDisableParser::handleEndElement(const std::string&, const std::string&) {
+ }
+
+ void CarbonsDisableParser::handleCharacterData(const std::string&) {
+ }
- void CarbonsDisableParser::handleCharacterData(const std::string&) {
- }
-
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsDisableParser.h b/Swiften/Parser/PayloadParsers/CarbonsDisableParser.h
index 56f6787..7a5f4a4 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsDisableParser.h
+++ b/Swiften/Parser/PayloadParsers/CarbonsDisableParser.h
@@ -11,13 +11,13 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API CarbonsDisableParser : public GenericPayloadParser<CarbonsDisable> {
- public:
- CarbonsDisableParser();
- virtual ~CarbonsDisableParser();
+ class SWIFTEN_API CarbonsDisableParser : public GenericPayloadParser<CarbonsDisable> {
+ public:
+ CarbonsDisableParser();
+ virtual ~CarbonsDisableParser();
- virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string&);
- virtual void handleCharacterData(const std::string&);
- };
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string&);
+ virtual void handleCharacterData(const std::string&);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsEnableParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsEnableParser.cpp
index 52bf6d7..700f939 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsEnableParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CarbonsEnableParser.cpp
@@ -8,19 +8,19 @@
namespace Swift {
- CarbonsEnableParser::CarbonsEnableParser() : GenericPayloadParser<CarbonsEnable>() {
- }
+ CarbonsEnableParser::CarbonsEnableParser() : GenericPayloadParser<CarbonsEnable>() {
+ }
- CarbonsEnableParser::~CarbonsEnableParser() {
- }
+ CarbonsEnableParser::~CarbonsEnableParser() {
+ }
- void CarbonsEnableParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- }
+ void CarbonsEnableParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
+ }
- void CarbonsEnableParser::handleEndElement(const std::string&, const std::string&) {
- }
+ void CarbonsEnableParser::handleEndElement(const std::string&, const std::string&) {
+ }
+
+ void CarbonsEnableParser::handleCharacterData(const std::string&) {
+ }
- void CarbonsEnableParser::handleCharacterData(const std::string&) {
- }
-
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsEnableParser.h b/Swiften/Parser/PayloadParsers/CarbonsEnableParser.h
index d0e5771..0488f97 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsEnableParser.h
+++ b/Swiften/Parser/PayloadParsers/CarbonsEnableParser.h
@@ -11,12 +11,12 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API CarbonsEnableParser : public GenericPayloadParser<CarbonsEnable> {
- public:
- CarbonsEnableParser();
- virtual ~CarbonsEnableParser();
- virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string&);
- virtual void handleCharacterData(const std::string&);
- };
+ class SWIFTEN_API CarbonsEnableParser : public GenericPayloadParser<CarbonsEnable> {
+ public:
+ CarbonsEnableParser();
+ virtual ~CarbonsEnableParser();
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string&);
+ virtual void handleCharacterData(const std::string&);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.cpp
index 888edf1..b2038db 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.cpp
@@ -8,19 +8,19 @@
namespace Swift {
- CarbonsPrivateParser::CarbonsPrivateParser() : GenericPayloadParser<CarbonsPrivate>() {
- }
+ CarbonsPrivateParser::CarbonsPrivateParser() : GenericPayloadParser<CarbonsPrivate>() {
+ }
- CarbonsPrivateParser::~CarbonsPrivateParser() {
- }
+ CarbonsPrivateParser::~CarbonsPrivateParser() {
+ }
- void CarbonsPrivateParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- }
+ void CarbonsPrivateParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
+ }
- void CarbonsPrivateParser::handleEndElement(const std::string&, const std::string&) {
- }
+ void CarbonsPrivateParser::handleEndElement(const std::string&, const std::string&) {
+ }
+
+ void CarbonsPrivateParser::handleCharacterData(const std::string&) {
+ }
- void CarbonsPrivateParser::handleCharacterData(const std::string&) {
- }
-
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.h b/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.h
index 2797808..2ae3bae 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.h
+++ b/Swiften/Parser/PayloadParsers/CarbonsPrivateParser.h
@@ -11,12 +11,12 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API CarbonsPrivateParser : public GenericPayloadParser<CarbonsPrivate> {
- public:
- CarbonsPrivateParser();
- virtual ~CarbonsPrivateParser();
- virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string&);
- virtual void handleCharacterData(const std::string&);
- };
+ class SWIFTEN_API CarbonsPrivateParser : public GenericPayloadParser<CarbonsPrivate> {
+ public:
+ CarbonsPrivateParser();
+ virtual ~CarbonsPrivateParser();
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string&);
+ virtual void handleCharacterData(const std::string&);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp
index 267c541..d6fb6be 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp
@@ -7,39 +7,39 @@
#include <Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h>
namespace Swift {
- CarbonsReceivedParser::CarbonsReceivedParser(PayloadParserFactoryCollection* factories) : GenericPayloadParser<CarbonsReceived>(), factories_(factories), level_(TopLevel) {
- }
+ CarbonsReceivedParser::CarbonsReceivedParser(PayloadParserFactoryCollection* factories) : GenericPayloadParser<CarbonsReceived>(), factories_(factories), level_(TopLevel) {
+ }
- CarbonsReceivedParser::~CarbonsReceivedParser() {
- }
+ CarbonsReceivedParser::~CarbonsReceivedParser() {
+ }
- void CarbonsReceivedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "forwarded") {
- forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_));
- }
- }
- if (forwardedParser_) {
- forwardedParser_->handleStartElement(element, ns, attributes);
- }
- ++level_;
- }
+ void CarbonsReceivedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level_ == PayloadLevel) {
+ if (element == "forwarded") {
+ forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_));
+ }
+ }
+ if (forwardedParser_) {
+ forwardedParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
+ }
- void CarbonsReceivedParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
- if (forwardedParser_ && level_ >= PayloadLevel) {
- forwardedParser_->handleEndElement(element, ns);
- }
- if (forwardedParser_ && level_ == PayloadLevel) {
- /* done parsing nested stanza */
- getPayloadInternal()->setForwarded(forwardedParser_->getPayloadInternal());
- forwardedParser_.reset();
- }
- }
+ void CarbonsReceivedParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level_;
+ if (forwardedParser_ && level_ >= PayloadLevel) {
+ forwardedParser_->handleEndElement(element, ns);
+ }
+ if (forwardedParser_ && level_ == PayloadLevel) {
+ /* done parsing nested stanza */
+ getPayloadInternal()->setForwarded(forwardedParser_->getPayloadInternal());
+ forwardedParser_.reset();
+ }
+ }
- void CarbonsReceivedParser::handleCharacterData(const std::string& data) {
- if (forwardedParser_) {
- forwardedParser_->handleCharacterData(data);
- }
- }
+ void CarbonsReceivedParser::handleCharacterData(const std::string& data) {
+ if (forwardedParser_) {
+ forwardedParser_->handleCharacterData(data);
+ }
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h
index 6aa6326..666f20b 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h
+++ b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h
@@ -12,24 +12,24 @@
#include <Swiften/Parser/PayloadParsers/ForwardedParser.h>
namespace Swift {
- class SWIFTEN_API CarbonsReceivedParser : public GenericPayloadParser<CarbonsReceived> {
- public:
- CarbonsReceivedParser(PayloadParserFactoryCollection* factories);
- virtual ~CarbonsReceivedParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap&);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string&);
+ class SWIFTEN_API CarbonsReceivedParser : public GenericPayloadParser<CarbonsReceived> {
+ public:
+ CarbonsReceivedParser(PayloadParserFactoryCollection* factories);
+ virtual ~CarbonsReceivedParser();
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap&);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string&);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
- private:
- PayloadParserFactoryCollection* factories_;
- boost::shared_ptr<ForwardedParser> forwardedParser_;
- int level_;
- };
+ private:
+ PayloadParserFactoryCollection* factories_;
+ boost::shared_ptr<ForwardedParser> forwardedParser_;
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp
index b430249..e616211 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CarbonsSentParser.cpp
@@ -7,39 +7,39 @@
#include <Swiften/Parser/PayloadParsers/CarbonsSentParser.h>
namespace Swift {
- CarbonsSentParser::CarbonsSentParser(PayloadParserFactoryCollection* factories) : GenericPayloadParser<CarbonsSent>(), factories_(factories), level_(TopLevel) {
- }
+ CarbonsSentParser::CarbonsSentParser(PayloadParserFactoryCollection* factories) : GenericPayloadParser<CarbonsSent>(), factories_(factories), level_(TopLevel) {
+ }
- CarbonsSentParser::~CarbonsSentParser() {
- }
+ CarbonsSentParser::~CarbonsSentParser() {
+ }
- void CarbonsSentParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "forwarded") {
- forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_));
- }
- }
- if (forwardedParser_) {
- forwardedParser_->handleStartElement(element, ns, attributes);
- }
- ++level_;
- }
+ void CarbonsSentParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level_ == PayloadLevel) {
+ if (element == "forwarded") {
+ forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_));
+ }
+ }
+ if (forwardedParser_) {
+ forwardedParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
+ }
- void CarbonsSentParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
- if (forwardedParser_ && level_ >= PayloadLevel) {
- forwardedParser_->handleEndElement(element, ns);
- }
- if (forwardedParser_ && level_ == PayloadLevel) {
- /* done parsing nested stanza */
- getPayloadInternal()->setForwarded(forwardedParser_->getPayloadInternal());
- forwardedParser_.reset();
- }
- }
+ void CarbonsSentParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level_;
+ if (forwardedParser_ && level_ >= PayloadLevel) {
+ forwardedParser_->handleEndElement(element, ns);
+ }
+ if (forwardedParser_ && level_ == PayloadLevel) {
+ /* done parsing nested stanza */
+ getPayloadInternal()->setForwarded(forwardedParser_->getPayloadInternal());
+ forwardedParser_.reset();
+ }
+ }
- void CarbonsSentParser::handleCharacterData(const std::string& data) {
- if (forwardedParser_) {
- forwardedParser_->handleCharacterData(data);
- }
- }
+ void CarbonsSentParser::handleCharacterData(const std::string& data) {
+ if (forwardedParser_) {
+ forwardedParser_->handleCharacterData(data);
+ }
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/CarbonsSentParser.h b/Swiften/Parser/PayloadParsers/CarbonsSentParser.h
index 91c3292..9faf62d 100644
--- a/Swiften/Parser/PayloadParsers/CarbonsSentParser.h
+++ b/Swiften/Parser/PayloadParsers/CarbonsSentParser.h
@@ -12,24 +12,24 @@
#include <Swiften/Parser/PayloadParsers/ForwardedParser.h>
namespace Swift {
- class SWIFTEN_API CarbonsSentParser : public GenericPayloadParser<CarbonsSent> {
- public:
- CarbonsSentParser(PayloadParserFactoryCollection* factories);
- virtual ~CarbonsSentParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap&);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string&);
+ class SWIFTEN_API CarbonsSentParser : public GenericPayloadParser<CarbonsSent> {
+ public:
+ CarbonsSentParser(PayloadParserFactoryCollection* factories);
+ virtual ~CarbonsSentParser();
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap&);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string&);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
- private:
- PayloadParserFactoryCollection* factories_;
- boost::shared_ptr<ForwardedParser> forwardedParser_;
- int level_;
- };
+ private:
+ PayloadParserFactoryCollection* factories_;
+ boost::shared_ptr<ForwardedParser> forwardedParser_;
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParser.cpp b/Swiften/Parser/PayloadParsers/ChatStateParser.cpp
index bd5ecbe..75ec699 100644
--- a/Swiften/Parser/PayloadParsers/ChatStateParser.cpp
+++ b/Swiften/Parser/PayloadParsers/ChatStateParser.cpp
@@ -12,26 +12,26 @@ ChatStateParser::ChatStateParser() : level_(0) {
}
void ChatStateParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) {
- if (level_ == 0) {
- ChatState::ChatStateType state = ChatState::Active;
- if (element == "active") {
- state = ChatState::Active;
- } else if (element == "composing") {
- state = ChatState::Composing;
- } else if (element == "inactive") {
- state = ChatState::Inactive;
- } else if (element == "paused") {
- state = ChatState::Paused;
- } else if (element == "gone") {
- state = ChatState::Gone;
- }
- getPayloadInternal()->setChatState(state);
- }
- ++level_;
+ if (level_ == 0) {
+ ChatState::ChatStateType state = ChatState::Active;
+ if (element == "active") {
+ state = ChatState::Active;
+ } else if (element == "composing") {
+ state = ChatState::Composing;
+ } else if (element == "inactive") {
+ state = ChatState::Inactive;
+ } else if (element == "paused") {
+ state = ChatState::Paused;
+ } else if (element == "gone") {
+ state = ChatState::Gone;
+ }
+ getPayloadInternal()->setChatState(state);
+ }
+ ++level_;
}
void ChatStateParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
+ --level_;
}
void ChatStateParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParser.h b/Swiften/Parser/PayloadParsers/ChatStateParser.h
index e18e17b..b932a5c 100644
--- a/Swiften/Parser/PayloadParsers/ChatStateParser.h
+++ b/Swiften/Parser/PayloadParsers/ChatStateParser.h
@@ -11,15 +11,15 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API ChatStateParser : public GenericPayloadParser<ChatState> {
- public:
- ChatStateParser();
+ class SWIFTEN_API ChatStateParser : public GenericPayloadParser<ChatState> {
+ public:
+ ChatStateParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- };
+ private:
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
index ac1c14d..cf226cc 100644
--- a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
@@ -11,22 +11,22 @@
#include <Swiften/Parser/PayloadParsers/ChatStateParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API ChatStateParserFactory : public PayloadParserFactory {
- public:
- ChatStateParserFactory() {
- }
+ class SWIFTEN_API ChatStateParserFactory : public PayloadParserFactory {
+ public:
+ ChatStateParserFactory() {
+ }
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return ns == "http://jabber.org/protocol/chatstates" &&
- (element == "active" || element == "composing"
- || element == "paused" || element == "inactive" || element == "gone");
- }
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return ns == "http://jabber.org/protocol/chatstates" &&
+ (element == "active" || element == "composing"
+ || element == "paused" || element == "inactive" || element == "gone");
+ }
- virtual PayloadParser* createPayloadParser() {
- return new ChatStateParser();
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new ChatStateParser();
+ }
- };
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp
index 91384db..1d2ddea 100644
--- a/Swiften/Parser/PayloadParsers/CommandParser.cpp
+++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp
@@ -14,130 +14,130 @@
namespace Swift {
CommandParser::CommandParser() : level_(TopLevel), inNote_(false), inActions_(false), noteType_(Command::Note::Info), formParser_(0) {
- formParserFactory_ = new FormParserFactory();
+ formParserFactory_ = new FormParserFactory();
}
CommandParser::~CommandParser() {
- delete formParserFactory_;
+ delete formParserFactory_;
}
void CommandParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- ++level_;
- if (level_ == PayloadLevel) {
- boost::optional<Command::Action> action = parseAction(attributes.getAttribute("action"));
- if (action) {
- getPayloadInternal()->setAction(*action);
- }
+ ++level_;
+ if (level_ == PayloadLevel) {
+ boost::optional<Command::Action> action = parseAction(attributes.getAttribute("action"));
+ if (action) {
+ getPayloadInternal()->setAction(*action);
+ }
- std::string status = attributes.getAttribute("status");
- if (status == "executing") {
- getPayloadInternal()->setStatus(Command::Executing);
- }
- else if (status == "completed") {
- getPayloadInternal()->setStatus(Command::Completed);
- }
- else if (status == "canceled") {
- getPayloadInternal()->setStatus(Command::Canceled);
- }
+ std::string status = attributes.getAttribute("status");
+ if (status == "executing") {
+ getPayloadInternal()->setStatus(Command::Executing);
+ }
+ else if (status == "completed") {
+ getPayloadInternal()->setStatus(Command::Completed);
+ }
+ else if (status == "canceled") {
+ getPayloadInternal()->setStatus(Command::Canceled);
+ }
- getPayloadInternal()->setNode(attributes.getAttribute("node"));
- getPayloadInternal()->setSessionID(attributes.getAttribute("sessionid"));
- }
- else if (level_ == FormOrNoteOrActionsLevel) {
- assert(!formParser_);
- if (formParserFactory_->canParse(element, ns, attributes)) {
- formParser_ = boost::polymorphic_downcast<FormParser*>(formParserFactory_->createPayloadParser());
- assert(formParser_);
- }
- else if (element == "note") {
- inNote_ = true;
- currentText_.clear();
- std::string noteType = attributes.getAttribute("type");
- if (noteType == "info") {
- noteType_ = Command::Note::Info;
- }
- else if (noteType == "warn") {
- noteType_ = Command::Note::Warn;
- }
- else if (noteType == "error") {
- noteType_ = Command::Note::Error;
- }
- else {
- noteType_ = Command::Note::Info;
- }
- }
- else if (element == "actions") {
- inActions_ = true;
- boost::optional<Command::Action> action = parseAction(attributes.getAttribute("execute"));
- if (action) {
- getPayloadInternal()->setExecuteAction(*action);
- }
- }
- }
- else if (level_ == ActionsActionLevel) {
- }
+ getPayloadInternal()->setNode(attributes.getAttribute("node"));
+ getPayloadInternal()->setSessionID(attributes.getAttribute("sessionid"));
+ }
+ else if (level_ == FormOrNoteOrActionsLevel) {
+ assert(!formParser_);
+ if (formParserFactory_->canParse(element, ns, attributes)) {
+ formParser_ = boost::polymorphic_downcast<FormParser*>(formParserFactory_->createPayloadParser());
+ assert(formParser_);
+ }
+ else if (element == "note") {
+ inNote_ = true;
+ currentText_.clear();
+ std::string noteType = attributes.getAttribute("type");
+ if (noteType == "info") {
+ noteType_ = Command::Note::Info;
+ }
+ else if (noteType == "warn") {
+ noteType_ = Command::Note::Warn;
+ }
+ else if (noteType == "error") {
+ noteType_ = Command::Note::Error;
+ }
+ else {
+ noteType_ = Command::Note::Info;
+ }
+ }
+ else if (element == "actions") {
+ inActions_ = true;
+ boost::optional<Command::Action> action = parseAction(attributes.getAttribute("execute"));
+ if (action) {
+ getPayloadInternal()->setExecuteAction(*action);
+ }
+ }
+ }
+ else if (level_ == ActionsActionLevel) {
+ }
- if (formParser_) {
- formParser_->handleStartElement(element, ns, attributes);
- }
+ if (formParser_) {
+ formParser_->handleStartElement(element, ns, attributes);
+ }
}
void CommandParser::handleEndElement(const std::string& element, const std::string& ns) {
- if (formParser_) {
- formParser_->handleEndElement(element, ns);
- }
+ if (formParser_) {
+ formParser_->handleEndElement(element, ns);
+ }
- if (level_ == FormOrNoteOrActionsLevel) {
- if (formParser_) {
- Form::ref form(boost::dynamic_pointer_cast<Form>(formParser_->getPayload()));
- assert(form);
- getPayloadInternal()->setForm(form);
- delete formParser_;
- formParser_ = 0;
- }
- else if (inNote_) {
- inNote_ = false;
- getPayloadInternal()->addNote(Command::Note(currentText_, noteType_));
- }
- else if (inActions_) {
- inActions_ = false;
- }
- }
- else if (level_ == ActionsActionLevel && inActions_) {
- boost::optional<Command::Action> action = parseAction(element);
- if (action) {
- getPayloadInternal()->addAvailableAction(*action);
- }
- }
- --level_;
+ if (level_ == FormOrNoteOrActionsLevel) {
+ if (formParser_) {
+ Form::ref form(boost::dynamic_pointer_cast<Form>(formParser_->getPayload()));
+ assert(form);
+ getPayloadInternal()->setForm(form);
+ delete formParser_;
+ formParser_ = 0;
+ }
+ else if (inNote_) {
+ inNote_ = false;
+ getPayloadInternal()->addNote(Command::Note(currentText_, noteType_));
+ }
+ else if (inActions_) {
+ inActions_ = false;
+ }
+ }
+ else if (level_ == ActionsActionLevel && inActions_) {
+ boost::optional<Command::Action> action = parseAction(element);
+ if (action) {
+ getPayloadInternal()->addAvailableAction(*action);
+ }
+ }
+ --level_;
}
void CommandParser::handleCharacterData(const std::string& data) {
- if (formParser_) {
- formParser_->handleCharacterData(data);
- }
- else {
- currentText_ += data;
- }
+ if (formParser_) {
+ formParser_->handleCharacterData(data);
+ }
+ else {
+ currentText_ += data;
+ }
}
boost::optional<Command::Action> CommandParser::parseAction(const std::string& action) {
- if (action == "execute") {
- return Command::Execute;
- }
- else if (action == "cancel") {
- return Command::Cancel;
- }
- else if (action == "prev") {
- return Command::Prev;
- }
- else if (action == "next") {
- return Command::Next;
- }
- else if (action == "complete") {
- return Command::Complete;
- }
- return boost::optional<Command::Action>();
+ if (action == "execute") {
+ return Command::Execute;
+ }
+ else if (action == "cancel") {
+ return Command::Cancel;
+ }
+ else if (action == "prev") {
+ return Command::Prev;
+ }
+ else if (action == "next") {
+ return Command::Next;
+ }
+ else if (action == "complete") {
+ return Command::Complete;
+ }
+ return boost::optional<Command::Action>();
}
}
diff --git a/Swiften/Parser/PayloadParsers/CommandParser.h b/Swiften/Parser/PayloadParsers/CommandParser.h
index 11badd4..105953a 100644
--- a/Swiften/Parser/PayloadParsers/CommandParser.h
+++ b/Swiften/Parser/PayloadParsers/CommandParser.h
@@ -13,34 +13,34 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class FormParserFactory;
- class FormParser;
-
- class SWIFTEN_API CommandParser : public GenericPayloadParser<Command> {
- public:
- CommandParser();
- ~CommandParser();
-
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
-
- private:
- static boost::optional<Command::Action> parseAction(const std::string& action);
-
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1,
- FormOrNoteOrActionsLevel = 2,
- ActionsActionLevel = 3
- };
- int level_;
- bool inNote_;
- bool inActions_;
- Command::Note::Type noteType_;
- FormParserFactory* formParserFactory_;
- FormParser* formParser_;
- std::string currentText_;
- };
+ class FormParserFactory;
+ class FormParser;
+
+ class SWIFTEN_API CommandParser : public GenericPayloadParser<Command> {
+ public:
+ CommandParser();
+ ~CommandParser();
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
+
+ private:
+ static boost::optional<Command::Action> parseAction(const std::string& action);
+
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1,
+ FormOrNoteOrActionsLevel = 2,
+ ActionsActionLevel = 3
+ };
+ int level_;
+ bool inNote_;
+ bool inActions_;
+ Command::Note::Type noteType_;
+ FormParserFactory* formParserFactory_;
+ FormParser* formParser_;
+ std::string currentText_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DelayParser.cpp b/Swiften/Parser/PayloadParsers/DelayParser.cpp
index b8e72d8..95371b7 100644
--- a/Swiften/Parser/PayloadParsers/DelayParser.cpp
+++ b/Swiften/Parser/PayloadParsers/DelayParser.cpp
@@ -14,19 +14,19 @@ DelayParser::DelayParser() : level_(0) {
}
void DelayParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& attributes) {
- if (level_ == 0) {
- boost::posix_time::ptime stamp = stringToDateTime(attributes.getAttribute("stamp"));
- getPayloadInternal()->setStamp(stamp);
- if (!attributes.getAttribute("from").empty()) {
- std::string from = attributes.getAttribute("from");
- getPayloadInternal()->setFrom(JID(from));
- }
- }
- ++level_;
+ if (level_ == 0) {
+ boost::posix_time::ptime stamp = stringToDateTime(attributes.getAttribute("stamp"));
+ getPayloadInternal()->setStamp(stamp);
+ if (!attributes.getAttribute("from").empty()) {
+ std::string from = attributes.getAttribute("from");
+ getPayloadInternal()->setFrom(JID(from));
+ }
+ }
+ ++level_;
}
void DelayParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
+ --level_;
}
void DelayParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/DelayParser.h b/Swiften/Parser/PayloadParsers/DelayParser.h
index d5fa58f..d9bf44b 100644
--- a/Swiften/Parser/PayloadParsers/DelayParser.h
+++ b/Swiften/Parser/PayloadParsers/DelayParser.h
@@ -11,15 +11,15 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API DelayParser : public GenericPayloadParser<Delay> {
- public:
- DelayParser();
+ class SWIFTEN_API DelayParser : public GenericPayloadParser<Delay> {
+ public:
+ DelayParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- };
+ private:
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.cpp b/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.cpp
index 347200d..b6f0a86 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.cpp
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.cpp
@@ -14,18 +14,18 @@ DeliveryReceiptParser::DeliveryReceiptParser() : level_(0) {
}
void DeliveryReceiptParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributeMap) {
- if (level_ == 0) {
- if (element == "received") {
- if (attributeMap.getAttributeValue("id").is_initialized()) {
- getPayloadInternal()->setReceivedID(attributeMap.getAttributeValue("id").get());
- }
- }
- }
- ++level_;
+ if (level_ == 0) {
+ if (element == "received") {
+ if (attributeMap.getAttributeValue("id").is_initialized()) {
+ getPayloadInternal()->setReceivedID(attributeMap.getAttributeValue("id").get());
+ }
+ }
+ }
+ ++level_;
}
void DeliveryReceiptParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
+ --level_;
}
void DeliveryReceiptParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h
index bcb73f3..5cc0009 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h
@@ -17,15 +17,15 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API DeliveryReceiptParser : public GenericPayloadParser<DeliveryReceipt> {
- public:
- DeliveryReceiptParser();
+ class SWIFTEN_API DeliveryReceiptParser : public GenericPayloadParser<DeliveryReceipt> {
+ public:
+ DeliveryReceiptParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributeMap);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributeMap);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- };
+ private:
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h
index aa5d856..dc0c311 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h
@@ -17,20 +17,20 @@
#include <Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API DeliveryReceiptParserFactory : public PayloadParserFactory {
- public:
- DeliveryReceiptParserFactory() {
- }
+ class SWIFTEN_API DeliveryReceiptParserFactory : public PayloadParserFactory {
+ public:
+ DeliveryReceiptParserFactory() {
+ }
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return ns == "urn:xmpp:receipts" && element == "received";
- }
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return ns == "urn:xmpp:receipts" && element == "received";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new DeliveryReceiptParser();
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new DeliveryReceiptParser();
+ }
- };
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h
index 5bf27fa..d8a68b0 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h
@@ -17,12 +17,12 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API DeliveryReceiptRequestParser : public GenericPayloadParser<DeliveryReceiptRequest> {
- public:
- DeliveryReceiptRequestParser();
+ class SWIFTEN_API DeliveryReceiptRequestParser : public GenericPayloadParser<DeliveryReceiptRequest> {
+ public:
+ DeliveryReceiptRequestParser();
- virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
- virtual void handleEndElement(const std::string&, const std::string&);
- virtual void handleCharacterData(const std::string& data);
- };
+ virtual void handleStartElement(const std::string&, const std::string&, const AttributeMap&);
+ virtual void handleEndElement(const std::string&, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h
index 509db63..a858285 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h
@@ -17,20 +17,20 @@
#include <Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API DeliveryReceiptRequestParserFactory : public PayloadParserFactory {
- public:
- DeliveryReceiptRequestParserFactory() {
- }
+ class SWIFTEN_API DeliveryReceiptRequestParserFactory : public PayloadParserFactory {
+ public:
+ DeliveryReceiptRequestParserFactory() {
+ }
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return ns == "urn:xmpp:receipts" && element == "request";
- }
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return ns == "urn:xmpp:receipts" && element == "request";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new DeliveryReceiptRequestParser();
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new DeliveryReceiptRequestParser();
+ }
- };
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
index 9786b37..7dffa88 100644
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
@@ -16,45 +16,45 @@ DiscoInfoParser::DiscoInfoParser() : level_(TopLevel), formParser_(NULL) {
}
void DiscoInfoParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- if (attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributes.getAttributeValue("node"));
- }
- }
- else if (level_ == PayloadLevel) {
- if (element == "identity") {
- getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang", "http://www.w3.org/XML/1998/namespace")));
- }
- else if (element == "feature") {
- getPayloadInternal()->addFeature(attributes.getAttribute("var"));
- }
- else if (element == "x" && ns == "jabber:x:data") {
- assert(!formParser_);
- formParser_ = new FormParser();
- }
- }
- if (formParser_) {
- formParser_->handleStartElement(element, ns, attributes);
- }
- ++level_;
+ if (level_ == TopLevel) {
+ if (attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributes.getAttributeValue("node"));
+ }
+ }
+ else if (level_ == PayloadLevel) {
+ if (element == "identity") {
+ getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang", "http://www.w3.org/XML/1998/namespace")));
+ }
+ else if (element == "feature") {
+ getPayloadInternal()->addFeature(attributes.getAttribute("var"));
+ }
+ else if (element == "x" && ns == "jabber:x:data") {
+ assert(!formParser_);
+ formParser_ = new FormParser();
+ }
+ }
+ if (formParser_) {
+ formParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
}
void DiscoInfoParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
- if (formParser_) {
- formParser_->handleEndElement(element, ns);
- }
- if (level_ == PayloadLevel && formParser_) {
- getPayloadInternal()->addExtension(formParser_->getPayloadInternal());
- delete formParser_;
- formParser_ = NULL;
- }
+ --level_;
+ if (formParser_) {
+ formParser_->handleEndElement(element, ns);
+ }
+ if (level_ == PayloadLevel && formParser_) {
+ getPayloadInternal()->addExtension(formParser_->getPayloadInternal());
+ delete formParser_;
+ formParser_ = NULL;
+ }
}
void DiscoInfoParser::handleCharacterData(const std::string& data) {
- if (formParser_) {
- formParser_->handleCharacterData(data);
- }
+ if (formParser_) {
+ formParser_->handleCharacterData(data);
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
index 3d10c4b..28bfff1 100644
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
+++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
@@ -11,20 +11,20 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API DiscoInfoParser : public GenericPayloadParser<DiscoInfo> {
- public:
- DiscoInfoParser();
+ class SWIFTEN_API DiscoInfoParser : public GenericPayloadParser<DiscoInfo> {
+ public:
+ DiscoInfoParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level_;
- FormParser* formParser_;
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+ int level_;
+ FormParser* formParser_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp b/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp
index 179fb29..a3b9245 100644
--- a/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp
@@ -12,21 +12,21 @@ DiscoItemsParser::DiscoItemsParser() : level_(TopLevel) {
}
void DiscoItemsParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "item") {
- getPayloadInternal()->addItem(DiscoItems::Item(attributes.getAttribute("name"), JID(attributes.getAttribute("jid")), attributes.getAttribute("node")));
- }
- }
- else if (level_ == TopLevel) {
- if (element == "query") {
- getPayloadInternal()->setNode(attributes.getAttribute("node"));
- }
- }
- ++level_;
+ if (level_ == PayloadLevel) {
+ if (element == "item") {
+ getPayloadInternal()->addItem(DiscoItems::Item(attributes.getAttribute("name"), JID(attributes.getAttribute("jid")), attributes.getAttribute("node")));
+ }
+ }
+ else if (level_ == TopLevel) {
+ if (element == "query") {
+ getPayloadInternal()->setNode(attributes.getAttribute("node"));
+ }
+ }
+ ++level_;
}
void DiscoItemsParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
+ --level_;
}
void DiscoItemsParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/DiscoItemsParser.h b/Swiften/Parser/PayloadParsers/DiscoItemsParser.h
index b467ca1..3197b79 100644
--- a/Swiften/Parser/PayloadParsers/DiscoItemsParser.h
+++ b/Swiften/Parser/PayloadParsers/DiscoItemsParser.h
@@ -11,20 +11,20 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API DiscoItemsParser : public GenericPayloadParser<DiscoItems> {
- public:
- DiscoItemsParser();
+ class SWIFTEN_API DiscoItemsParser : public GenericPayloadParser<DiscoItems> {
+ public:
+ DiscoItemsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level_;
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.cpp b/Swiften/Parser/PayloadParsers/ErrorParser.cpp
index ace305b..222bcbd 100644
--- a/Swiften/Parser/PayloadParsers/ErrorParser.cpp
+++ b/Swiften/Parser/PayloadParsers/ErrorParser.cpp
@@ -15,132 +15,132 @@ ErrorParser::ErrorParser(PayloadParserFactoryCollection* factories) : factories(
}
void ErrorParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- std::string type = attributes.getAttribute("type");
- if (type == "continue") {
- getPayloadInternal()->setType(ErrorPayload::Continue);
- }
- else if (type == "modify") {
- getPayloadInternal()->setType(ErrorPayload::Modify);
- }
- else if (type == "auth") {
- getPayloadInternal()->setType(ErrorPayload::Auth);
- }
- else if (type == "wait") {
- getPayloadInternal()->setType(ErrorPayload::Wait);
- }
- else {
- getPayloadInternal()->setType(ErrorPayload::Cancel);
- }
- }
- else if (level_ == PayloadLevel) {
- if (element == "text") {
+ if (level_ == TopLevel) {
+ std::string type = attributes.getAttribute("type");
+ if (type == "continue") {
+ getPayloadInternal()->setType(ErrorPayload::Continue);
+ }
+ else if (type == "modify") {
+ getPayloadInternal()->setType(ErrorPayload::Modify);
+ }
+ else if (type == "auth") {
+ getPayloadInternal()->setType(ErrorPayload::Auth);
+ }
+ else if (type == "wait") {
+ getPayloadInternal()->setType(ErrorPayload::Wait);
+ }
+ else {
+ getPayloadInternal()->setType(ErrorPayload::Cancel);
+ }
+ }
+ else if (level_ == PayloadLevel) {
+ if (element == "text") {
- }
- else if (element == "bad-request") {
- getPayloadInternal()->setCondition(ErrorPayload::BadRequest);
- }
- else if (element == "conflict") {
- getPayloadInternal()->setCondition(ErrorPayload::Conflict);
- }
- else if (element == "feature-not-implemented") {
- getPayloadInternal()->setCondition(ErrorPayload::FeatureNotImplemented);
- }
- else if (element == "forbidden") {
- getPayloadInternal()->setCondition(ErrorPayload::Forbidden);
- }
- else if (element == "gone") {
- getPayloadInternal()->setCondition(ErrorPayload::Gone);
- }
- else if (element == "internal-server-error") {
- getPayloadInternal()->setCondition(ErrorPayload::InternalServerError);
- }
- else if (element == "item-not-found") {
- getPayloadInternal()->setCondition(ErrorPayload::ItemNotFound);
- }
- else if (element == "jid-malformed") {
- getPayloadInternal()->setCondition(ErrorPayload::JIDMalformed);
- }
- else if (element == "not-acceptable") {
- getPayloadInternal()->setCondition(ErrorPayload::NotAcceptable);
- }
- else if (element == "not-allowed") {
- getPayloadInternal()->setCondition(ErrorPayload::NotAllowed);
- }
- else if (element == "not-authorized") {
- getPayloadInternal()->setCondition(ErrorPayload::NotAuthorized);
- }
- else if (element == "payment-required") {
- getPayloadInternal()->setCondition(ErrorPayload::PaymentRequired);
- }
- else if (element == "recipient-unavailable") {
- getPayloadInternal()->setCondition(ErrorPayload::RecipientUnavailable);
- }
- else if (element == "redirect") {
- getPayloadInternal()->setCondition(ErrorPayload::Redirect);
- }
- else if (element == "registration-required") {
- getPayloadInternal()->setCondition(ErrorPayload::RegistrationRequired);
- }
- else if (element == "remote-server-not-found") {
- getPayloadInternal()->setCondition(ErrorPayload::RemoteServerNotFound);
- }
- else if (element == "remote-server-timeout") {
- getPayloadInternal()->setCondition(ErrorPayload::RemoteServerTimeout);
- }
- else if (element == "resource-constraint") {
- getPayloadInternal()->setCondition(ErrorPayload::ResourceConstraint);
- }
- else if (element == "service-unavailable") {
- getPayloadInternal()->setCondition(ErrorPayload::ServiceUnavailable);
- }
- else if (element == "subscription-required") {
- getPayloadInternal()->setCondition(ErrorPayload::SubscriptionRequired);
- }
- else if (element == "unexpected-request") {
- getPayloadInternal()->setCondition(ErrorPayload::UnexpectedRequest);
- }
- else {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- } else {
- getPayloadInternal()->setCondition(ErrorPayload::UndefinedCondition);
- }
- }
- }
- if (level_ >= PayloadLevel && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level_;
+ }
+ else if (element == "bad-request") {
+ getPayloadInternal()->setCondition(ErrorPayload::BadRequest);
+ }
+ else if (element == "conflict") {
+ getPayloadInternal()->setCondition(ErrorPayload::Conflict);
+ }
+ else if (element == "feature-not-implemented") {
+ getPayloadInternal()->setCondition(ErrorPayload::FeatureNotImplemented);
+ }
+ else if (element == "forbidden") {
+ getPayloadInternal()->setCondition(ErrorPayload::Forbidden);
+ }
+ else if (element == "gone") {
+ getPayloadInternal()->setCondition(ErrorPayload::Gone);
+ }
+ else if (element == "internal-server-error") {
+ getPayloadInternal()->setCondition(ErrorPayload::InternalServerError);
+ }
+ else if (element == "item-not-found") {
+ getPayloadInternal()->setCondition(ErrorPayload::ItemNotFound);
+ }
+ else if (element == "jid-malformed") {
+ getPayloadInternal()->setCondition(ErrorPayload::JIDMalformed);
+ }
+ else if (element == "not-acceptable") {
+ getPayloadInternal()->setCondition(ErrorPayload::NotAcceptable);
+ }
+ else if (element == "not-allowed") {
+ getPayloadInternal()->setCondition(ErrorPayload::NotAllowed);
+ }
+ else if (element == "not-authorized") {
+ getPayloadInternal()->setCondition(ErrorPayload::NotAuthorized);
+ }
+ else if (element == "payment-required") {
+ getPayloadInternal()->setCondition(ErrorPayload::PaymentRequired);
+ }
+ else if (element == "recipient-unavailable") {
+ getPayloadInternal()->setCondition(ErrorPayload::RecipientUnavailable);
+ }
+ else if (element == "redirect") {
+ getPayloadInternal()->setCondition(ErrorPayload::Redirect);
+ }
+ else if (element == "registration-required") {
+ getPayloadInternal()->setCondition(ErrorPayload::RegistrationRequired);
+ }
+ else if (element == "remote-server-not-found") {
+ getPayloadInternal()->setCondition(ErrorPayload::RemoteServerNotFound);
+ }
+ else if (element == "remote-server-timeout") {
+ getPayloadInternal()->setCondition(ErrorPayload::RemoteServerTimeout);
+ }
+ else if (element == "resource-constraint") {
+ getPayloadInternal()->setCondition(ErrorPayload::ResourceConstraint);
+ }
+ else if (element == "service-unavailable") {
+ getPayloadInternal()->setCondition(ErrorPayload::ServiceUnavailable);
+ }
+ else if (element == "subscription-required") {
+ getPayloadInternal()->setCondition(ErrorPayload::SubscriptionRequired);
+ }
+ else if (element == "unexpected-request") {
+ getPayloadInternal()->setCondition(ErrorPayload::UnexpectedRequest);
+ }
+ else {
+ PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
+ } else {
+ getPayloadInternal()->setCondition(ErrorPayload::UndefinedCondition);
+ }
+ }
+ }
+ if (level_ >= PayloadLevel && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
}
void ErrorParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
- if (currentPayloadParser) {
- if (level_ >= PayloadLevel) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level_;
+ if (currentPayloadParser) {
+ if (level_ >= PayloadLevel) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level_ == PayloadLevel) {
- getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
- currentPayloadParser.reset();
- }
- }
- else if (level_ == PayloadLevel) {
- if (element == "text") {
- getPayloadInternal()->setText(currentText_);
- }
- }
+ if (level_ == PayloadLevel) {
+ getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
+ currentPayloadParser.reset();
+ }
+ }
+ else if (level_ == PayloadLevel) {
+ if (element == "text") {
+ getPayloadInternal()->setText(currentText_);
+ }
+ }
}
void ErrorParser::handleCharacterData(const std::string& data) {
- if (level_ > PayloadLevel && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
- else {
- currentText_ += data;
- }
+ if (level_ > PayloadLevel && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
+ else {
+ currentText_ += data;
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/ErrorParser.h b/Swiften/Parser/PayloadParsers/ErrorParser.h
index fc4a5cb..dd1aa95 100644
--- a/Swiften/Parser/PayloadParsers/ErrorParser.h
+++ b/Swiften/Parser/PayloadParsers/ErrorParser.h
@@ -11,23 +11,23 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class SWIFTEN_API ErrorParser : public GenericPayloadParser<ErrorPayload> {
- public:
- ErrorParser(PayloadParserFactoryCollection* factories);
+ class PayloadParserFactoryCollection;
+ class SWIFTEN_API ErrorParser : public GenericPayloadParser<ErrorPayload> {
+ public:
+ ErrorParser(PayloadParserFactoryCollection* factories);
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- PayloadParserFactoryCollection* factories;
- int level_;
- std::string currentText_;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+ PayloadParserFactoryCollection* factories;
+ int level_;
+ std::string currentText_;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/ErrorParserFactory.h b/Swiften/Parser/PayloadParsers/ErrorParserFactory.h
index bcced8b..d8f09bf 100644
--- a/Swiften/Parser/PayloadParsers/ErrorParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/ErrorParserFactory.h
@@ -11,23 +11,23 @@
#include <Swiften/Parser/PayloadParsers/ErrorParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API ErrorParserFactory : public PayloadParserFactory {
- public:
- ErrorParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
+ class SWIFTEN_API ErrorParserFactory : public PayloadParserFactory {
+ public:
+ ErrorParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
- virtual bool canParse(const std::string& element, const std::string& /*ns*/, const AttributeMap&) const {
- return element == "error";
- }
+ virtual bool canParse(const std::string& element, const std::string& /*ns*/, const AttributeMap&) const {
+ return element == "error";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new ErrorParser(factories);
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new ErrorParser(factories);
+ }
- private:
- PayloadParserFactoryCollection* factories;
+ private:
+ PayloadParserFactoryCollection* factories;
- };
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/FormParser.cpp b/Swiften/Parser/PayloadParsers/FormParser.cpp
index b66dadc..3a2c880 100644
--- a/Swiften/Parser/PayloadParsers/FormParser.cpp
+++ b/Swiften/Parser/PayloadParsers/FormParser.cpp
@@ -16,240 +16,240 @@ FormParser::FormParser() : level_(TopLevel), parsingItem_(false), parsingReporte
}
void FormParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- std::string type = attributes.getAttribute("type");
- if (type == "form") {
- getPayloadInternal()->setType(Form::FormType);
- }
- else if (type == "submit") {
- getPayloadInternal()->setType(Form::SubmitType);
- }
- else if (type == "cancel") {
- getPayloadInternal()->setType(Form::CancelType);
- }
- else if (type == "result") {
- getPayloadInternal()->setType(Form::ResultType);
- }
- }
- else if (level_ == PayloadLevel) {
- if (element == "title") {
- currentText_.clear();
- }
- else if (element == "instructions") {
- currentText_.clear();
- }
- else if (element == "reported") {
- parsingReported_ = true;
- }
- else if (element == "item") {
- parsingItem_ = true;
- }
- else if (element == "page") {
- currentPage_ = boost::make_shared<FormPage>();
- currentPage_->setLabel(attributes.getAttribute("label"));
- }
- }
- else if (level_ == FieldLevel && currentField_) {
- currentText_.clear();
- if (element == "option") {
- currentOptionLabel_ = attributes.getAttribute("label");
- currentOptionValue_ = "";
- parsingOption_ = true;
- }
- }
- if (level_ >= PayloadLevel) {
- if (element == "field") {
- currentField_ = boost::make_shared<FormField>();
- std::string type = attributes.getAttribute("type");
- FormField::Type fieldType = FormField::UnknownType;
- if (type == "boolean") {
- fieldType = FormField::BooleanType;
- }
- if (type == "fixed") {
- fieldType = FormField::FixedType;
- }
- if (type == "hidden") {
- fieldType = FormField::HiddenType;
- }
- if (type == "list-single") {
- fieldType = FormField::ListSingleType;
- }
- if (type == "text-multi") {
- fieldType = FormField::TextMultiType;
- }
- if (type == "text-private") {
- fieldType = FormField::TextPrivateType;
- }
- if (type == "text-single") {
- fieldType = FormField::TextSingleType;
- }
- if (type == "jid-single") {
- fieldType = FormField::JIDSingleType;
- }
- if (type == "jid-multi") {
- fieldType = FormField::JIDMultiType;
- }
- if (type == "list-multi") {
- fieldType = FormField::ListMultiType;
- }
- currentField_->setType(fieldType);
- currentField_->setName(attributes.getAttribute("var"));
- currentField_->setLabel(attributes.getAttribute("label"));
- }
- else if (element == "value") {
- currentText_.clear();
- }
- }
- if (level_ > PayloadLevel) {
- if (element == "section") {
- currentSection_ = boost::make_shared<FormSection>();
- currentSection_->setLabel(attributes.getAttribute("label"));
- sectionStack_.push_back(currentSection_);
- currentSections_.push_back(currentSection_);
- }
- if (element == "reportedref") {
- currentReportedRef_ = boost::make_shared<FormReportedRef>();
- }
- if (element == "fieldref") {
- currentText_.clear();
- currentFieldRef_ = attributes.getAttribute("var");
- if (sectionStack_.size() > 0) {
- sectionStack_.at(sectionStack_.size()-1)->addFieldRef(currentFieldRef_);
- } else if (currentPage_) {
- currentPage_->addFieldRef(currentFieldRef_);
- }
- }
- if (element == "text") {
- currentText_.clear();
- currentTextElement_ = boost::make_shared<FormText>();
- }
- }
- ++level_;
+ if (level_ == TopLevel) {
+ std::string type = attributes.getAttribute("type");
+ if (type == "form") {
+ getPayloadInternal()->setType(Form::FormType);
+ }
+ else if (type == "submit") {
+ getPayloadInternal()->setType(Form::SubmitType);
+ }
+ else if (type == "cancel") {
+ getPayloadInternal()->setType(Form::CancelType);
+ }
+ else if (type == "result") {
+ getPayloadInternal()->setType(Form::ResultType);
+ }
+ }
+ else if (level_ == PayloadLevel) {
+ if (element == "title") {
+ currentText_.clear();
+ }
+ else if (element == "instructions") {
+ currentText_.clear();
+ }
+ else if (element == "reported") {
+ parsingReported_ = true;
+ }
+ else if (element == "item") {
+ parsingItem_ = true;
+ }
+ else if (element == "page") {
+ currentPage_ = boost::make_shared<FormPage>();
+ currentPage_->setLabel(attributes.getAttribute("label"));
+ }
+ }
+ else if (level_ == FieldLevel && currentField_) {
+ currentText_.clear();
+ if (element == "option") {
+ currentOptionLabel_ = attributes.getAttribute("label");
+ currentOptionValue_ = "";
+ parsingOption_ = true;
+ }
+ }
+ if (level_ >= PayloadLevel) {
+ if (element == "field") {
+ currentField_ = boost::make_shared<FormField>();
+ std::string type = attributes.getAttribute("type");
+ FormField::Type fieldType = FormField::UnknownType;
+ if (type == "boolean") {
+ fieldType = FormField::BooleanType;
+ }
+ if (type == "fixed") {
+ fieldType = FormField::FixedType;
+ }
+ if (type == "hidden") {
+ fieldType = FormField::HiddenType;
+ }
+ if (type == "list-single") {
+ fieldType = FormField::ListSingleType;
+ }
+ if (type == "text-multi") {
+ fieldType = FormField::TextMultiType;
+ }
+ if (type == "text-private") {
+ fieldType = FormField::TextPrivateType;
+ }
+ if (type == "text-single") {
+ fieldType = FormField::TextSingleType;
+ }
+ if (type == "jid-single") {
+ fieldType = FormField::JIDSingleType;
+ }
+ if (type == "jid-multi") {
+ fieldType = FormField::JIDMultiType;
+ }
+ if (type == "list-multi") {
+ fieldType = FormField::ListMultiType;
+ }
+ currentField_->setType(fieldType);
+ currentField_->setName(attributes.getAttribute("var"));
+ currentField_->setLabel(attributes.getAttribute("label"));
+ }
+ else if (element == "value") {
+ currentText_.clear();
+ }
+ }
+ if (level_ > PayloadLevel) {
+ if (element == "section") {
+ currentSection_ = boost::make_shared<FormSection>();
+ currentSection_->setLabel(attributes.getAttribute("label"));
+ sectionStack_.push_back(currentSection_);
+ currentSections_.push_back(currentSection_);
+ }
+ if (element == "reportedref") {
+ currentReportedRef_ = boost::make_shared<FormReportedRef>();
+ }
+ if (element == "fieldref") {
+ currentText_.clear();
+ currentFieldRef_ = attributes.getAttribute("var");
+ if (sectionStack_.size() > 0) {
+ sectionStack_.at(sectionStack_.size()-1)->addFieldRef(currentFieldRef_);
+ } else if (currentPage_) {
+ currentPage_->addFieldRef(currentFieldRef_);
+ }
+ }
+ if (element == "text") {
+ currentText_.clear();
+ currentTextElement_ = boost::make_shared<FormText>();
+ }
+ }
+ ++level_;
}
void FormParser::handleEndElement(const std::string& element, const std::string&) {
- --level_;
- if (level_ == PayloadLevel) {
- if (element == "title") {
- std::string currentTitle = getPayloadInternal()->getTitle();
- if (currentTitle.empty()) {
- getPayloadInternal()->setTitle(currentText_);
- }
- else {
- getPayloadInternal()->setTitle(currentTitle + "\n" + currentText_);
- }
- }
- else if (element == "instructions") {
- std::string currentInstructions = getPayloadInternal()->getInstructions();
- if (currentInstructions.empty()) {
- getPayloadInternal()->setInstructions(currentText_);
- }
- else {
- getPayloadInternal()->setInstructions(currentInstructions + "\n" + currentText_);
- }
- }
- else if (element == "reported") {
- parsingReported_ = false;
- }
- else if (element == "item") {
- parsingItem_ = false;
- getPayloadInternal()->addItem(currentFields_);
- currentFields_.clear();
- }
- else if (element == "page") {
- getPayloadInternal()->addPage(currentPage_);
- currentPages_.push_back(currentPage_);
- }
- }
- else if (currentField_) {
- if (element == "required") {
- currentField_->setRequired(true);
- }
- else if (element == "desc") {
- currentField_->setDescription(currentText_);
- }
- else if (element == "option") {
- currentField_->addOption(FormField::Option(currentOptionLabel_, currentOptionValue_));
- parsingOption_ = false;
- }
- else if (element == "value") {
- if (parsingOption_) {
- currentOptionValue_ = currentText_;
- }
- else {
- currentField_->addValue(currentText_);
- }
- }
- }
- if (level_ >= PayloadLevel && currentField_) {
- if (element == "field") {
- if (parsingReported_) {
- getPayloadInternal()->addReportedField(currentField_);
- }
- else if (parsingItem_) {
- currentFields_.push_back(currentField_);
- }
- else {
- if (currentPages_.size() > 0) {
- foreach (boost::shared_ptr<FormPage> page, currentPages_) {
- foreach (std::string pageRef, page->getFieldRefs()) {
- if (pageRef == currentField_->getName()) {
- page->addField(currentField_);
- }
- }
- }
- foreach (boost::shared_ptr<FormSection> section, currentSections_) {
- foreach (std::string sectionRef, section->getFieldRefs()) {
- if (sectionRef == currentField_->getName()) {
- section->addField(currentField_);
- }
- }
- }
- } else {
- getPayloadInternal()->addField(currentField_);
- }
- }
- currentField_.reset();
- }
- }
- if (level_ > PayloadLevel) {
- if (element == "section") {
- if (sectionStack_.size() > 1) {
- // Add the section at the top of the stack to the level below
- sectionStack_.at(sectionStack_.size()-2)->addChildSection(sectionStack_.at(sectionStack_.size()-1));
- sectionStack_.pop_back();
- }
- else if (sectionStack_.size() == 1) {
- // Add the remaining section on the stack to its parent page
- currentPage_->addChildSection(sectionStack_.at(sectionStack_.size()-1));
- sectionStack_.pop_back();
- }
- }
- if (currentReportedRef_ && !hasReportedRef_) {
- if (sectionStack_.size() > 0) {
- sectionStack_.at(sectionStack_.size()-1)->addReportedRef(currentReportedRef_);
- } else if (currentPage_) {
- currentPage_->addReportedRef(currentReportedRef_);
- }
- hasReportedRef_ = true;
- currentReportedRef_.reset();
- }
- if (currentTextElement_) {
- if (element == "text") {
- currentTextElement_->setTextString(currentText_);
- }
- if (sectionStack_.size() > 0) {
- sectionStack_.at(sectionStack_.size()-1)->addTextElement(currentTextElement_);
- } else if (currentPage_) {
- currentPage_->addTextElement(currentTextElement_);
- }
- currentTextElement_.reset();
- }
- }
+ --level_;
+ if (level_ == PayloadLevel) {
+ if (element == "title") {
+ std::string currentTitle = getPayloadInternal()->getTitle();
+ if (currentTitle.empty()) {
+ getPayloadInternal()->setTitle(currentText_);
+ }
+ else {
+ getPayloadInternal()->setTitle(currentTitle + "\n" + currentText_);
+ }
+ }
+ else if (element == "instructions") {
+ std::string currentInstructions = getPayloadInternal()->getInstructions();
+ if (currentInstructions.empty()) {
+ getPayloadInternal()->setInstructions(currentText_);
+ }
+ else {
+ getPayloadInternal()->setInstructions(currentInstructions + "\n" + currentText_);
+ }
+ }
+ else if (element == "reported") {
+ parsingReported_ = false;
+ }
+ else if (element == "item") {
+ parsingItem_ = false;
+ getPayloadInternal()->addItem(currentFields_);
+ currentFields_.clear();
+ }
+ else if (element == "page") {
+ getPayloadInternal()->addPage(currentPage_);
+ currentPages_.push_back(currentPage_);
+ }
+ }
+ else if (currentField_) {
+ if (element == "required") {
+ currentField_->setRequired(true);
+ }
+ else if (element == "desc") {
+ currentField_->setDescription(currentText_);
+ }
+ else if (element == "option") {
+ currentField_->addOption(FormField::Option(currentOptionLabel_, currentOptionValue_));
+ parsingOption_ = false;
+ }
+ else if (element == "value") {
+ if (parsingOption_) {
+ currentOptionValue_ = currentText_;
+ }
+ else {
+ currentField_->addValue(currentText_);
+ }
+ }
+ }
+ if (level_ >= PayloadLevel && currentField_) {
+ if (element == "field") {
+ if (parsingReported_) {
+ getPayloadInternal()->addReportedField(currentField_);
+ }
+ else if (parsingItem_) {
+ currentFields_.push_back(currentField_);
+ }
+ else {
+ if (currentPages_.size() > 0) {
+ foreach (boost::shared_ptr<FormPage> page, currentPages_) {
+ foreach (std::string pageRef, page->getFieldRefs()) {
+ if (pageRef == currentField_->getName()) {
+ page->addField(currentField_);
+ }
+ }
+ }
+ foreach (boost::shared_ptr<FormSection> section, currentSections_) {
+ foreach (std::string sectionRef, section->getFieldRefs()) {
+ if (sectionRef == currentField_->getName()) {
+ section->addField(currentField_);
+ }
+ }
+ }
+ } else {
+ getPayloadInternal()->addField(currentField_);
+ }
+ }
+ currentField_.reset();
+ }
+ }
+ if (level_ > PayloadLevel) {
+ if (element == "section") {
+ if (sectionStack_.size() > 1) {
+ // Add the section at the top of the stack to the level below
+ sectionStack_.at(sectionStack_.size()-2)->addChildSection(sectionStack_.at(sectionStack_.size()-1));
+ sectionStack_.pop_back();
+ }
+ else if (sectionStack_.size() == 1) {
+ // Add the remaining section on the stack to its parent page
+ currentPage_->addChildSection(sectionStack_.at(sectionStack_.size()-1));
+ sectionStack_.pop_back();
+ }
+ }
+ if (currentReportedRef_ && !hasReportedRef_) {
+ if (sectionStack_.size() > 0) {
+ sectionStack_.at(sectionStack_.size()-1)->addReportedRef(currentReportedRef_);
+ } else if (currentPage_) {
+ currentPage_->addReportedRef(currentReportedRef_);
+ }
+ hasReportedRef_ = true;
+ currentReportedRef_.reset();
+ }
+ if (currentTextElement_) {
+ if (element == "text") {
+ currentTextElement_->setTextString(currentText_);
+ }
+ if (sectionStack_.size() > 0) {
+ sectionStack_.at(sectionStack_.size()-1)->addTextElement(currentTextElement_);
+ } else if (currentPage_) {
+ currentPage_->addTextElement(currentTextElement_);
+ }
+ currentTextElement_.reset();
+ }
+ }
}
void FormParser::handleCharacterData(const std::string& text) {
- currentText_ += text;
+ currentText_ += text;
}
}
diff --git a/Swiften/Parser/PayloadParsers/FormParser.h b/Swiften/Parser/PayloadParsers/FormParser.h
index c8c2294..81032ee 100644
--- a/Swiften/Parser/PayloadParsers/FormParser.h
+++ b/Swiften/Parser/PayloadParsers/FormParser.h
@@ -11,36 +11,36 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API FormParser : public GenericPayloadParser<Form> {
- public:
- FormParser();
+ class SWIFTEN_API FormParser : public GenericPayloadParser<Form> {
+ public:
+ FormParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1,
- FieldLevel = 2
- };
- int level_;
- std::string currentText_;
- std::string currentOptionLabel_;
- std::string currentOptionValue_;
- std::string currentFieldRef_;
- bool parsingItem_;
- bool parsingReported_;
- bool parsingOption_;
- bool hasReportedRef_;
- FormField::ref currentField_;
- std::vector<FormField::ref> currentFields_;
- FormText::text currentTextElement_;
- FormReportedRef::ref currentReportedRef_;
- FormPage::page currentPage_;
- FormSection::section currentSection_;
- std::vector<boost::shared_ptr<FormPage> > currentPages_;
- std::vector<boost::shared_ptr<FormSection> > sectionStack_;
- std::vector<boost::shared_ptr<FormSection> > currentSections_;
- };
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1,
+ FieldLevel = 2
+ };
+ int level_;
+ std::string currentText_;
+ std::string currentOptionLabel_;
+ std::string currentOptionValue_;
+ std::string currentFieldRef_;
+ bool parsingItem_;
+ bool parsingReported_;
+ bool parsingOption_;
+ bool hasReportedRef_;
+ FormField::ref currentField_;
+ std::vector<FormField::ref> currentFields_;
+ FormText::text currentTextElement_;
+ FormReportedRef::ref currentReportedRef_;
+ FormPage::page currentPage_;
+ FormSection::section currentSection_;
+ std::vector<boost::shared_ptr<FormPage> > currentPages_;
+ std::vector<boost::shared_ptr<FormSection> > sectionStack_;
+ std::vector<boost::shared_ptr<FormSection> > currentSections_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/FormParserFactory.h b/Swiften/Parser/PayloadParsers/FormParserFactory.h
index 74b2d35..851b302 100644
--- a/Swiften/Parser/PayloadParsers/FormParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/FormParserFactory.h
@@ -11,20 +11,20 @@
#include <Swiften/Parser/PayloadParsers/FormParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API FormParserFactory : public PayloadParserFactory {
- public:
- FormParserFactory() {
- }
+ class SWIFTEN_API FormParserFactory : public PayloadParserFactory {
+ public:
+ FormParserFactory() {
+ }
- virtual bool canParse(const std::string& /*element*/, const std::string& ns, const AttributeMap&) const {
- return ns == "jabber:x:data";
- }
+ virtual bool canParse(const std::string& /*element*/, const std::string& ns, const AttributeMap&) const {
+ return ns == "jabber:x:data";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new FormParser();
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new FormParser();
+ }
- };
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/ForwardedParser.cpp b/Swiften/Parser/PayloadParsers/ForwardedParser.cpp
index 1e3d339..35d20a9 100644
--- a/Swiften/Parser/PayloadParsers/ForwardedParser.cpp
+++ b/Swiften/Parser/PayloadParsers/ForwardedParser.cpp
@@ -23,51 +23,51 @@ ForwardedParser::ForwardedParser(PayloadParserFactoryCollection* factories) : fa
}
void ForwardedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
- if (element == "iq" && ns == "jabber:client") { /* begin parsing a nested stanza? */
- childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<IQParser>(factories_));
- } else if (element == "message" && ns == "jabber:client") {
- childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<MessageParser>(factories_));
- } else if (element == "presence" && ns == "jabber:client") {
- childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<PresenceParser>(factories_));
- } else if (element == "delay" && ns == "urn:xmpp:delay") { /* nested delay payload */
- delayParser_ = boost::make_shared<DelayParser>();
- }
- }
- if (childParser_) { /* parsing a nested stanza? */
- childParser_->handleStartElement(element, ns, attributes);
- }
- if (delayParser_) { /* parsing a nested delay payload? */
- delayParser_->handleStartElement(element, ns, attributes);
- }
- ++level_;
+ if (level_ == PayloadLevel) {
+ if (element == "iq" && ns == "jabber:client") { /* begin parsing a nested stanza? */
+ childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<IQParser>(factories_));
+ } else if (element == "message" && ns == "jabber:client") {
+ childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<MessageParser>(factories_));
+ } else if (element == "presence" && ns == "jabber:client") {
+ childParser_ = boost::dynamic_pointer_cast<StanzaParser>(boost::make_shared<PresenceParser>(factories_));
+ } else if (element == "delay" && ns == "urn:xmpp:delay") { /* nested delay payload */
+ delayParser_ = boost::make_shared<DelayParser>();
+ }
+ }
+ if (childParser_) { /* parsing a nested stanza? */
+ childParser_->handleStartElement(element, ns, attributes);
+ }
+ if (delayParser_) { /* parsing a nested delay payload? */
+ delayParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
}
void ForwardedParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
- if (childParser_ && level_ >= PayloadLevel) {
- childParser_->handleEndElement(element, ns);
- }
- if (childParser_ && level_ == PayloadLevel) {
- /* done parsing nested stanza */
- getPayloadInternal()->setStanza(childParser_->getStanza());
- childParser_.reset();
- }
- if (delayParser_ && level_ >= PayloadLevel) {
- delayParser_->handleEndElement(element, ns);
- }
- if (delayParser_ && level_ == PayloadLevel) {
- /* done parsing nested delay payload */
- getPayloadInternal()->setDelay(boost::dynamic_pointer_cast<Delay>(delayParser_->getPayload()));
- delayParser_.reset();
- }
+ --level_;
+ if (childParser_ && level_ >= PayloadLevel) {
+ childParser_->handleEndElement(element, ns);
+ }
+ if (childParser_ && level_ == PayloadLevel) {
+ /* done parsing nested stanza */
+ getPayloadInternal()->setStanza(childParser_->getStanza());
+ childParser_.reset();
+ }
+ if (delayParser_ && level_ >= PayloadLevel) {
+ delayParser_->handleEndElement(element, ns);
+ }
+ if (delayParser_ && level_ == PayloadLevel) {
+ /* done parsing nested delay payload */
+ getPayloadInternal()->setDelay(boost::dynamic_pointer_cast<Delay>(delayParser_->getPayload()));
+ delayParser_.reset();
+ }
}
void ForwardedParser::handleCharacterData(const std::string& data) {
- if (childParser_) {
- childParser_->handleCharacterData(data);
- }
- if (delayParser_) {
- delayParser_->handleCharacterData(data);
- }
+ if (childParser_) {
+ childParser_->handleCharacterData(data);
+ }
+ if (delayParser_) {
+ delayParser_->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/ForwardedParser.h b/Swiften/Parser/PayloadParsers/ForwardedParser.h
index 6d7b4f5..70eecdf 100644
--- a/Swiften/Parser/PayloadParsers/ForwardedParser.h
+++ b/Swiften/Parser/PayloadParsers/ForwardedParser.h
@@ -14,27 +14,27 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class StanzaParser;
- class DelayParser;
-
- class SWIFTEN_API ForwardedParser : public GenericPayloadParser<Forwarded> {
- public:
- ForwardedParser(PayloadParserFactoryCollection* factories);
-
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
-
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
-
- private:
- PayloadParserFactoryCollection* factories_;
- boost::shared_ptr<StanzaParser> childParser_;
- boost::shared_ptr<DelayParser> delayParser_;
- int level_;
- };
+ class PayloadParserFactoryCollection;
+ class StanzaParser;
+ class DelayParser;
+
+ class SWIFTEN_API ForwardedParser : public GenericPayloadParser<Forwarded> {
+ public:
+ ForwardedParser(PayloadParserFactoryCollection* factories);
+
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+
+ private:
+ PayloadParserFactoryCollection* factories_;
+ boost::shared_ptr<StanzaParser> childParser_;
+ boost::shared_ptr<DelayParser> delayParser_;
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
index 7e7123f..0d0c424 100644
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
@@ -94,94 +94,94 @@ using namespace boost;
namespace Swift {
FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<IBBParser> >("", "http://jabber.org/protocol/ibb"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StatusShowParser> >("show"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StatusParser> >("status"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "http://swift.im/protocol/replace"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "urn:xmpp:message-correct:0"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<LastParser> >("query", "jabber:iq:last"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BodyParser> >("body"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SubjectParser> >("subject"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ThreadParser> >("thread"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<PriorityParser> >("priority"));
- factories_.push_back(boost::make_shared<ErrorParserFactory>(this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DelayParser> >("delay", "urn:xmpp:delay"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SoftwareVersionParser> >("query", "jabber:iq:version"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StorageParser> >("storage", "storage:bookmarks"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<RosterItemExchangeParser> >("x", "http://jabber.org/protocol/rosterx"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<RosterParser> >("query", "jabber:iq:roster"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DiscoInfoParser> >("query", "http://jabber.org/protocol/disco#info"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DiscoItemsParser> >("query", "http://jabber.org/protocol/disco#items"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CapsInfoParser> >("c", "http://jabber.org/protocol/caps"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ResourceBindParser> >("bind", "urn:ietf:params:xml:ns:xmpp-bind"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StartSessionParser> >("session", "urn:ietf:params:xml:ns:xmpp-session"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<BlockPayload> > >("block", "urn:xmpp:blocking"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<BlockListPayload> > >("blocklist", "urn:xmpp:blocking"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<UnblockPayload> > >("unblock", "urn:xmpp:blocking"));
- factories_.push_back(boost::make_shared<SecurityLabelParserFactory>());
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SecurityLabelsCatalogParser> >("catalog", "urn:xmpp:sec-label:catalog:2"));
- factories_.push_back(boost::make_shared<FormParserFactory>());
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CommandParser> >("command", "http://jabber.org/protocol/commands"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<InBandRegistrationPayloadParser> >("query", "jabber:iq:register"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SearchPayloadParser> >("query", "jabber:iq:search"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationParser> >("si", "http://jabber.org/protocol/si"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BytestreamsParser> >("query", "http://jabber.org/protocol/bytestreams"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<VCardUpdateParser> >("x", "vcard-temp:x:update"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<VCardParser> >("vCard", "vcard-temp"));
- factories_.push_back(boost::make_shared<PrivateStorageParserFactory>(this));
- factories_.push_back(boost::make_shared<ChatStateParserFactory>());
- factories_.push_back(boost::make_shared<MUCUserPayloadParserFactory>(this));
- factories_.push_back(boost::make_shared<MUCOwnerPayloadParserFactory>(this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCInvitationPayloadParser> >("x", "jabber:x:conference"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCAdminPayloadParser> >("query", "http://jabber.org/protocol/muc#admin"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#user"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#owner"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<NicknameParser> >("nick", "http://jabber.org/protocol/nick"));
- factories_.push_back(boost::make_shared<JingleParserFactory>(this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleReasonParser> >("reason", "urn:xmpp:jingle:1"));
- factories_.push_back(boost::make_shared<JingleContentPayloadParserFactory>(this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleIBBTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:ibb:1"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleS5BTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:s5b:1"));
- factories_.push_back(boost::make_shared<JingleFileTransferDescriptionParserFactory>(this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationFileInfoParser> >("file", "http://jabber.org/protocol/si/profile/file-transfer"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferFileInfoParser> >("file", "urn:xmpp:jingle:apps:file-transfer:4"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferHashParser> >("checksum"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<S5BProxyRequestParser> >("query", "http://jabber.org/protocol/bytestreams"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<WhiteboardParser> >("wb", "http://swift.im/whiteboard"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<UserLocationParser> >("geoloc", "http://jabber.org/protocol/geoloc"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<UserTuneParser> >("tune", "http://jabber.org/protocol/tune"));
- factories_.push_back(boost::make_shared<DeliveryReceiptParserFactory>());
- factories_.push_back(boost::make_shared<DeliveryReceiptRequestParserFactory>());
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<IdleParser> >("idle", "urn:xmpp:idle:1"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubOwnerPubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub#owner", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubEventParser> >("event", "http://jabber.org/protocol/pubsub#event", this));
- factories_.push_back(boost::make_shared<PubSubErrorParserFactory>());
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ResultSetParser> >("set", "http://jabber.org/protocol/rsm"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<ForwardedParser> >("forwarded", "urn:xmpp:forward:0", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<MAMResultParser> >("result", "urn:xmpp:mam:0", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMQueryParser> >("query", "urn:xmpp:mam:0"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMFinParser> >("fin", "urn:xmpp:mam:0"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<IsodeIQDelegationParser> >("delegate", "http://isode.com/iq_delegation", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsEnableParser> >("enable", "urn:xmpp:carbons:2"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsDisableParser> >("disable", "urn:xmpp:carbons:2"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<CarbonsReceivedParser> >("received", "urn:xmpp:carbons:2", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<CarbonsSentParser> >("sent", "urn:xmpp:carbons:2", this));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsPrivateParser> >("private", "urn:xmpp:carbons:2"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<IBBParser> >("", "http://jabber.org/protocol/ibb"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StatusShowParser> >("show"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StatusParser> >("status"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "http://swift.im/protocol/replace"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ReplaceParser> >("replace", "urn:xmpp:message-correct:0"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<LastParser> >("query", "jabber:iq:last"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BodyParser> >("body"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SubjectParser> >("subject"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ThreadParser> >("thread"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<PriorityParser> >("priority"));
+ factories_.push_back(boost::make_shared<ErrorParserFactory>(this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DelayParser> >("delay", "urn:xmpp:delay"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SoftwareVersionParser> >("query", "jabber:iq:version"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StorageParser> >("storage", "storage:bookmarks"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<RosterItemExchangeParser> >("x", "http://jabber.org/protocol/rosterx"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<RosterParser> >("query", "jabber:iq:roster"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DiscoInfoParser> >("query", "http://jabber.org/protocol/disco#info"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<DiscoItemsParser> >("query", "http://jabber.org/protocol/disco#items"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CapsInfoParser> >("c", "http://jabber.org/protocol/caps"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ResourceBindParser> >("bind", "urn:ietf:params:xml:ns:xmpp-bind"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StartSessionParser> >("session", "urn:ietf:params:xml:ns:xmpp-session"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<BlockPayload> > >("block", "urn:xmpp:blocking"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<BlockListPayload> > >("blocklist", "urn:xmpp:blocking"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BlockParser<UnblockPayload> > >("unblock", "urn:xmpp:blocking"));
+ factories_.push_back(boost::make_shared<SecurityLabelParserFactory>());
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SecurityLabelsCatalogParser> >("catalog", "urn:xmpp:sec-label:catalog:2"));
+ factories_.push_back(boost::make_shared<FormParserFactory>());
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CommandParser> >("command", "http://jabber.org/protocol/commands"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<InBandRegistrationPayloadParser> >("query", "jabber:iq:register"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<SearchPayloadParser> >("query", "jabber:iq:search"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationParser> >("si", "http://jabber.org/protocol/si"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<BytestreamsParser> >("query", "http://jabber.org/protocol/bytestreams"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<VCardUpdateParser> >("x", "vcard-temp:x:update"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<VCardParser> >("vCard", "vcard-temp"));
+ factories_.push_back(boost::make_shared<PrivateStorageParserFactory>(this));
+ factories_.push_back(boost::make_shared<ChatStateParserFactory>());
+ factories_.push_back(boost::make_shared<MUCUserPayloadParserFactory>(this));
+ factories_.push_back(boost::make_shared<MUCOwnerPayloadParserFactory>(this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCInvitationPayloadParser> >("x", "jabber:x:conference"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCAdminPayloadParser> >("query", "http://jabber.org/protocol/muc#admin"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#user"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MUCDestroyPayloadParser> >("destroy", "http://jabber.org/protocol/muc#owner"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<NicknameParser> >("nick", "http://jabber.org/protocol/nick"));
+ factories_.push_back(boost::make_shared<JingleParserFactory>(this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleReasonParser> >("reason", "urn:xmpp:jingle:1"));
+ factories_.push_back(boost::make_shared<JingleContentPayloadParserFactory>(this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleIBBTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:ibb:1"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleS5BTransportMethodPayloadParser> >("transport", "urn:xmpp:jingle:transports:s5b:1"));
+ factories_.push_back(boost::make_shared<JingleFileTransferDescriptionParserFactory>(this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationFileInfoParser> >("file", "http://jabber.org/protocol/si/profile/file-transfer"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferFileInfoParser> >("file", "urn:xmpp:jingle:apps:file-transfer:4"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferHashParser> >("checksum"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<S5BProxyRequestParser> >("query", "http://jabber.org/protocol/bytestreams"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<WhiteboardParser> >("wb", "http://swift.im/whiteboard"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<UserLocationParser> >("geoloc", "http://jabber.org/protocol/geoloc"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<UserTuneParser> >("tune", "http://jabber.org/protocol/tune"));
+ factories_.push_back(boost::make_shared<DeliveryReceiptParserFactory>());
+ factories_.push_back(boost::make_shared<DeliveryReceiptRequestParserFactory>());
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<IdleParser> >("idle", "urn:xmpp:idle:1"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubOwnerPubSubParser> >("pubsub", "http://jabber.org/protocol/pubsub#owner", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<PubSubEventParser> >("event", "http://jabber.org/protocol/pubsub#event", this));
+ factories_.push_back(boost::make_shared<PubSubErrorParserFactory>());
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<ResultSetParser> >("set", "http://jabber.org/protocol/rsm"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<ForwardedParser> >("forwarded", "urn:xmpp:forward:0", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<MAMResultParser> >("result", "urn:xmpp:mam:0", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMQueryParser> >("query", "urn:xmpp:mam:0"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMFinParser> >("fin", "urn:xmpp:mam:0"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<IsodeIQDelegationParser> >("delegate", "http://isode.com/iq_delegation", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsEnableParser> >("enable", "urn:xmpp:carbons:2"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsDisableParser> >("disable", "urn:xmpp:carbons:2"));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<CarbonsReceivedParser> >("received", "urn:xmpp:carbons:2", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<CarbonsSentParser> >("sent", "urn:xmpp:carbons:2", this));
+ factories_.push_back(boost::make_shared<GenericPayloadParserFactory<CarbonsPrivateParser> >("private", "urn:xmpp:carbons:2"));
- foreach(shared_ptr<PayloadParserFactory> factory, factories_) {
- addFactory(factory.get());
- }
- defaultFactory_ = new RawXMLPayloadParserFactory();
- setDefaultFactory(defaultFactory_);
+ foreach(shared_ptr<PayloadParserFactory> factory, factories_) {
+ addFactory(factory.get());
+ }
+ defaultFactory_ = new RawXMLPayloadParserFactory();
+ setDefaultFactory(defaultFactory_);
}
FullPayloadParserFactoryCollection::~FullPayloadParserFactoryCollection() {
- setDefaultFactory(NULL);
- delete defaultFactory_;
- foreach(shared_ptr<PayloadParserFactory> factory, factories_) {
- removeFactory(factory.get());
- }
+ setDefaultFactory(NULL);
+ delete defaultFactory_;
+ foreach(shared_ptr<PayloadParserFactory> factory, factories_) {
+ removeFactory(factory.get());
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
index 3346e47..210e85e 100644
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
+++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h
@@ -15,13 +15,13 @@
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
namespace Swift {
- class SWIFTEN_API FullPayloadParserFactoryCollection : public PayloadParserFactoryCollection {
- public:
- FullPayloadParserFactoryCollection();
- ~FullPayloadParserFactoryCollection();
+ class SWIFTEN_API FullPayloadParserFactoryCollection : public PayloadParserFactoryCollection {
+ public:
+ FullPayloadParserFactoryCollection();
+ ~FullPayloadParserFactoryCollection();
- private:
- std::vector< boost::shared_ptr<PayloadParserFactory> > factories_;
- PayloadParserFactory* defaultFactory_;
- };
+ private:
+ std::vector< boost::shared_ptr<PayloadParserFactory> > factories_;
+ PayloadParserFactory* defaultFactory_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/IBBParser.cpp b/Swiften/Parser/PayloadParsers/IBBParser.cpp
index c04e3cc..3aeb04c 100644
--- a/Swiften/Parser/PayloadParsers/IBBParser.cpp
+++ b/Swiften/Parser/PayloadParsers/IBBParser.cpp
@@ -20,57 +20,57 @@ IBBParser::~IBBParser() {
}
void IBBParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level == TopLevel) {
- if (element == "data") {
- getPayloadInternal()->setAction(IBB::Data);
- getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
- try {
- getPayloadInternal()->setSequenceNumber(boost::lexical_cast<int>(attributes.getAttribute("seq")));
- }
- catch (boost::bad_lexical_cast&) {
- }
- }
- else if (element == "open") {
- getPayloadInternal()->setAction(IBB::Open);
- getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
- if (attributes.getAttribute("stanza") == "message") {
- getPayloadInternal()->setStanzaType(IBB::MessageStanza);
- }
- else {
- getPayloadInternal()->setStanzaType(IBB::IQStanza);
- }
- try {
- getPayloadInternal()->setBlockSize(boost::lexical_cast<int>(attributes.getAttribute("block-size")));
- }
- catch (boost::bad_lexical_cast&) {
- }
- }
- else if (element == "close") {
- getPayloadInternal()->setAction(IBB::Close);
- getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
- }
- }
- ++level;
+ if (level == TopLevel) {
+ if (element == "data") {
+ getPayloadInternal()->setAction(IBB::Data);
+ getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
+ try {
+ getPayloadInternal()->setSequenceNumber(boost::lexical_cast<int>(attributes.getAttribute("seq")));
+ }
+ catch (boost::bad_lexical_cast&) {
+ }
+ }
+ else if (element == "open") {
+ getPayloadInternal()->setAction(IBB::Open);
+ getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
+ if (attributes.getAttribute("stanza") == "message") {
+ getPayloadInternal()->setStanzaType(IBB::MessageStanza);
+ }
+ else {
+ getPayloadInternal()->setStanzaType(IBB::IQStanza);
+ }
+ try {
+ getPayloadInternal()->setBlockSize(boost::lexical_cast<int>(attributes.getAttribute("block-size")));
+ }
+ catch (boost::bad_lexical_cast&) {
+ }
+ }
+ else if (element == "close") {
+ getPayloadInternal()->setAction(IBB::Close);
+ getPayloadInternal()->setStreamID(attributes.getAttribute("sid"));
+ }
+ }
+ ++level;
}
void IBBParser::handleEndElement(const std::string& element, const std::string&) {
- --level;
- if (level == TopLevel) {
- if (element == "data") {
- std::vector<char> data;
- for (size_t i = 0; i < currentText.size(); ++i) {
- char c = currentText[i];
- if ((c >= 48 && c <= 122) || c == 47 || c == 43) {
- data.push_back(c);
- }
- }
- getPayloadInternal()->setData(Base64::decode(std::string(&data[0], data.size())));
- }
- }
+ --level;
+ if (level == TopLevel) {
+ if (element == "data") {
+ std::vector<char> data;
+ for (size_t i = 0; i < currentText.size(); ++i) {
+ char c = currentText[i];
+ if ((c >= 48 && c <= 122) || c == 47 || c == 43) {
+ data.push_back(c);
+ }
+ }
+ getPayloadInternal()->setData(Base64::decode(std::string(&data[0], data.size())));
+ }
+ }
}
void IBBParser::handleCharacterData(const std::string& data) {
- currentText += data;
+ currentText += data;
}
diff --git a/Swiften/Parser/PayloadParsers/IBBParser.h b/Swiften/Parser/PayloadParsers/IBBParser.h
index 95fe61a..7ef3e6f 100644
--- a/Swiften/Parser/PayloadParsers/IBBParser.h
+++ b/Swiften/Parser/PayloadParsers/IBBParser.h
@@ -13,20 +13,20 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API IBBParser : public GenericPayloadParser<IBB> {
- public:
- IBBParser();
- ~IBBParser();
+ class SWIFTEN_API IBBParser : public GenericPayloadParser<IBB> {
+ public:
+ IBBParser();
+ ~IBBParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- enum Level {
- TopLevel = 0
- };
- int level;
- std::string currentText;
- };
+ private:
+ enum Level {
+ TopLevel = 0
+ };
+ int level;
+ std::string currentText;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/IdleParser.cpp b/Swiften/Parser/PayloadParsers/IdleParser.cpp
index 51aa34b..e985576 100644
--- a/Swiften/Parser/PayloadParsers/IdleParser.cpp
+++ b/Swiften/Parser/PayloadParsers/IdleParser.cpp
@@ -14,15 +14,15 @@ IdleParser::IdleParser() : level_(0) {
}
void IdleParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& attributes) {
- if (level_ == 0) {
- boost::posix_time::ptime since = stringToDateTime(attributes.getAttribute("since"));
- getPayloadInternal()->setSince(since);
- }
- ++level_;
+ if (level_ == 0) {
+ boost::posix_time::ptime since = stringToDateTime(attributes.getAttribute("since"));
+ getPayloadInternal()->setSince(since);
+ }
+ ++level_;
}
void IdleParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
+ --level_;
}
void IdleParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/IdleParser.h b/Swiften/Parser/PayloadParsers/IdleParser.h
index d8bbd1d..c1922c0 100644
--- a/Swiften/Parser/PayloadParsers/IdleParser.h
+++ b/Swiften/Parser/PayloadParsers/IdleParser.h
@@ -17,15 +17,15 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API IdleParser : public GenericPayloadParser<Idle> {
- public:
- IdleParser();
+ class SWIFTEN_API IdleParser : public GenericPayloadParser<Idle> {
+ public:
+ IdleParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- };
+ private:
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp
index d29fa73..b019626 100644
--- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp
@@ -14,118 +14,118 @@
namespace Swift {
InBandRegistrationPayloadParser::InBandRegistrationPayloadParser() : level(TopLevel), formParser(NULL) {
- formParserFactory = new FormParserFactory();
+ formParserFactory = new FormParserFactory();
}
InBandRegistrationPayloadParser::~InBandRegistrationPayloadParser() {
- delete formParserFactory;
+ delete formParserFactory;
}
void InBandRegistrationPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == TopLevel) {
- }
- else if (level == PayloadLevel) {
- if (element == "x" && ns == "jabber:x:data") {
- assert(!formParser);
- formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser());
- }
- else {
- currentText.clear();
- }
- }
+ if (level == TopLevel) {
+ }
+ else if (level == PayloadLevel) {
+ if (element == "x" && ns == "jabber:x:data") {
+ assert(!formParser);
+ formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser());
+ }
+ else {
+ currentText.clear();
+ }
+ }
- if (formParser) {
- formParser->handleStartElement(element, ns, attributes);
- }
+ if (formParser) {
+ formParser->handleStartElement(element, ns, attributes);
+ }
- ++level;
+ ++level;
}
void InBandRegistrationPayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
+ --level;
- if (formParser) {
- formParser->handleEndElement(element, ns);
- }
+ if (formParser) {
+ formParser->handleEndElement(element, ns);
+ }
- if (level == TopLevel) {
- }
- else if (level == PayloadLevel) {
- if (formParser) {
- getPayloadInternal()->setForm(formParser->getPayloadInternal());
- delete formParser;
- formParser = NULL;
- }
- else if (element == "registered") {
- getPayloadInternal()->setRegistered(true);
- }
- else if (element == "remove") {
- getPayloadInternal()->setRemove(true);
- }
- else if (element == "instructions") {
- getPayloadInternal()->setInstructions(currentText);
- }
- else if (element == "username") {
- getPayloadInternal()->setUsername(currentText);
- }
- else if (element == "nick") {
- getPayloadInternal()->setNick(currentText);
- }
- else if (element == "password") {
- getPayloadInternal()->setPassword(currentText);
- }
- else if (element == "name") {
- getPayloadInternal()->setName(currentText);
- }
- else if (element == "first") {
- getPayloadInternal()->setFirst(currentText);
- }
- else if (element == "last") {
- getPayloadInternal()->setLast(currentText);
- }
- else if (element == "email") {
- getPayloadInternal()->setEMail(currentText);
- }
- else if (element == "address") {
- getPayloadInternal()->setAddress(currentText);
- }
- else if (element == "city") {
- getPayloadInternal()->setCity(currentText);
- }
- else if (element == "state") {
- getPayloadInternal()->setState(currentText);
- }
- else if (element == "zip") {
- getPayloadInternal()->setZip(currentText);
- }
- else if (element == "phone") {
- getPayloadInternal()->setPhone(currentText);
- }
- else if (element == "url") {
- getPayloadInternal()->setURL(currentText);
- }
- else if (element == "date") {
- getPayloadInternal()->setDate(currentText);
- }
- else if (element == "misc") {
- getPayloadInternal()->setMisc(currentText);
- }
- else if (element == "text") {
- getPayloadInternal()->setText(currentText);
- }
- else if (element == "key") {
- getPayloadInternal()->setKey(currentText);
- }
- }
+ if (level == TopLevel) {
+ }
+ else if (level == PayloadLevel) {
+ if (formParser) {
+ getPayloadInternal()->setForm(formParser->getPayloadInternal());
+ delete formParser;
+ formParser = NULL;
+ }
+ else if (element == "registered") {
+ getPayloadInternal()->setRegistered(true);
+ }
+ else if (element == "remove") {
+ getPayloadInternal()->setRemove(true);
+ }
+ else if (element == "instructions") {
+ getPayloadInternal()->setInstructions(currentText);
+ }
+ else if (element == "username") {
+ getPayloadInternal()->setUsername(currentText);
+ }
+ else if (element == "nick") {
+ getPayloadInternal()->setNick(currentText);
+ }
+ else if (element == "password") {
+ getPayloadInternal()->setPassword(currentText);
+ }
+ else if (element == "name") {
+ getPayloadInternal()->setName(currentText);
+ }
+ else if (element == "first") {
+ getPayloadInternal()->setFirst(currentText);
+ }
+ else if (element == "last") {
+ getPayloadInternal()->setLast(currentText);
+ }
+ else if (element == "email") {
+ getPayloadInternal()->setEMail(currentText);
+ }
+ else if (element == "address") {
+ getPayloadInternal()->setAddress(currentText);
+ }
+ else if (element == "city") {
+ getPayloadInternal()->setCity(currentText);
+ }
+ else if (element == "state") {
+ getPayloadInternal()->setState(currentText);
+ }
+ else if (element == "zip") {
+ getPayloadInternal()->setZip(currentText);
+ }
+ else if (element == "phone") {
+ getPayloadInternal()->setPhone(currentText);
+ }
+ else if (element == "url") {
+ getPayloadInternal()->setURL(currentText);
+ }
+ else if (element == "date") {
+ getPayloadInternal()->setDate(currentText);
+ }
+ else if (element == "misc") {
+ getPayloadInternal()->setMisc(currentText);
+ }
+ else if (element == "text") {
+ getPayloadInternal()->setText(currentText);
+ }
+ else if (element == "key") {
+ getPayloadInternal()->setKey(currentText);
+ }
+ }
}
void InBandRegistrationPayloadParser::handleCharacterData(const std::string& data) {
- if (formParser) {
- formParser->handleCharacterData(data);
- }
- else {
- currentText += data;
- }
+ if (formParser) {
+ formParser->handleCharacterData(data);
+ }
+ else {
+ currentText += data;
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h
index cd8c452..7e2a4a4 100644
--- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h
@@ -13,26 +13,26 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class FormParserFactory;
- class FormParser;
+ class FormParserFactory;
+ class FormParser;
- class SWIFTEN_API InBandRegistrationPayloadParser : public GenericPayloadParser<InBandRegistrationPayload> {
- public:
- InBandRegistrationPayloadParser();
- ~InBandRegistrationPayloadParser();
+ class SWIFTEN_API InBandRegistrationPayloadParser : public GenericPayloadParser<InBandRegistrationPayload> {
+ public:
+ InBandRegistrationPayloadParser();
+ ~InBandRegistrationPayloadParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
- int level;
- FormParserFactory* formParserFactory;
- FormParser* formParser;
- std::string currentText;
- };
+ private:
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+ int level;
+ FormParserFactory* formParserFactory;
+ FormParser* formParser;
+ std::string currentText;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp
index 483654a..6bdd517 100644
--- a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp
+++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp
@@ -24,36 +24,36 @@ IsodeIQDelegationParser::~IsodeIQDelegationParser() {
}
void IsodeIQDelegationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
-
-
- if (level == 1) {
- if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) {
- currentPayloadParser.reset(factory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+
+
+ if (level == 1) {
+ if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) {
+ currentPayloadParser.reset(factory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void IsodeIQDelegationParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- getPayloadInternal()->setForward(boost::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload()));
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ getPayloadInternal()->setForward(boost::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload()));
+ currentPayloadParser.reset();
+ }
+ }
}
void IsodeIQDelegationParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h
index 6115761..cf86a1a 100644
--- a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h
+++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API IsodeIQDelegationParser : public GenericPayloadParser<IsodeIQDelegation> {
- public:
- IsodeIQDelegationParser(PayloadParserFactoryCollection* parsers);
- virtual ~IsodeIQDelegationParser();
+ class SWIFTEN_API IsodeIQDelegationParser : public GenericPayloadParser<IsodeIQDelegation> {
+ public:
+ IsodeIQDelegationParser(PayloadParserFactoryCollection* parsers);
+ virtual ~IsodeIQDelegationParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp
index e6eecd7..30404f3 100644
--- a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.cpp
@@ -18,63 +18,63 @@
#include <Swiften/Parser/PayloadParserFactoryCollection.h>
namespace Swift {
- JingleContentPayloadParser::JingleContentPayloadParser(PayloadParserFactoryCollection* factories) : factories(factories), level(0) {
-
- }
-
- void JingleContentPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- std::string creator = attributes.getAttributeValue("creator").get_value_or("");
- if (creator == "initiator") {
- getPayloadInternal()->setCreator(JingleContentPayload::InitiatorCreator);
- } else if (creator == "responder") {
- getPayloadInternal()->setCreator(JingleContentPayload::ResponderCreator);
- } else {
- getPayloadInternal()->setCreator(JingleContentPayload::UnknownCreator);
- }
-
- getPayloadInternal()->setName(attributes.getAttributeValue("name").get_value_or(""));
- }
-
- if (level == 1) {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
-
- ++level;
- }
-
- void JingleContentPayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
-
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- boost::shared_ptr<JingleTransportPayload> transport = boost::dynamic_pointer_cast<JingleTransportPayload>(currentPayloadParser->getPayload());
- if (transport) {
- getPayloadInternal()->addTransport(transport);
- }
-
- boost::shared_ptr<JingleDescription> description = boost::dynamic_pointer_cast<JingleDescription>(currentPayloadParser->getPayload());
- if (description) {
- getPayloadInternal()->addDescription(description);
- }
- }
- }
- }
-
- void JingleContentPayloadParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
- }
+ JingleContentPayloadParser::JingleContentPayloadParser(PayloadParserFactoryCollection* factories) : factories(factories), level(0) {
+
+ }
+
+ void JingleContentPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level == 0) {
+ std::string creator = attributes.getAttributeValue("creator").get_value_or("");
+ if (creator == "initiator") {
+ getPayloadInternal()->setCreator(JingleContentPayload::InitiatorCreator);
+ } else if (creator == "responder") {
+ getPayloadInternal()->setCreator(JingleContentPayload::ResponderCreator);
+ } else {
+ getPayloadInternal()->setCreator(JingleContentPayload::UnknownCreator);
+ }
+
+ getPayloadInternal()->setName(attributes.getAttributeValue("name").get_value_or(""));
+ }
+
+ if (level == 1) {
+ PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+
+ ++level;
+ }
+
+ void JingleContentPayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level;
+
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ boost::shared_ptr<JingleTransportPayload> transport = boost::dynamic_pointer_cast<JingleTransportPayload>(currentPayloadParser->getPayload());
+ if (transport) {
+ getPayloadInternal()->addTransport(transport);
+ }
+
+ boost::shared_ptr<JingleDescription> description = boost::dynamic_pointer_cast<JingleDescription>(currentPayloadParser->getPayload());
+ if (description) {
+ getPayloadInternal()->addDescription(description);
+ }
+ }
+ }
+ }
+
+ void JingleContentPayloadParser::handleCharacterData(const std::string& data) {
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h
index 977d2eb..eaa8ff6 100644
--- a/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h
@@ -21,17 +21,17 @@ namespace Swift {
class PayloadParserFactoryCollection;
class SWIFTEN_API JingleContentPayloadParser : public GenericPayloadParser<JingleContentPayload> {
- public:
- JingleContentPayloadParser(PayloadParserFactoryCollection* factories);
+ public:
+ JingleContentPayloadParser(PayloadParserFactoryCollection* factories);
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- PayloadParserFactoryCollection* factories;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
+ private:
+ PayloadParserFactoryCollection* factories;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h b/Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h
index b343c24..8e9741d 100644
--- a/Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h
@@ -17,26 +17,26 @@
#include <Swiften/Parser/PayloadParsers/JingleContentPayloadParser.h>
namespace Swift {
-
- class PayloadParserFactoryCollection;
-
- class SWIFTEN_API JingleContentPayloadParserFactory : public PayloadParserFactory {
- public:
- JingleContentPayloadParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
-
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return element == "content" && ns == "urn:xmpp:jingle:1";
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new JingleContentPayloadParser(factories);
- }
-
- private:
- PayloadParserFactoryCollection* factories;
-
- };
+
+ class PayloadParserFactoryCollection;
+
+ class SWIFTEN_API JingleContentPayloadParserFactory : public PayloadParserFactory {
+ public:
+ JingleContentPayloadParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "content" && ns == "urn:xmpp:jingle:1";
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new JingleContentPayloadParser(factories);
+ }
+
+ private:
+ PayloadParserFactoryCollection* factories;
+
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp
index 0e4e636..32a6e4c 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.cpp
@@ -26,37 +26,37 @@ JingleFileTransferDescriptionParser::JingleFileTransferDescriptionParser(Payload
}
void JingleFileTransferDescriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 1) {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 1) {
+ PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void JingleFileTransferDescriptionParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 0) {
- boost::shared_ptr<JingleFileTransferFileInfo> info = boost::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload());
- if (info) {
- getPayloadInternal()->setFileInfo(*info);
- }
- }
+ --level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 0) {
+ boost::shared_ptr<JingleFileTransferFileInfo> info = boost::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload());
+ if (info) {
+ getPayloadInternal()->setFileInfo(*info);
+ }
+ }
}
void JingleFileTransferDescriptionParser::handleCharacterData(const std::string& data) {
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h
index 52dd232..c7f80e1 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h
@@ -22,17 +22,17 @@ namespace Swift {
class PayloadParserFactoryCollection;
class SWIFTEN_API JingleFileTransferDescriptionParser : public GenericPayloadParser<JingleFileTransferDescription> {
- public:
- JingleFileTransferDescriptionParser(PayloadParserFactoryCollection* factories);
+ public:
+ JingleFileTransferDescriptionParser(PayloadParserFactoryCollection* factories);
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- PayloadParserFactoryCollection* factories;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
+ private:
+ PayloadParserFactoryCollection* factories;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h
index f8a340c..c75125f 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h
@@ -17,26 +17,26 @@
#include <Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h>
namespace Swift {
-
- class PayloadParserFactoryCollection;
-
- class SWIFTEN_API JingleFileTransferDescriptionParserFactory : public PayloadParserFactory {
- public:
- JingleFileTransferDescriptionParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
-
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return element == "description" && ns == "urn:xmpp:jingle:apps:file-transfer:4";
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new JingleFileTransferDescriptionParser(factories);
- }
-
- private:
- PayloadParserFactoryCollection* factories;
-
- };
+
+ class PayloadParserFactoryCollection;
+
+ class SWIFTEN_API JingleFileTransferDescriptionParserFactory : public PayloadParserFactory {
+ public:
+ JingleFileTransferDescriptionParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "description" && ns == "urn:xmpp:jingle:apps:file-transfer:4";
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new JingleFileTransferDescriptionParser(factories);
+ }
+
+ private:
+ PayloadParserFactoryCollection* factories;
+
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp
index 51c13e9..4f8b9a9 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.cpp
@@ -14,66 +14,66 @@
namespace Swift {
-JingleFileTransferFileInfoParser::JingleFileTransferFileInfoParser() : level(0) {
+JingleFileTransferFileInfoParser::JingleFileTransferFileInfoParser() : level(0) {
}
template<typename T> boost::optional<T> safeLexicalCast(const std::string& str) {
- boost::optional<T> ret;
- try {
- ret = boost::lexical_cast<T>(str);
- } catch (boost::bad_lexical_cast &) {
+ boost::optional<T> ret;
+ try {
+ ret = boost::lexical_cast<T>(str);
+ } catch (boost::bad_lexical_cast &) {
- }
- return ret;
+ }
+ return ret;
}
void JingleFileTransferFileInfoParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- charData.clear();
- if (element == "hash") {
- hashAlg = attributes.getAttributeValue("algo").get_value_or("");
- }
- else if (element == "range") {
- rangeOffset = safeLexicalCast<boost::uintmax_t>(attributes.getAttributeValue("offset").get_value_or(""));
- }
+ charData.clear();
+ if (element == "hash") {
+ hashAlg = attributes.getAttributeValue("algo").get_value_or("");
+ }
+ else if (element == "range") {
+ rangeOffset = safeLexicalCast<boost::uintmax_t>(attributes.getAttributeValue("offset").get_value_or(""));
+ }
- ++level;
+ ++level;
}
void JingleFileTransferFileInfoParser::handleEndElement(const std::string& element, const std::string&) {
- --level;
- if (level == 1) {
- if (element == "date") {
- getPayloadInternal()->setDate(stringToDateTime(charData));
- }
- else if (element == "desc") {
- getPayloadInternal()->setDescription(charData);
- }
- else if (element == "media-type") {
- getPayloadInternal()->setMediaType(charData);
- }
- else if (element == "name") {
- getPayloadInternal()->setName(charData);
- }
- else if (element == "size") {
- boost::optional<boost::uintmax_t> size = safeLexicalCast<boost::uintmax_t>(charData);
- if (size) {
- getPayloadInternal()->setSize(size.get());
- }
- }
- else if (element == "range") {
- getPayloadInternal()->setSupportsRangeRequests(true);
- if (rangeOffset) {
- getPayloadInternal()->setRangeOffset(rangeOffset.get_value_or(0));
- }
- }
- else if (element == "hash") {
- getPayloadInternal()->addHash(HashElement(hashAlg, Base64::decode(charData)));
- }
- }
+ --level;
+ if (level == 1) {
+ if (element == "date") {
+ getPayloadInternal()->setDate(stringToDateTime(charData));
+ }
+ else if (element == "desc") {
+ getPayloadInternal()->setDescription(charData);
+ }
+ else if (element == "media-type") {
+ getPayloadInternal()->setMediaType(charData);
+ }
+ else if (element == "name") {
+ getPayloadInternal()->setName(charData);
+ }
+ else if (element == "size") {
+ boost::optional<boost::uintmax_t> size = safeLexicalCast<boost::uintmax_t>(charData);
+ if (size) {
+ getPayloadInternal()->setSize(size.get());
+ }
+ }
+ else if (element == "range") {
+ getPayloadInternal()->setSupportsRangeRequests(true);
+ if (rangeOffset) {
+ getPayloadInternal()->setRangeOffset(rangeOffset.get_value_or(0));
+ }
+ }
+ else if (element == "hash") {
+ getPayloadInternal()->addHash(HashElement(hashAlg, Base64::decode(charData)));
+ }
+ }
}
void JingleFileTransferFileInfoParser::handleCharacterData(const std::string& data) {
- charData += data;
+ charData += data;
}
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.h
index e49ee69..237f105 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferFileInfoParser.h
@@ -13,18 +13,18 @@
namespace Swift {
class SWIFTEN_API JingleFileTransferFileInfoParser : public GenericPayloadParser<JingleFileTransferFileInfo> {
- public:
- JingleFileTransferFileInfoParser();
+ public:
+ JingleFileTransferFileInfoParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
-
- private:
- int level;
- std::string charData;
- std::string hashAlg;
- boost::optional<boost::uintmax_t> rangeOffset;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
+
+ private:
+ int level;
+ std::string charData;
+ std::string hashAlg;
+ boost::optional<boost::uintmax_t> rangeOffset;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp
index 7c6c0d4..a890a99 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.cpp
@@ -23,36 +23,36 @@ namespace Swift {
JingleFileTransferHashParser::JingleFileTransferHashParser() : level(0) {
}
-
+
void JingleFileTransferHashParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 1 && element == "file") {
- currentPayloadParser = boost::make_shared<JingleFileTransferFileInfoParser>();
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 1 && element == "file") {
+ currentPayloadParser = boost::make_shared<JingleFileTransferFileInfoParser>();
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void JingleFileTransferHashParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- boost::shared_ptr<JingleFileTransferFileInfo> info = boost::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload());
- if (info) {
- getPayloadInternal()->setFileInfo(*info);
- }
- }
+ --level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ boost::shared_ptr<JingleFileTransferFileInfo> info = boost::dynamic_pointer_cast<JingleFileTransferFileInfo>(currentPayloadParser->getPayload());
+ if (info) {
+ getPayloadInternal()->setFileInfo(*info);
+ }
+ }
}
void JingleFileTransferHashParser::handleCharacterData(const std::string& data) {
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h
index 15d3294..8a28d5a 100644
--- a/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h
@@ -20,15 +20,15 @@ namespace Swift {
class SWIFTEN_API JingleFileTransferHashParser : public GenericPayloadParser<JingleFileTransferHash> {
public:
- JingleFileTransferHashParser();
-
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
-
+ JingleFileTransferHashParser();
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
+
private:
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp
index e446575..438420b 100644
--- a/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp
@@ -18,30 +18,30 @@
#include <Swiften/Base/Log.h>
namespace Swift {
- JingleIBBTransportMethodPayloadParser::JingleIBBTransportMethodPayloadParser() : level(0) {
-
- }
-
- void JingleIBBTransportMethodPayloadParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
- try {
- boost::optional<std::string> blockSize = attributes.getAttributeValue("block-size");
- if (blockSize) {
- getPayloadInternal()->setBlockSize(boost::lexical_cast<unsigned int>(*blockSize));
- }
- }
- catch (boost::bad_lexical_cast &) {
- }
- getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
- ++level;
- }
-
- void JingleIBBTransportMethodPayloadParser::handleEndElement(const std::string&, const std::string&) {
- --level;
-
-
- }
-
- void JingleIBBTransportMethodPayloadParser::handleCharacterData(const std::string&) {
-
- }
+ JingleIBBTransportMethodPayloadParser::JingleIBBTransportMethodPayloadParser() : level(0) {
+
+ }
+
+ void JingleIBBTransportMethodPayloadParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
+ try {
+ boost::optional<std::string> blockSize = attributes.getAttributeValue("block-size");
+ if (blockSize) {
+ getPayloadInternal()->setBlockSize(boost::lexical_cast<unsigned int>(*blockSize));
+ }
+ }
+ catch (boost::bad_lexical_cast &) {
+ }
+ getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
+ ++level;
+ }
+
+ void JingleIBBTransportMethodPayloadParser::handleEndElement(const std::string&, const std::string&) {
+ --level;
+
+
+ }
+
+ void JingleIBBTransportMethodPayloadParser::handleCharacterData(const std::string&) {
+
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h b/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h
index 4e22943..e406b9f 100644
--- a/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h
@@ -19,15 +19,15 @@
namespace Swift {
class SWIFTEN_API JingleIBBTransportMethodPayloadParser : public GenericPayloadParser<JingleIBBTransportPayload> {
- public:
- JingleIBBTransportMethodPayloadParser();
+ public:
+ JingleIBBTransportMethodPayloadParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level;
+ private:
+ int level;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleParser.cpp b/Swiften/Parser/PayloadParsers/JingleParser.cpp
index 21f415b..48507af 100644
--- a/Swiften/Parser/PayloadParsers/JingleParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleParser.cpp
@@ -21,100 +21,100 @@
namespace Swift {
- JingleParser::JingleParser(PayloadParserFactoryCollection* factories) : factories(factories), level(0) {
-
- }
-
- void JingleParser::handleStartElement(const std::string& element, const std::string &ns, const AttributeMap& attributes) {
- if (level == 0) {
- // <jingle > tag
- JinglePayload::ref payload = getPayloadInternal();
- payload->setAction(stringToAction(attributes.getAttributeValue("action").get_value_or("")));
- payload->setInitiator(JID(attributes.getAttributeValue("initiator").get_value_or("")));
- payload->setResponder(JID(attributes.getAttributeValue("responder").get_value_or("")));
- payload->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
- }
-
- if (level == 1) {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
-
- ++level;
- }
-
- void JingleParser::handleEndElement(const std::string& element, const std::string &ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- boost::shared_ptr<JinglePayload::Reason> reason = boost::dynamic_pointer_cast<JinglePayload::Reason>(currentPayloadParser->getPayload());
- if (reason) {
- getPayloadInternal()->setReason(*reason);
- }
-
- boost::shared_ptr<JingleContentPayload> payload = boost::dynamic_pointer_cast<JingleContentPayload>(currentPayloadParser->getPayload());
- if (payload) {
- getPayloadInternal()->addContent(payload);
- }
-
- boost::shared_ptr<JingleFileTransferHash> hash = boost::dynamic_pointer_cast<JingleFileTransferHash>(currentPayloadParser->getPayload());
- if (hash) {
- getPayloadInternal()->addPayload(hash);
- }
- }
- }
- }
-
- void JingleParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
- }
-
- JinglePayload::Action JingleParser::stringToAction(const std::string &str) const {
- if (str == "content-accept") {
- return JinglePayload::ContentAccept;
- } else if (str == "content-add") {
- return JinglePayload::ContentAdd;
- } else if (str == "content-modify") {
- return JinglePayload::ContentModify;
- } else if (str == "content-reject") {
- return JinglePayload::ContentReject;
- } else if (str == "content-remove") {
- return JinglePayload::ContentRemove;
- } else if (str == "description-info") {
- return JinglePayload::DescriptionInfo;
- } else if (str == "security-info") {
- return JinglePayload::SecurityInfo;
- } else if (str == "session-accept") {
- return JinglePayload::SessionAccept;
- } else if (str == "session-info") {
- return JinglePayload::SessionInfo;
- } else if (str == "session-initiate") {
- return JinglePayload::SessionInitiate;
- } else if (str == "session-terminate") {
- return JinglePayload::SessionTerminate;
- } else if (str == "transport-accept") {
- return JinglePayload::TransportAccept;
- } else if (str == "transport-info") {
- return JinglePayload::TransportInfo;
- } else if (str == "transport-reject") {
- return JinglePayload::TransportReject;
- } else if (str == "transport-replace") {
- return JinglePayload::TransportReplace;
- } else {
- return JinglePayload::UnknownAction;
- }
-
- }
+ JingleParser::JingleParser(PayloadParserFactoryCollection* factories) : factories(factories), level(0) {
+
+ }
+
+ void JingleParser::handleStartElement(const std::string& element, const std::string &ns, const AttributeMap& attributes) {
+ if (level == 0) {
+ // <jingle > tag
+ JinglePayload::ref payload = getPayloadInternal();
+ payload->setAction(stringToAction(attributes.getAttributeValue("action").get_value_or("")));
+ payload->setInitiator(JID(attributes.getAttributeValue("initiator").get_value_or("")));
+ payload->setResponder(JID(attributes.getAttributeValue("responder").get_value_or("")));
+ payload->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
+ }
+
+ if (level == 1) {
+ PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+
+ ++level;
+ }
+
+ void JingleParser::handleEndElement(const std::string& element, const std::string &ns) {
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ boost::shared_ptr<JinglePayload::Reason> reason = boost::dynamic_pointer_cast<JinglePayload::Reason>(currentPayloadParser->getPayload());
+ if (reason) {
+ getPayloadInternal()->setReason(*reason);
+ }
+
+ boost::shared_ptr<JingleContentPayload> payload = boost::dynamic_pointer_cast<JingleContentPayload>(currentPayloadParser->getPayload());
+ if (payload) {
+ getPayloadInternal()->addContent(payload);
+ }
+
+ boost::shared_ptr<JingleFileTransferHash> hash = boost::dynamic_pointer_cast<JingleFileTransferHash>(currentPayloadParser->getPayload());
+ if (hash) {
+ getPayloadInternal()->addPayload(hash);
+ }
+ }
+ }
+ }
+
+ void JingleParser::handleCharacterData(const std::string& data) {
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
+ }
+
+ JinglePayload::Action JingleParser::stringToAction(const std::string &str) const {
+ if (str == "content-accept") {
+ return JinglePayload::ContentAccept;
+ } else if (str == "content-add") {
+ return JinglePayload::ContentAdd;
+ } else if (str == "content-modify") {
+ return JinglePayload::ContentModify;
+ } else if (str == "content-reject") {
+ return JinglePayload::ContentReject;
+ } else if (str == "content-remove") {
+ return JinglePayload::ContentRemove;
+ } else if (str == "description-info") {
+ return JinglePayload::DescriptionInfo;
+ } else if (str == "security-info") {
+ return JinglePayload::SecurityInfo;
+ } else if (str == "session-accept") {
+ return JinglePayload::SessionAccept;
+ } else if (str == "session-info") {
+ return JinglePayload::SessionInfo;
+ } else if (str == "session-initiate") {
+ return JinglePayload::SessionInitiate;
+ } else if (str == "session-terminate") {
+ return JinglePayload::SessionTerminate;
+ } else if (str == "transport-accept") {
+ return JinglePayload::TransportAccept;
+ } else if (str == "transport-info") {
+ return JinglePayload::TransportInfo;
+ } else if (str == "transport-reject") {
+ return JinglePayload::TransportReject;
+ } else if (str == "transport-replace") {
+ return JinglePayload::TransportReplace;
+ } else {
+ return JinglePayload::UnknownAction;
+ }
+
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/JingleParser.h b/Swiften/Parser/PayloadParsers/JingleParser.h
index ad49e96..28850e2 100644
--- a/Swiften/Parser/PayloadParsers/JingleParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleParser.h
@@ -20,20 +20,20 @@
namespace Swift {
class SWIFTEN_API JingleParser : public GenericPayloadParser<JinglePayload> {
- public:
- JingleParser(PayloadParserFactoryCollection* factories);
-
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
-
- private:
- JinglePayload::Action stringToAction(const std::string &str) const;
-
- private:
- PayloadParserFactoryCollection* factories;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
+ public:
+ JingleParser(PayloadParserFactoryCollection* factories);
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
+
+ private:
+ JinglePayload::Action stringToAction(const std::string &str) const;
+
+ private:
+ PayloadParserFactoryCollection* factories;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleParserFactory.h b/Swiften/Parser/PayloadParsers/JingleParserFactory.h
index 73395fc..5f9b45b 100644
--- a/Swiften/Parser/PayloadParsers/JingleParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/JingleParserFactory.h
@@ -17,26 +17,26 @@
#include <Swiften/Parser/PayloadParsers/JingleParser.h>
namespace Swift {
-
- class PayloadParserFactoryCollection;
-
- class SWIFTEN_API JingleParserFactory : public PayloadParserFactory {
- public:
- JingleParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
-
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return element == "jingle" && ns == "urn:xmpp:jingle:1";
- }
-
- virtual PayloadParser* createPayloadParser() {
- return new JingleParser(factories);
- }
-
- private:
- PayloadParserFactoryCollection* factories;
-
- };
+
+ class PayloadParserFactoryCollection;
+
+ class SWIFTEN_API JingleParserFactory : public PayloadParserFactory {
+ public:
+ JingleParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "jingle" && ns == "urn:xmpp:jingle:1";
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new JingleParser(factories);
+ }
+
+ private:
+ PayloadParserFactoryCollection* factories;
+
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/JingleReasonParser.cpp b/Swiften/Parser/PayloadParsers/JingleReasonParser.cpp
index d144cbd..9a81e5f 100644
--- a/Swiften/Parser/PayloadParsers/JingleReasonParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleReasonParser.cpp
@@ -15,73 +15,73 @@
#include <Swiften/Base/Log.h>
namespace Swift {
- JingleReasonParser::JingleReasonParser() : level(0), parseText(false) {
-
- }
-
- void JingleReasonParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) {
- if (level == 1) {
- if (element == "text") {
- parseText = true;
- } else {
- // reason type
- getPayloadInternal()->type = stringToReasonType(element);
- }
- }
- ++level;
- }
-
- void JingleReasonParser::handleEndElement(const std::string& element, const std::string&) {
- --level;
- if (element == "text") {
- parseText = false;
- getPayloadInternal()->text = text;
- }
- }
-
- void JingleReasonParser::handleCharacterData(const std::string& data) {
- if (parseText) {
- text += data;
- }
- }
-
- JinglePayload::Reason::Type JingleReasonParser::stringToReasonType(const std::string& type) const {
- if (type == "alternative-session") {
- return JinglePayload::Reason::AlternativeSession;
- } else if (type == "busy") {
- return JinglePayload::Reason::Busy;
- } else if (type == "cancel") {
- return JinglePayload::Reason::Cancel;
- } else if (type == "connectivity-error") {
- return JinglePayload::Reason::ConnectivityError;
- } else if (type == "decline") {
- return JinglePayload::Reason::Decline;
- } else if (type == "expired") {
- return JinglePayload::Reason::Expired;
- } else if (type == "failed-application") {
- return JinglePayload::Reason::FailedApplication;
- } else if (type == "failed-transport") {
- return JinglePayload::Reason::FailedTransport;
- } else if (type == "general-error") {
- return JinglePayload::Reason::GeneralError;
- } else if (type == "gone") {
- return JinglePayload::Reason::Gone;
- } else if (type == "incompatible-parameters") {
- return JinglePayload::Reason::IncompatibleParameters;
- } else if (type == "media-error") {
- return JinglePayload::Reason::MediaError;
- } else if (type == "security-error") {
- return JinglePayload::Reason::SecurityError;
- } else if (type == "success") {
- return JinglePayload::Reason::Success;
- } else if (type == "timeout") {
- return JinglePayload::Reason::Timeout;
- } else if (type == "unsupported-applications") {
- return JinglePayload::Reason::UnsupportedApplications;
- } else if (type == "unsupported-transports") {
- return JinglePayload::Reason::UnsupportedTransports;
- } else {
- return JinglePayload::Reason::UnknownType;
- }
- }
+ JingleReasonParser::JingleReasonParser() : level(0), parseText(false) {
+
+ }
+
+ void JingleReasonParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) {
+ if (level == 1) {
+ if (element == "text") {
+ parseText = true;
+ } else {
+ // reason type
+ getPayloadInternal()->type = stringToReasonType(element);
+ }
+ }
+ ++level;
+ }
+
+ void JingleReasonParser::handleEndElement(const std::string& element, const std::string&) {
+ --level;
+ if (element == "text") {
+ parseText = false;
+ getPayloadInternal()->text = text;
+ }
+ }
+
+ void JingleReasonParser::handleCharacterData(const std::string& data) {
+ if (parseText) {
+ text += data;
+ }
+ }
+
+ JinglePayload::Reason::Type JingleReasonParser::stringToReasonType(const std::string& type) const {
+ if (type == "alternative-session") {
+ return JinglePayload::Reason::AlternativeSession;
+ } else if (type == "busy") {
+ return JinglePayload::Reason::Busy;
+ } else if (type == "cancel") {
+ return JinglePayload::Reason::Cancel;
+ } else if (type == "connectivity-error") {
+ return JinglePayload::Reason::ConnectivityError;
+ } else if (type == "decline") {
+ return JinglePayload::Reason::Decline;
+ } else if (type == "expired") {
+ return JinglePayload::Reason::Expired;
+ } else if (type == "failed-application") {
+ return JinglePayload::Reason::FailedApplication;
+ } else if (type == "failed-transport") {
+ return JinglePayload::Reason::FailedTransport;
+ } else if (type == "general-error") {
+ return JinglePayload::Reason::GeneralError;
+ } else if (type == "gone") {
+ return JinglePayload::Reason::Gone;
+ } else if (type == "incompatible-parameters") {
+ return JinglePayload::Reason::IncompatibleParameters;
+ } else if (type == "media-error") {
+ return JinglePayload::Reason::MediaError;
+ } else if (type == "security-error") {
+ return JinglePayload::Reason::SecurityError;
+ } else if (type == "success") {
+ return JinglePayload::Reason::Success;
+ } else if (type == "timeout") {
+ return JinglePayload::Reason::Timeout;
+ } else if (type == "unsupported-applications") {
+ return JinglePayload::Reason::UnsupportedApplications;
+ } else if (type == "unsupported-transports") {
+ return JinglePayload::Reason::UnsupportedTransports;
+ } else {
+ return JinglePayload::Reason::UnknownType;
+ }
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/JingleReasonParser.h b/Swiften/Parser/PayloadParsers/JingleReasonParser.h
index 4fe334e..a445448 100644
--- a/Swiften/Parser/PayloadParsers/JingleReasonParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleReasonParser.h
@@ -19,19 +19,19 @@
namespace Swift {
class SWIFTEN_API JingleReasonParser : public GenericPayloadParser<JinglePayload::Reason> {
- public:
- JingleReasonParser();
-
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
- private:
- JinglePayload::Reason::Type stringToReasonType(const std::string& type) const;
-
- private:
- int level;
- bool parseText;
- std::string text;
+ public:
+ JingleReasonParser();
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
+ private:
+ JinglePayload::Reason::Type stringToReasonType(const std::string& type) const;
+
+ private:
+ int level;
+ bool parseText;
+ std::string text;
};
}
diff --git a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
index 4a7e6c1..859dcec 100644
--- a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
@@ -18,78 +18,78 @@
#include <Swiften/Base/Log.h>
namespace Swift {
- JingleS5BTransportMethodPayloadParser::JingleS5BTransportMethodPayloadParser() : level(0) {
-
- }
-
- void JingleS5BTransportMethodPayloadParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level == 0) {
- getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
- std::string mode = attributes.getAttributeValue("mode").get_value_or("tcp");
- if (mode == "tcp") {
- getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode);
- } else if(mode == "udp") {
- getPayloadInternal()->setMode(JingleS5BTransportPayload::UDPMode);
- } else {
- SWIFT_LOG(warning) << "Unknown S5B mode; falling back to defaul!";
- getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode);
- }
- getPayloadInternal()->setDstAddr(attributes.getAttributeValue("dstaddr").get_value_or(""));
- } else if (level == 1) {
- if (element == "candidate") {
- JingleS5BTransportPayload::Candidate candidate;
- candidate.cid = attributes.getAttributeValue("cid").get_value_or("");
-
- int port = -1;
- try {
- port = boost::lexical_cast<int>(attributes.getAttributeValue("port").get_value_or("-1"));
- } catch(boost::bad_lexical_cast &) { }
- candidate.hostPort = HostAddressPort(HostAddress(attributes.getAttributeValue("host").get_value_or("")), port);
- candidate.jid = JID(attributes.getAttributeValue("jid").get_value_or(""));
- int priority = -1;
- try {
- priority = boost::lexical_cast<int>(attributes.getAttributeValue("priority").get_value_or("-1"));
- } catch(boost::bad_lexical_cast &) { }
- candidate.priority = priority;
- candidate.type = stringToType(attributes.getAttributeValue("type").get_value_or("direct"));
-
- getPayloadInternal()->addCandidate(candidate);
- } else if (element == "candidate-used") {
- getPayloadInternal()->setCandidateUsed(attributes.getAttributeValue("cid").get_value_or(""));
- } else if (element == "candidate-error") {
- getPayloadInternal()->setCandidateError(true);
- } else if (element == "activated") {
- getPayloadInternal()->setActivated(attributes.getAttributeValue("cid").get_value_or(""));
- } else if (element == "proxy-error") {
- getPayloadInternal()->setProxyError(true);
- }
- }
-
- ++level;
- }
-
- void JingleS5BTransportMethodPayloadParser::handleEndElement(const std::string&, const std::string&) {
- --level;
-
-
- }
-
- void JingleS5BTransportMethodPayloadParser::handleCharacterData(const std::string&) {
-
- }
-
- JingleS5BTransportPayload::Candidate::Type JingleS5BTransportMethodPayloadParser::stringToType(const std::string &str) const {
- if (str == "direct") {
- return JingleS5BTransportPayload::Candidate::DirectType;
- } else if (str == "assisted") {
- return JingleS5BTransportPayload::Candidate::AssistedType;
- } else if (str == "tunnel") {
- return JingleS5BTransportPayload::Candidate::TunnelType;
- } else if (str == "proxy") {
- return JingleS5BTransportPayload::Candidate::ProxyType;
- } else {
- SWIFT_LOG(warning) << "Unknown candidate type; falling back to default!";
- return JingleS5BTransportPayload::Candidate::DirectType;
- }
- }
+ JingleS5BTransportMethodPayloadParser::JingleS5BTransportMethodPayloadParser() : level(0) {
+
+ }
+
+ void JingleS5BTransportMethodPayloadParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
+ if (level == 0) {
+ getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
+ std::string mode = attributes.getAttributeValue("mode").get_value_or("tcp");
+ if (mode == "tcp") {
+ getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode);
+ } else if(mode == "udp") {
+ getPayloadInternal()->setMode(JingleS5BTransportPayload::UDPMode);
+ } else {
+ SWIFT_LOG(warning) << "Unknown S5B mode; falling back to defaul!";
+ getPayloadInternal()->setMode(JingleS5BTransportPayload::TCPMode);
+ }
+ getPayloadInternal()->setDstAddr(attributes.getAttributeValue("dstaddr").get_value_or(""));
+ } else if (level == 1) {
+ if (element == "candidate") {
+ JingleS5BTransportPayload::Candidate candidate;
+ candidate.cid = attributes.getAttributeValue("cid").get_value_or("");
+
+ int port = -1;
+ try {
+ port = boost::lexical_cast<int>(attributes.getAttributeValue("port").get_value_or("-1"));
+ } catch(boost::bad_lexical_cast &) { }
+ candidate.hostPort = HostAddressPort(HostAddress(attributes.getAttributeValue("host").get_value_or("")), port);
+ candidate.jid = JID(attributes.getAttributeValue("jid").get_value_or(""));
+ int priority = -1;
+ try {
+ priority = boost::lexical_cast<int>(attributes.getAttributeValue("priority").get_value_or("-1"));
+ } catch(boost::bad_lexical_cast &) { }
+ candidate.priority = priority;
+ candidate.type = stringToType(attributes.getAttributeValue("type").get_value_or("direct"));
+
+ getPayloadInternal()->addCandidate(candidate);
+ } else if (element == "candidate-used") {
+ getPayloadInternal()->setCandidateUsed(attributes.getAttributeValue("cid").get_value_or(""));
+ } else if (element == "candidate-error") {
+ getPayloadInternal()->setCandidateError(true);
+ } else if (element == "activated") {
+ getPayloadInternal()->setActivated(attributes.getAttributeValue("cid").get_value_or(""));
+ } else if (element == "proxy-error") {
+ getPayloadInternal()->setProxyError(true);
+ }
+ }
+
+ ++level;
+ }
+
+ void JingleS5BTransportMethodPayloadParser::handleEndElement(const std::string&, const std::string&) {
+ --level;
+
+
+ }
+
+ void JingleS5BTransportMethodPayloadParser::handleCharacterData(const std::string&) {
+
+ }
+
+ JingleS5BTransportPayload::Candidate::Type JingleS5BTransportMethodPayloadParser::stringToType(const std::string &str) const {
+ if (str == "direct") {
+ return JingleS5BTransportPayload::Candidate::DirectType;
+ } else if (str == "assisted") {
+ return JingleS5BTransportPayload::Candidate::AssistedType;
+ } else if (str == "tunnel") {
+ return JingleS5BTransportPayload::Candidate::TunnelType;
+ } else if (str == "proxy") {
+ return JingleS5BTransportPayload::Candidate::ProxyType;
+ } else {
+ SWIFT_LOG(warning) << "Unknown candidate type; falling back to default!";
+ return JingleS5BTransportPayload::Candidate::DirectType;
+ }
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h
index ccf0b1b..f48c4b5 100644
--- a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h
@@ -19,18 +19,18 @@
namespace Swift {
class SWIFTEN_API JingleS5BTransportMethodPayloadParser : public GenericPayloadParser<JingleS5BTransportPayload> {
- public:
- JingleS5BTransportMethodPayloadParser();
+ public:
+ JingleS5BTransportMethodPayloadParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- JingleS5BTransportPayload::Candidate::Type stringToType(const std::string &str) const;
+ private:
+ JingleS5BTransportPayload::Candidate::Type stringToType(const std::string &str) const;
- private:
- int level;
+ private:
+ int level;
};
}
diff --git a/Swiften/Parser/PayloadParsers/LastParser.cpp b/Swiften/Parser/PayloadParsers/LastParser.cpp
index 896a554..89d39ac 100644
--- a/Swiften/Parser/PayloadParsers/LastParser.cpp
+++ b/Swiften/Parser/PayloadParsers/LastParser.cpp
@@ -14,16 +14,16 @@ LastParser::LastParser() : level_(0) {
}
void LastParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
- if (level_ == 0) {
- int seconds = 0;
- try {
- seconds = boost::lexical_cast<int>(attributes.getAttribute("seconds"));
- }
- catch (boost::bad_lexical_cast&) {
- }
- getPayloadInternal()->setSeconds(seconds);
- }
- ++level_;
+ if (level_ == 0) {
+ int seconds = 0;
+ try {
+ seconds = boost::lexical_cast<int>(attributes.getAttribute("seconds"));
+ }
+ catch (boost::bad_lexical_cast&) {
+ }
+ getPayloadInternal()->setSeconds(seconds);
+ }
+ ++level_;
}
diff --git a/Swiften/Parser/PayloadParsers/LastParser.h b/Swiften/Parser/PayloadParsers/LastParser.h
index 58cde22..70bfdcb 100644
--- a/Swiften/Parser/PayloadParsers/LastParser.h
+++ b/Swiften/Parser/PayloadParsers/LastParser.h
@@ -11,15 +11,15 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API LastParser : public GenericPayloadParser<Last> {
- public:
- LastParser();
+ class SWIFTEN_API LastParser : public GenericPayloadParser<Last> {
+ public:
+ LastParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- };
+ private:
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MAMFinParser.cpp b/Swiften/Parser/PayloadParsers/MAMFinParser.cpp
index e972381..a29a7c4 100644
--- a/Swiften/Parser/PayloadParsers/MAMFinParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MAMFinParser.cpp
@@ -20,42 +20,42 @@ MAMFinParser::MAMFinParser() : level_(TopLevel) {
}
void MAMFinParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- getPayloadInternal()->setComplete(attributes.getBoolAttribute("complete", false));
- getPayloadInternal()->setStable(attributes.getBoolAttribute("stable", true));
- boost::optional<std::string> attributeValue;
- if ((attributeValue = attributes.getAttributeValue("queryid"))) {
- getPayloadInternal()->setQueryID(*attributeValue);
- }
- }
- else if (level_ == PayloadLevel) {
- if (element == "set" && ns == "http://jabber.org/protocol/rsm") {
- resultSetParser_ = boost::make_shared<ResultSetParser>();
- }
- }
-
- if (resultSetParser_) { /* parsing a nested ResultSet */
- resultSetParser_->handleStartElement(element, ns, attributes);
- }
-
- ++level_;
+ if (level_ == TopLevel) {
+ getPayloadInternal()->setComplete(attributes.getBoolAttribute("complete", false));
+ getPayloadInternal()->setStable(attributes.getBoolAttribute("stable", true));
+ boost::optional<std::string> attributeValue;
+ if ((attributeValue = attributes.getAttributeValue("queryid"))) {
+ getPayloadInternal()->setQueryID(*attributeValue);
+ }
+ }
+ else if (level_ == PayloadLevel) {
+ if (element == "set" && ns == "http://jabber.org/protocol/rsm") {
+ resultSetParser_ = boost::make_shared<ResultSetParser>();
+ }
+ }
+
+ if (resultSetParser_) { /* parsing a nested ResultSet */
+ resultSetParser_->handleStartElement(element, ns, attributes);
+ }
+
+ ++level_;
}
void MAMFinParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
-
- if (resultSetParser_ && level_ >= PayloadLevel) {
- resultSetParser_->handleEndElement(element, ns);
- }
- if (resultSetParser_ && level_ == PayloadLevel) {
- /* done parsing nested ResultSet */
- getPayloadInternal()->setResultSet(boost::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload()));
- resultSetParser_.reset();
- }
+ --level_;
+
+ if (resultSetParser_ && level_ >= PayloadLevel) {
+ resultSetParser_->handleEndElement(element, ns);
+ }
+ if (resultSetParser_ && level_ == PayloadLevel) {
+ /* done parsing nested ResultSet */
+ getPayloadInternal()->setResultSet(boost::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload()));
+ resultSetParser_.reset();
+ }
}
void MAMFinParser::handleCharacterData(const std::string& data) {
- if (resultSetParser_) {
- resultSetParser_->handleCharacterData(data);
- }
+ if (resultSetParser_) {
+ resultSetParser_->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/MAMFinParser.h b/Swiften/Parser/PayloadParsers/MAMFinParser.h
index 6f2d942..2e805ad 100644
--- a/Swiften/Parser/PayloadParsers/MAMFinParser.h
+++ b/Swiften/Parser/PayloadParsers/MAMFinParser.h
@@ -14,23 +14,23 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class ResultSetParser;
+ class ResultSetParser;
- class SWIFTEN_API MAMFinParser : public GenericPayloadParser<MAMFin> {
- public:
- MAMFinParser();
+ class SWIFTEN_API MAMFinParser : public GenericPayloadParser<MAMFin> {
+ public:
+ MAMFinParser();
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
- private:
- boost::shared_ptr<ResultSetParser> resultSetParser_;
- int level_;
- };
+ private:
+ boost::shared_ptr<ResultSetParser> resultSetParser_;
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp b/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp
index 3be997b..41fbbb7 100644
--- a/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MAMQueryParser.cpp
@@ -19,60 +19,60 @@ MAMQueryParser::MAMQueryParser() : level_(TopLevel) {
}
void MAMQueryParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- boost::optional<std::string> attributeValue;
- if ((attributeValue = attributes.getAttributeValue("queryid"))) {
- getPayloadInternal()->setQueryID(*attributeValue);
- }
- if ((attributeValue = attributes.getAttributeValue("node"))) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- } else if (level_ == PayloadLevel) {
- if (element == "x" && ns == "jabber:x:data") {
- formParser_ = boost::make_shared<FormParser>();
- } else if (element == "set" && ns == "http://jabber.org/protocol/rsm") {
- resultSetParser_ = boost::make_shared<ResultSetParser>();
- }
- }
+ if (level_ == TopLevel) {
+ boost::optional<std::string> attributeValue;
+ if ((attributeValue = attributes.getAttributeValue("queryid"))) {
+ getPayloadInternal()->setQueryID(*attributeValue);
+ }
+ if ((attributeValue = attributes.getAttributeValue("node"))) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ } else if (level_ == PayloadLevel) {
+ if (element == "x" && ns == "jabber:x:data") {
+ formParser_ = boost::make_shared<FormParser>();
+ } else if (element == "set" && ns == "http://jabber.org/protocol/rsm") {
+ resultSetParser_ = boost::make_shared<ResultSetParser>();
+ }
+ }
- if (formParser_) { /* parsing a nested Form */
- formParser_->handleStartElement(element, ns, attributes);
- }
+ if (formParser_) { /* parsing a nested Form */
+ formParser_->handleStartElement(element, ns, attributes);
+ }
- if (resultSetParser_) { /* parsing a nested ResultSet */
- resultSetParser_->handleStartElement(element, ns, attributes);
- }
+ if (resultSetParser_) { /* parsing a nested ResultSet */
+ resultSetParser_->handleStartElement(element, ns, attributes);
+ }
- ++level_;
+ ++level_;
}
void MAMQueryParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
+ --level_;
- if (formParser_ && level_ >= PayloadLevel) {
- formParser_->handleEndElement(element, ns);
- }
- if (formParser_ && level_ == PayloadLevel) {
- /* done parsing nested Form */
- getPayloadInternal()->setForm(boost::dynamic_pointer_cast<Form>(formParser_->getPayload()));
- formParser_.reset();
- }
+ if (formParser_ && level_ >= PayloadLevel) {
+ formParser_->handleEndElement(element, ns);
+ }
+ if (formParser_ && level_ == PayloadLevel) {
+ /* done parsing nested Form */
+ getPayloadInternal()->setForm(boost::dynamic_pointer_cast<Form>(formParser_->getPayload()));
+ formParser_.reset();
+ }
- if (resultSetParser_ && level_ >= PayloadLevel) {
- resultSetParser_->handleEndElement(element, ns);
- }
- if (resultSetParser_ && level_ == PayloadLevel) {
- /* done parsing nested ResultSet */
- getPayloadInternal()->setResultSet(boost::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload()));
- resultSetParser_.reset();
- }
+ if (resultSetParser_ && level_ >= PayloadLevel) {
+ resultSetParser_->handleEndElement(element, ns);
+ }
+ if (resultSetParser_ && level_ == PayloadLevel) {
+ /* done parsing nested ResultSet */
+ getPayloadInternal()->setResultSet(boost::dynamic_pointer_cast<ResultSet>(resultSetParser_->getPayload()));
+ resultSetParser_.reset();
+ }
}
void MAMQueryParser::handleCharacterData(const std::string& data) {
- if (formParser_) {
- formParser_->handleCharacterData(data);
- }
- if (resultSetParser_) {
- resultSetParser_->handleCharacterData(data);
- }
+ if (formParser_) {
+ formParser_->handleCharacterData(data);
+ }
+ if (resultSetParser_) {
+ resultSetParser_->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/MAMQueryParser.h b/Swiften/Parser/PayloadParsers/MAMQueryParser.h
index 119f956..4f5bd47 100644
--- a/Swiften/Parser/PayloadParsers/MAMQueryParser.h
+++ b/Swiften/Parser/PayloadParsers/MAMQueryParser.h
@@ -16,25 +16,25 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class ResultSetParser;
- class FormParser;
-
- class SWIFTEN_API MAMQueryParser : public GenericPayloadParser<MAMQuery> {
- public:
- MAMQueryParser();
-
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
-
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
-
- private:
- boost::shared_ptr<FormParser> formParser_;
- boost::shared_ptr<ResultSetParser> resultSetParser_;
- int level_;
- };
+ class ResultSetParser;
+ class FormParser;
+
+ class SWIFTEN_API MAMQueryParser : public GenericPayloadParser<MAMQuery> {
+ public:
+ MAMQueryParser();
+
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+
+ private:
+ boost::shared_ptr<FormParser> formParser_;
+ boost::shared_ptr<ResultSetParser> resultSetParser_;
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MAMResultParser.cpp b/Swiften/Parser/PayloadParsers/MAMResultParser.cpp
index ac32100..e39ed94 100644
--- a/Swiften/Parser/PayloadParsers/MAMResultParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MAMResultParser.cpp
@@ -18,42 +18,42 @@ MAMResultParser::MAMResultParser(PayloadParserFactoryCollection* factories) : fa
}
void MAMResultParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == TopLevel) {
- boost::optional<std::string> attributeValue;
- if ((attributeValue = attributes.getAttributeValue("id"))) {
- getPayloadInternal()->setID(*attributeValue);
- }
- if ((attributeValue = attributes.getAttributeValue("queryid"))) {
- getPayloadInternal()->setQueryID(*attributeValue);
- }
- } else if (level_ == PayloadLevel) {
- if (element == "forwarded" && ns == "urn:xmpp:forward:0") {
- payloadParser_ = boost::make_shared<ForwardedParser>(factories_);
- }
- }
-
- if (payloadParser_) {
- /* parsing a nested payload */
- payloadParser_->handleStartElement(element, ns, attributes);
- }
-
- ++level_;
+ if (level_ == TopLevel) {
+ boost::optional<std::string> attributeValue;
+ if ((attributeValue = attributes.getAttributeValue("id"))) {
+ getPayloadInternal()->setID(*attributeValue);
+ }
+ if ((attributeValue = attributes.getAttributeValue("queryid"))) {
+ getPayloadInternal()->setQueryID(*attributeValue);
+ }
+ } else if (level_ == PayloadLevel) {
+ if (element == "forwarded" && ns == "urn:xmpp:forward:0") {
+ payloadParser_ = boost::make_shared<ForwardedParser>(factories_);
+ }
+ }
+
+ if (payloadParser_) {
+ /* parsing a nested payload */
+ payloadParser_->handleStartElement(element, ns, attributes);
+ }
+
+ ++level_;
}
void MAMResultParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level_;
- if (payloadParser_ && level_ >= PayloadLevel) {
- payloadParser_->handleEndElement(element, ns);
- }
- if (payloadParser_ && level_ == PayloadLevel) {
- /* done parsing nested stanza */
- getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<Forwarded>(payloadParser_->getPayload()));
- payloadParser_.reset();
- }
+ --level_;
+ if (payloadParser_ && level_ >= PayloadLevel) {
+ payloadParser_->handleEndElement(element, ns);
+ }
+ if (payloadParser_ && level_ == PayloadLevel) {
+ /* done parsing nested stanza */
+ getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<Forwarded>(payloadParser_->getPayload()));
+ payloadParser_.reset();
+ }
}
void MAMResultParser::handleCharacterData(const std::string& data) {
- if (payloadParser_) {
- payloadParser_->handleCharacterData(data);
- }
+ if (payloadParser_) {
+ payloadParser_->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/MAMResultParser.h b/Swiften/Parser/PayloadParsers/MAMResultParser.h
index e1b0b8e..5177f8b 100644
--- a/Swiften/Parser/PayloadParsers/MAMResultParser.h
+++ b/Swiften/Parser/PayloadParsers/MAMResultParser.h
@@ -16,25 +16,25 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class ForwardedParser;
-
- class SWIFTEN_API MAMResultParser : public GenericPayloadParser<MAMResult> {
- public:
- MAMResultParser(PayloadParserFactoryCollection* factories);
-
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
-
- enum Level {
- TopLevel = 0,
- PayloadLevel = 1
- };
-
- private:
- boost::shared_ptr<ForwardedParser> payloadParser_;
- PayloadParserFactoryCollection* factories_;
- int level_;
- };
+ class PayloadParserFactoryCollection;
+ class ForwardedParser;
+
+ class SWIFTEN_API MAMResultParser : public GenericPayloadParser<MAMResult> {
+ public:
+ MAMResultParser(PayloadParserFactoryCollection* factories);
+
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+
+ enum Level {
+ TopLevel = 0,
+ PayloadLevel = 1
+ };
+
+ private:
+ boost::shared_ptr<ForwardedParser> payloadParser_;
+ PayloadParserFactoryCollection* factories_;
+ int level_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp
index 717fc60..1fbff1c 100644
--- a/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.cpp
@@ -14,10 +14,10 @@
namespace Swift {
void MUCAdminPayloadParser::handleTree(ParserElement::ref root) {
- foreach (ParserElement::ref itemElement, root->getChildren("item", "http://jabber.org/protocol/muc#admin")) {
- MUCItem item = MUCItemParser::itemFromTree(itemElement);
- getPayloadInternal()->addItem(item);
- }
+ foreach (ParserElement::ref itemElement, root->getChildren("item", "http://jabber.org/protocol/muc#admin")) {
+ MUCItem item = MUCItemParser::itemFromTree(itemElement);
+ getPayloadInternal()->addItem(item);
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h
index 9174c7d..de46690 100644
--- a/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h
@@ -14,8 +14,8 @@
#include <Swiften/Parser/PayloadParsers/MUCItemParser.h>
namespace Swift {
- class SWIFTEN_API MUCAdminPayloadParser : public GenericPayloadTreeParser<MUCAdminPayload> {
- public:
- virtual void handleTree(ParserElement::ref root);
- };
+ class SWIFTEN_API MUCAdminPayloadParser : public GenericPayloadTreeParser<MUCAdminPayload> {
+ public:
+ virtual void handleTree(ParserElement::ref root);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp
index b70c1d4..95ff8c5 100644
--- a/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.cpp
@@ -11,12 +11,12 @@
namespace Swift {
void MUCDestroyPayloadParser::handleTree(ParserElement::ref root) {
- std::string ns = root->getNamespace();
- std::string jid = root->getAttributes().getAttribute("jid");
- if (!jid.empty()) {
- getPayloadInternal()->setNewVenue(JID(jid));
- }
- getPayloadInternal()->setReason(root->getChild("reason", ns)->getText());
+ std::string ns = root->getNamespace();
+ std::string jid = root->getAttributes().getAttribute("jid");
+ if (!jid.empty()) {
+ getPayloadInternal()->setNewVenue(JID(jid));
+ }
+ getPayloadInternal()->setReason(root->getChild("reason", ns)->getText());
}
}
diff --git a/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h
index 1e5d545..e79d9a6 100644
--- a/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h
@@ -13,8 +13,8 @@
#include <Swiften/Parser/GenericPayloadTreeParser.h>
namespace Swift {
- class SWIFTEN_API MUCDestroyPayloadParser : public GenericPayloadTreeParser<MUCDestroyPayload> {
- public:
- virtual void handleTree(ParserElement::ref root);
- };
+ class SWIFTEN_API MUCDestroyPayloadParser : public GenericPayloadTreeParser<MUCDestroyPayload> {
+ public:
+ virtual void handleTree(ParserElement::ref root);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp
index 376353d..20e5f2b 100644
--- a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.cpp
@@ -11,14 +11,14 @@
namespace Swift {
void MUCInvitationPayloadParser::handleTree(ParserElement::ref root) {
- MUCInvitationPayload::ref invite = getPayloadInternal();
- invite->setIsContinuation(root->getAttributes().getBoolAttribute("continue", false));
- invite->setJID(JID(root->getAttributes().getAttribute("jid")));
- invite->setPassword(root->getAttributes().getAttribute("password"));
- invite->setReason(root->getAttributes().getAttribute("reason"));
- invite->setThread(root->getAttributes().getAttribute("thread"));
- ParserElement::ref impromptuNode = root->getChild("impromptu", "http://swift.im/impromptu");
- invite->setIsImpromptu(!boost::dynamic_pointer_cast<NullParserElement>(impromptuNode));
+ MUCInvitationPayload::ref invite = getPayloadInternal();
+ invite->setIsContinuation(root->getAttributes().getBoolAttribute("continue", false));
+ invite->setJID(JID(root->getAttributes().getAttribute("jid")));
+ invite->setPassword(root->getAttributes().getAttribute("password"));
+ invite->setReason(root->getAttributes().getAttribute("reason"));
+ invite->setThread(root->getAttributes().getAttribute("thread"));
+ ParserElement::ref impromptuNode = root->getChild("impromptu", "http://swift.im/impromptu");
+ invite->setIsImpromptu(!boost::dynamic_pointer_cast<NullParserElement>(impromptuNode));
}
}
diff --git a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h
index f79c971..7b76166 100644
--- a/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h
@@ -11,8 +11,8 @@
#include <Swiften/Parser/GenericPayloadTreeParser.h>
namespace Swift {
- class SWIFTEN_API MUCInvitationPayloadParser : public GenericPayloadTreeParser<MUCInvitationPayload> {
- public:
- virtual void handleTree(ParserElement::ref root);
- };
+ class SWIFTEN_API MUCInvitationPayloadParser : public GenericPayloadTreeParser<MUCInvitationPayload> {
+ public:
+ virtual void handleTree(ParserElement::ref root);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCItemParser.cpp b/Swiften/Parser/PayloadParsers/MUCItemParser.cpp
index 332df11..0486cb4 100644
--- a/Swiften/Parser/PayloadParsers/MUCItemParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCItemParser.cpp
@@ -16,65 +16,65 @@
namespace Swift {
MUCItem MUCItemParser::itemFromTree(ParserElement::ref root) {
- MUCItem item;
- std::string affiliation = root->getAttributes().getAttribute("affiliation");
- std::string role = root->getAttributes().getAttribute("role");
- std::string nick = root->getAttributes().getAttribute("nick");
- std::string jid = root->getAttributes().getAttribute("jid");
- item.affiliation = parseAffiliation(affiliation);
- item.role = parseRole(role);
- if (!jid.empty()) {
- item.realJID = JID(jid);
- }
- if (!nick.empty()) {
- item.nick = nick;
- }
- std::string xmlns = root->getNamespace();
- std::string reason = root->getChild("reason", xmlns)->getText();
- std::string actor = root->getChild("actor", xmlns)->getAttributes().getAttribute("jid");
- if (!reason.empty()) {
- item.reason = reason;
- }
- if (!actor.empty()) {
- item.actor = JID(actor);
- }
+ MUCItem item;
+ std::string affiliation = root->getAttributes().getAttribute("affiliation");
+ std::string role = root->getAttributes().getAttribute("role");
+ std::string nick = root->getAttributes().getAttribute("nick");
+ std::string jid = root->getAttributes().getAttribute("jid");
+ item.affiliation = parseAffiliation(affiliation);
+ item.role = parseRole(role);
+ if (!jid.empty()) {
+ item.realJID = JID(jid);
+ }
+ if (!nick.empty()) {
+ item.nick = nick;
+ }
+ std::string xmlns = root->getNamespace();
+ std::string reason = root->getChild("reason", xmlns)->getText();
+ std::string actor = root->getChild("actor", xmlns)->getAttributes().getAttribute("jid");
+ if (!reason.empty()) {
+ item.reason = reason;
+ }
+ if (!actor.empty()) {
+ item.actor = JID(actor);
+ }
- return item;
+ return item;
}
boost::optional<MUCOccupant::Role> MUCItemParser::parseRole(const std::string& roleString) {
- if (roleString == "moderator") {
- return MUCOccupant::Moderator;
- }
- if (roleString == "participant") {
- return MUCOccupant::Participant;
- }
- if (roleString == "visitor") {
- return MUCOccupant::Visitor;
- }
- if (roleString == "none") {
- return MUCOccupant::NoRole;
- }
- return boost::optional<MUCOccupant::Role>();
+ if (roleString == "moderator") {
+ return MUCOccupant::Moderator;
+ }
+ if (roleString == "participant") {
+ return MUCOccupant::Participant;
+ }
+ if (roleString == "visitor") {
+ return MUCOccupant::Visitor;
+ }
+ if (roleString == "none") {
+ return MUCOccupant::NoRole;
+ }
+ return boost::optional<MUCOccupant::Role>();
}
boost::optional<MUCOccupant::Affiliation> MUCItemParser::parseAffiliation(const std::string& affiliationString) {
- if (affiliationString == "owner") {
- return MUCOccupant::Owner;
- }
- if (affiliationString == "admin") {
- return MUCOccupant::Admin;
- }
- if (affiliationString == "member") {
- return MUCOccupant::Member;
- }
- if (affiliationString == "outcast") {
- return MUCOccupant::Outcast;
- }
- if (affiliationString == "none") {
- return MUCOccupant::NoAffiliation;
- }
- return boost::optional<MUCOccupant::Affiliation>();
+ if (affiliationString == "owner") {
+ return MUCOccupant::Owner;
+ }
+ if (affiliationString == "admin") {
+ return MUCOccupant::Admin;
+ }
+ if (affiliationString == "member") {
+ return MUCOccupant::Member;
+ }
+ if (affiliationString == "outcast") {
+ return MUCOccupant::Outcast;
+ }
+ if (affiliationString == "none") {
+ return MUCOccupant::NoAffiliation;
+ }
+ return boost::optional<MUCOccupant::Affiliation>();
}
}
diff --git a/Swiften/Parser/PayloadParsers/MUCItemParser.h b/Swiften/Parser/PayloadParsers/MUCItemParser.h
index fc5d657..6f80d54 100644
--- a/Swiften/Parser/PayloadParsers/MUCItemParser.h
+++ b/Swiften/Parser/PayloadParsers/MUCItemParser.h
@@ -11,11 +11,11 @@
#include <Swiften/Parser/GenericPayloadTreeParser.h>
namespace Swift {
- class SWIFTEN_API MUCItemParser {
- public:
- static MUCItem itemFromTree(ParserElement::ref root);
- private:
- static boost::optional<MUCOccupant::Role> parseRole(const std::string& itemString);
- static boost::optional<MUCOccupant::Affiliation> parseAffiliation(const std::string& statusString);
- };
+ class SWIFTEN_API MUCItemParser {
+ public:
+ static MUCItem itemFromTree(ParserElement::ref root);
+ private:
+ static boost::optional<MUCOccupant::Role> parseRole(const std::string& itemString);
+ static boost::optional<MUCOccupant::Affiliation> parseAffiliation(const std::string& statusString);
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.cpp
index b4cc7b6..7e7c0d4 100644
--- a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.cpp
@@ -15,36 +15,36 @@ MUCOwnerPayloadParser::MUCOwnerPayloadParser(PayloadParserFactoryCollection* fac
}
void MUCOwnerPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 1) {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 1) {
+ PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void MUCOwnerPayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
+ }
+ }
}
void MUCOwnerPayloadParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h
index 85db82f..6502512 100644
--- a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h
@@ -13,20 +13,20 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API MUCOwnerPayloadParser : public GenericPayloadParser<MUCOwnerPayload> {
- public:
- MUCOwnerPayloadParser(PayloadParserFactoryCollection* factories);
+ class SWIFTEN_API MUCOwnerPayloadParser : public GenericPayloadParser<MUCOwnerPayload> {
+ public:
+ MUCOwnerPayloadParser(PayloadParserFactoryCollection* factories);
- private:
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ private:
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- PayloadParserFactoryCollection* factories;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* factories;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h
index 9270dc7..d6399e7 100644
--- a/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h
@@ -11,23 +11,23 @@
#include <Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API MUCOwnerPayloadParserFactory : public PayloadParserFactory {
- public:
- MUCOwnerPayloadParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
+ class SWIFTEN_API MUCOwnerPayloadParserFactory : public PayloadParserFactory {
+ public:
+ MUCOwnerPayloadParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return element == "query" && ns == "http://jabber.org/protocol/muc#owner";
- }
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "query" && ns == "http://jabber.org/protocol/muc#owner";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new MUCOwnerPayloadParser(factories);
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new MUCOwnerPayloadParser(factories);
+ }
- private:
- PayloadParserFactoryCollection* factories;
+ private:
+ PayloadParserFactoryCollection* factories;
- };
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp
index 39e216c..00a5d4f 100644
--- a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.cpp
@@ -17,42 +17,42 @@
namespace Swift {
void MUCUserPayloadParser::handleTree(ParserElement::ref root) {
- foreach (ParserElement::ref child, root->getAllChildren()) {
- if (child->getName() == "item" && child->getNamespace() == root->getNamespace()) {
- MUCItem item = MUCItemParser::itemFromTree(child);
- getPayloadInternal()->addItem(item);
- }
- else if (child->getName() == "password" && child->getNamespace() == root->getNamespace()) {
- getPayloadInternal()->setPassword(child->getText());
- }
- else if (child->getName() == "invite" && child->getNamespace() == root->getNamespace()) {
- MUCUserPayload::Invite invite;
- std::string to = child->getAttributes().getAttribute("to");
- if (!to.empty()) {
- invite.to = to;
- }
- std::string from = child->getAttributes().getAttribute("from");
- if (!from.empty()) {
- invite.from = from;
- }
- ParserElement::ref reason = child->getChild("reason", root->getNamespace());
- if (reason) {
- invite.reason = reason->getText();
- }
- getPayloadInternal()->setInvite(invite);
- }
- else if (child->getName() == "status" && child->getNamespace() == root->getNamespace()) {
- MUCUserPayload::StatusCode status;
- try {
- status.code = boost::lexical_cast<int>(child->getAttributes().getAttribute("code").c_str());
- getPayloadInternal()->addStatusCode(status);
- } catch (boost::bad_lexical_cast&) {
- }
- }
- else {
- getPayloadInternal()->setPayload(TreeReparser::parseTree(child, factories));
- }
- }
+ foreach (ParserElement::ref child, root->getAllChildren()) {
+ if (child->getName() == "item" && child->getNamespace() == root->getNamespace()) {
+ MUCItem item = MUCItemParser::itemFromTree(child);
+ getPayloadInternal()->addItem(item);
+ }
+ else if (child->getName() == "password" && child->getNamespace() == root->getNamespace()) {
+ getPayloadInternal()->setPassword(child->getText());
+ }
+ else if (child->getName() == "invite" && child->getNamespace() == root->getNamespace()) {
+ MUCUserPayload::Invite invite;
+ std::string to = child->getAttributes().getAttribute("to");
+ if (!to.empty()) {
+ invite.to = to;
+ }
+ std::string from = child->getAttributes().getAttribute("from");
+ if (!from.empty()) {
+ invite.from = from;
+ }
+ ParserElement::ref reason = child->getChild("reason", root->getNamespace());
+ if (reason) {
+ invite.reason = reason->getText();
+ }
+ getPayloadInternal()->setInvite(invite);
+ }
+ else if (child->getName() == "status" && child->getNamespace() == root->getNamespace()) {
+ MUCUserPayload::StatusCode status;
+ try {
+ status.code = boost::lexical_cast<int>(child->getAttributes().getAttribute("code").c_str());
+ getPayloadInternal()->addStatusCode(status);
+ } catch (boost::bad_lexical_cast&) {
+ }
+ }
+ else {
+ getPayloadInternal()->setPayload(TreeReparser::parseTree(child, factories));
+ }
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h
index 3d7a53b..3d6dbab 100644
--- a/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h
+++ b/Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h
@@ -14,12 +14,12 @@
#include <Swiften/Parser/PayloadParsers/MUCItemParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class SWIFTEN_API MUCUserPayloadParser : public GenericPayloadTreeParser<MUCUserPayload> {
- public:
- MUCUserPayloadParser(PayloadParserFactoryCollection* collection) : factories(collection) {}
- virtual void handleTree(ParserElement::ref root);
- private:
- PayloadParserFactoryCollection* factories;
- };
+ class PayloadParserFactoryCollection;
+ class SWIFTEN_API MUCUserPayloadParser : public GenericPayloadTreeParser<MUCUserPayload> {
+ public:
+ MUCUserPayloadParser(PayloadParserFactoryCollection* collection) : factories(collection) {}
+ virtual void handleTree(ParserElement::ref root);
+ private:
+ PayloadParserFactoryCollection* factories;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h b/Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h
index 4cc9134..4a0380d 100644
--- a/Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h
@@ -11,20 +11,20 @@
#include <Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h>
namespace Swift {
- class SWIFTEN_API MUCUserPayloadParserFactory : public PayloadParserFactory {
- public:
- MUCUserPayloadParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
+ class SWIFTEN_API MUCUserPayloadParserFactory : public PayloadParserFactory {
+ public:
+ MUCUserPayloadParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return element == "x" && ns == "http://jabber.org/protocol/muc#user";
- }
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "x" && ns == "http://jabber.org/protocol/muc#user";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new MUCUserPayloadParser(factories);
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new MUCUserPayloadParser(factories);
+ }
- private:
- PayloadParserFactoryCollection* factories;
- };
+ private:
+ PayloadParserFactoryCollection* factories;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/NicknameParser.cpp b/Swiften/Parser/PayloadParsers/NicknameParser.cpp
index a3ce952..331355a 100644
--- a/Swiften/Parser/PayloadParsers/NicknameParser.cpp
+++ b/Swiften/Parser/PayloadParsers/NicknameParser.cpp
@@ -12,18 +12,18 @@ NicknameParser::NicknameParser() : level(0) {
}
void NicknameParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++level;
+ ++level;
}
void NicknameParser::handleEndElement(const std::string&, const std::string&) {
- --level;
- if (level == 0) {
- getPayloadInternal()->setNickname(text);
- }
+ --level;
+ if (level == 0) {
+ getPayloadInternal()->setNickname(text);
+ }
}
void NicknameParser::handleCharacterData(const std::string& data) {
- text += data;
+ text += data;
}
}
diff --git a/Swiften/Parser/PayloadParsers/NicknameParser.h b/Swiften/Parser/PayloadParsers/NicknameParser.h
index d8ac5b5..1bdd600 100644
--- a/Swiften/Parser/PayloadParsers/NicknameParser.h
+++ b/Swiften/Parser/PayloadParsers/NicknameParser.h
@@ -11,16 +11,16 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API NicknameParser : public GenericPayloadParser<Nickname> {
- public:
- NicknameParser();
+ class SWIFTEN_API NicknameParser : public GenericPayloadParser<Nickname> {
+ public:
+ NicknameParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level;
- std::string text;
- };
+ private:
+ int level;
+ std::string text;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PriorityParser.cpp b/Swiften/Parser/PayloadParsers/PriorityParser.cpp
index 862d219..88eef0d 100644
--- a/Swiften/Parser/PayloadParsers/PriorityParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PriorityParser.cpp
@@ -14,24 +14,24 @@ PriorityParser::PriorityParser() : level_(0) {
}
void PriorityParser::handleStartElement(const std::string&, const std::string&, const AttributeMap&) {
- ++level_;
+ ++level_;
}
void PriorityParser::handleEndElement(const std::string&, const std::string&) {
- --level_;
- if (level_ == 0) {
- int priority = 0;
- try {
- priority = boost::lexical_cast<int>(text_);
- }
- catch (boost::bad_lexical_cast&) {
- }
- getPayloadInternal()->setPriority(priority);
- }
+ --level_;
+ if (level_ == 0) {
+ int priority = 0;
+ try {
+ priority = boost::lexical_cast<int>(text_);
+ }
+ catch (boost::bad_lexical_cast&) {
+ }
+ getPayloadInternal()->setPriority(priority);
+ }
}
void PriorityParser::handleCharacterData(const std::string& data) {
- text_ += data;
+ text_ += data;
}
}
diff --git a/Swiften/Parser/PayloadParsers/PriorityParser.h b/Swiften/Parser/PayloadParsers/PriorityParser.h
index 6c34e3b..e6bf059 100644
--- a/Swiften/Parser/PayloadParsers/PriorityParser.h
+++ b/Swiften/Parser/PayloadParsers/PriorityParser.h
@@ -11,16 +11,16 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SWIFTEN_API PriorityParser : public GenericPayloadParser<Priority> {
- public:
- PriorityParser();
+ class SWIFTEN_API PriorityParser : public GenericPayloadParser<Priority> {
+ public:
+ PriorityParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- int level_;
- std::string text_;
- };
+ private:
+ int level_;
+ std::string text_;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp b/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp
index 0dca7b1..e40249a 100644
--- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PrivateStorageParser.cpp
@@ -15,36 +15,36 @@ PrivateStorageParser::PrivateStorageParser(PayloadParserFactoryCollection* facto
}
void PrivateStorageParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 1) {
- PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
- if (payloadParserFactory) {
- currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 1) {
+ PayloadParserFactory* payloadParserFactory = factories->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser.reset(payloadParserFactory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PrivateStorageParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ getPayloadInternal()->setPayload(currentPayloadParser->getPayload());
+ }
+ }
}
void PrivateStorageParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
}
diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h
index 57e4136..761a019 100644
--- a/Swiften/Parser/PayloadParsers/PrivateStorageParser.h
+++ b/Swiften/Parser/PayloadParsers/PrivateStorageParser.h
@@ -13,20 +13,20 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API PrivateStorageParser : public GenericPayloadParser<PrivateStorage> {
- public:
- PrivateStorageParser(PayloadParserFactoryCollection* factories);
+ class SWIFTEN_API PrivateStorageParser : public GenericPayloadParser<PrivateStorage> {
+ public:
+ PrivateStorageParser(PayloadParserFactoryCollection* factories);
- private:
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
- virtual void handleEndElement(const std::string& element, const std::string&);
- virtual void handleCharacterData(const std::string& data);
+ private:
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string&);
+ virtual void handleCharacterData(const std::string& data);
- private:
- PayloadParserFactoryCollection* factories;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* factories;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h b/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h
index e8db9af..550177c 100644
--- a/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h
@@ -11,23 +11,23 @@
#include <Swiften/Parser/PayloadParsers/PrivateStorageParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
+ class PayloadParserFactoryCollection;
- class SWIFTEN_API PrivateStorageParserFactory : public PayloadParserFactory {
- public:
- PrivateStorageParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
- }
+ class SWIFTEN_API PrivateStorageParserFactory : public PayloadParserFactory {
+ public:
+ PrivateStorageParserFactory(PayloadParserFactoryCollection* factories) : factories(factories) {
+ }
- virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
- return element == "query" && ns == "jabber:iq:private";
- }
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "query" && ns == "jabber:iq:private";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new PrivateStorageParser(factories);
- }
+ virtual PayloadParser* createPayloadParser() {
+ return new PrivateStorageParser(factories);
+ }
- private:
- PayloadParserFactoryCollection* factories;
-
- };
+ private:
+ PayloadParserFactoryCollection* factories;
+
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.cpp b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.cpp
index 9a470a4..cba3816 100644
--- a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.cpp
@@ -24,41 +24,41 @@ PubSubAffiliationParser::~PubSubAffiliationParser() {
}
void PubSubAffiliationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("affiliation")) {
- if (boost::optional<PubSubAffiliation::Type> value = EnumParser<PubSubAffiliation::Type>()(PubSubAffiliation::None, "none")(PubSubAffiliation::Member, "member")(PubSubAffiliation::Outcast, "outcast")(PubSubAffiliation::Owner, "owner")(PubSubAffiliation::Publisher, "publisher")(PubSubAffiliation::PublishOnly, "publish-only").parse(*attributeValue)) {
- getPayloadInternal()->setType(*value);
- }
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("affiliation")) {
+ if (boost::optional<PubSubAffiliation::Type> value = EnumParser<PubSubAffiliation::Type>()(PubSubAffiliation::None, "none")(PubSubAffiliation::Member, "member")(PubSubAffiliation::Outcast, "outcast")(PubSubAffiliation::Owner, "owner")(PubSubAffiliation::Publisher, "publisher")(PubSubAffiliation::PublishOnly, "publish-only").parse(*attributeValue)) {
+ getPayloadInternal()->setType(*value);
+ }
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubAffiliationParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubAffiliationParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h
index 08cddea..1d3f4fd 100644
--- a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubAffiliationParser : public GenericPayloadParser<PubSubAffiliation> {
- public:
- PubSubAffiliationParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubAffiliationParser();
+ class SWIFTEN_API PubSubAffiliationParser : public GenericPayloadParser<PubSubAffiliation> {
+ public:
+ PubSubAffiliationParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubAffiliationParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp
index b316134..8a11553 100644
--- a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.cpp
@@ -24,42 +24,42 @@ PubSubAffiliationsParser::~PubSubAffiliationsParser() {
}
void PubSubAffiliationsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubAffiliationParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubAffiliationParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubAffiliationsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub") {
- getPayloadInternal()->addAffiliation(boost::dynamic_pointer_cast<PubSubAffiliation>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub") {
+ getPayloadInternal()->addAffiliation(boost::dynamic_pointer_cast<PubSubAffiliation>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubAffiliationsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h
index a52e1c1..a26942f 100644
--- a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubAffiliationsParser : public GenericPayloadParser<PubSubAffiliations> {
- public:
- PubSubAffiliationsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubAffiliationsParser();
+ class SWIFTEN_API PubSubAffiliationsParser : public GenericPayloadParser<PubSubAffiliations> {
+ public:
+ PubSubAffiliationsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubAffiliationsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp
index cac9924..f3af12f 100644
--- a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.cpp
@@ -24,38 +24,38 @@ PubSubConfigureParser::~PubSubConfigureParser() {
}
void PubSubConfigureParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
-
-
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- currentPayloadParser = boost::make_shared<FormParser>();
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+
+
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser = boost::make_shared<FormParser>();
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubConfigureParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubConfigureParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h
index 0364ed4..33a3da5 100644
--- a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubConfigureParser : public GenericPayloadParser<PubSubConfigure> {
- public:
- PubSubConfigureParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubConfigureParser();
+ class SWIFTEN_API PubSubConfigureParser : public GenericPayloadParser<PubSubConfigure> {
+ public:
+ PubSubConfigureParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubConfigureParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubCreateParser.cpp b/Swiften/Parser/PayloadParsers/PubSubCreateParser.cpp
index fbf2eba..e299ddb 100644
--- a/Swiften/Parser/PayloadParsers/PubSubCreateParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubCreateParser.cpp
@@ -24,36 +24,36 @@ PubSubCreateParser::~PubSubCreateParser() {
}
void PubSubCreateParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubCreateParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubCreateParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubCreateParser.h b/Swiften/Parser/PayloadParsers/PubSubCreateParser.h
index b4f82a0..3f277ed 100644
--- a/Swiften/Parser/PayloadParsers/PubSubCreateParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubCreateParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubCreateParser : public GenericPayloadParser<PubSubCreate> {
- public:
- PubSubCreateParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubCreateParser();
+ class SWIFTEN_API PubSubCreateParser : public GenericPayloadParser<PubSubCreate> {
+ public:
+ PubSubCreateParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubCreateParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.cpp b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.cpp
index bf5a210..78c6d0b 100644
--- a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.cpp
@@ -24,41 +24,41 @@ PubSubDefaultParser::~PubSubDefaultParser() {
}
void PubSubDefaultParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("type")) {
- if (boost::optional<PubSubDefault::Type> value = EnumParser<PubSubDefault::Type>()(PubSubDefault::None, "none")(PubSubDefault::Collection, "collection")(PubSubDefault::Leaf, "leaf").parse(*attributeValue)) {
- getPayloadInternal()->setType(*value);
- }
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("type")) {
+ if (boost::optional<PubSubDefault::Type> value = EnumParser<PubSubDefault::Type>()(PubSubDefault::None, "none")(PubSubDefault::Collection, "collection")(PubSubDefault::Leaf, "leaf").parse(*attributeValue)) {
+ getPayloadInternal()->setType(*value);
+ }
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubDefaultParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubDefaultParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h
index e3596d6..b0f0e25 100644
--- a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubDefaultParser : public GenericPayloadParser<PubSubDefault> {
- public:
- PubSubDefaultParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubDefaultParser();
+ class SWIFTEN_API PubSubDefaultParser : public GenericPayloadParser<PubSubDefault> {
+ public:
+ PubSubDefaultParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubDefaultParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubErrorParser.cpp b/Swiften/Parser/PayloadParsers/PubSubErrorParser.cpp
index f399717..99a306d 100644
--- a/Swiften/Parser/PayloadParsers/PubSubErrorParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubErrorParser.cpp
@@ -9,95 +9,95 @@
using namespace Swift;
PubSubErrorParser::PubSubErrorParser() : level(0) {
- typeParser
- (PubSubError::ClosedNode, "closed-node")
- (PubSubError::ConfigurationRequired, "configuration-required")
- (PubSubError::InvalidJID, "invalid-jid")
- (PubSubError::InvalidOptions, "invalid-options")
- (PubSubError::InvalidPayload, "invalid-payload")
- (PubSubError::InvalidSubscriptionID, "invalid-subid")
- (PubSubError::ItemForbidden, "item-forbidden")
- (PubSubError::ItemRequired, "item-required")
- (PubSubError::JIDRequired, "jid-required")
- (PubSubError::MaximumItemsExceeded, "max-items-exceeded")
- (PubSubError::MaximumNodesExceeded, "max-nodes-exceeded")
- (PubSubError::NodeIDRequired, "nodeid-required")
- (PubSubError::NotInRosterGroup, "not-in-roster-group")
- (PubSubError::NotSubscribed, "not-subscribed")
- (PubSubError::PayloadTooBig, "payload-too-big")
- (PubSubError::PayloadRequired, "payload-required")
- (PubSubError::PendingSubscription, "pending-subscription")
- (PubSubError::PresenceSubscriptionRequired, "presence-subscription-required")
- (PubSubError::SubscriptionIDRequired, "subid-required")
- (PubSubError::TooManySubscriptions, "too-many-subscriptions")
- (PubSubError::Unsupported, "unsupported")
- (PubSubError::UnsupportedAccessModel, "unsupported-access-model");
- unsupportedTypeParser
- (PubSubError::AccessAuthorize, "access-authorize")
- (PubSubError::AccessOpen, "access-open")
- (PubSubError::AccessPresence, "access-presence")
- (PubSubError::AccessRoster, "access-roster")
- (PubSubError::AccessWhitelist, "access-whitelist")
- (PubSubError::AutoCreate, "auto-create")
- (PubSubError::AutoSubscribe, "auto-subscribe")
- (PubSubError::Collections, "collections")
- (PubSubError::ConfigNode, "config-node")
- (PubSubError::CreateAndConfigure, "create-and-configure")
- (PubSubError::CreateNodes, "create-nodes")
- (PubSubError::DeleteItems, "delete-items")
- (PubSubError::DeleteNodes, "delete-nodes")
- (PubSubError::FilteredNotifications, "filtered-notifications")
- (PubSubError::GetPending, "get-pending")
- (PubSubError::InstantNodes, "instant-nodes")
- (PubSubError::ItemIDs, "item-ids")
- (PubSubError::LastPublished, "last-published")
- (PubSubError::LeasedSubscription, "leased-subscription")
- (PubSubError::ManageSubscriptions, "manage-subscriptions")
- (PubSubError::MemberAffiliation, "member-affiliation")
- (PubSubError::MetaData, "meta-data")
- (PubSubError::ModifyAffiliations, "modify-affiliations")
- (PubSubError::MultiCollection, "multi-collection")
- (PubSubError::MultiSubscribe, "multi-subscribe")
- (PubSubError::OutcastAffiliation, "outcast-affiliation")
- (PubSubError::PersistentItems, "persistent-items")
- (PubSubError::PresenceNotifications, "presence-notifications")
- (PubSubError::PresenceSubscribe, "presence-subscribe")
- (PubSubError::Publish, "publish")
- (PubSubError::PublishOptions, "publish-options")
- (PubSubError::PublishOnlyAffiliation, "publish-only-affiliation")
- (PubSubError::PublisherAffiliation, "publisher-affiliation")
- (PubSubError::PurgeNodes, "purge-nodes")
- (PubSubError::RetractItems, "retract-items")
- (PubSubError::RetrieveAffiliations, "retrieve-affiliations")
- (PubSubError::RetrieveDefault, "retrieve-default")
- (PubSubError::RetrieveItems, "retrieve-items")
- (PubSubError::RetrieveSubscriptions, "retrieve-subscriptions")
- (PubSubError::Subscribe, "subscribe")
- (PubSubError::SubscriptionOptions, "subscription-options")
- (PubSubError::SubscriptionNotifications, "subscription-notifications");
+ typeParser
+ (PubSubError::ClosedNode, "closed-node")
+ (PubSubError::ConfigurationRequired, "configuration-required")
+ (PubSubError::InvalidJID, "invalid-jid")
+ (PubSubError::InvalidOptions, "invalid-options")
+ (PubSubError::InvalidPayload, "invalid-payload")
+ (PubSubError::InvalidSubscriptionID, "invalid-subid")
+ (PubSubError::ItemForbidden, "item-forbidden")
+ (PubSubError::ItemRequired, "item-required")
+ (PubSubError::JIDRequired, "jid-required")
+ (PubSubError::MaximumItemsExceeded, "max-items-exceeded")
+ (PubSubError::MaximumNodesExceeded, "max-nodes-exceeded")
+ (PubSubError::NodeIDRequired, "nodeid-required")
+ (PubSubError::NotInRosterGroup, "not-in-roster-group")
+ (PubSubError::NotSubscribed, "not-subscribed")
+ (PubSubError::PayloadTooBig, "payload-too-big")
+ (PubSubError::PayloadRequired, "payload-required")
+ (PubSubError::PendingSubscription, "pending-subscription")
+ (PubSubError::PresenceSubscriptionRequired, "presence-subscription-required")
+ (PubSubError::SubscriptionIDRequired, "subid-required")
+ (PubSubError::TooManySubscriptions, "too-many-subscriptions")
+ (PubSubError::Unsupported, "unsupported")
+ (PubSubError::UnsupportedAccessModel, "unsupported-access-model");
+ unsupportedTypeParser
+ (PubSubError::AccessAuthorize, "access-authorize")
+ (PubSubError::AccessOpen, "access-open")
+ (PubSubError::AccessPresence, "access-presence")
+ (PubSubError::AccessRoster, "access-roster")
+ (PubSubError::AccessWhitelist, "access-whitelist")
+ (PubSubError::AutoCreate, "auto-create")
+ (PubSubError::AutoSubscribe, "auto-subscribe")
+ (PubSubError::Collections, "collections")
+ (PubSubError::ConfigNode, "config-node")
+ (PubSubError::CreateAndConfigure, "create-and-configure")
+ (PubSubError::CreateNodes, "create-nodes")
+ (PubSubError::DeleteItems, "delete-items")
+ (PubSubError::DeleteNodes, "delete-nodes")
+ (PubSubError::FilteredNotifications, "filtered-notifications")
+ (PubSubError::GetPending, "get-pending")
+ (PubSubError::InstantNodes, "instant-nodes")
+ (PubSubError::ItemIDs, "item-ids")
+ (PubSubError::LastPublished, "last-published")
+ (PubSubError::LeasedSubscription, "leased-subscription")
+ (PubSubError::ManageSubscriptions, "manage-subscriptions")
+ (PubSubError::MemberAffiliation, "member-affiliation")
+ (PubSubError::MetaData, "meta-data")
+ (PubSubError::ModifyAffiliations, "modify-affiliations")
+ (PubSubError::MultiCollection, "multi-collection")
+ (PubSubError::MultiSubscribe, "multi-subscribe")
+ (PubSubError::OutcastAffiliation, "outcast-affiliation")
+ (PubSubError::PersistentItems, "persistent-items")
+ (PubSubError::PresenceNotifications, "presence-notifications")
+ (PubSubError::PresenceSubscribe, "presence-subscribe")
+ (PubSubError::Publish, "publish")
+ (PubSubError::PublishOptions, "publish-options")
+ (PubSubError::PublishOnlyAffiliation, "publish-only-affiliation")
+ (PubSubError::PublisherAffiliation, "publisher-affiliation")
+ (PubSubError::PurgeNodes, "purge-nodes")
+ (PubSubError::RetractItems, "retract-items")
+ (PubSubError::RetrieveAffiliations, "retrieve-affiliations")
+ (PubSubError::RetrieveDefault, "retrieve-default")
+ (PubSubError::RetrieveItems, "retrieve-items")
+ (PubSubError::RetrieveSubscriptions, "retrieve-subscriptions")
+ (PubSubError::Subscribe, "subscribe")
+ (PubSubError::SubscriptionOptions, "subscription-options")
+ (PubSubError::SubscriptionNotifications, "subscription-notifications");
}
PubSubErrorParser::~PubSubErrorParser() {
}
void PubSubErrorParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
- if (level == 1) {
- if (boost::optional<PubSubError::Type> type = typeParser.parse(element)) {
- getPayloadInternal()->setType(*type);
- if (type == PubSubError::Unsupported) {
- if (boost::optional<std::string> feature = attributes.getAttributeValue("feature")) {
- if (boost::optional<PubSubError::UnsupportedFeatureType> unsupportedType = unsupportedTypeParser.parse(*feature)) {
- getPayloadInternal()->setUnsupportedFeatureType(*unsupportedType);
- }
- }
- }
- }
- }
- ++level;
+ if (level == 1) {
+ if (boost::optional<PubSubError::Type> type = typeParser.parse(element)) {
+ getPayloadInternal()->setType(*type);
+ if (type == PubSubError::Unsupported) {
+ if (boost::optional<std::string> feature = attributes.getAttributeValue("feature")) {
+ if (boost::optional<PubSubError::UnsupportedFeatureType> unsupportedType = unsupportedTypeParser.parse(*feature)) {
+ getPayloadInternal()->setUnsupportedFeatureType(*unsupportedType);
+ }
+ }
+ }
+ }
+ }
+ ++level;
}
void PubSubErrorParser::handleEndElement(const std::string&, const std::string&) {
- --level;
+ --level;
}
void PubSubErrorParser::handleCharacterData(const std::string&) {
diff --git a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h
index 73f4207..749fb1a 100644
--- a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h
@@ -15,21 +15,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubErrorParser : public GenericPayloadParser<PubSubError> {
- public:
- PubSubErrorParser();
- virtual ~PubSubErrorParser();
+ class SWIFTEN_API PubSubErrorParser : public GenericPayloadParser<PubSubError> {
+ public:
+ PubSubErrorParser();
+ virtual ~PubSubErrorParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- int level;
- EnumParser<PubSubError::Type> typeParser;
- EnumParser<PubSubError::UnsupportedFeatureType> unsupportedTypeParser;
- };
+ private:
+ int level;
+ EnumParser<PubSubError::Type> typeParser;
+ EnumParser<PubSubError::UnsupportedFeatureType> unsupportedTypeParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h b/Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h
index e421581..c7a3614 100644
--- a/Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h
@@ -11,20 +11,20 @@
#include <Swiften/Parser/PayloadParsers/PubSubErrorParser.h>
namespace Swift {
- class SWIFTEN_API PubSubErrorParserFactory : public PayloadParserFactory {
- public:
- PubSubErrorParserFactory() {
- }
- ~PubSubErrorParserFactory();
+ class SWIFTEN_API PubSubErrorParserFactory : public PayloadParserFactory {
+ public:
+ PubSubErrorParserFactory() {
+ }
+ ~PubSubErrorParserFactory();
- virtual bool canParse(const std::string&, const std::string& ns, const AttributeMap&) const {
- return ns == "http://jabber.org/protocol/pubsub#errors";
- }
+ virtual bool canParse(const std::string&, const std::string& ns, const AttributeMap&) const {
+ return ns == "http://jabber.org/protocol/pubsub#errors";
+ }
- virtual PayloadParser* createPayloadParser() {
- return new PubSubErrorParser();
- }
- };
+ virtual PayloadParser* createPayloadParser() {
+ return new PubSubErrorParser();
+ }
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.cpp
index dd740b3..c5d8959 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.cpp
@@ -24,36 +24,36 @@ PubSubEventAssociateParser::~PubSubEventAssociateParser() {
}
void PubSubEventAssociateParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventAssociateParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventAssociateParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h
index 3e87523..c2cc9f6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventAssociateParser : public GenericPayloadParser<PubSubEventAssociate> {
- public:
- PubSubEventAssociateParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventAssociateParser();
+ class SWIFTEN_API PubSubEventAssociateParser : public GenericPayloadParser<PubSubEventAssociate> {
+ public:
+ PubSubEventAssociateParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventAssociateParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp
index 373d971..bb167e3 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.cpp
@@ -25,48 +25,48 @@ PubSubEventCollectionParser::~PubSubEventCollectionParser() {
}
void PubSubEventCollectionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "disassociate" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventDisassociateParser>(parsers);
- }
- if (element == "associate" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventAssociateParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "disassociate" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventDisassociateParser>(parsers);
+ }
+ if (element == "associate" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventAssociateParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventCollectionParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "disassociate" && ns == "http://jabber.org/protocol/pubsub#event") {
- getPayloadInternal()->setDisassociate(boost::dynamic_pointer_cast<PubSubEventDisassociate>(currentPayloadParser->getPayload()));
- }
- if (element == "associate" && ns == "http://jabber.org/protocol/pubsub#event") {
- getPayloadInternal()->setAssociate(boost::dynamic_pointer_cast<PubSubEventAssociate>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "disassociate" && ns == "http://jabber.org/protocol/pubsub#event") {
+ getPayloadInternal()->setDisassociate(boost::dynamic_pointer_cast<PubSubEventDisassociate>(currentPayloadParser->getPayload()));
+ }
+ if (element == "associate" && ns == "http://jabber.org/protocol/pubsub#event") {
+ getPayloadInternal()->setAssociate(boost::dynamic_pointer_cast<PubSubEventAssociate>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventCollectionParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h
index 26d580b..a2b1663 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventCollectionParser : public GenericPayloadParser<PubSubEventCollection> {
- public:
- PubSubEventCollectionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventCollectionParser();
+ class SWIFTEN_API PubSubEventCollectionParser : public GenericPayloadParser<PubSubEventCollection> {
+ public:
+ PubSubEventCollectionParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventCollectionParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp
index 97e5ad9..d118ab8 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.cpp
@@ -24,42 +24,42 @@ PubSubEventConfigurationParser::~PubSubEventConfigurationParser() {
}
void PubSubEventConfigurationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- currentPayloadParser = boost::make_shared<FormParser>();
- }
- }
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser = boost::make_shared<FormParser>();
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventConfigurationParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventConfigurationParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h
index f1f07b2..e3fcab6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventConfigurationParser : public GenericPayloadParser<PubSubEventConfiguration> {
- public:
- PubSubEventConfigurationParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventConfigurationParser();
+ class SWIFTEN_API PubSubEventConfigurationParser : public GenericPayloadParser<PubSubEventConfiguration> {
+ public:
+ PubSubEventConfigurationParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventConfigurationParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp
index 9641a03..167a682 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.cpp
@@ -24,42 +24,42 @@ PubSubEventDeleteParser::~PubSubEventDeleteParser() {
}
void PubSubEventDeleteParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventRedirectParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventRedirectParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventDeleteParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#event") {
- getPayloadInternal()->setRedirects(boost::dynamic_pointer_cast<PubSubEventRedirect>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#event") {
+ getPayloadInternal()->setRedirects(boost::dynamic_pointer_cast<PubSubEventRedirect>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventDeleteParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h
index 8a6f0eb..24d6b6b 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventDeleteParser : public GenericPayloadParser<PubSubEventDelete> {
- public:
- PubSubEventDeleteParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventDeleteParser();
+ class SWIFTEN_API PubSubEventDeleteParser : public GenericPayloadParser<PubSubEventDelete> {
+ public:
+ PubSubEventDeleteParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventDeleteParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.cpp
index 25ec3a9..d0da109 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.cpp
@@ -24,36 +24,36 @@ PubSubEventDisassociateParser::~PubSubEventDisassociateParser() {
}
void PubSubEventDisassociateParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventDisassociateParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventDisassociateParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h
index a5dae6b..6835602 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventDisassociateParser : public GenericPayloadParser<PubSubEventDisassociate> {
- public:
- PubSubEventDisassociateParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventDisassociateParser();
+ class SWIFTEN_API PubSubEventDisassociateParser : public GenericPayloadParser<PubSubEventDisassociate> {
+ public:
+ PubSubEventDisassociateParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventDisassociateParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.cpp
index e245e63..fca2df8 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.cpp
@@ -24,46 +24,46 @@ PubSubEventItemParser::~PubSubEventItemParser() {
}
void PubSubEventItemParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("publisher")) {
- getPayloadInternal()->setPublisher(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("id")) {
- getPayloadInternal()->setID(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("publisher")) {
+ getPayloadInternal()->setPublisher(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("id")) {
+ getPayloadInternal()->setID(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) {
- currentPayloadParser.reset(factory->createPayloadParser());
- }
- }
+ if (level == 1) {
+ if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) {
+ currentPayloadParser.reset(factory->createPayloadParser());
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventItemParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- getPayloadInternal()->addData(currentPayloadParser->getPayload());
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ getPayloadInternal()->addData(currentPayloadParser->getPayload());
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventItemParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h
index faee9d3..4b34a26 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventItemParser : public GenericPayloadParser<PubSubEventItem> {
- public:
- PubSubEventItemParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventItemParser();
+ class SWIFTEN_API PubSubEventItemParser : public GenericPayloadParser<PubSubEventItem> {
+ public:
+ PubSubEventItemParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventItemParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp
index 2aafb74..90d3fe8 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.cpp
@@ -25,48 +25,48 @@ PubSubEventItemsParser::~PubSubEventItemsParser() {
}
void PubSubEventItemsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventItemParser>(parsers);
- }
- if (element == "retract" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventRetractParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventItemParser>(parsers);
+ }
+ if (element == "retract" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventRetractParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventItemsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub#event") {
- getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubEventItem>(currentPayloadParser->getPayload()));
- }
- if (element == "retract" && ns == "http://jabber.org/protocol/pubsub#event") {
- getPayloadInternal()->addRetract(boost::dynamic_pointer_cast<PubSubEventRetract>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub#event") {
+ getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubEventItem>(currentPayloadParser->getPayload()));
+ }
+ if (element == "retract" && ns == "http://jabber.org/protocol/pubsub#event") {
+ getPayloadInternal()->addRetract(boost::dynamic_pointer_cast<PubSubEventRetract>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventItemsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h
index 1847be5..6cb0148 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventItemsParser : public GenericPayloadParser<PubSubEventItems> {
- public:
- PubSubEventItemsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventItemsParser();
+ class SWIFTEN_API PubSubEventItemsParser : public GenericPayloadParser<PubSubEventItems> {
+ public:
+ PubSubEventItemsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventItemsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp
index 34db2f8..ae0439c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventParser.cpp
@@ -29,53 +29,53 @@ PubSubEventParser::~PubSubEventParser() {
}
void PubSubEventParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
-
- if (level == 1) {
- if (element == "items" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventItemsParser>(parsers);
- }
- if (element == "collection" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventCollectionParser>(parsers);
- }
- if (element == "purge" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventPurgeParser>(parsers);
- }
- if (element == "configuration" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventConfigurationParser>(parsers);
- }
- if (element == "delete" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventDeleteParser>(parsers);
- }
- if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#event") {
- currentPayloadParser = boost::make_shared<PubSubEventSubscriptionParser>(parsers);
- }
- }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 1) {
+ if (element == "items" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventItemsParser>(parsers);
+ }
+ if (element == "collection" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventCollectionParser>(parsers);
+ }
+ if (element == "purge" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventPurgeParser>(parsers);
+ }
+ if (element == "configuration" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventConfigurationParser>(parsers);
+ }
+ if (element == "delete" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventDeleteParser>(parsers);
+ }
+ if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#event") {
+ currentPayloadParser = boost::make_shared<PubSubEventSubscriptionParser>(parsers);
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (currentPayloadParser) {
- getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubEventPayload>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (currentPayloadParser) {
+ getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubEventPayload>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventParser.h b/Swiften/Parser/PayloadParsers/PubSubEventParser.h
index fc63528..a4fc5a6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventParser : public GenericPayloadParser<PubSubEvent> {
- public:
- PubSubEventParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventParser();
+ class SWIFTEN_API PubSubEventParser : public GenericPayloadParser<PubSubEvent> {
+ public:
+ PubSubEventParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.cpp
index cdd3808..09ceeea 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.cpp
@@ -24,36 +24,36 @@ PubSubEventPurgeParser::~PubSubEventPurgeParser() {
}
void PubSubEventPurgeParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventPurgeParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventPurgeParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h
index c174d5b..7afc754 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventPurgeParser : public GenericPayloadParser<PubSubEventPurge> {
- public:
- PubSubEventPurgeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventPurgeParser();
+ class SWIFTEN_API PubSubEventPurgeParser : public GenericPayloadParser<PubSubEventPurge> {
+ public:
+ PubSubEventPurgeParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventPurgeParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.cpp
index 8ea236e..899c039 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.cpp
@@ -24,36 +24,36 @@ PubSubEventRedirectParser::~PubSubEventRedirectParser() {
}
void PubSubEventRedirectParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("uri")) {
- getPayloadInternal()->setURI(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("uri")) {
+ getPayloadInternal()->setURI(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventRedirectParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventRedirectParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h
index 3905285..ecdeca5 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventRedirectParser : public GenericPayloadParser<PubSubEventRedirect> {
- public:
- PubSubEventRedirectParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventRedirectParser();
+ class SWIFTEN_API PubSubEventRedirectParser : public GenericPayloadParser<PubSubEventRedirect> {
+ public:
+ PubSubEventRedirectParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventRedirectParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.cpp
index 7a4df14..32d88b4 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.cpp
@@ -24,36 +24,36 @@ PubSubEventRetractParser::~PubSubEventRetractParser() {
}
void PubSubEventRetractParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("id")) {
- getPayloadInternal()->setID(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("id")) {
+ getPayloadInternal()->setID(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventRetractParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventRetractParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h
index 99cc164..8bc6a9c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventRetractParser : public GenericPayloadParser<PubSubEventRetract> {
- public:
- PubSubEventRetractParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventRetractParser();
+ class SWIFTEN_API PubSubEventRetractParser : public GenericPayloadParser<PubSubEventRetract> {
+ public:
+ PubSubEventRetractParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventRetractParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.cpp b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.cpp
index 9308101..92d1a0c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.cpp
@@ -25,52 +25,52 @@ PubSubEventSubscriptionParser::~PubSubEventSubscriptionParser() {
}
void PubSubEventSubscriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
- if (boost::optional<PubSubEventSubscription::SubscriptionType> value = EnumParser<PubSubEventSubscription::SubscriptionType>()(PubSubEventSubscription::None, "none")(PubSubEventSubscription::Pending, "pending")(PubSubEventSubscription::Subscribed, "subscribed")(PubSubEventSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
- getPayloadInternal()->setSubscription(*value);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
- getPayloadInternal()->setSubscriptionID(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("expiry")) {
- getPayloadInternal()->setExpiry(stringToDateTime(*attributeValue));
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
+ if (boost::optional<PubSubEventSubscription::SubscriptionType> value = EnumParser<PubSubEventSubscription::SubscriptionType>()(PubSubEventSubscription::None, "none")(PubSubEventSubscription::Pending, "pending")(PubSubEventSubscription::Subscribed, "subscribed")(PubSubEventSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
+ getPayloadInternal()->setSubscription(*value);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
+ getPayloadInternal()->setSubscriptionID(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("expiry")) {
+ getPayloadInternal()->setExpiry(stringToDateTime(*attributeValue));
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubEventSubscriptionParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubEventSubscriptionParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h
index 24ce22a..b43e64a 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubEventSubscriptionParser : public GenericPayloadParser<PubSubEventSubscription> {
- public:
- PubSubEventSubscriptionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventSubscriptionParser();
+ class SWIFTEN_API PubSubEventSubscriptionParser : public GenericPayloadParser<PubSubEventSubscription> {
+ public:
+ PubSubEventSubscriptionParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubEventSubscriptionParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubItemParser.cpp b/Swiften/Parser/PayloadParsers/PubSubItemParser.cpp
index a2b22ac..8537ecb 100644
--- a/Swiften/Parser/PayloadParsers/PubSubItemParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubItemParser.cpp
@@ -24,40 +24,40 @@ PubSubItemParser::~PubSubItemParser() {
}
void PubSubItemParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("id")) {
- getPayloadInternal()->setID(*attributeValue);
- }
- }
-
- if (level == 1) {
- if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) {
- currentPayloadParser.reset(factory->createPayloadParser());
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("id")) {
+ getPayloadInternal()->setID(*attributeValue);
+ }
+ }
+
+ if (level == 1) {
+ if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) {
+ currentPayloadParser.reset(factory->createPayloadParser());
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubItemParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- getPayloadInternal()->addData(currentPayloadParser->getPayload());
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ getPayloadInternal()->addData(currentPayloadParser->getPayload());
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubItemParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubItemParser.h b/Swiften/Parser/PayloadParsers/PubSubItemParser.h
index e584797..39d24bc 100644
--- a/Swiften/Parser/PayloadParsers/PubSubItemParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubItemParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubItemParser : public GenericPayloadParser<PubSubItem> {
- public:
- PubSubItemParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubItemParser();
+ class SWIFTEN_API PubSubItemParser : public GenericPayloadParser<PubSubItem> {
+ public:
+ PubSubItemParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubItemParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp
index f07b6fa..643eb85 100644
--- a/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubItemsParser.cpp
@@ -24,52 +24,52 @@ PubSubItemsParser::~PubSubItemsParser() {
}
void PubSubItemsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("max_items")) {
- try {
- getPayloadInternal()->setMaximumItems(boost::lexical_cast<unsigned int>(*attributeValue));
- }
- catch (boost::bad_lexical_cast&) {
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
- getPayloadInternal()->setSubscriptionID(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("max_items")) {
+ try {
+ getPayloadInternal()->setMaximumItems(boost::lexical_cast<unsigned int>(*attributeValue));
+ }
+ catch (boost::bad_lexical_cast&) {
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
+ getPayloadInternal()->setSubscriptionID(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubItemsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
- getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
+ getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubItemsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubItemsParser.h b/Swiften/Parser/PayloadParsers/PubSubItemsParser.h
index 5f3afd3..84c8f79 100644
--- a/Swiften/Parser/PayloadParsers/PubSubItemsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubItemsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubItemsParser : public GenericPayloadParser<PubSubItems> {
- public:
- PubSubItemsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubItemsParser();
+ class SWIFTEN_API PubSubItemsParser : public GenericPayloadParser<PubSubItems> {
+ public:
+ PubSubItemsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubItemsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp
index 438d728..2683ae6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.cpp
@@ -24,50 +24,50 @@ PubSubOptionsParser::~PubSubOptionsParser() {
}
void PubSubOptionsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
- getPayloadInternal()->setSubscriptionID(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
+ getPayloadInternal()->setSubscriptionID(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- currentPayloadParser = boost::make_shared<FormParser>();
- }
- }
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser = boost::make_shared<FormParser>();
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOptionsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOptionsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h
index 3070cec..52d374c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOptionsParser : public GenericPayloadParser<PubSubOptions> {
- public:
- PubSubOptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOptionsParser();
+ class SWIFTEN_API PubSubOptionsParser : public GenericPayloadParser<PubSubOptions> {
+ public:
+ PubSubOptionsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOptionsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.cpp
index 3a8ceb8..eb63696 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.cpp
@@ -24,43 +24,43 @@ PubSubOwnerAffiliationParser::~PubSubOwnerAffiliationParser() {
}
void PubSubOwnerAffiliationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("affiliation")) {
- if (boost::optional<PubSubOwnerAffiliation::Type> value = EnumParser<PubSubOwnerAffiliation::Type>()(PubSubOwnerAffiliation::None, "none")(PubSubOwnerAffiliation::Member, "member")(PubSubOwnerAffiliation::Outcast, "outcast")(PubSubOwnerAffiliation::Owner, "owner")(PubSubOwnerAffiliation::Publisher, "publisher")(PubSubOwnerAffiliation::PublishOnly, "publish-only").parse(*attributeValue)) {
- getPayloadInternal()->setType(*value);
- }
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("affiliation")) {
+ if (boost::optional<PubSubOwnerAffiliation::Type> value = EnumParser<PubSubOwnerAffiliation::Type>()(PubSubOwnerAffiliation::None, "none")(PubSubOwnerAffiliation::Member, "member")(PubSubOwnerAffiliation::Outcast, "outcast")(PubSubOwnerAffiliation::Owner, "owner")(PubSubOwnerAffiliation::Publisher, "publisher")(PubSubOwnerAffiliation::PublishOnly, "publish-only").parse(*attributeValue)) {
+ getPayloadInternal()->setType(*value);
+ }
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerAffiliationParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerAffiliationParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h
index f412ab5..972930c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerAffiliationParser : public GenericPayloadParser<PubSubOwnerAffiliation> {
- public:
- PubSubOwnerAffiliationParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerAffiliationParser();
+ class SWIFTEN_API PubSubOwnerAffiliationParser : public GenericPayloadParser<PubSubOwnerAffiliation> {
+ public:
+ PubSubOwnerAffiliationParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerAffiliationParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp
index df3813e..247bf4c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.cpp
@@ -24,42 +24,42 @@ PubSubOwnerAffiliationsParser::~PubSubOwnerAffiliationsParser() {
}
void PubSubOwnerAffiliationsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerAffiliationParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerAffiliationParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerAffiliationsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub#owner") {
- getPayloadInternal()->addAffiliation(boost::dynamic_pointer_cast<PubSubOwnerAffiliation>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "affiliation" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ getPayloadInternal()->addAffiliation(boost::dynamic_pointer_cast<PubSubOwnerAffiliation>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerAffiliationsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h
index c1cc4a0..870d809 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerAffiliationsParser : public GenericPayloadParser<PubSubOwnerAffiliations> {
- public:
- PubSubOwnerAffiliationsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerAffiliationsParser();
+ class SWIFTEN_API PubSubOwnerAffiliationsParser : public GenericPayloadParser<PubSubOwnerAffiliations> {
+ public:
+ PubSubOwnerAffiliationsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerAffiliationsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp
index 1cc8660..62dd1ac 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.cpp
@@ -24,42 +24,42 @@ PubSubOwnerConfigureParser::~PubSubOwnerConfigureParser() {
}
void PubSubOwnerConfigureParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- currentPayloadParser = boost::make_shared<FormParser>();
- }
- }
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser = boost::make_shared<FormParser>();
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerConfigureParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerConfigureParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h
index 0a96aa7..914a309 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerConfigureParser : public GenericPayloadParser<PubSubOwnerConfigure> {
- public:
- PubSubOwnerConfigureParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerConfigureParser();
+ class SWIFTEN_API PubSubOwnerConfigureParser : public GenericPayloadParser<PubSubOwnerConfigure> {
+ public:
+ PubSubOwnerConfigureParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerConfigureParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp
index a704411..36ccbaf 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.cpp
@@ -24,38 +24,38 @@ PubSubOwnerDefaultParser::~PubSubOwnerDefaultParser() {
}
void PubSubOwnerDefaultParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
-
-
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- currentPayloadParser = boost::make_shared<FormParser>();
- }
- }
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+
+
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser = boost::make_shared<FormParser>();
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerDefaultParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- if (element == "x" && ns == "jabber:x:data") {
- getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(boost::dynamic_pointer_cast<Form>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerDefaultParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h
index 5ab8f8f..3106854 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerDefaultParser : public GenericPayloadParser<PubSubOwnerDefault> {
- public:
- PubSubOwnerDefaultParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerDefaultParser();
+ class SWIFTEN_API PubSubOwnerDefaultParser : public GenericPayloadParser<PubSubOwnerDefault> {
+ public:
+ PubSubOwnerDefaultParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerDefaultParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp
index 9817793..047fe8b 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.cpp
@@ -24,42 +24,42 @@ PubSubOwnerDeleteParser::~PubSubOwnerDeleteParser() {
}
void PubSubOwnerDeleteParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerRedirectParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerRedirectParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerDeleteParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#owner") {
- getPayloadInternal()->setRedirect(boost::dynamic_pointer_cast<PubSubOwnerRedirect>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "redirect" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ getPayloadInternal()->setRedirect(boost::dynamic_pointer_cast<PubSubOwnerRedirect>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerDeleteParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h
index 25a1f03..f56ae3c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerDeleteParser : public GenericPayloadParser<PubSubOwnerDelete> {
- public:
- PubSubOwnerDeleteParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerDeleteParser();
+ class SWIFTEN_API PubSubOwnerDeleteParser : public GenericPayloadParser<PubSubOwnerDelete> {
+ public:
+ PubSubOwnerDeleteParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerDeleteParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp
index 71b1c16..aa7310e 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.cpp
@@ -29,53 +29,53 @@ PubSubOwnerPubSubParser::~PubSubOwnerPubSubParser() {
}
void PubSubOwnerPubSubParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
-
- if (level == 1) {
- if (element == "configure" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerConfigureParser>(parsers);
- }
- if (element == "subscriptions" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerSubscriptionsParser>(parsers);
- }
- if (element == "default" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerDefaultParser>(parsers);
- }
- if (element == "purge" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerPurgeParser>(parsers);
- }
- if (element == "affiliations" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerAffiliationsParser>(parsers);
- }
- if (element == "delete" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerDeleteParser>(parsers);
- }
- }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 1) {
+ if (element == "configure" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerConfigureParser>(parsers);
+ }
+ if (element == "subscriptions" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerSubscriptionsParser>(parsers);
+ }
+ if (element == "default" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerDefaultParser>(parsers);
+ }
+ if (element == "purge" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerPurgeParser>(parsers);
+ }
+ if (element == "affiliations" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerAffiliationsParser>(parsers);
+ }
+ if (element == "delete" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerDeleteParser>(parsers);
+ }
+ }
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerPubSubParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (currentPayloadParser) {
- getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubOwnerPayload>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (currentPayloadParser) {
+ getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubOwnerPayload>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerPubSubParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h
index bd6f3a5..d4d67f9 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerPubSubParser : public GenericPayloadParser<PubSubOwnerPubSub> {
- public:
- PubSubOwnerPubSubParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerPubSubParser();
+ class SWIFTEN_API PubSubOwnerPubSubParser : public GenericPayloadParser<PubSubOwnerPubSub> {
+ public:
+ PubSubOwnerPubSubParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerPubSubParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.cpp
index f417ec2..68224f6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.cpp
@@ -24,36 +24,36 @@ PubSubOwnerPurgeParser::~PubSubOwnerPurgeParser() {
}
void PubSubOwnerPurgeParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerPurgeParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerPurgeParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h
index baccb9a..364de29 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerPurgeParser : public GenericPayloadParser<PubSubOwnerPurge> {
- public:
- PubSubOwnerPurgeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerPurgeParser();
+ class SWIFTEN_API PubSubOwnerPurgeParser : public GenericPayloadParser<PubSubOwnerPurge> {
+ public:
+ PubSubOwnerPurgeParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerPurgeParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.cpp
index e4ad149..72c19dd 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.cpp
@@ -24,36 +24,36 @@ PubSubOwnerRedirectParser::~PubSubOwnerRedirectParser() {
}
void PubSubOwnerRedirectParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("uri")) {
- getPayloadInternal()->setURI(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("uri")) {
+ getPayloadInternal()->setURI(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerRedirectParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerRedirectParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h
index b277af9..fd48dbb 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerRedirectParser : public GenericPayloadParser<PubSubOwnerRedirect> {
- public:
- PubSubOwnerRedirectParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerRedirectParser();
+ class SWIFTEN_API PubSubOwnerRedirectParser : public GenericPayloadParser<PubSubOwnerRedirect> {
+ public:
+ PubSubOwnerRedirectParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerRedirectParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.cpp
index 9e2fdee..ee4c34f 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.cpp
@@ -24,43 +24,43 @@ PubSubOwnerSubscriptionParser::~PubSubOwnerSubscriptionParser() {
}
void PubSubOwnerSubscriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
- if (boost::optional<PubSubOwnerSubscription::SubscriptionType> value = EnumParser<PubSubOwnerSubscription::SubscriptionType>()(PubSubOwnerSubscription::None, "none")(PubSubOwnerSubscription::Pending, "pending")(PubSubOwnerSubscription::Subscribed, "subscribed")(PubSubOwnerSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
- getPayloadInternal()->setSubscription(*value);
- }
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
+ if (boost::optional<PubSubOwnerSubscription::SubscriptionType> value = EnumParser<PubSubOwnerSubscription::SubscriptionType>()(PubSubOwnerSubscription::None, "none")(PubSubOwnerSubscription::Pending, "pending")(PubSubOwnerSubscription::Subscribed, "subscribed")(PubSubOwnerSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
+ getPayloadInternal()->setSubscription(*value);
+ }
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerSubscriptionParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerSubscriptionParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h
index c76734f..46df820 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerSubscriptionParser : public GenericPayloadParser<PubSubOwnerSubscription> {
- public:
- PubSubOwnerSubscriptionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerSubscriptionParser();
+ class SWIFTEN_API PubSubOwnerSubscriptionParser : public GenericPayloadParser<PubSubOwnerSubscription> {
+ public:
+ PubSubOwnerSubscriptionParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerSubscriptionParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp
index 857bd87..e08d782 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.cpp
@@ -24,42 +24,42 @@ PubSubOwnerSubscriptionsParser::~PubSubOwnerSubscriptionsParser() {
}
void PubSubOwnerSubscriptionsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#owner") {
- currentPayloadParser = boost::make_shared<PubSubOwnerSubscriptionParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ currentPayloadParser = boost::make_shared<PubSubOwnerSubscriptionParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubOwnerSubscriptionsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#owner") {
- getPayloadInternal()->addSubscription(boost::dynamic_pointer_cast<PubSubOwnerSubscription>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub#owner") {
+ getPayloadInternal()->addSubscription(boost::dynamic_pointer_cast<PubSubOwnerSubscription>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubOwnerSubscriptionsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h
index 35a18fb..10c11e4 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubOwnerSubscriptionsParser : public GenericPayloadParser<PubSubOwnerSubscriptions> {
- public:
- PubSubOwnerSubscriptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerSubscriptionsParser();
+ class SWIFTEN_API PubSubOwnerSubscriptionsParser : public GenericPayloadParser<PubSubOwnerSubscriptions> {
+ public:
+ PubSubOwnerSubscriptionsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubOwnerSubscriptionsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubParser.cpp b/Swiften/Parser/PayloadParsers/PubSubParser.cpp
index c6574a8..9c86c21 100644
--- a/Swiften/Parser/PayloadParsers/PubSubParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubParser.cpp
@@ -36,90 +36,90 @@ PubSubParser::~PubSubParser() {
}
void PubSubParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 1) {
- if (element == "items" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubItemsParser>(parsers);
- }
- if (element == "create" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubCreateParser>(parsers);
- }
- if (element == "publish" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubPublishParser>(parsers);
- }
- if (element == "affiliations" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubAffiliationsParser>(parsers);
- }
- if (element == "retract" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubRetractParser>(parsers);
- }
- if (element == "options" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubOptionsParser>(parsers);
- }
- if (element == "configure" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubConfigureParser>(parsers);
- }
- if (element == "default" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubDefaultParser>(parsers);
- }
- if (element == "subscriptions" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubSubscriptionsParser>(parsers);
- }
- if (element == "subscribe" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubSubscribeParser>(parsers);
- }
- if (element == "unsubscribe" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubUnsubscribeParser>(parsers);
- }
- if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubSubscriptionParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "items" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubItemsParser>(parsers);
+ }
+ if (element == "create" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubCreateParser>(parsers);
+ }
+ if (element == "publish" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubPublishParser>(parsers);
+ }
+ if (element == "affiliations" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubAffiliationsParser>(parsers);
+ }
+ if (element == "retract" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubRetractParser>(parsers);
+ }
+ if (element == "options" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubOptionsParser>(parsers);
+ }
+ if (element == "configure" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubConfigureParser>(parsers);
+ }
+ if (element == "default" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubDefaultParser>(parsers);
+ }
+ if (element == "subscriptions" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubSubscriptionsParser>(parsers);
+ }
+ if (element == "subscribe" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubSubscribeParser>(parsers);
+ }
+ if (element == "unsubscribe" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubUnsubscribeParser>(parsers);
+ }
+ if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubSubscriptionParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (currentPayloadParser) {
- if (element == "options" && ns == "http://jabber.org/protocol/pubsub") {
- optionsPayload = boost::dynamic_pointer_cast<PubSubOptions>(currentPayloadParser->getPayload());
- }
- else if (element == "configure" && ns == "http://jabber.org/protocol/pubsub") {
- configurePayload = boost::dynamic_pointer_cast<PubSubConfigure>(currentPayloadParser->getPayload());
- }
- else {
- getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubPayload>(currentPayloadParser->getPayload()));
- }
- }
- currentPayloadParser.reset();
- }
+ if (level == 1) {
+ if (currentPayloadParser) {
+ if (element == "options" && ns == "http://jabber.org/protocol/pubsub") {
+ optionsPayload = boost::dynamic_pointer_cast<PubSubOptions>(currentPayloadParser->getPayload());
+ }
+ else if (element == "configure" && ns == "http://jabber.org/protocol/pubsub") {
+ configurePayload = boost::dynamic_pointer_cast<PubSubConfigure>(currentPayloadParser->getPayload());
+ }
+ else {
+ getPayloadInternal()->setPayload(boost::dynamic_pointer_cast<PubSubPayload>(currentPayloadParser->getPayload()));
+ }
+ }
+ currentPayloadParser.reset();
+ }
- if (level == 0) {
- if (boost::shared_ptr<PubSubCreate> create = boost::dynamic_pointer_cast<PubSubCreate>(getPayloadInternal()->getPayload())) {
- if (configurePayload) {
- create->setConfigure(configurePayload);
- }
- }
- if (boost::shared_ptr<PubSubSubscribe> subscribe = boost::dynamic_pointer_cast<PubSubSubscribe>(getPayloadInternal()->getPayload())) {
- if (optionsPayload) {
- subscribe->setOptions(optionsPayload);
- }
- }
- }
- }
+ if (level == 0) {
+ if (boost::shared_ptr<PubSubCreate> create = boost::dynamic_pointer_cast<PubSubCreate>(getPayloadInternal()->getPayload())) {
+ if (configurePayload) {
+ create->setConfigure(configurePayload);
+ }
+ }
+ if (boost::shared_ptr<PubSubSubscribe> subscribe = boost::dynamic_pointer_cast<PubSubSubscribe>(getPayloadInternal()->getPayload())) {
+ if (optionsPayload) {
+ subscribe->setOptions(optionsPayload);
+ }
+ }
+ }
+ }
}
void PubSubParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubParser.h b/Swiften/Parser/PayloadParsers/PubSubParser.h
index 1ccae54..a8043fc 100644
--- a/Swiften/Parser/PayloadParsers/PubSubParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubParser.h
@@ -14,25 +14,25 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
- class PubSubOptions;
- class PubSubConfigure;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
+ class PubSubOptions;
+ class PubSubConfigure;
- class SWIFTEN_API PubSubParser : public GenericPayloadParser<PubSub> {
- public:
- PubSubParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubParser();
+ class SWIFTEN_API PubSubParser : public GenericPayloadParser<PubSub> {
+ public:
+ PubSubParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- boost::shared_ptr<PubSubConfigure> configurePayload;
- boost::shared_ptr<PubSubOptions> optionsPayload;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ boost::shared_ptr<PubSubConfigure> configurePayload;
+ boost::shared_ptr<PubSubOptions> optionsPayload;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp b/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp
index 2b52edc..3bd3ac0 100644
--- a/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubPublishParser.cpp
@@ -24,42 +24,42 @@ PubSubPublishParser::~PubSubPublishParser() {
}
void PubSubPublishParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubPublishParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
- getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
+ getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubPublishParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubPublishParser.h b/Swiften/Parser/PayloadParsers/PubSubPublishParser.h
index 6b60457..1df7c6f 100644
--- a/Swiften/Parser/PayloadParsers/PubSubPublishParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubPublishParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubPublishParser : public GenericPayloadParser<PubSubPublish> {
- public:
- PubSubPublishParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubPublishParser();
+ class SWIFTEN_API PubSubPublishParser : public GenericPayloadParser<PubSubPublish> {
+ public:
+ PubSubPublishParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubPublishParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp b/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp
index 909e82f..e710fad 100644
--- a/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp
@@ -24,45 +24,45 @@ PubSubRetractParser::~PubSubRetractParser() {
}
void PubSubRetractParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("notify")) {
- getPayloadInternal()->setNotify(*attributeValue == "true" ? true : false);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("notify")) {
+ getPayloadInternal()->setNotify(*attributeValue == "true" ? true : false);
+ }
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubItemParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubRetractParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
- getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "item" && ns == "http://jabber.org/protocol/pubsub") {
+ getPayloadInternal()->addItem(boost::dynamic_pointer_cast<PubSubItem>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubRetractParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubRetractParser.h b/Swiften/Parser/PayloadParsers/PubSubRetractParser.h
index 9b1a052..ece2a52 100644
--- a/Swiften/Parser/PayloadParsers/PubSubRetractParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubRetractParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubRetractParser : public GenericPayloadParser<PubSubRetract> {
- public:
- PubSubRetractParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubRetractParser();
+ class SWIFTEN_API PubSubRetractParser : public GenericPayloadParser<PubSubRetract> {
+ public:
+ PubSubRetractParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubRetractParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.cpp
index 64bea49..120d704 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.cpp
@@ -24,34 +24,34 @@ PubSubSubscribeOptionsParser::~PubSubSubscribeOptionsParser() {
}
void PubSubSubscribeOptionsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubSubscribeOptionsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
- if (element == "required") {
- getPayloadInternal()->setRequired(true);
- }
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+ if (element == "required") {
+ getPayloadInternal()->setRequired(true);
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubSubscribeOptionsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h
index 7fb140a..9136f44 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubSubscribeOptionsParser : public GenericPayloadParser<PubSubSubscribeOptions> {
- public:
- PubSubSubscribeOptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscribeOptionsParser();
+ class SWIFTEN_API PubSubSubscribeOptionsParser : public GenericPayloadParser<PubSubSubscribeOptions> {
+ public:
+ PubSubSubscribeOptionsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubSubscribeOptionsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.cpp b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.cpp
index 3f34fc7..f049642 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.cpp
@@ -24,41 +24,41 @@ PubSubSubscribeParser::~PubSubSubscribeParser() {
}
void PubSubSubscribeParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubSubscribeParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubSubscribeParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h
index 72d0233..823c086 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubSubscribeParser : public GenericPayloadParser<PubSubSubscribe> {
- public:
- PubSubSubscribeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscribeParser();
+ class SWIFTEN_API PubSubSubscribeParser : public GenericPayloadParser<PubSubSubscribe> {
+ public:
+ PubSubSubscribeParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubSubscribeParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp
index b78c841..5954bf1 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.cpp
@@ -25,55 +25,55 @@ PubSubSubscriptionParser::~PubSubSubscriptionParser() {
}
void PubSubSubscriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
- getPayloadInternal()->setSubscriptionID(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
- if (boost::optional<PubSubSubscription::SubscriptionType> value = EnumParser<PubSubSubscription::SubscriptionType>()(PubSubSubscription::None, "none")(PubSubSubscription::Pending, "pending")(PubSubSubscription::Subscribed, "subscribed")(PubSubSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
- getPayloadInternal()->setSubscription(*value);
- }
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
+ getPayloadInternal()->setSubscriptionID(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subscription")) {
+ if (boost::optional<PubSubSubscription::SubscriptionType> value = EnumParser<PubSubSubscription::SubscriptionType>()(PubSubSubscription::None, "none")(PubSubSubscription::Pending, "pending")(PubSubSubscription::Subscribed, "subscribed")(PubSubSubscription::Unconfigured, "unconfigured").parse(*attributeValue)) {
+ getPayloadInternal()->setSubscription(*value);
+ }
+ }
+ }
- if (level == 1) {
- if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubSubscribeOptionsParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubSubscribeOptionsParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubSubscriptionParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") {
- getPayloadInternal()->setOptions(boost::dynamic_pointer_cast<PubSubSubscribeOptions>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "subscribe-options" && ns == "http://jabber.org/protocol/pubsub") {
+ getPayloadInternal()->setOptions(boost::dynamic_pointer_cast<PubSubSubscribeOptions>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubSubscriptionParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h
index b5eeb5a..771a74a 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubSubscriptionParser : public GenericPayloadParser<PubSubSubscription> {
- public:
- PubSubSubscriptionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscriptionParser();
+ class SWIFTEN_API PubSubSubscriptionParser : public GenericPayloadParser<PubSubSubscription> {
+ public:
+ PubSubSubscriptionParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubSubscriptionParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp
index 85929a4..30198a5 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.cpp
@@ -24,42 +24,42 @@ PubSubSubscriptionsParser::~PubSubSubscriptionsParser() {
}
void PubSubSubscriptionsParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- }
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ }
- if (level == 1) {
- if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") {
- currentPayloadParser = boost::make_shared<PubSubSubscriptionParser>(parsers);
- }
- }
+ if (level == 1) {
+ if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") {
+ currentPayloadParser = boost::make_shared<PubSubSubscriptionParser>(parsers);
+ }
+ }
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubSubscriptionsParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
- if (level == 1) {
- if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") {
- getPayloadInternal()->addSubscription(boost::dynamic_pointer_cast<PubSubSubscription>(currentPayloadParser->getPayload()));
- }
- currentPayloadParser.reset();
- }
- }
+ if (level == 1) {
+ if (element == "subscription" && ns == "http://jabber.org/protocol/pubsub") {
+ getPayloadInternal()->addSubscription(boost::dynamic_pointer_cast<PubSubSubscription>(currentPayloadParser->getPayload()));
+ }
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubSubscriptionsParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h
index 0b5378e..9f18376 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubSubscriptionsParser : public GenericPayloadParser<PubSubSubscriptions> {
- public:
- PubSubSubscriptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscriptionsParser();
+ class SWIFTEN_API PubSubSubscriptionsParser : public GenericPayloadParser<PubSubSubscriptions> {
+ public:
+ PubSubSubscriptionsParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubSubscriptionsParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.cpp b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.cpp
index 1b1808e..e3e7d23 100644
--- a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.cpp
+++ b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.cpp
@@ -24,44 +24,44 @@ PubSubUnsubscribeParser::~PubSubUnsubscribeParser() {
}
void PubSubUnsubscribeParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level == 0) {
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
- getPayloadInternal()->setNode(*attributeValue);
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
- if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
- getPayloadInternal()->setJID(*jid);
- }
- }
- if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
- getPayloadInternal()->setSubscriptionID(*attributeValue);
- }
- }
-
-
-
- if (level >= 1 && currentPayloadParser) {
- currentPayloadParser->handleStartElement(element, ns, attributes);
- }
- ++level;
+ if (level == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributeValue);
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("subid")) {
+ getPayloadInternal()->setSubscriptionID(*attributeValue);
+ }
+ }
+
+
+
+ if (level >= 1 && currentPayloadParser) {
+ currentPayloadParser->handleStartElement(element, ns, attributes);
+ }
+ ++level;
}
void PubSubUnsubscribeParser::handleEndElement(const std::string& element, const std::string& ns) {
- --level;
- if (currentPayloadParser) {
- if (level >= 1) {
- currentPayloadParser->handleEndElement(element, ns);
- }
-
- if (level == 1) {
-
- currentPayloadParser.reset();
- }
- }
+ --level;
+ if (currentPayloadParser) {
+ if (level >= 1) {
+ currentPayloadParser->handleEndElement(element, ns);
+ }
+
+ if (level == 1) {
+
+ currentPayloadParser.reset();
+ }
+ }
}
void PubSubUnsubscribeParser::handleCharacterData(const std::string& data) {
- if (level > 1 && currentPayloadParser) {
- currentPayloadParser->handleCharacterData(data);
- }
+ if (level > 1 && currentPayloadParser) {
+ currentPayloadParser->handleCharacterData(data);
+ }
}
diff --git a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h
index 0de1fab..d33d33c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h
@@ -14,21 +14,21 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
+ class PayloadParserFactoryCollection;
+ class PayloadParser;
- class SWIFTEN_API PubSubUnsubscribeParser : public GenericPayloadParser<PubSubUnsubscribe> {
- public:
- PubSubUnsubscribeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubUnsubscribeParser();
+ class SWIFTEN_API PubSubUnsubscribeParser : public GenericPayloadParser<PubSubUnsubscribe> {
+ public:
+ PubSubUnsubscribeParser(PayloadParserFactoryCollection* parsers);
+ virtual ~PubSubUnsubscribeParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
+ virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
+ virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
- private:
- PayloadParserFactoryCollection* parsers;
- int level;
- boost::shared_ptr<PayloadParser> currentPayloadParser;
- };
+ private:
+ PayloadParserFactoryCollection* parsers;
+ int level;
+ boost::shared_ptr<PayloadParser> currentPayloadParser;
+ };
}
diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp
index 700624f..97abce3 100644
--- a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.cpp
@@ -14,20 +14,20 @@ RawXMLPayloadParser::RawXMLPayloadParser() : level_(0) {
}
void RawXMLPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- ++level_;
- serializingParser_.handleStartElement(element, ns, attributes);
+ ++level_;
+ serializingParser_.handleStartElement(element, ns, attributes);
}
void RawXMLPayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
- serializingParser_.handleEndElement(element, ns);
- --level_;
- if (level_ == 0) {
- getPayloadInternal()->setRawXML(serializingParser_.getResult());
- }
+ serializingParser_.handleEndElement(element, ns);
+ --level_;
+ if (level_ == 0) {
+ getPayloadInternal()->setRawXML(serializingParser_.getResult());
+ }
}
void RawXMLPayloadParser::handleCharacterData(const std::string& data) {
- serializingParser_.handleCharacterData(data);
+ serializingParser_.handleCharacterData(data);
}
}
diff --git a/Swiften/Parser/PayloadParsers/RawXMLPayloadParser.h b/Swiften/Parser/PayloadParsers/RawXMLPayloadPar