summaryrefslogtreecommitdiff
path: root/src/modules/chat/tools.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-18 16:05:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-18 16:05:32 +0000
commit082f19f7b21686c2a30867a2dc604e61a47d8b20 (patch)
tree1c43b6bf08be42395f330605e412bb4695e961d8 /src/modules/chat/tools.cpp
parent408d77b0377713b6d2e485d217f8f811e7eff159 (diff)
crazy problems require crazy solutions
git-svn-id: http://svn.miranda-ng.org/main/trunk@7730 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/chat/tools.cpp')
-rw-r--r--src/modules/chat/tools.cpp92
1 files changed, 46 insertions, 46 deletions
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];