From f5181037fb93cebe849b625e5759f60192d406e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 15 May 2013 12:50:56 +0000 Subject: MS_MSG_SETSTATUSTEXT for tabSRMM git-svn-id: http://svn.miranda-ng.org/main/trunk@4657 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/globals.cpp | 7 ------ plugins/TabSRMM/src/globals.h | 18 ------------- plugins/TabSRMM/src/msgs.cpp | 56 ++++++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 48 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index eb1d7216c1..16a804abf8 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -562,8 +562,6 @@ int CGlobals::MetaContactEvent(WPARAM wParam, LPARAM lParam) int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam) { - int i; - #if defined(__USE_EX_HANDLERS) __try { #endif @@ -581,11 +579,6 @@ int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam) for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) M->WriteDword(hContact, SRMSGMOD_T, "messagecount", 0); - for (i=0; i < SERVICE_LAST; i++) { - if (PluginConfig.hSvc[i]) - DestroyServiceFunction(PluginConfig.hSvc[i]); - } - ::SI_DeinitStatusIcons(); ::CB_DeInitCustomButtons(); /* diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 6bc4987886..36574b5706 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -61,23 +61,6 @@ private: class CGlobals { public: - enum { - H_MS_MSG_SENDMESSAGE = 0, - H_MS_MSG_SENDMESSAGEW = 1, - H_MS_MSG_FORWARDMESSAGE = 2, - H_MS_MSG_GETWINDOWAPI = 3, - H_MS_MSG_GETWINDOWCLASS = 4, - H_MS_MSG_GETWINDOWDATA = 5, - H_MS_MSG_READMESSAGE = 6, - H_MS_MSG_TYPINGMESSAGE = 7, - H_MS_MSG_MOD_MESSAGEDIALOGOPENED = 8, - H_MS_TABMSG_SETUSERPREFS = 9, - H_MS_TABMSG_TRAYSUPPORT = 10, - H_MSG_MOD_GETWINDOWFLAGS = 11, - H_MS_TABMSG_SLQMGR = 12, - SERVICE_LAST = 13 - }; - CGlobals() { ::ZeroMemory(this, sizeof(CGlobals)); @@ -189,7 +172,6 @@ public: COLORREF m_ipBackgroundGradientHigh; COLORREF m_tbBackgroundHigh, m_tbBackgroundLow, m_fillColor, m_cRichBorders, m_genericTxtColor; BYTE m_dontUseDefaultKbd; - HANDLE hSvc[SERVICE_LAST]; HANDLE m_event_MsgWin, m_event_MsgPopup, m_event_WriteEvent; HGENMENU m_hMenuItem; BYTE m_useAeroPeek; diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 0cd43dcef5..00e1ea6f64 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -131,6 +131,24 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) return 1; } +/* + * service function. Sets a status bar text for a contact + */ + +static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) +{ + HWND hwnd = M->FindWindow((HANDLE)wParam); + if (hwnd == NULL) + return 1; + + TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); + if (dat == NULL || dat->pContainer == NULL) + return 1; + + SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, lParam); + return 0; +} + /* * service function. Invoke the user preferences dialog for the contact given (by handle) in wParam */ @@ -505,32 +523,24 @@ int IconsChanged(WPARAM wParam, LPARAM lParam) * initialises the internal API, services, events etc... */ -static struct _svcdef { - char *szName; - INT_PTR (*pfnService)(WPARAM wParam, LPARAM lParam); - HANDLE *h; -} SERVICES[] = { - MS_MSG_SENDMESSAGE, SendMessageCommand, &PluginConfig.hSvc[CGlobals::H_MS_MSG_SENDMESSAGE], - MS_MSG_GETWINDOWAPI, GetWindowAPI, &PluginConfig.hSvc[CGlobals::H_MS_MSG_GETWINDOWAPI], - MS_MSG_GETWINDOWCLASS, GetWindowClass, &PluginConfig.hSvc[CGlobals::H_MS_MSG_GETWINDOWCLASS], - MS_MSG_GETWINDOWDATA, GetWindowData, &PluginConfig.hSvc[CGlobals::H_MS_MSG_GETWINDOWDATA], - "SRMsg/ReadMessage", ReadMessageCommand, &PluginConfig.hSvc[CGlobals::H_MS_MSG_READMESSAGE], - "SRMsg/TypingMessage", TypingMessageCommand, &PluginConfig.hSvc[CGlobals::H_MS_MSG_TYPINGMESSAGE], - MS_MSG_MOD_MESSAGEDIALOGOPENED, MessageWindowOpened, &PluginConfig.hSvc[CGlobals::H_MS_MSG_MOD_MESSAGEDIALOGOPENED], - MS_TABMSG_SETUSERPREFS, SetUserPrefs, &PluginConfig.hSvc[CGlobals::H_MS_TABMSG_SETUSERPREFS], - MS_TABMSG_TRAYSUPPORT, Service_OpenTrayMenu, &PluginConfig.hSvc[CGlobals::H_MS_TABMSG_TRAYSUPPORT], - MS_MSG_MOD_GETWINDOWFLAGS, GetMessageWindowFlags, &PluginConfig.hSvc[CGlobals::H_MSG_MOD_GETWINDOWFLAGS], - MS_TABMSG_SLQMGR, CSendLater::svcQMgr, &PluginConfig.hSvc[CGlobals::H_MS_TABMSG_SLQMGR] -}; - static void TSAPI InitAPI() { - ZeroMemory(PluginConfig.hSvc, sizeof(HANDLE) * CGlobals::SERVICE_LAST); - - for (int i=0; i < SIZEOF(SERVICES); i++) - *(SERVICES[i].h) = CreateServiceFunction(SERVICES[i].szName, SERVICES[i].pfnService); + CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); + CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand_W); + CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI); + CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass); + CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData); + CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText); + + CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); + CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand); + CreateServiceFunction(MS_TABMSG_SETUSERPREFS, SetUserPrefs); + CreateServiceFunction(MS_TABMSG_TRAYSUPPORT, Service_OpenTrayMenu); + CreateServiceFunction(MS_TABMSG_SLQMGR, CSendLater::svcQMgr); + + CreateServiceFunction(MS_MSG_MOD_GETWINDOWFLAGS, GetMessageWindowFlags); + CreateServiceFunction(MS_MSG_MOD_MESSAGEDIALOGOPENED, MessageWindowOpened); - *(SERVICES[CGlobals::H_MS_MSG_SENDMESSAGEW].h) = CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand_W); SI_InitStatusIcons(); CB_InitCustomButtons(); -- cgit v1.2.3