diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-17 20:53:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-17 20:53:52 +0000 |
commit | f6c842738792940ed5b91a5d8977b9e8d20337c0 (patch) | |
tree | 58735945361c1fc2052e67a87f35ce72c40d681c /plugins/TabSRMM/src/chat | |
parent | cf77bdeca036ce292aa334d352a194209a45cf3d (diff) |
tabSRMM highlights
git-svn-id: http://svn.miranda-ng.org/main/trunk@7698 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat')
-rw-r--r-- | plugins/TabSRMM/src/chat/chat.h | 5 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/main.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/services.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/tools.cpp | 11 |
4 files changed, 15 insertions, 9 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index 8dbc004450..ecfbf2b503 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -61,7 +61,6 @@ struct MODULEINFO : public GCModuleInfoBase DWORD idleTimeStamp;
DWORD lastIdleCheck;
TCHAR tszIdleMsg[60];
- CMUCHighlight* Highlight;
MODULEINFO * next;
};
@@ -70,7 +69,6 @@ struct SESSION_INFO : public GCSessionInfoBase TWindowData *dat;
TContainerData *pContainer;
int iLogTrayFlags, iLogPopupFlags, iSearchItem;
- CMUCHighlight *Highlight;
TCHAR szSearch[255];
TCHAR pszLogFileName[MAX_PATH + 50];
@@ -101,7 +99,6 @@ struct TMUCSettings : public GlobalLogSettingsBase bool bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog;
bool bScaleIcons, bUseDividers, bDividersUsePopupConfig;
- HANDLE hGroup;
CMUCHighlight* Highlight;
};
@@ -170,7 +167,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL b int Chat_GetColorIndex(const char* pszModule, COLORREF cr);
TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2);
int GetRichTextLength(HWND hwnd);
-BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText);
+BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index bd043c637b..3c15eefb0a 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -49,7 +49,6 @@ static void OnAddLog(SESSION_INFO *si, int isOk) static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi)
{
- si->Highlight = g_Settings.Highlight;
if (mi) {
mi->idleTimeStamp = time(0);
pci->SM_BroadcastMessage(mi->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE);
@@ -273,6 +272,7 @@ int Chat_Load() // this operation is unsafe, that's why we restore the old pci state on exit
pci->DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
+ pci->IsHighlighted = IsHighlighted;
pci->ReloadSettings();
g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 5457c2edce..fc0aa1549b 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -166,7 +166,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
{
- if (!si)
+ if (si == NULL)
return;
if (si->hWnd != NULL) {
@@ -174,10 +174,8 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) return;
}
- TCHAR szName[CONTAINER_NAMELEN + 2];
+ TCHAR szName[CONTAINER_NAMELEN + 2]; szName[0] = 0;
TContainerData *pContainer = si->pContainer;
-
- szName[0] = 0;
if (pContainer == NULL) {
GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN);
if (!g_Settings.bOpenInDefault && !_tcscmp(szName, _T("default")))
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index ee2b54b374..334447193a 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -757,3 +757,14 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) return si->pszLogFileName;
}
+
+BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
+{
+ if (!g_Settings.HighlightEnabled || !g_Settings.pszHighlightWords || !gce)
+ return FALSE;
+
+ int dwMask = 0;
+ if (gce->ptszText != NULL) dwMask |= CMUCHighlight::MATCH_TEXT;
+ if (gce->ptszNick != NULL) dwMask |= CMUCHighlight::MATCH_NICKNAME;
+ return g_Settings.Highlight->match(gce, si, dwMask);
+}
|