diff options
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r-- | plugins/TabSRMM/src/chat_tools.cpp | 3 | ||||
-rw-r--r-- | plugins/TabSRMM/src/hotkeyhandler.cpp | 38 | ||||
-rw-r--r-- | plugins/TabSRMM/src/mim.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 9 |
8 files changed, 65 insertions, 5 deletions
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 51ae54e65a..5f63874862 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -278,6 +278,9 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) dat->m_pContainer->m_flags.m_bNeedsUpdateTitle = true;
}
}
+
+ if (p->bMustFlash && p->bInactive)
+ AddUnreadContact(dat->m_hContact);
}
delete p;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 84a00382ec..e9aa7d72bd 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -37,9 +37,10 @@ #include "stdafx.h"
static UINT WM_TASKBARCREATED;
+static HANDLE hSvcHotkeyProcessor = nullptr;
static HOTKEYDESC _hotkeydescs[] = {
- { "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), 0, TABSRMM_HK_LASTUNREAD },
+ { "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), 0, TABSRMM_HK_LASTUNREAD },
{ "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), 0, TABSRMM_HK_PASTEANDSEND },
{ "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, nullptr, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), 0, TABSRMM_HK_SETUSERPREFS },
{ "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), 0, TABSRMM_HK_CONTAINEROPTIONS },
@@ -79,7 +80,7 @@ LRESULT CMsgDialog::ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, return OnFilter(&mf);
}
-void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact)
+static void HandleMenuEntryFromhContact(MCONTACT hContact)
{
if (hContact == 0)
return;
@@ -98,6 +99,37 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact) Clist_ContactDoubleClicked(hContact);
}
+static INT_PTR HotkeyProcessor(WPARAM, LPARAM lParam)
+{
+ if (lParam == TABSRMM_HK_LASTUNREAD) {
+ if (g_arUnreadWindows.getCount()) {
+ HANDLE hContact = g_arUnreadWindows[0];
+ g_arUnreadWindows.remove(0);
+ HandleMenuEntryFromhContact(MCONTACT(hContact));
+ }
+ // restore last active container
+ else if (pLastActiveContainer != nullptr) {
+ if (IsIconic(pLastActiveContainer->m_hwnd) || !IsWindowVisible(pLastActiveContainer->m_hwnd)) {
+ SendMessage(pLastActiveContainer->m_hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
+ SetForegroundWindow(pLastActiveContainer->m_hwnd);
+ SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE));
+ }
+ else if (GetForegroundWindow() != pLastActiveContainer->m_hwnd) {
+ SetForegroundWindow(pLastActiveContainer->m_hwnd);
+ SetFocus(GetDlgItem(pLastActiveContainer->m_hwndActive, IDC_SRMM_MESSAGE));
+ }
+ else {
+ if (PluginConfig.m_bHideOnClose)
+ ShowWindow(pLastActiveContainer->m_hwnd, SW_HIDE);
+ else
+ SendMessage(pLastActiveContainer->m_hwnd, WM_SYSCOMMAND, SC_MINIMIZE, 0);
+ }
+ }
+ }
+
+ return 0;
+}
+
void TSAPI DrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, DWORD dwIdle)
{
FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_MENU));
@@ -119,6 +151,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated");
ShowWindow(hwndDlg, SW_HIDE);
+ hSvcHotkeyProcessor = CreateServiceFunction(MS_TABMSG_HOTKEYPROCESS, HotkeyProcessor);
SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, nullptr);
break;
@@ -386,6 +419,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP break;
case WM_DESTROY:
+ DestroyServiceFunction(hSvcHotkeyProcessor);
KillTimer(hwndDlg, TIMERID_SENDLATER_TICK);
KillTimer(hwndDlg, TIMERID_SENDLATER);
break;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 4c3149fd56..3b7c5845c6 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -520,6 +520,8 @@ nowindowcreate: // for tray support, we add the event to the tray menu. otherwise we send it back to // the contact list for flashing if (!(dbei.flags & DBEF_READ)) { + AddUnreadContact(hContact); + wchar_t toolTip[256]; mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact)); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index cc27fe9d4c..262be602a3 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -32,6 +32,8 @@ bool IsStringValidLink(wchar_t *pszText);
+LIST<void> g_arUnreadWindows(1, PtrKeySortT);
+
static int g_cLinesPerPage = 0;
static int g_iWheelCarryover = 0;
@@ -689,6 +691,8 @@ void CMsgDialog::OnDestroy() {
NotifyEvent(MSG_WINDOW_EVT_CLOSING);
+ g_arUnreadWindows.remove((HANDLE)m_hContact);
+
m_cache->setWindowData();
m_pContainer->ClearMargins();
PostMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 1);
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 3cf15c59f5..28d66676d2 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -522,8 +522,10 @@ void CMsgDialog::FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei) { m_dwTickLastEvent = GetTickCount(); - if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE) + if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE) { m_dwUnread++; + AddUnreadContact(m_hContact); + } if (hEvent == 0) return; @@ -2282,6 +2284,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) m_pContainer->m_dwLastActivity = m_dwLastActivity; m_pContainer->m_pMenuBar->configureMenu(); + g_arUnreadWindows.remove(HANDLE(m_hContact)); if (m_pContainer->m_hwndActive == m_hwnd) DeletePopupsForContact(m_hContact, PU_REMOVE_ON_FOCUS); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 84bfb1e070..fa1ff6e1cc 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -66,6 +66,14 @@ bool TSAPI IsCustomEvent(int eventType) }
/////////////////////////////////////////////////////////////////////////////////////////
+
+void TSAPI AddUnreadContact(MCONTACT hContact)
+{
+ if (!g_arUnreadWindows.find(HANDLE(hContact)))
+ g_arUnreadWindows.insert(HANDLE(hContact));
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// checking if theres's protected text at the point
// emulates EN_LINK WM_NOTIFY to parent to process links
diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 6d664a82b7..ea40839012 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -30,6 +30,7 @@ #define WANT_IEVIEW_LOG 1
#define WANT_HPP_LOG 2
+void TSAPI AddUnreadContact(MCONTACT hContact);
void TSAPI ProcessAvatarChange(HWND hwnd, LPARAM lParam);
BOOL TSAPI CheckCustomLink(HWND hwndRich, POINT *ptClient, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL bUrlNeeded);
int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 7858d901d7..886c2f166b 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -660,6 +660,8 @@ public: void onSelChange_List(CCtrlListBox*);
};
+extern LIST<void> g_arUnreadWindows;
+
#define MESSAGE_WINDOW_DATA_SIZE offsetof(_MessageWindowData, hdbEventFirst);
/*
@@ -1016,8 +1018,11 @@ struct SIDEBARITEM // callback for the user menu entry
-#define MS_TABMSG_SETUSERPREFS "SRMsg_MOD/SetUserPrefs"
-#define MS_TABMSG_SLQMGR "SRMsg_MOD/InvokeQmgr"
+#define MS_TABMSG_SETUSERPREFS "SRMsg_MOD/SetUserPrefs"
+#define MS_TABMSG_SLQMGR "SRMsg_MOD/InvokeQmgr"
+
+// the service which processes globally registered hotkeys
+#define MS_TABMSG_HOTKEYPROCESS "SRMsg_MOD/ProcessHotkey"
#define MBF_DISABLED 0x01
|