diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-16 21:40:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-16 21:40:14 +0000 |
commit | 831ad8a0121f9f9ee5c4f38d4a0d209b3c2bdb60 (patch) | |
tree | e362f0459b19341b213e5ca7de87af699564beab /src | |
parent | 41ba18e9cb1c340cb80c637817231b487c54562e (diff) |
kernel chats, part 3, tabsrmm
git-svn-id: http://svn.miranda-ng.org/main/trunk@7684 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdchat/src/log.cpp | 4 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 66 | ||||
-rw-r--r-- | src/modules/chat/chat.h | 2 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 6 | ||||
-rw-r--r-- | src/modules/chat/clist.cpp | 78 | ||||
-rw-r--r-- | src/modules/chat/manager.cpp | 11 | ||||
-rw-r--r-- | src/modules/chat/tools.cpp | 4 |
7 files changed, 89 insertions, 82 deletions
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 10b6f8097e..0e5a94edb5 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -87,7 +87,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedr //set the insertion point at the bottom
sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & sel);
+ SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) &sel);
// fix for the indent... must be a M$ bug
if (sel.cpMax == 0)
@@ -151,7 +151,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedr // need to invalidate the window
if (bFlag) {
sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich);
- SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) & sel);
+ SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM) &sel);
SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0);
InvalidateRect(hwndRich, NULL, TRUE);
} } }
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 181dfa24e2..4c622eee41 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -399,7 +399,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (pszName == NULL) {
pszName = dat->szTabSave;
SendMessage(hwnd, EM_SETSEL, start, end);
- if (end !=start)
+ if (end != start)
SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) pszName);
dat->szTabSave[0] = '\0';
}
@@ -417,9 +417,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0;
}
- if (dat->szTabSave[0] != '\0' && wParam != VK_RIGHT && wParam != VK_LEFT
- && wParam != VK_SPACE && wParam != VK_RETURN && wParam != VK_BACK
- && wParam != VK_DELETE ) {
+ if (dat->szTabSave[0] != '\0' && wParam != VK_RIGHT && wParam != VK_LEFT &&
+ wParam != VK_SPACE && wParam != VK_RETURN && wParam != VK_BACK && wParam != VK_DELETE)
+ {
if (g_Settings.AddColonToAutoComplete && start == 0)
SendMessageA(hwnd, EM_REPLACESEL, FALSE, (LPARAM) ": ");
@@ -432,25 +432,25 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
if (wParam == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics)
- CheckDlgButton(GetParent(hwnd), IDC_ITALICS, IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_ITALICS, IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_ITALICS, 0), 0);
return TRUE;
}
if (wParam == 0x42 && isCtrl && !isAlt) { // ctrl-b (bold)
- CheckDlgButton(GetParent(hwnd), IDC_BOLD, IsDlgButtonChecked(GetParent(hwnd), IDC_BOLD) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_BOLD, IsDlgButtonChecked(GetParent(hwnd), IDC_BOLD) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_BOLD, 0), 0);
return TRUE;
}
if (wParam == 0x55 && isCtrl && !isAlt) { // ctrl-u (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, IsDlgButtonChecked(GetParent(hwnd), IDC_UNDERLINE) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, IsDlgButtonChecked(GetParent(hwnd), IDC_UNDERLINE) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_UNDERLINE, 0), 0);
return TRUE;
}
if (wParam == 0x4b && isCtrl && !isAlt) { // ctrl-k (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_COLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_COLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_COLOR, 0), 0);
return TRUE;
}
@@ -470,7 +470,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
if (wParam == 0x4c && isCtrl && !isAlt) { // ctrl-l (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_BKGCOLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_BKGCOLOR, 0), 0);
return TRUE;
}
@@ -498,7 +498,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return TRUE;
}
- if ((wParam == 45 && isShift || wParam == 0x56 && isCtrl )&& !isAlt) { // ctrl-v (paste clean text)
+ if ((wParam == 45 && isShift || wParam == 0x56 && isCtrl) && !isAlt) { // ctrl-v (paste clean text)
SendMessage(hwnd, EM_PASTESPECIAL, CF_TEXT, 0);
return TRUE;
}
@@ -535,7 +535,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
- SendMessage(hwnd, EM_SCROLLCARET, 0,0);
+ SendMessage(hwnd, EM_SCROLLCARET, 0, 0);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
SendMessage(hwnd, EM_SETSEL, iLen, iLen);
@@ -583,18 +583,18 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, CHARRANGE sel, all = { 0, -1 };
HMENU hSubMenu = GetSubMenu(g_hMenu, 4);
TranslateMenu(hSubMenu);
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- EnableMenuItem(hSubMenu, ID_MESSAGE_UNDO, SendMessage(hwnd, EM_CANUNDO, 0,0)?MF_ENABLED:MF_GRAYED);
- EnableMenuItem(hSubMenu, ID_MESSAGE_REDO, SendMessage(hwnd, EM_CANREDO, 0,0)?MF_ENABLED:MF_GRAYED);
- EnableMenuItem(hSubMenu, ID_MESSAGE_COPY, sel.cpMax!=sel.cpMin?MF_ENABLED:MF_GRAYED);
- EnableMenuItem(hSubMenu, ID_MESSAGE_CUT, sel.cpMax!=sel.cpMin?MF_ENABLED:MF_GRAYED);
+ EnableMenuItem(hSubMenu, ID_MESSAGE_UNDO, SendMessage(hwnd, EM_CANUNDO, 0, 0) ? MF_ENABLED : MF_GRAYED);
+ EnableMenuItem(hSubMenu, ID_MESSAGE_REDO, SendMessage(hwnd, EM_CANREDO, 0, 0) ? MF_ENABLED : MF_GRAYED);
+ EnableMenuItem(hSubMenu, ID_MESSAGE_COPY, sel.cpMax != sel.cpMin ? MF_ENABLED : MF_GRAYED);
+ EnableMenuItem(hSubMenu, ID_MESSAGE_CUT, sel.cpMax != sel.cpMin ? MF_ENABLED : MF_GRAYED);
dat->lastEnterTime = 0;
POINT pt;
pt.x = (short)LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
ClientToScreen(hwnd, &pt);
UINT uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
@@ -623,14 +623,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
case ID_MESSAGE_SELECTALL:
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & all);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all);
break;
case ID_MESSAGE_CLEAR:
- SetWindowText(hwnd, _T( "" ));
+ SetWindowText(hwnd, _T(""));
break;
}
- PostMessage(hwnd, WM_KEYUP, 0, 0 );
+ PostMessage(hwnd, WM_KEYUP, 0, 0);
}
break;
@@ -644,7 +644,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_BACKCOLOR|CFM_COLOR;
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_BACKCOLOR | CFM_COLOR;
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bColor) {
@@ -811,11 +811,11 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_LBUTTONUP:
{
CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel);
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
SendMessage(hwnd, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel);
+ sel.cpMin = sel.cpMax;
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
}
SetFocus(GetDlgItem(GetParent(hwnd), IDC_MESSAGE));
}
@@ -830,10 +830,10 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_ACTIVATE:
if (LOWORD(wParam) == WA_INACTIVE) {
CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) &sel);
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
- sel.cpMin = sel.cpMax ;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM) & sel);
+ sel.cpMin = sel.cpMax;
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);
}
}
break;
@@ -922,8 +922,8 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_LBUTTONDBLCLK:
{
TCHITTESTINFO tci = {0};
- tci.pt.x=(short)LOWORD(GetMessagePos());
- tci.pt.y=(short)HIWORD(GetMessagePos());
+ tci.pt.x = (short)LOWORD(GetMessagePos());
+ tci.pt.y = (short)HIWORD(GetMessagePos());
tci.flags = TCHT_ONITEM;
ScreenToClient(hwnd, &tci.pt);
@@ -1983,7 +1983,7 @@ LABEL_SHOWWINDOW: si.nPos = si.nMax - si.nPage + 1;
SetScrollInfo(GetDlgItem(hwndDlg, IDC_LOG), SB_VERT, &si, TRUE);
sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG));
- SendMessage(GetDlgItem(hwndDlg, IDC_LOG), EM_EXSETSEL, 0, (LPARAM) & sel);
+ SendMessage(GetDlgItem(hwndDlg, IDC_LOG), EM_EXSETSEL, 0, (LPARAM) &sel);
PostMessage(GetDlgItem(hwndDlg, IDC_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
} }
break;
@@ -2164,10 +2164,10 @@ LABEL_SHOWWINDOW: break;
case ID_COPYALL:
- SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) &sel);
SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & all);
SendMessage(pNmhdr->hwndFrom, WM_COPY, 0, 0);
- SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) & sel);
+ SendMessage(pNmhdr->hwndFrom, EM_EXSETSEL, 0, (LPARAM) &sel);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0 );
break;
@@ -2226,7 +2226,7 @@ LABEL_SHOWWINDOW: TEXTRANGE tr;
CHARRANGE sel;
- SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(pNmhdr->hwndFrom, EM_EXGETSEL, 0, (LPARAM) &sel);
if (sel.cpMin != sel.cpMax)
break;
tr.chrg = ((ENLINK *) lParam)->chrg;
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index c916ca565a..91caba9bde 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -87,6 +87,8 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, in BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, DWORD dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
+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, ...);
const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2);
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index a89d70cc3e..f39318bc32 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -397,12 +397,12 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) case GC_EVENT_TOPIC:
if (si = ci.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
if (gce->ptszText) {
- replaceStrT(si->ptszTopic, gce->ptszText);
- db_set_ts(si->hContact, si->pszModule, "Topic", RemoveFormatting(si->ptszTopic));
+ replaceStrT(si->ptszTopic, RemoveFormatting(gce->ptszText));
+ db_set_ts(si->hContact, si->pszModule, "Topic", si->ptszTopic);
if (ci.OnSetTopic)
ci.OnSetTopic(si);
if (db_get_b(NULL, "Chat", "TopicOnClist", 0))
- db_set_ts(si->hContact, "CList", "StatusMsg", RemoveFormatting(si->ptszTopic));
+ db_set_ts(si->hContact, "CList", "StatusMsg", si->ptszTopic);
}
}
break;
diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index f8b30bcc68..07dace2d3b 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -24,21 +24,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType)
{
- HANDLE hContact = ci.FindRoom(pszModule, pszRoom);
- DBVARIANT dbv;
- TCHAR pszGroup[50];
-
- *pszGroup = '\0';
- if (!db_get_ts(NULL, "Chat", "AddToGroup", &dbv)) {
- if (lstrlen(dbv.ptszVal) > 0)
- lstrcpyn(pszGroup, dbv.ptszVal, 50);
- db_free(&dbv);
+ TCHAR pszGroup[50]; *pszGroup = '\0';
+ ptrT groupName(db_get_tsa(NULL, "Chat", "AddToGroup"));
+ if (groupName)
+ _tcsncpy_s(pszGroup, SIZEOF(pszGroup), groupName, _TRUNCATE);
+ else
+ _tcscpy(pszGroup, _T("Chat rooms"));
+
+ if (pszGroup[0]) {
+ HANDLE hGroup = Clist_GroupExists(pszGroup);
+ if (hGroup == 0) {
+ hGroup = Clist_CreateGroup(0, pszGroup);
+ if (hGroup) {
+ CallService(MS_CLUI_GROUPADDED, (WPARAM)hGroup, 0);
+ CallService(MS_CLIST_GROUPSETEXPANDED, (WPARAM)hGroup, 1);
+ }
+ }
}
- else lstrcpyn(pszGroup, _T("Chat rooms"), 50);
-
- if (pszGroup[0])
- Clist_CreateGroup(0, pszGroup);
+ HANDLE hContact = ci.FindRoom(pszModule, pszRoom);
if (hContact) { //contact exist, make sure it is in the right group
if (pszGroup[0]) {
ptrT grpName(db_get_tsa(hContact, "CList", "Group"));
@@ -109,28 +113,25 @@ int RoomDoubleclicked(WPARAM wParam, LPARAM lParam) if (db_get_b(hContact, szProto, "ChatRoom", 0) == 0)
return 0;
- DBVARIANT dbv;
- if (!db_get_ts(hContact, szProto, "ChatRoomID", &dbv)) {
- SESSION_INFO *si = ci.SM_FindSession(dbv.ptszVal, szProto);
- if (si) {
- // is the "toggle visibility option set, so we need to close the window?
- if (si->hWnd != NULL
- && db_get_b(NULL, "Chat", "ToggleVisibility", 0) == 1
- && !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)
- && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd))
- {
- if (ci.OnSessionDblClick)
- ci.OnSessionDblClick(si);
- db_free(&dbv);
- return 1;
- }
- ci.ShowRoom(si, WINDOW_VISIBLE, TRUE);
+ ptrT roomid(db_get_tsa(hContact, szProto, "ChatRoomID"));
+ if (roomid == NULL)
+ return 0;
+
+ SESSION_INFO *si = ci.SM_FindSession(roomid, szProto);
+ if (si) {
+ // is the "toggle visibility option set, so we need to close the window?
+ if (si->hWnd != NULL &&
+ db_get_b(NULL, "Chat", "ToggleVisibility", 0) == 1 &&
+ !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0) &&
+ IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd))
+ {
+ if (ci.OnSessionDblClick)
+ ci.OnSessionDblClick(si);
+ return 1;
}
- db_free(&dbv);
- return 1;
+ ci.ShowRoom(si, WINDOW_VISIBLE, TRUE);
}
-
- return 0;
+ return 1;
}
INT_PTR EventDoubleclicked(WPARAM wParam,LPARAM lParam)
@@ -238,14 +239,9 @@ HANDLE FindRoom(const char *pszModule, const TCHAR *pszRoom) if (!db_get_b(hContact, pszModule, "ChatRoom", 0))
continue;
- DBVARIANT dbv;
- if (!db_get_ts(hContact, pszModule, "ChatRoomID", &dbv)) {
- if (!lstrcmpi(dbv.ptszVal, pszRoom)) {
- db_free(&dbv);
- return hContact;
- }
- db_free(&dbv);
- }
+ ptrT roomid(db_get_tsa(hContact, pszModule, "ChatRoomID"));
+ if (roomid != NULL && !lstrcmpi(roomid, pszRoom))
+ return hContact;
}
return 0;
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index 488b038a7d..7dd26e8713 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -70,6 +70,9 @@ static SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char *pszModule) node->ptszID = mir_tstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
+ if (ci.OnCreateSession)
+ ci.OnCreateSession(node, ci.MM_FindModule(pszModule));
+
if (ci.wndList == NULL) { // list is empty
ci.wndList = node;
node->next = NULL;
@@ -292,6 +295,7 @@ static BOOL SM_AddEvent(const TCHAR *pszID, const char *pszModule, GCEVENT *gce, if (ci.pSettings->iEventLimit > 0 && pTemp->iEventCount > ci.pSettings->iEventLimit + 20) {
ci.LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - ci.pSettings->iEventLimit);
+ pTemp->bTrimmed = true;
pTemp->iEventCount = ci.pSettings->iEventLimit;
return FALSE;
}
@@ -652,6 +656,8 @@ static BOOL SM_ChangeNick(const TCHAR *pszID, const char *pszModule, GCEVENT *gc SM_MoveUser(pTemp->ptszID, pTemp->pszModule, ui->pszUID);
if (pTemp->hWnd)
SendMessage(pTemp->hWnd, GC_UPDATENICKLIST, 0, 0);
+ if (ci.OnChangeNick)
+ ci.OnChangeNick(pTemp);
}
if (pszID)
@@ -1455,7 +1461,10 @@ CHAT_MANAGER ci = FindRoom,
Log_CreateRTF,
LoadMsgDlgFont,
- MakeTimeStamp
+ MakeTimeStamp,
+ DoPopup,
+ ShowPopup,
+ RemoveFormatting
};
INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam)
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index 665bd61ecb..c34c1064bb 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -116,7 +116,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA return DefWindowProc(hWnd, message, wParam, lParam);
}
-static int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
+int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
{
static TCHAR szBuf[4 * 1024];
@@ -214,7 +214,7 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) return TRUE;
}
-static BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
+BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
{
int iEvent = gce->pDest->iType;
|