diff options
author | Tarun Gupta <tarun1995gupta@gmail.com> | 2017-07-07 21:09:17 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2017-07-24 14:24:05 (GMT) |
commit | 38c132a6fe0ecaa3394550df15d36ae10dcce7d9 (patch) | |
tree | 3b48d7e237e6a5f88fe031b2512d5f346f42c8f5 /Swiften/MIX/MIXImpl.h | |
parent | f0db4d39912e773208e9db2a3da3b68ac92ba17b (diff) | |
download | swift-38c132a6fe0ecaa3394550df15d36ae10dcce7d9.zip swift-38c132a6fe0ecaa3394550df15d36ae10dcce7d9.tar.bz2 |
Add Channel Join and Leave Capability to MIX
Add UpdateSubscription feature for subscribing to additional
MIX nodes
Add Joining a channel with a preference form
Add requesting user preference form and updating the preferences
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests added for joining and leaving a channel as in XEP-0369,
which passes.
Tests also added for updating subscription, joining channel
with preference form and requesting user preference form as
in XEP-0369, which passes.
Tested on Ubuntu 16.04 LTS.
Change-Id: Ibc2737f6154eeee1a85e98cb5f80c8bdbad35dcd
Diffstat (limited to 'Swiften/MIX/MIXImpl.h')
-rw-r--r-- | Swiften/MIX/MIXImpl.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Swiften/MIX/MIXImpl.h b/Swiften/MIX/MIXImpl.h new file mode 100644 index 0000000..58b33f4 --- /dev/null +++ b/Swiften/MIX/MIXImpl.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017 Tarun Gupta + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/MIX/MIX.h> + +namespace Swift { + class StanzaChannel; + class IQRouter; + + class SWIFTEN_API MIXImpl : public MIX { + public: + using ref = std::shared_ptr<MIXImpl>; + + public: + MIXImpl(const JID& ownJID, const JID& channelJID, IQRouter* iqRouter); + virtual ~MIXImpl(); + + /** + * Returns the (bare) JID of the user. + */ + virtual JID getJID() const { + return ownJID_.toBare(); + } + + /** + * Returns the JID of MIX channel. + */ + virtual JID getChannelJID() const { + return channelJID_; + } + + virtual void joinChannel(const std::unordered_set<std::string>& nodes) override; + + virtual void joinChannelWithPreferences(const std::unordered_set<std::string>& nodes, Form::ref form) override; + + virtual void updateSubscription(const std::unordered_set<std::string>& nodes) override; + + virtual void leaveChannel() override; + + virtual void requestPreferencesForm() override; + + virtual void updatePreferences(Form::ref form) override; + + private: + void handleJoinResponse(MIXJoin::ref, ErrorPayload::ref); + void handleLeaveResponse(MIXLeave::ref, ErrorPayload::ref); + void handleUpdateSubscriptionResponse(MIXUpdateSubscription::ref, ErrorPayload::ref); + void handlePreferencesFormReceived(MIXUserPreference::ref, ErrorPayload::ref); + void handlePreferencesResultReceived(MIXUserPreference::ref /*payload*/, ErrorPayload::ref error); + + private: + JID ownJID_; + JID channelJID_; + IQRouter* iqRouter_; + }; +} |