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/MIX.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/MIX.h')
-rw-r--r-- | Swiften/MIX/MIX.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Swiften/MIX/MIX.h b/Swiften/MIX/MIX.h new file mode 100644 index 0000000..1398a6e --- /dev/null +++ b/Swiften/MIX/MIX.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2017 Tarun Gupta + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <memory> +#include <string> +#include <unordered_set> + +#include <boost/signals2.hpp> + +#include <Swiften/Base/API.h> +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/Form.h> +#include <Swiften/Elements/MIXJoin.h> +#include <Swiften/Elements/MIXLeave.h> +#include <Swiften/Elements/MIXUpdateSubscription.h> +#include <Swiften/Elements/MIXUserPreference.h> +#include <Swiften/Elements/ErrorPayload.h> + +namespace Swift { + class SWIFTEN_API MIX { + public: + using ref = std::shared_ptr<MIX>; + + public: + virtual ~MIX(); + + /** + * Join a MIX channel and subscribe to nodes. + */ + virtual void joinChannel(const std::unordered_set<std::string>& nodes) = 0; + + /** + * Join Channel with a set of preferences. + */ + virtual void joinChannelWithPreferences(const std::unordered_set<std::string>& nodes, Form::ref form) = 0; + + /** + * Update subscription of nodes. + */ + virtual void updateSubscription(const std::unordered_set<std::string>& nodes) = 0; + + /** + * Leave a MIX channel and unsubcribe nodes. + */ + virtual void leaveChannel() = 0; + + /** + * Request a configuration form for updating preferences. + */ + virtual void requestPreferencesForm() = 0; + + /** + * Update preferences after requesting preference form. + */ + virtual void updatePreferences(Form::ref form) = 0; + + public: + boost::signals2::signal<void (MIXJoin::ref /* joinResponse */, ErrorPayload::ref /* joinError */)> onJoinResponse; + boost::signals2::signal<void (MIXLeave::ref /* leaveResponse */, ErrorPayload::ref /* leaveError */)> onLeaveResponse; + boost::signals2::signal<void (MIXUpdateSubscription::ref /* updateResponse */, ErrorPayload::ref /* updateError */)> onSubscriptionUpdateResponse; + boost::signals2::signal<void (Form::ref /* preferencesForm */, ErrorPayload::ref /* failedConfiguration */)> onPreferencesFormResponse; + boost::signals2::signal<void (MIXUserPreference::ref /* userPreferenceResponse */, ErrorPayload::ref /* failedUpdate */)> onPreferencesUpdateResponse; + }; +} |