From 025f4137a8d54ae30ace6291b0cee1ba44288c8e Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 21 Nov 2018 21:39:58 +0300 Subject: this code is so much faster --- src/mir_app/src/chat_manager.cpp | 8 ++++---- src/mir_app/src/chat_svc.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 3552cf8e7d..f51d1f2811 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -689,14 +689,14 @@ bool UM_SortUser(SESSION_INFO *si, const wchar_t *pszUID) return true; } -USERINFO* UM_AddUser(STATUSINFO *pStatusList, SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus) +USERINFO* UM_AddUser(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus) { - if (pStatusList == nullptr || si == nullptr || pszNick == nullptr) + if (si == nullptr || pszNick == nullptr) return nullptr; USERINFO *node = new USERINFO(); - replaceStrW(node->pszUID, pszUID); - replaceStrW(node->pszNick, pszNick); + node->pszUID = mir_wstrdup(pszUID); + node->pszNick = mir_wstrdup(pszNick); node->Status = wStatus; si->getUserList().insert(node); return node; diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 2eeb134218..daaab3b654 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -369,7 +369,7 @@ static void AddUser(GCEVENT *gce) WORD status = TM_StringToWord(si->pStatuses, gce->ptszStatus); - USERINFO *ui = g_chatApi.UM_AddUser(si->pStatuses, si, gce->ptszUID, gce->ptszNick, status); + USERINFO *ui = g_chatApi.UM_AddUser(si, gce->ptszUID, gce->ptszNick, status); if (ui == nullptr) return; -- cgit v1.2.3