summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_groupchat.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-10 14:27:45 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-10 14:27:45 +0000
commit97eb95cd8aecd628d82d3aee30b81e567beb7754 (patch)
treeada84b3b7b20bc1f5ab6b490286ab1d41529108f /protocols/JabberG/src/jabber_groupchat.cpp
parent3bcc4ebb3e1a43574fb934a80903feaa56642089 (diff)
almost all old helpers replaced with smart pointers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5307 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_groupchat.cpp')
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index f4e5ee0d0c..900e21ebc5 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -1129,14 +1129,11 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
else if ( !_tcscmp(type, _T("error"))) {
int errorCode = 0;
HXML errorNode = xmlGetChild(node , "error");
- TCHAR* str = JabberErrorMsg(errorNode, &errorCode);
+ ptrT str( JabberErrorMsg(errorNode, &errorCode));
if (errorCode == JABBER_ERROR_CONFLICT) {
- TCHAR newNick[256] = { 0 };
- if (++item->iChatState == 1 &&
- JGetStringT(NULL, "GcAltNick", newNick, SIZEOF(newNick)) != NULL &&
- newNick[0] != _T('\0'))
- {
+ ptrT newNick( db_get_tsa(NULL, m_szModuleName, "GcAltNick"));
+ if (++item->iChatState == 1 && newNick != NULL && newNick[0] != 0) {
replaceStrT(item->nick, newNick);
TCHAR text[1024] = { 0 };
mir_sntprintf(text, SIZEOF(text), _T("%s/%s"), item->jid, newNick);
@@ -1146,16 +1143,15 @@ void CJabberProto::GroupchatProcessPresence(HXML node)
CallFunctionAsync(JabberGroupchatChangeNickname, new JabberGroupchatChangeNicknameParam(this, from));
item->iChatState = 0;
}
- mir_free(str);
return;
}
MsgPopup(NULL, str, TranslateT("Jabber Error"));
- if (item != NULL)
- if ( !item->bChatActive) ListRemove(LIST_CHATROOM, from);
- mir_free(str);
-} }
+ if (item != NULL && !item->bChatActive)
+ ListRemove(LIST_CHATROOM, from);
+ }
+}
void CJabberProto::GroupchatProcessMessage(HXML node)
{