From 4ef50db3e581016365087759d5af8649e37ab8a7 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 2 Feb 2022 21:37:05 +0100 Subject: Various call UI/UX improvements --- xmpp-vala/src/module/xep/0045_muc/module.vala | 5 ++++- xmpp-vala/src/module/xep/0272_muji.vala | 5 ++++- xmpp-vala/src/module/xep/muji_meta.vala | 14 +++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'xmpp-vala') diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index e8711742..9969f507 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -218,7 +218,10 @@ public class Module : XmppStreamModule { public async void change_affiliation(XmppStream stream, Jid muc_jid, Jid? user_jid, string? nick, string new_affiliation) { StanzaNode item_node = new StanzaNode.build("item", NS_URI_ADMIN) .put_attribute("affiliation", new_affiliation, NS_URI_ADMIN); - if (user_jid != null) item_node.put_attribute("jid", user_jid.to_string(), NS_URI_ADMIN); + if (user_jid != null) { + // Some servers don't allow full JIDs and reply error:modify - jid-malformed - "Bare JID expected, got full JID". Make them bare JIDs. + item_node.put_attribute("jid", user_jid.bare_jid.to_string(), NS_URI_ADMIN); + } if (nick != null) item_node.put_attribute("nick", nick, NS_URI_ADMIN); StanzaNode query = new StanzaNode.build("query", NS_URI_ADMIN).add_self_xmlns().put_node(item_node); diff --git a/xmpp-vala/src/module/xep/0272_muji.vala b/xmpp-vala/src/module/xep/0272_muji.vala index b602d94c..f8b45e25 100644 --- a/xmpp-vala/src/module/xep/0272_muji.vala +++ b/xmpp-vala/src/module/xep/0272_muji.vala @@ -237,11 +237,14 @@ namespace Xmpp.Xep.Muji { public override void attach(XmppStream stream) { stream.add_flag(new Flag()); + stream.get_module(ServiceDiscovery.Module.IDENTITY).add_feature(stream, NS_URI); stream.get_module(Presence.Module.IDENTITY).received_available.connect(on_received_available); stream.get_module(Presence.Module.IDENTITY).received_unavailable.connect(on_received_unavailable); } - public override void detach(XmppStream stream) { } + public override void detach(XmppStream stream) { + stream.get_module(ServiceDiscovery.Module.IDENTITY).remove_feature(stream, NS_URI); + } public override string get_ns() { return NS_URI; diff --git a/xmpp-vala/src/module/xep/muji_meta.vala b/xmpp-vala/src/module/xep/muji_meta.vala index 89a0e8de..fa161f28 100644 --- a/xmpp-vala/src/module/xep/muji_meta.vala +++ b/xmpp-vala/src/module/xep/muji_meta.vala @@ -11,7 +11,7 @@ namespace Xmpp.Xep.MujiMeta { public signal void call_accepted(Jid from, Jid muc_jid, string message_type); public signal void call_rejected(Jid from, Jid to, Jid muc_jid, string message_type); - public void send_invite(XmppStream stream, Jid invitee, Jid muc_jid, bool video, string? message_type = null) { + public void send_invite(XmppStream stream, Jid invitee, Jid muc_jid, bool video, string message_type) { var invite_node = new StanzaNode.build("propose", NS_URI).put_attribute("muc", muc_jid.to_string()); invite_node.put_node(new StanzaNode.build("description", Xep.JingleRtp.NS_URI).add_self_xmlns().put_attribute("media", "audio")); if (video) { @@ -23,27 +23,27 @@ namespace Xmpp.Xep.MujiMeta { stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, invite_message); } - public void send_invite_retract_to_peer(XmppStream stream, Jid invitee, Jid muc_jid, string? message_type = null) { + public void send_invite_retract_to_peer(XmppStream stream, Jid invitee, Jid muc_jid, string message_type) { send_jmi_message(stream, "retract", invitee, muc_jid, message_type); } - public void send_invite_accept_to_peer(XmppStream stream, Jid invitor, Jid muc_jid, string? message_type = null) { + public void send_invite_accept_to_peer(XmppStream stream, Jid invitor, Jid muc_jid, string message_type) { send_jmi_message(stream, "accept", invitor, muc_jid, message_type); } public void send_invite_accept_to_self(XmppStream stream, Jid muc_jid) { - send_jmi_message(stream, "accept", Bind.Flag.get_my_jid(stream).bare_jid, muc_jid); + send_jmi_message(stream, "accept", Bind.Flag.get_my_jid(stream).bare_jid, muc_jid, MessageStanza.TYPE_CHAT); } - public void send_invite_reject_to_peer(XmppStream stream, Jid invitor, Jid muc_jid, string? message_type = null) { + public void send_invite_reject_to_peer(XmppStream stream, Jid invitor, Jid muc_jid, string message_type) { send_jmi_message(stream, "reject", invitor, muc_jid, message_type); } public void send_invite_reject_to_self(XmppStream stream, Jid muc_jid) { - send_jmi_message(stream, "reject", Bind.Flag.get_my_jid(stream).bare_jid, muc_jid); + send_jmi_message(stream, "reject", Bind.Flag.get_my_jid(stream).bare_jid, muc_jid, MessageStanza.TYPE_CHAT); } - private void send_jmi_message(XmppStream stream, string name, Jid to, Jid muc, string? message_type = null) { + private void send_jmi_message(XmppStream stream, string name, Jid to, Jid muc, string message_type) { var jmi_node = new StanzaNode.build(name, NS_URI).add_self_xmlns().put_attribute("muc", muc.to_string()); var muji_node = new StanzaNode.build("muji", NS_URI).add_self_xmlns().put_node(jmi_node); -- cgit v1.2.3-54-g00ecf