From 9cbb9794dca03fe252b0b0659ca108de63737678 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 20 Aug 2016 19:48:11 +0000 Subject: - fix for the wrong tab name for new contacts; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@17195 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/window.cpp | 2 +- plugins/TabSRMM/src/contactcache.cpp | 7 +------ plugins/TabSRMM/src/contactcache.h | 1 - plugins/TabSRMM/src/generic_msghandlers.cpp | 6 +++--- plugins/TabSRMM/src/globals.cpp | 3 +++ plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/templates.cpp | 2 +- plugins/TabSRMM/src/version.h | 4 ++-- 8 files changed, 12 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 54c436ae8b..5ed4d7f05c 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1749,7 +1749,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar dat->Panel = new CInfoPanel(dat); dat->cache = CContactCache::getContactCache(dat->hContact); - dat->cache->updateState(); + dat->cache->updateNick(); dat->cache->updateUIN(); newData->item.lParam = (LPARAM)hwndDlg; TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item); diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index b2ac11e277..d3f7600f6d 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -71,7 +71,7 @@ void CContactCache::initPhaseTwo() m_isMeta = db_mc_isMeta(cc->contactID) != 0; // don't use cc->IsMeta() here if (m_isMeta) updateMeta(); - updateState(); + updateNick(); updateFavorite(); } else { @@ -102,11 +102,6 @@ void CContactCache::closeWindow() ::SendMessage(m_hwnd, WM_CLOSE, 1, 2); } -void CContactCache::updateState() -{ - updateNick(); -} - /** * update private copy of the nick name. Use contact list name cache * diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 8e5c2afef4..a469b4b6a5 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -100,7 +100,6 @@ struct CContactCache : public MZeroedObject //////////////////////////////////////////////////////////////////////////// bool updateStatus(int iStatus); - void updateState(); bool updateNick(); void updateMeta(); bool updateUIN(); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index ba3f54c5b9..bf08ac6917 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1704,7 +1704,7 @@ void TSAPI DM_HandleAutoSizeRequest(TWindowData *dat, REQRESIZE* rr) void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) { - wchar_t newtitle[128], newcontactname[128]; + wchar_t newtitle[128]; DWORD dwOldIdle = dat->idle; const char *szActProto = 0; @@ -1713,7 +1713,6 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) HWND hwndContainer = dat->pContainer->hwnd; TContainerData* m_pContainer = dat->pContainer; - newcontactname[0] = 0; dat->szStatus[0] = 0; if (dat->iTabID == -1) @@ -1735,6 +1734,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) wcsncpy_s(dat->szStatus, pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, 0), _TRUNCATE); if (lParam != 0) { + wchar_t newcontactname[128]; newcontactname[0] = 0; if (PluginConfig.m_bCutContactNameOnTabs) CutContactName(szNick, newcontactname, _countof(newcontactname)); else @@ -1742,7 +1742,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) Utils::DoubleAmpersands(newcontactname, _countof(newcontactname)); - if (mir_wstrlen(newcontactname) != 0) { + if (newcontactname[0] != 0) { if (PluginConfig.m_bStatusOnTabs) mir_snwprintf(newtitle, L"%s (%s)", newcontactname, dat->szStatus); else diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 3cdb3315ac..8efb343740 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -370,6 +370,9 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (szProto == NULL) return 0; + if (!c->isValid()) + c->resetMeta(); // restart constructor + // catch own relevant settings if (!strcmp(cws->szModule, SRMSGMOD_T)) if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent")) diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 1f5349381c..b388c39c0a 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1175,7 +1175,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l dat->hContact = newData->hContact; dat->cache = CContactCache::getContactCache(dat->hContact); - dat->cache->updateState(); + dat->cache->updateNick(); dat->cache->setWindowData(hwndDlg, dat); M.AddWindow(hwndDlg, dat->hContact); BroadCastContainer(m_pContainer, DM_REFRESHTABINDEX, 0, 0); diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index abdb089cf8..7112227e4e 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -156,7 +156,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->dwFlags = dat->pContainer->theme.dwFlags; dat->cache = CContactCache::getContactCache(dat->hContact); - dat->cache->updateState(); + dat->cache->updateNick(); dat->cache->updateUIN(); dat->cache->updateStats(TSessionStats::INIT_TIMER); GetMYUIN(dat); diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index 732ac88563..b2e1e15e4b 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3 #define __MINOR_VERSION 4 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 12 +#define __RELEASE_NUM 1 +#define __BUILD_NUM 1 #include -- cgit v1.2.3