summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-10-02 17:38:56 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-10-03 07:02:37 (GMT)
commit4ea336d9d124f1c761b22943eaf6771e16a61e58 (patch)
tree7bcb7ac4366cf31a2f98654a5859de0b32fb318a /Swiften/MUC
parent123502d97dc20357ea03fd7f238f117aeb2d05c3 (diff)
downloadswift-4ea336d9d124f1c761b22943eaf6771e16a61e58.zip
swift-4ea336d9d124f1c761b22943eaf6771e16a61e58.tar.bz2
Simple MUC invites.
Resolves: #152
Diffstat (limited to 'Swiften/MUC')
-rw-r--r--Swiften/MUC/MUC.cpp12
-rw-r--r--Swiften/MUC/MUC.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp
index 6fe8f19..4c9e537 100644
--- a/Swiften/MUC/MUC.cpp
+++ b/Swiften/MUC/MUC.cpp
@@ -21,6 +21,7 @@
#include <Swiften/Elements/MUCAdminPayload.h>
#include <Swiften/Elements/MUCPayload.h>
#include <Swiften/Elements/MUCDestroyPayload.h>
+#include <Swiften/Elements/MUCInvitationPayload.h>
#include <Swiften/MUC/MUCRegistry.h>
#include <Swiften/Queries/GenericRequest.h>
@@ -286,6 +287,17 @@ void MUC::destroyRoom() {
request->send();
}
+void MUC::invitePerson(const JID& person, const std::string& reason) {
+ Message::ref message = boost::make_shared<Message>();
+ message->setTo(person);
+ message->setType(Message::Normal);
+ MUCInvitationPayload::ref invite = boost::make_shared<MUCInvitationPayload>();
+ invite->setReason(reason);
+ invite->setJID(ownMUCJID.toBare());
+ message->addPayload(invite);
+ stanzaChannel->sendMessage(message);
+}
+
//TODO: Invites(direct/mediated)
//TODO: requesting membership
diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h
index b99c4b4..45b8004 100644
--- a/Swiften/MUC/MUC.h
+++ b/Swiften/MUC/MUC.h
@@ -61,6 +61,8 @@ namespace Swift {
void requestConfigurationForm();
void configureRoom(Form::ref);
void destroyRoom();
+ /** Send an invite for the person to join the MUC */
+ void invitePerson(const JID& person, const std::string& reason = "");
public:
boost::signal<void (const std::string& /*nick*/)> onJoinComplete;
boost::signal<void (ErrorPayload::ref)> onJoinFailed;