From b69451fd2e4166cfa7aad6b96047c70f7545eadc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 8 Aug 2016 08:19:59 +0000 Subject: - warning fixes; - more cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@17168 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/contactcache.cpp | 8 +++++++- plugins/TabSRMM/src/contactcache.h | 37 ++++++++++++++++++------------------ plugins/TabSRMM/src/globals.cpp | 7 ++++++- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgs.h | 12 ++++++------ plugins/TabSRMM/src/sendqueue.cpp | 4 ++-- 6 files changed, 41 insertions(+), 29 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 6a27e4be6e..afe9bd384c 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -38,7 +38,7 @@ static DBCachedContact ccInvalid; CContactCache::CContactCache(MCONTACT hContact) { m_hContact = hContact; - m_wOldStatus = ID_STATUS_OFFLINE; + m_wStatus = m_wOldStatus = ID_STATUS_OFFLINE; if (hContact) { if ((cc = db_get_contact(hContact)) != NULL) { @@ -582,3 +582,9 @@ int CContactCache::getStatus() const { return db_get_w(getActiveContact(), getActiveProto(), "Status", ID_STATUS_OFFLINE); } + +void CContactCache::updateStatus() +{ + m_wOldStatus = m_wStatus; + m_wStatus = getStatus(); +} diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 769654ac7e..0c3ce81892 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -99,36 +99,37 @@ struct CContactCache : public MZeroedObject //////////////////////////////////////////////////////////////////////////// - void updateState(); - bool updateNick(); - void updateMeta(); - bool updateUIN(); - void updateStatusMsg(const char *szKey = 0); - void setWindowData(const HWND hwnd = 0, TWindowData *dat = 0); - void resetMeta(); - void closeWindow(); - void deletedHandler(); - void updateFavorite(); + void updateStatus(); + void updateState(); + bool updateNick(); + void updateMeta(); + bool updateUIN(); + void updateStatusMsg(const char *szKey = 0); + void setWindowData(const HWND hwnd = 0, TWindowData *dat = 0); + void resetMeta(); + void closeWindow(); + void deletedHandler(); + void updateFavorite(); wchar_t* getNormalizedStatusMsg(const wchar_t *src, bool fStripAll = false); - HICON getIcon(int& iSize) const; + HICON getIcon(int& iSize) const; /* * input history */ - void saveHistory(WPARAM wParam, LPARAM lParam); - void inputHistoryEvent(WPARAM wParam); + void saveHistory(WPARAM wParam, LPARAM lParam); + void inputHistoryEvent(WPARAM wParam); static CContactCache* getContactCache(MCONTACT hContact); static int cacheUpdateMetaChanged(WPARAM wParam, LPARAM lParam); private: - void allocStats(); - void initPhaseTwo(); - void allocHistory(); - void releaseAlloced(); + void allocStats(); + void initPhaseTwo(); + void allocHistory(); + void releaseAlloced(); MCONTACT m_hContact, m_hSub; - WORD m_wOldStatus, m_wMetaStatus; + WORD m_wStatus, m_wOldStatus, m_wMetaStatus; char *m_szMetaProto; wchar_t *m_szAccount; wchar_t m_szNick[80], m_szUIN[80]; diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index b9bcd45f2c..fe960dbd77 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -364,6 +364,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (hwnd == 0 && hContact != 0) { // we are not interested in this event if there is no open message window/tab if (!strcmp(setting, "Status") || !strcmp(setting, "MyHandle") || !strcmp(setting, "Nick") || !strcmp(cws->szModule, SRMSGMOD_T)) { CContactCache *c = CContactCache::getContactCache(hContact); + c->updateStatus(); if (strcmp(setting, "Status")) c->updateNick(); if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent")) @@ -397,7 +398,11 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (hwnd == NULL) return 0; - bool fChanged = !strcmp(cws->szSetting, "Status"), fNickChanged = false, fExtendedStatusChange = false; + bool fChanged = false, fNickChanged = false, fExtendedStatusChange = false; + if (!strcmp(cws->szSetting, "Status")) { + c->updateStatus(); + fChanged = true; + } if (c) fNickChanged = c->updateNick(); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index e8ae781eda..1f5349381c 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1334,7 +1334,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l dat->cache->updateStats(TSessionStats::INIT_TIMER); if (dat->hContact) { FindFirstEvent(dat); - dat->nMax = dat->cache->getMaxMessageLength(); + dat->nMax = (int)dat->cache->getMaxMessageLength(); } LoadContactAvatar(dat); SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 0, 0); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index b58246c00e..5ce30b3ae6 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -239,11 +239,11 @@ struct TWindowData DWORD dwFlagsEx; MCONTACT hContact; char *szProto; - wchar_t szMyNickname[130]; - wchar_t szStatusBar[100]; + wchar_t szMyNickname[130]; + wchar_t szStatusBar[100]; StatusTextData *sbCustom; - wchar_t newtitle[130]; // tab title... - wchar_t szStatus[50]; + wchar_t newtitle[130]; // tab title... + wchar_t szStatus[50]; WORD wStatus; char *sendBuffer; size_t iSendBufferSize; @@ -287,14 +287,14 @@ struct TWindowData int iOpenJobs; int iCurrentQueueError; MEVENT hFlashingEvent; - wchar_t myUin[80]; + wchar_t myUin[80]; int SendFormat; MEVENT *hQueuedEvents; int iNextQueuedEvent; #define EVENT_QUEUE_SIZE 10 int iEventQueueSize; LCID lcid; - wchar_t lcID[10]; + wchar_t lcID[10]; int iPanelAvatarX, iPanelAvatarY; DWORD idle; HWND hwndTip; diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 0680965059..a939afb23a 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -139,7 +139,7 @@ static void DoSplitSendA(LPVOID param) job->iAcksNeeded++; char *szSaved = &szBegin[iCur]; - int iSavedCur = iCur; + size_t iSavedCur = iCur; for (int i = 0; iCur; i++, iCur--) { if (szBegin[iCur] == ' ') { szSaved = &szBegin[iCur]; @@ -238,7 +238,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) if (dat->hContact == NULL) return 0; //never happens - dat->nMax = dat->cache->getMaxMessageLength(); // refresh length info + dat->nMax = (int)dat->cache->getMaxMessageLength(); // refresh length info if (M.GetByte("autosplit", 0) && !(dat->sendMode & SMODE_SENDLATER)) { // determine send buffer length -- cgit v1.2.3