From b11126a19dbaadf4c32fb8dbec22754ad0712c26 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sun, 8 Dec 2013 20:14:12 +0100 Subject: Provide a JID for IRC users, and add a stringprep dependency for this --- src/xmpp/xmpp_component.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/xmpp/xmpp_component.cpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 5e65595..6424d74 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -267,7 +267,10 @@ void XmppComponent::send_message(const std::string& from, Xmpp::body&& body, con this->send_stanza(node); } -void XmppComponent::send_user_join(const std::string& from, const std::string& nick, const std::string& to) +void XmppComponent::send_user_join(const std::string& from, + const std::string& nick, + const std::string& realjid, + const std::string& to) { XmlNode node("presence"); node["to"] = to; @@ -280,6 +283,12 @@ void XmppComponent::send_user_join(const std::string& from, const std::string& n XmlNode item("item"); item["affiliation"] = "member"; item["role"] = "participant"; + if (!realjid.empty()) + { + const std::string preped_jid = jidprep(realjid); + if (!preped_jid.empty()) + item["jid"] = preped_jid; + } item.close(); x.add_child(std::move(item)); x.close(); @@ -408,7 +417,7 @@ void XmppComponent::send_nick_change(const std::string& muc_name, const std::str if (self) this->send_self_join(muc_name, new_nick, jid_to); else - this->send_user_join(muc_name, new_nick, jid_to); + this->send_user_join(muc_name, new_nick, "", jid_to); } void XmppComponent::kick_user(const std::string& muc_name, -- cgit v1.2.3