summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_groupchat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_groupchat.cpp')
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 42d968d7c5..3fba354194 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -739,12 +739,12 @@ static VOID CALLBACK JabberGroupchatChangeNickname(void* arg)
CMStringW szBuffer, szTitle;
szTitle.Format(TranslateT("Change nickname in <%s>"), item->name ? item->name : Utf2T(item->jid));
if (item->nick)
- szBuffer = item->nick;
+ szBuffer = Utf2T(item->nick);
if (param->ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
T2Utf newNick(szBuffer);
replaceStr(item->nick, newNick);
- param->ppro->SendPresenceTo(param->ppro->m_iStatus, CMStringA(FORMAT, "%s/%s", item->jid, newNick.get()));
+ param->ppro->SendPresenceTo(param->ppro->m_iStatus, MakeJid(item->jid, newNick));
}
}
@@ -824,10 +824,6 @@ void CJabberProto::GroupchatProcessPresence(const TiXmlElement *node)
const char *nick = cnick ? cnick : (r && r->m_szNick ? r->m_szNick : resource);
- // process custom nick change
- if (cnick && r && r->m_szNick && mir_strcmp(cnick, r->m_szNick))
- r->m_szNick = mir_strdup(cnick);
-
const TiXmlElement *itemNode = nullptr;
auto *xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
if (xNode)
@@ -851,6 +847,10 @@ void CJabberProto::GroupchatProcessPresence(const TiXmlElement *node)
else if (!mir_strcmp(pszStatus, "chat")) status = ID_STATUS_FREECHAT;
}
+ // process custom nick change
+ if (cnick && r && r->m_szNick && mir_strcmp(cnick, r->m_szNick))
+ r->m_szNick = mir_strdup(cnick);
+
const char *str = XmlGetChildText(node, "status");
int priority = XmlGetChildInt(node, "priority");
int newRes = ListAddResource(LIST_CHATROOM, from, status, str, priority, cnick) ? GC_EVENT_JOIN : 0;
@@ -990,9 +990,7 @@ void CJabberProto::GroupchatProcessPresence(const TiXmlElement *node)
ptrA newNick(getUStringA("GcAltNick"));
if (++item->iChatState == 1 && newNick != nullptr && newNick[0] != 0) {
replaceStr(item->nick, newNick);
- char text[1024];
- mir_snprintf(text, "%s/%s", item->jid, newNick);
- SendPresenceTo(m_iStatus, text);
+ SendPresenceTo(m_iStatus, MakeJid(item->jid, newNick));
}
else {
CallFunctionAsync(JabberGroupchatChangeNickname, new JabberGroupchatChangeNicknameParam(this, from));