diff options
author | David Plassmann <slaveriq@users.noreply.github.com> | 2018-01-09 01:06:32 +0100 |
---|---|---|
committer | fiaxh <fiaxh@users.noreply.github.com> | 2018-01-09 01:06:32 +0100 |
commit | 5d6cf9d8d56f9f3f781d1e6afa149f736868a108 (patch) | |
tree | b69cbc3398f845e7e0b612fc0d919125980380a7 /xmpp-vala/src/module/xep | |
parent | 2e041e2984fa303034a9736918631935c52ac03a (diff) | |
download | dino-5d6cf9d8d56f9f3f781d1e6afa149f736868a108.tar.gz dino-5d6cf9d8d56f9f3f781d1e6afa149f736868a108.zip |
Add support for setting a new Affiliation in a muc (#266)
* Added support for setting a new Affiliation in a muc
* small changes
* fix parameter order
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r-- | xmpp-vala/src/module/xep/0045_muc/module.vala | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index 08747343..faaf1901 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -142,6 +142,20 @@ public class Module : XmppStreamModule { return true; } + public void change_role(XmppStream stream, string jid, string nick, string new_role) { + StanzaNode query = new StanzaNode.build("query", NS_URI_ADMIN).add_self_xmlns(); + query.put_node(new StanzaNode.build("item", NS_URI_ADMIN).put_attribute("nick", nick, NS_URI_ADMIN).put_attribute("role", new_role, NS_URI_ADMIN)); + Iq.Stanza iq = new Iq.Stanza.set(query) { to=jid }; + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq); + } + + public void change_affiliation(XmppStream stream, string jid, string nick, string new_affiliation) { + StanzaNode query = new StanzaNode.build("query", NS_URI_ADMIN).add_self_xmlns(); + query.put_node(new StanzaNode.build("item", NS_URI_ADMIN).put_attribute("nick", nick, NS_URI_ADMIN).put_attribute("affiliation", new_affiliation, NS_URI_ADMIN)); + Iq.Stanza iq = new Iq.Stanza.set(query) { to=jid }; + stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq); + } + public delegate void OnConfigFormResult(XmppStream stream, string jid, DataForms.DataForm data_form); public void get_config_form(XmppStream stream, string jid, owned OnConfigFormResult listener) { Iq.Stanza get_iq = new Iq.Stanza.get(new StanzaNode.build("query", NS_URI_OWNER).add_self_xmlns()) { to=jid }; @@ -187,14 +201,6 @@ public class Module : XmppStreamModule { public override string get_ns() { return NS_URI; } public override string get_id() { return IDENTITY.id; } - private void change_role(XmppStream stream, string jid, string nick, string new_role) { - StanzaNode query = new StanzaNode.build("query", NS_URI_ADMIN).add_self_xmlns(); - query.put_node(new StanzaNode.build("item", NS_URI_ADMIN).put_attribute("nick", nick, NS_URI_ADMIN).put_attribute("role", new_role, NS_URI_ADMIN)); - Iq.Stanza iq = new Iq.Stanza.set(query); - iq.to = jid; - stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq); - } - private void on_received_message(XmppStream stream, Message.Stanza message) { if (message.type_ == Message.Stanza.TYPE_GROUPCHAT) { StanzaNode? subject_node = message.stanza.get_subnode("subject"); |