summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-18 14:30:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-18 14:30:17 +0000
commit3e9f54f75f04ec194cb223a8dff5b95da41ab4b9 (patch)
tree94f56ba2e8aa22d8d4978b7a71d0b5b14a6d0d6d /plugins/TabSRMM/src
parent641fa78a4a2326f07d2b742171c58b5971244d90 (diff)
tabSRMM popups used if tabSRMM is active
git-svn-id: http://svn.miranda-ng.org/main/trunk@7723 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/chat/chat.h2
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp58
3 files changed, 58 insertions, 4 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h
index 211a11e60c..5515358a5f 100644
--- a/plugins/TabSRMM/src/chat/chat.h
+++ b/plugins/TabSRMM/src/chat/chat.h
@@ -168,6 +168,8 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SES
void DestroyGCMenu(HMENU *hMenu, int iIndex);
void Chat_SetFilters(SESSION_INFO *si);
void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p);
+BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce);
+int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
// message.c
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index 1e4ab502c9..5989cbf31b 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -275,6 +275,8 @@ int Chat_Load()
pci->DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
pci->IsHighlighted = IsHighlighted;
pci->LogToFile = LogToFile;
+ pci->DoPopup = DoPopup;
+ pci->ShowPopup = ShowPopup;
pci->Log_CreateRtfHeader = Log_CreateRtfHeader;
pci->ReloadSettings();
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index e0d2cc7488..c31372cc54 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -104,12 +104,62 @@ BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
return TRUE;
}
-static BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce, TWindowData *dat)
+int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
+{
+ POPUPDATAT pd = { 0 };
+ va_list marker;
+ static TCHAR szBuf[4 * 1024];
+
+ if (!fmt || lstrlen(fmt) == 0 || lstrlen(fmt) > 2000)
+ return 0;
+
+ va_start(marker, fmt);
+ mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ va_end(marker);
+
+ pd.lchContact = hContact;
+
+ if (hIcon)
+ pd.lchIcon = hIcon;
+ else
+ pd.lchIcon = LoadIconEx(IDI_CHANMGR, "window", 0, 0);
+
+ PROTOACCOUNT *pa = ProtoGetAccount(pszProtoName);
+ mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME - 1, _T("%s - %s"),
+ (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
+ pcli->pfnGetContactDisplayName(hContact, 0));
+
+ lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
+ pd.iSeconds = g_Settings.iPopupTimeout;
+
+ if (g_Settings.iPopupStyle == 2) {
+ pd.colorBack = 0;
+ pd.colorText = 0;
+ }
+ else if (g_Settings.iPopupStyle == 3) {
+ pd.colorBack = g_Settings.crPUBkgColour;
+ pd.colorText = g_Settings.crPUTextColour;
+ }
+ else {
+ pd.colorBack = M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR);
+ pd.colorText = crBkg;
+ }
+
+ pd.PluginWindowProc = PopupDlgProc;
+ pd.PluginData = si;
+ return PUAddPopupT(&pd);
+}
+
+BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce)
{
int iEvent = gce->pDest->iType;
if (si == NULL || !(iEvent & si->iLogPopupFlags))
return true;
+ TWindowData *dat = si->dat;
+ if (dat == NULL)
+ return true;
+
TContainerData *pContainer = dat ? dat->pContainer : NULL;
TCHAR *bbStart, *bbEnd;
@@ -169,7 +219,7 @@ passed:
}
if (iNewEvent == GC_EVENT_MESSAGE) {
- pci->ShowPopup(si->hContact, si, pci->hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : pci->aFonts[9].color,
+ ShowPopup(si->hContact, si, pci->hIcons[ICON_MESSAGE], si->pszModule, si->ptszName, clr ? clr : pci->aFonts[9].color,
TranslateT("%s%s says:%s %s"), bbStart, gce->ptszNick, bbEnd, pci->RemoveFormatting(gce->ptszText));
}
else pci->DoPopup(si, gce);
@@ -304,7 +354,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
}
#endif
if (dat || !nen_options.iMUCDisable)
- DoPopup(si, gce, dat);
+ DoPopup(si, gce);
if (params->bInactive && si && si->hWnd)
SendMessage(si->hWnd, GC_SETMESSAGEHIGHLIGHT, 0, (LPARAM)si);
if (g_Settings.bFlashWindowHightlight && params->bInactive)
@@ -323,7 +373,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
if (bManyFix == 0) {
// do popups
if (dat || !nen_options.iMUCDisable)
- DoPopup(si, gce, dat);
+ DoPopup(si, gce);
// do sounds and flashing
switch (params->iEvent) {