From fbed4e49ff41a49e2b8b09e0ccc1268aeffbada1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 6 Aug 2013 08:33:44 +0000 Subject: - DoTrimMessage removed and replaced with rtrim() - contactcache.cpp moved from a linked list to a sorted list git-svn-id: http://svn.miranda-ng.org/main/trunk@5598 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/log.cpp | 16 ++- plugins/TabSRMM/src/chat/muchighlight.h | 42 +++---- plugins/TabSRMM/src/chat/window.cpp | 10 +- plugins/TabSRMM/src/contactcache.cpp | 71 +++++++----- plugins/TabSRMM/src/contactcache.h | 199 ++++++++++++++++---------------- plugins/TabSRMM/src/globals.cpp | 34 +----- plugins/TabSRMM/src/globals.h | 16 +-- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.cpp | 16 --- plugins/TabSRMM/src/msgdlgutils.h | 1 - plugins/TabSRMM/src/msgs.h | 3 +- 11 files changed, 181 insertions(+), 229 deletions(-) diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 37930006af..25ff4df187 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -517,13 +517,14 @@ static void Log_Append(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, co static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buffer, int *cbBufferEnd, int *cbBufferAlloced, const TCHAR *fmt, ...) { va_list va; - int lineLen, textCharsCount = 0; - TCHAR* line = (TCHAR*)alloca(8001 * sizeof(TCHAR)); - char* d; + int textCharsCount = 0; + char *d; + TCHAR *line = (TCHAR*)alloca(8001 * sizeof(TCHAR)); va_start(va, fmt); - lineLen = mir_vsntprintf(line, 8000, fmt, va); - if (lineLen < 0) lineLen = 8000; + int lineLen = mir_vsntprintf(line, 8000, fmt, va); + if (lineLen < 0) + lineLen = 8000; line[lineLen] = 0; va_end(va); @@ -546,9 +547,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff CopyMemory(d, "\\line ", 6); d += 6; } else if (*line == '%' && !simpleMode) { - char szTemp[200]; - - szTemp[0] = '\0'; + char szTemp[200]; szTemp[0] = '\0'; switch (*++line) { case '\0': case '%': @@ -559,7 +558,6 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff case 'f': if (g_Settings.bStripFormat || streamData->bStripFormat) line += 2; - else if (line[1] != '\0' && line[2] != '\0') { TCHAR szTemp3[3], c = *line; int col; diff --git a/plugins/TabSRMM/src/chat/muchighlight.h b/plugins/TabSRMM/src/chat/muchighlight.h index c552468577..8e9018778e 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.h +++ b/plugins/TabSRMM/src/chat/muchighlight.h @@ -58,26 +58,26 @@ public: cleanup(); } - void init (); - void cleanup (); - int match (const GCEVENT *pgce, const SESSION_INFO *psi, - DWORD dwFlags = MATCH_NICKNAME); + void init(); + void cleanup(); + int match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwFlags = MATCH_NICKNAME); + + static INT_PTR CALLBACK dlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); // option page dlg proc + static INT_PTR CALLBACK dlgProcAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); // for the "add to" dialog - static INT_PTR CALLBACK dlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); // option page dlg proc - static INT_PTR CALLBACK dlgProcAdd (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); // for the "add to" dialog private: - void tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr); - int wildmatch (const TCHAR *pattern, const TCHAR *tszString); - DWORD m_dwFlags; - bool m_fInitialized; - TCHAR** m_NickPatterns; - TCHAR** m_TextPatterns; - UINT m_iNickPatterns; - UINT m_iTextPatterns; - TCHAR * m_NickPatternString; - TCHAR * m_TextPatternString; - bool m_Valid; - bool m_fHighlightMe; + void tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr); + int wildmatch (const TCHAR *pattern, const TCHAR *tszString); + DWORD m_dwFlags; + bool m_fInitialized; + TCHAR** m_NickPatterns; + TCHAR** m_TextPatterns; + UINT m_iNickPatterns; + UINT m_iTextPatterns; + TCHAR *m_NickPatternString; + TCHAR *m_TextPatternString; + bool m_Valid; + bool m_fHighlightMe; }; struct THighLightEdit @@ -87,8 +87,8 @@ struct THighLightEdit CMD_EDIT = 2 }; - UINT uCmd; - SESSION_INFO *si; - USERINFO *ui; + UINT uCmd; + SESSION_INFO *si; + USERINFO *ui; }; diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 1c1d5c0b11..29941c9312 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -1568,13 +1568,13 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, else if (wParam < ' ') break; else { - TCHAR szNew[2]; - szNew[0] = (TCHAR) wParam; - szNew[1] = '\0'; if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) { MessageBeep(MB_OK); break; } + TCHAR szNew[2]; + szNew[0] = (TCHAR) wParam; + szNew[1] = '\0'; _tcscat(si->szSearch, szNew); } if (si->szSearch[0]) { @@ -3003,10 +3003,10 @@ LABEL_SHOWWINDOW: SM_AddCommand(si->ptszID, si->pszModule, pszRtf); ptrT ptszText( Chat_DoRtfToTags(pszRtf, si)); - if ((TCHAR*)ptszText == NULL) + if (ptszText == NULL) break; - DoTrimMessage(ptszText); + rtrimt(ptszText); if (mi && mi->bAckMsg) { Utils::enableDlgControl(hwndDlg, IDC_CHAT_MESSAGE, FALSE); diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index a824b421ca..634fa76176 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -35,19 +35,13 @@ #include "commonheaders.h" -CContactCache* CContactCache::m_cCache = 0; +static OBJLIST arContacts(50, HandleKeySortT); CContactCache::CContactCache(const HANDLE hContact) { - ZeroMemory(this, sizeof(CContactCache)); - - m_Valid = m_isMeta = false; m_hContact = hContact; m_wOldStatus = m_wStatus = m_wMetaStatus = ID_STATUS_OFFLINE; - m_szStatusMsg = m_ListeningInfo = m_xStatusMsg = 0; - m_nMax = 0; - if (hContact) { m_szProto = ::GetContactProto(m_hContact); if (m_szProto) @@ -69,11 +63,9 @@ CContactCache::CContactCache(const HANDLE hContact) */ void CContactCache::initPhaseTwo() { - PROTOACCOUNT* acc = 0; - m_szAccount = 0; if (m_szProto) { - acc = reinterpret_cast(::CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)m_szProto)); + PROTOACCOUNT *acc = reinterpret_cast(::CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)m_szProto)); if (acc && acc->tszAccountName) m_szAccount = acc->tszAccountName; } @@ -363,7 +355,8 @@ void CContactCache::inputHistoryEvent(WPARAM wParam) if (m_iHistoryCurrent == 0) return; m_iHistoryCurrent--; - } else { + } + else { m_iHistoryCurrent++; if (m_iHistoryCurrent > m_iHistoryTop) m_iHistoryCurrent = m_iHistoryTop; @@ -374,13 +367,14 @@ void CContactCache::inputHistoryEvent(WPARAM wParam) ::SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistorySize].szText); ::SendMessage(hwndEdit, EM_SETSEL, (WPARAM)- 1, (LPARAM)- 1); } - } else { + } + else { if (m_history[m_iHistoryCurrent].szText != NULL) { ::SetWindowText(hwndEdit, _T("")); ::SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistoryCurrent].szText); ::SendMessage(hwndEdit, EM_SETSEL, (WPARAM)- 1, (LPARAM)- 1); - } else - ::SetWindowText(hwndEdit, _T("")); + } + else ::SetWindowText(hwndEdit, _T("")); } ::SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(::GetDlgCtrlID(hwndEdit), EN_CHANGE), (LPARAM)hwndEdit); m_dat->dwFlags &= ~MWF_NEEDHISTORYSAVE; @@ -518,27 +512,44 @@ void CContactCache::updateStatusMsg(const char *szKey) * @return CContactCache* pointer to the cache entry for this contact */ -CContactCache* CContactCache::getContactCache(const HANDLE hContact) +CContactCache* CContactCache::getContactCache(HANDLE hContact) { - CContactCache *c = m_cCache, *cTemp; + CContactCache *cc = arContacts.find((CContactCache*)&hContact); + if (cc == NULL) { + cc = new CContactCache(hContact); + arContacts.insert(cc); + } + return cc; +} - cTemp = c; +/** + * when the state of the meta contacts protocol changes from enabled to disabled + * (or vice versa), this updates the contact cache + * + * it is ONLY called from the DBSettingChanged() event handler when the relevant + * database value is touched. + */ +void CContactCache::cacheUpdateMetaChanged() +{ + bool fMetaActive = (PluginConfig.g_MetaContactsAvail && PluginConfig.bMetaEnabled) ? true : false; - while(c) { - cTemp = c; - if (c->m_hContact == hContact) { - c->inc(); - return(c); + for (int i=0; i < arContacts.getCount(); i++) { + CContactCache &c = arContacts[i]; + if (c.isMeta() && PluginConfig.bMetaEnabled == false) { + c.closeWindow(); + c.resetMeta(); } - c = c->m_next; - } - CContactCache* _c = new CContactCache(hContact); - if (cTemp) { - cTemp->m_next = _c; - return(_c); + + // meta contacts are enabled, but current contact is a subcontact - > close window + + if (fMetaActive && c.isSubContact()) + c.closeWindow(); + + // reset meta contact information, if metacontacts protocol became avail + + if (fMetaActive && !strcmp(c.getProto(), PluginConfig.szMetaName)) + c.resetMeta(); } - m_cCache = _c; - return(_c); } /** diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index ab166e6b3c..d6684e9cd7 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -46,120 +46,119 @@ struct TInputHistory { struct TSessionStats { enum { - BYTES_RECEIVED = 1, - BYTES_SENT = 2, - FAILURE = 3, - UPDATE_WITH_LAST_RCV= 4, - SET_LAST_RCV = 5, - INIT_TIMER = 6, + BYTES_RECEIVED = 1, + BYTES_SENT = 2, + FAILURE = 3, + UPDATE_WITH_LAST_RCV = 4, + SET_LAST_RCV = 5, + INIT_TIMER = 6, }; - time_t started; - unsigned int iSent, iReceived, iSentBytes, iReceivedBytes; - unsigned int messageCount; - unsigned int iFailures; - unsigned int lastReceivedChars; - BOOL bWritten; + time_t started; + unsigned iSent, iReceived, iSentBytes, iReceivedBytes; + unsigned messageCount; + unsigned iFailures; + unsigned lastReceivedChars; + BOOL bWritten; }; -class CContactCache { -public: - - CContactCache () {} - CContactCache (const HANDLE hContact); - ~CContactCache () +struct CContactCache : public MZeroedObject +{ + CContactCache() {} + CContactCache(const HANDLE hContact); + ~CContactCache() { releaseAlloced(); } - void inc () { m_accessCount++; } - const bool isValid () const { return(m_Valid); } - const WORD getStatus () const { return(m_wStatus); } - const WORD getMetaStatus () const { return(m_wMetaStatus); } - const WORD getActiveStatus () const { return(m_isMeta ? m_wMetaStatus : m_wStatus); } - const WORD getOldStatus () const { return(m_wOldStatus); } - const TCHAR* getNick () const { return(m_szNick); } - const HANDLE getContact () const { return(m_hContact); } - const HANDLE getActiveContact () const { return(m_isMeta ? (m_hSubContact ? m_hSubContact : m_hContact) : m_hContact); } - const DWORD getIdleTS () const { return(m_idleTS); } - const char* getProto () const { return(m_szProto); } - const TCHAR* getProtoT () const { return(m_tszProto); } - const char* getMetaProto () const { return(m_szMetaProto ? m_szMetaProto : C_INVALID_PROTO); } - const TCHAR* getMetaProtoT () const { return(m_szMetaProto ? m_tszMetaProto : C_INVALID_PROTO_T); } - const char* getActiveProto () const { return(m_isMeta ? (m_szMetaProto ? m_szMetaProto : m_szProto) : m_szProto); } - const TCHAR* getActiveProtoT () const { return(m_isMeta ? (m_szMetaProto ? m_tszMetaProto : m_tszProto) : m_tszProto); } - bool isMeta () const { return(m_isMeta); } - bool isSubContact () const { return(m_isSubcontact); } - bool isFavorite () const { return(m_isFavorite); } - bool isRecent () const { return(m_isRecent); } - const TCHAR* getRealAccount () const { return(m_szAccount ? m_szAccount : C_INVALID_ACCOUNT); } - const TCHAR* getUIN () const { return(m_szUIN); } - const TCHAR* getStatusMsg () const { return(m_szStatusMsg); } - const TCHAR* getXStatusMsg () const { return(m_xStatusMsg); } - const TCHAR* getListeningInfo () const { return(m_ListeningInfo); } - BYTE getXStatusId () const { return(m_xStatus); } - const HWND getWindowData (TWindowData*& dat) const { dat = m_dat; return(m_hwnd); } - const HWND getHwnd () const { return(m_hwnd); } - int getMaxMessageLength (); - - TWindowData* getDat () const { return(m_dat); } - - void updateStats (int iType, size_t value = 0); - const DWORD getSessionStart () const { return(m_stats->started); } - const int getSessionMsgCount () const { return((int)m_stats->messageCount) ; } - void updateState (); - bool updateStatus (); - bool updateNick (); - void updateMeta (bool fForce = false); - 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 (); - TCHAR* getNormalizedStatusMsg (const TCHAR *src, bool fStripAll = false); - HICON getIcon (int& iSize) const; + + const bool isValid() const { return(m_Valid); } + const WORD getStatus() const { return(m_wStatus); } + const WORD getMetaStatus() const { return(m_wMetaStatus); } + const WORD getActiveStatus() const { return(m_isMeta ? m_wMetaStatus : m_wStatus); } + const WORD getOldStatus() const { return(m_wOldStatus); } + const TCHAR* getNick() const { return(m_szNick); } + const HANDLE getContact() const { return(m_hContact); } + const HANDLE getActiveContact() const { return(m_isMeta ? (m_hSubContact ? m_hSubContact : m_hContact) : m_hContact); } + const DWORD getIdleTS() const { return(m_idleTS); } + const char* getProto() const { return(m_szProto); } + const TCHAR* getProtoT() const { return(m_tszProto); } + const char* getMetaProto() const { return(m_szMetaProto ? m_szMetaProto : C_INVALID_PROTO); } + const TCHAR* getMetaProtoT() const { return(m_szMetaProto ? m_tszMetaProto : C_INVALID_PROTO_T); } + const char* getActiveProto() const { return(m_isMeta ? (m_szMetaProto ? m_szMetaProto : m_szProto) : m_szProto); } + const TCHAR* getActiveProtoT() const { return(m_isMeta ? (m_szMetaProto ? m_tszMetaProto : m_tszProto) : m_tszProto); } + bool isMeta() const { return(m_isMeta); } + bool isSubContact() const { return(m_isSubcontact); } + bool isFavorite() const { return(m_isFavorite); } + bool isRecent() const { return(m_isRecent); } + const TCHAR* getRealAccount() const { return(m_szAccount ? m_szAccount : C_INVALID_ACCOUNT); } + const TCHAR* getUIN() const { return(m_szUIN); } + const TCHAR* getStatusMsg() const { return(m_szStatusMsg); } + const TCHAR* getXStatusMsg() const { return(m_xStatusMsg); } + const TCHAR* getListeningInfo() const { return(m_ListeningInfo); } + BYTE getXStatusId() const { return(m_xStatus); } + const HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return(m_hwnd); } + const HWND getHwnd() const { return(m_hwnd); } + int getMaxMessageLength(); + + TWindowData* getDat() const { return(m_dat); } + + void updateStats(int iType, size_t value = 0); + const DWORD getSessionStart() const { return(m_stats->started); } + const int getSessionMsgCount() const { return((int)m_stats->messageCount) ; } + + //////////////////////////////////////////////////////////////////////////// + + void updateState(); + bool updateStatus(); + bool updateNick(); + void updateMeta(bool fForce = false); + 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(); + TCHAR* getNormalizedStatusMsg(const TCHAR *src, bool fStripAll = false); + HICON getIcon(int& iSize) const; /* * input history */ - void saveHistory (WPARAM wParam, LPARAM lParam); - void inputHistoryEvent (WPARAM wParam); - - HANDLE m_hContact; - CContactCache* m_next; + void saveHistory(WPARAM wParam, LPARAM lParam); + void inputHistoryEvent(WPARAM wParam); - static CContactCache* m_cCache; - static CContactCache* getContactCache(const HANDLE hContact); - -private: - void allocStats (); - void initPhaseTwo (); - void allocHistory (); - void releaseAlloced (); + static CContactCache* getContactCache(HANDLE hContact); + static void cacheUpdateMetaChanged(); private: - size_t m_accessCount; - HANDLE m_hSubContact; - WORD m_wStatus, m_wMetaStatus; - WORD m_wOldStatus; - char* m_szProto, *m_szMetaProto; - TCHAR* m_tszProto, m_tszMetaProto[40]; - TCHAR* m_szAccount; - TCHAR m_szNick[80], m_szUIN[80]; - TCHAR* m_szStatusMsg, *m_xStatusMsg, *m_ListeningInfo; - BYTE m_xStatus; - DWORD m_idleTS; - bool m_isMeta, m_isSubcontact; - bool m_Valid; - bool m_isFavorite; - bool m_isRecent; - HWND m_hwnd; - int m_nMax; - int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize; - TWindowData* m_dat; - TSessionStats* m_stats; - TInputHistory* m_history; + void allocStats(); + void initPhaseTwo(); + void allocHistory(); + void releaseAlloced(); + + HANDLE m_hContact; + HANDLE m_hSubContact; + WORD m_wStatus, m_wMetaStatus; + WORD m_wOldStatus; + char* m_szProto, *m_szMetaProto; + TCHAR* m_tszProto, m_tszMetaProto[40]; + TCHAR* m_szAccount; + TCHAR m_szNick[80], m_szUIN[80]; + TCHAR* m_szStatusMsg, *m_xStatusMsg, *m_ListeningInfo; + BYTE m_xStatus; + DWORD m_idleTS; + bool m_isMeta, m_isSubcontact; + bool m_Valid; + bool m_isFavorite; + bool m_isRecent; + HWND m_hwnd; + int m_nMax; + int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize; + + TWindowData *m_dat; + TSessionStats *m_stats; + TInputHistory *m_history; }; #endif /* __CONTACTCACHE_H */ diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index be420b1552..b44b52423e 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -467,7 +467,7 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) if (wParam == 0 && !lstrcmpA(setting, "Enabled")) { if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName)) { // catch the disabled meta contacts PluginConfig.bMetaEnabled = abs(M.GetByte(PluginConfig.szMetaName, "Enabled", -1)); - cacheUpdateMetaChanged(); + CContactCache::cacheUpdateMetaChanged(); } } @@ -721,38 +721,6 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) } } -/** - * when the state of the meta contacts protocol changes from enabled to disabled - * (or vice versa), this updates the contact cache - * - * it is ONLY called from the DBSettingChanged() event handler when the relevant - * database value is touched. - */ -void CGlobals::cacheUpdateMetaChanged() -{ - CContactCache* c = CContactCache::m_cCache; - bool fMetaActive = (PluginConfig.g_MetaContactsAvail && PluginConfig.bMetaEnabled) ? true : false; - - while(c) { - if (c->isMeta() && PluginConfig.bMetaEnabled == false) { - c->closeWindow(); - c->resetMeta(); - } - - // meta contacts are enabled, but current contact is a subcontact - > close window - - if (fMetaActive && c->isSubContact()) - c->closeWindow(); - - // reset meta contact information, if metacontacts protocol became avail - - if (fMetaActive && !strcmp(c->getProto(), PluginConfig.szMetaName)) - c->resetMeta(); - - c = c->m_next; - } -} - /** * on Windows 7, when using new task bar features (grouping mode and per tab * previews), autoswitching does not work relieably, so it is disabled. diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 36574b5706..e063312726 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -37,10 +37,10 @@ struct TSplitterBroadCast { TContainerData *pSrcContainer; TWindowData *pSrcDat; - LONG pos, pos_chat; - LONG off_chat, off_im; - LPARAM lParam; - BYTE bSync; + LONG pos, pos_chat; + LONG off_chat, off_im; + LPARAM lParam; + BYTE bSync; }; typedef BOOL (WINAPI *pfnSetMenuInfo )( HMENU hmenu, LPCMENUINFO lpcmi ); @@ -71,13 +71,6 @@ public: { if (m_MenuBar) ::DestroyMenu(m_MenuBar); - - CContactCache* c = CContactCache::m_cCache, *cTemp; - while(c) { - cTemp = c->m_next; - delete c; - c = cTemp; - } } void reloadAdv(); void reloadSystemStartup(); @@ -184,7 +177,6 @@ public: static TCHAR* m_default_container_name; - static void cacheUpdateMetaChanged(); static void logStatusChange(WPARAM wParam, const CContactCache *c); static void Ex_CopyEditToClipboard(HWND hWnd); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index f48607bdc1..0901618a18 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2953,7 +2953,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP char* utfResult = NULL; if (final_sendformat) DoRtfToTags(decoded, dat); - DoTrimMessage(decoded); + rtrimt(decoded); bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0); if (!IsUtfSendAvailable(dat->hContact)) { diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index b42674cd82..93ac9d56ff 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1197,22 +1197,6 @@ BOOL TSAPI DoRtfToTags(TCHAR * pszText, const TWindowData *dat) return TRUE; } -/* - * trims the output from DoRtfToTags(), removes trailing newlines and whitespaces... - */ - -void TSAPI DoTrimMessage(TCHAR *msg) -{ - size_t iLen = lstrlen(msg); - size_t i = iLen; - - while (i && (msg[i-1] == '\r' || msg[i-1] == '\n') || msg[i-1] == ' ') { - i--; - } - if (i < iLen) - msg[i] = '\0'; -} - /* * retrieve both buddys and my own UIN for a message session and store them in the message window *dat * respects metacontacts and uses the current protocol if the contact is a MC diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index c004d71afe..ac544d60d2 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -49,7 +49,6 @@ void TSAPI SetDialogToType (HWND hwndDlg); void TSAPI FlashOnClist (HWND hwndDlg, TWindowData *dat, HANDLE hEvent, DBEVENTINFO *dbei); char* TSAPI Message_GetFromStream (HWND hwndDlg, const TWindowData *dat, DWORD dwPassedFlags); BOOL TSAPI DoRtfToTags (TCHAR * pszText, const TWindowData *dat); -void TSAPI DoTrimMessage (TCHAR *msg); void TSAPI GetMYUIN (TWindowData *dat); void TSAPI SetMessageLog (TWindowData *dat); void TSAPI SwitchMessageLog (TWindowData *dat, int iMode); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 562ce342c5..2b3242b6b0 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -141,9 +141,10 @@ class CTaskbarInteract; class CMenuBar; class CInfoPanel; class CSideBar; -class CContactCache; class CProxyWindow; +struct CContactCache; + #define STICK_ICON_MSG 10 struct TLogTheme -- cgit v1.2.3