diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-18 16:05:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-18 16:05:32 +0000 |
commit | 082f19f7b21686c2a30867a2dc604e61a47d8b20 (patch) | |
tree | 1c43b6bf08be42395f330605e412bb4695e961d8 | |
parent | 408d77b0377713b6d2e485d217f8f811e7eff159 (diff) |
crazy problems require crazy solutions
git-svn-id: http://svn.miranda-ng.org/main/trunk@7730 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | include/m_chat_int.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/window.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/chat.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/tools.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 6 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 6 | ||||
-rw-r--r-- | src/modules/chat/clist.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/tools.cpp | 92 |
8 files changed, 59 insertions, 60 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index f0a21adeed..ffd036e3ff 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define OPTIONS_FONTCOUNT 20
#define STATUSICONCOUNT 6
+#define GC_FAKE_EVENT HANDLE(0xBABABEDA)
+
#define GC_UPDATETITLE (WM_USER+100)
#define GC_SPLITTERMOVED (WM_USER+101)
#define GC_CLOSEWINDOW (WM_USER+103)
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index cbcd8c270a..e32ff87438 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -1362,7 +1362,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR si->wState &= ~GC_EVENT_HIGHLIGHT;
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
}
SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
@@ -1490,7 +1490,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR case SESSION_TERMINATE:
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
@@ -1629,7 +1629,7 @@ LABEL_SHOWWINDOW: if (db_get_w(si->hContact, si->pszModule, "ApparentMode", 0) != 0)
db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
break;
case WM_NOTIFY:
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index 5515358a5f..025a854983 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -178,7 +178,6 @@ TCHAR* Chat_DoRtfToTags(char* pszRtfText, SESSION_INFO *si); #include "chat_resource.h"
-extern char *szChatIconString;
extern char szIndicators[];
#define DEFLOGFILENAME _T("%miranda_logpath%\\%proto%\\%userid%.log")
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index c3da2d9b1c..be3f0d826b 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -33,8 +33,6 @@ #include "..\commonheaders.h"
-char *szChatIconString = "chaticon";
-
int GetRichTextLength(HWND hwnd)
{
GETTEXTLENGTHEX gtl;
@@ -59,7 +57,7 @@ static void TSAPI Chat_DismissPopup(const SESSION_INFO *si, HWND hwndPopup) {
if (si->hContact)
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
if (si->hWnd && KillTimer(si->hWnd, TIMERID_FLASHWND))
FlashWindow(si->hWnd, FALSE);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 4ef037a93c..ec32faac47 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -278,7 +278,7 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) if (db_get_w(si->hContact, si->pszModule , "ApparentMode", 0) != 0)
db_set_w(si->hContact, si->pszModule , "ApparentMode", 0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1);
dat->dwTickLastEvent = 0;
@@ -2378,7 +2378,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case SESSION_TERMINATE:
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
dat->bWasDeleted = 1;
@@ -3534,7 +3534,7 @@ LABEL_SHOWWINDOW: case WM_DESTROY:
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)szChatIconString);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
si->hWnd = NULL;
si->dat = NULL;
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 3e54bcf393..4669f0423e 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1673,7 +1673,7 @@ END_REMOVETAB: s->wState &= ~GC_EVENT_HIGHLIGHT;
if (CallService(MS_CLIST_GETEVENT, (WPARAM)s->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)s->hContact, (LPARAM)"chaticon");
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)s->hContact, (LPARAM)GC_FAKE_EVENT);
}
SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s);
@@ -1845,7 +1845,7 @@ END_REMOVETAB: db_set_dw(si->hContact, "Chat", "roomheight", si->iHeight);
}
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
@@ -2034,7 +2034,7 @@ LABEL_SHOWWINDOW: if (db_get_w(si->hContact, si->pszModule ,"ApparentMode", 0) != 0)
db_set_w(si->hContact, si->pszModule ,"ApparentMode",(LPARAM) 0);
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
}
break;
diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index 07dace2d3b..658076cd09 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -227,7 +227,7 @@ BOOL AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, }
else {
if (CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hEvent);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)GC_FAKE_EVENT);
CallService(MS_CLIST_ADDEVENT, (WPARAM)hContact, (LPARAM)&cle);
}
return TRUE;
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index 5b91b0e2e1..e3c43e483d 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -83,81 +83,48 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord) return (TCHAR*)&szTemp;
}
-static void __stdcall ShowRoomFromPopup(void * pi)
-{
- SESSION_INFO *si = (SESSION_INFO*)pi;
- ci.ShowRoom(si, WINDOW_VISIBLE, TRUE);
-}
-
-static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch (message) {
- case WM_COMMAND:
- if (HIWORD(wParam) == STN_CLICKED) {
- SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
- CallFunctionAsync(ShowRoomFromPopup, si);
-
- PUDeletePopup(hWnd);
- return TRUE;
- }
- break;
- case WM_CONTEXTMENU:
- SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
- if (si->hContact)
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)"chaticon");
-
- if (si->hWnd && KillTimer(si->hWnd, TIMERID_FLASHWND))
- FlashWindow(si->hWnd, FALSE);
-
- PUDeletePopup(hWnd);
- break;
- }
- return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
switch (gce->pDest->iType) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
- ci.AddEvent(si->hContact, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), "chaticon", 0, TranslateT("%s wants your attention in %s"), gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), GC_FAKE_EVENT, 0, TranslateT("%s wants your attention in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_MESSAGE:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_MESSAGE], "chaticon", CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_MESSAGE], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_ACTION:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_ACTION], "chaticon", CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_ACTION], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_JOIN:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_JOIN], "chaticon", CLEF_ONLYAFEW, TranslateT("%s has joined %s"), gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_JOIN], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has joined %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_PART:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_PART], "chaticon", CLEF_ONLYAFEW, TranslateT("%s has left %s"), gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_PART], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has left %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_QUIT:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_QUIT], "chaticon", CLEF_ONLYAFEW, TranslateT("%s has disconnected"), gce->ptszNick);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_QUIT], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s has disconnected"), gce->ptszNick);
break;
case GC_EVENT_NICK:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_NICK], "chaticon", CLEF_ONLYAFEW, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_NICK], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
break;
case GC_EVENT_KICK:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_KICK], "chaticon", CLEF_ONLYAFEW, TranslateT("%s kicked %s from %s"), gce->ptszStatus, gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_KICK], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s kicked %s from %s"), gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_NOTICE:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_NOTICE], "chaticon", CLEF_ONLYAFEW, TranslateT("Notice from %s"), gce->ptszNick);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_NOTICE], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Notice from %s"), gce->ptszNick);
break;
case GC_EVENT_TOPIC:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_TOPIC], "chaticon", CLEF_ONLYAFEW, TranslateT("Topic change in %s"), si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_TOPIC], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Topic change in %s"), si->ptszName);
break;
case GC_EVENT_INFORMATION:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_INFO], "chaticon", CLEF_ONLYAFEW, TranslateT("Information in %s"), si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_INFO], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("Information in %s"), si->ptszName);
break;
case GC_EVENT_ADDSTATUS:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_ADDSTATUS], "chaticon", CLEF_ONLYAFEW, TranslateT("%s enables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_ADDSTATUS], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s enables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
case GC_EVENT_REMOVESTATUS:
- ci.AddEvent(si->hContact, ci.hIcons[ICON_REMSTATUS], "chaticon", CLEF_ONLYAFEW, TranslateT("%s disables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
+ ci.AddEvent(si->hContact, ci.hIcons[ICON_REMSTATUS], GC_FAKE_EVENT, CLEF_ONLYAFEW, TranslateT("%s disables \'%s\' status for %s in %s"), gce->ptszText, gce->ptszStatus, gce->ptszNick, si->ptszName);
break;
}
@@ -166,6 +133,39 @@ BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) /////////////////////////////////////////////////////////////////////////////////////////
+static void __stdcall ShowRoomFromPopup(void * pi)
+{
+ SESSION_INFO *si = (SESSION_INFO*)pi;
+ ci.ShowRoom(si, WINDOW_VISIBLE, TRUE);
+}
+
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message) {
+ case WM_COMMAND:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
+ CallFunctionAsync(ShowRoomFromPopup, si);
+
+ PUDeletePopup(hWnd);
+ return TRUE;
+ }
+ break;
+ case WM_CONTEXTMENU:
+ SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
+ if (si->hContact)
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT);
+
+ if (si->hWnd && KillTimer(si->hWnd, TIMERID_FLASHWND))
+ FlashWindow(si->hWnd, FALSE);
+
+ PUDeletePopup(hWnd);
+ break;
+ }
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
{
static TCHAR szBuf[4 * 1024];
|