summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-01-04 01:30:03 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:36 +0100
commite840704b58a984351971e8034e74f5e9fdfaf114 (patch)
tree9b038d0003e175b640cddd8de0d7814dde8eaf51 /src/xmpp
parentbaf03a7e20d30698a06ccf03cd93b15317de340e (diff)
downloadbiboumi-e840704b58a984351971e8034e74f5e9fdfaf114.tar.gz
biboumi-e840704b58a984351971e8034e74f5e9fdfaf114.tar.bz2
biboumi-e840704b58a984351971e8034e74f5e9fdfaf114.tar.xz
biboumi-e840704b58a984351971e8034e74f5e9fdfaf114.zip
Convert received modes into roles and affiliations
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_component.cpp22
-rw-r--r--src/xmpp/xmpp_component.hpp9
2 files changed, 31 insertions, 0 deletions
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index f0d1d3a..a0054ea 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -484,3 +484,25 @@ void XmppComponent::send_nickname_conflict_error(const std::string& muc_name,
presence.close();
this->send_stanza(presence);
}
+
+void XmppComponent::send_affiliation_role_change(const std::string& muc_name,
+ const std::string& target,
+ const std::string& affiliation,
+ const std::string& role,
+ const std::string& jid_to)
+{
+ Stanza presence("presence");
+ presence["from"] = muc_name + "@" + this->served_hostname + "/" + target;
+ presence["to"] = jid_to;
+ XmlNode x("x");
+ x["xmlns"] = MUC_USER_NS;
+ XmlNode item("item");
+ item["affiliation"] = affiliation;
+ item["role"] = role;
+ item.close();
+ x.add_child(std::move(item));
+ x.close();
+ presence.add_child(std::move(x));
+ presence.close();
+ this->send_stanza(presence);
+}
diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp
index c10f10a..f86d930 100644
--- a/src/xmpp/xmpp_component.hpp
+++ b/src/xmpp/xmpp_component.hpp
@@ -113,6 +113,15 @@ public:
const std::string& nickname,
const std::string& jid_to);
/**
+ * Send a presence from the MUC indicating a change in the role and/or
+ * affiliation of a participant
+ */
+ void send_affiliation_role_change(const std::string& muc_name,
+ const std::string& target,
+ const std::string& affiliation,
+ const std::string& role,
+ const std::string& jid_to);
+ /**
* Handle the various stanza types
*/
void handle_handshake(const Stanza& stanza);