summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h3
-rw-r--r--plugins/Scriver/src/chat/main.cpp20
-rw-r--r--plugins/Scriver/src/chat/window.cpp12
-rw-r--r--plugins/Scriver/src/msgwindow.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp20
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp23
-rw-r--r--src/mir_app/src/chat_clist.cpp9
-rw-r--r--src/mir_app/src/chat_manager.cpp30
-rw-r--r--src/mir_app/src/chat_svc.cpp4
9 files changed, 26 insertions, 97 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index d1f83b3a15..b5155ed375 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -385,16 +385,13 @@ struct CHAT_MANAGER
void (*OnCreateModule)(MODULEINFO*);
void (*OnCreateSession)(SESSION_INFO*, MODULEINFO*);
- void (*OnDblClickSession)(SESSION_INFO*);
void (*OnOfflineSession)(SESSION_INFO*);
- void (*OnRemoveSession)(SESSION_INFO*);
void (*OnReplaceSession)(SESSION_INFO*);
void (*ShowRoom)(SESSION_INFO*, WPARAM wp, BOOL bSetForeground);
void (*OnGetLogName)(SESSION_INFO*, const wchar_t*);
void (*OnEventBroadcast)(SESSION_INFO *si, GCEVENT *gce);
- void (*OnSetStatusBar)(SESSION_INFO*);
void (*OnSetTopic)(SESSION_INFO*);
void (*OnAddUser)(SESSION_INFO*, USERINFO*);
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp
index 53e25f6e28..41cf8b408b 100644
--- a/plugins/Scriver/src/chat/main.cpp
+++ b/plugins/Scriver/src/chat/main.cpp
@@ -45,29 +45,12 @@ void LoadModuleIcons(MODULEINFO *mi)
ImageList_Destroy(hList);
}
-static void OnDblClickSession(SESSION_INFO *si)
-{
- PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
-}
-
-static void OnRemoveSession(SESSION_INFO *si)
-{
- if (si->hWnd)
- SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
-}
-
static void OnReplaceSession(SESSION_INFO *si)
{
if (si->hWnd)
RedrawWindow(GetDlgItem(si->hWnd, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
}
-static void OnSetStatusBar(SESSION_INFO *si)
-{
- if (si->hWnd)
- SendMessage(si->hWnd, DM_UPDATETITLEBAR, 0, 0);
-}
-
static void OnNewUser(SESSION_INFO *si, USERINFO*)
{
if (si->hWnd)
@@ -142,11 +125,8 @@ int Chat_Load()
pci->OnSetStatus = OnSetStatus;
- pci->OnRemoveSession = OnRemoveSession;
pci->OnReplaceSession = OnReplaceSession;
- pci->OnDblClickSession = OnDblClickSession;
- pci->OnSetStatusBar = OnSetStatusBar;
pci->OnFlashWindow = OnFlashWindow;
pci->OnFlashHighlight = OnFlashHighlight;
pci->ShowRoom = ShowRoom;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index f65ec5a5f5..18734f4d68 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -978,7 +978,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, TRUE, 0);
SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM)hwndDlg, psi->hContact);
@@ -991,7 +991,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
// LoadGlobalSettings();
InitButtons(hwndDlg, si);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
@@ -1061,7 +1061,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
break;
- case DM_UPDATESTATUSBAR:
+ case GC_UPDATESTATUSBAR:
{
MODULEINFO *mi = pci->MM_FindModule(si->pszModule);
hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
@@ -1297,12 +1297,12 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
case GC_CONTROL_MSG:
switch (wParam) {
case SESSION_OFFLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
return TRUE;
case SESSION_ONLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
return TRUE;
case WINDOW_HIDDEN:
@@ -1340,7 +1340,7 @@ LABEL_SHOWWINDOW:
SendMessage(hwndDlg, WM_SIZE, 0, 0);
SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
ShowWindow(hwndDlg, SW_SHOW);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
SetForegroundWindow(hwndDlg);
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp
index 4f5749f1f3..eea70544f1 100644
--- a/plugins/Scriver/src/msgwindow.cpp
+++ b/plugins/Scriver/src/msgwindow.cpp
@@ -252,7 +252,7 @@ static void ActivateChild(ParentWindowData *dat, HWND child)
HWND prev = dat->hwndActive;
dat->hwndActive = child;
SetupStatusBar(dat);
- SendMessage(dat->hwndActive, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(dat->hwndActive, GC_UPDATESTATUSBAR, 0, 0);
SendMessage(dat->hwndActive, DM_UPDATETITLEBAR, 0, 0);
SendMessage(dat->hwnd, WM_SIZE, 0, 0);
ShowWindow(dat->hwndActive, SW_SHOWNOACTIVATE);
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index aa152ef95b..52821f0123 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -45,17 +45,6 @@ static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi)
}
}
-static void OnDblClickSession(SESSION_INFO *si)
-{
- PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
-}
-
-static void OnRemoveSession(SESSION_INFO *si)
-{
- if (si->hWnd)
- SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
-}
-
static void OnReplaceSession(SESSION_INFO *si)
{
if (si->hContact)
@@ -70,12 +59,6 @@ static void OnSetTopic(SESSION_INFO *si)
SendMessage(si->hWnd, DM_INVALIDATEPANEL, 0, 0);
}
-static void OnSetStatusBar(SESSION_INFO *si)
-{
- if (si->hWnd)
- SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
-}
-
static void OnNewUser(SESSION_INFO *si, USERINFO*)
{
if (si->hWnd) {
@@ -246,11 +229,8 @@ int Chat_Load()
pci->OnSetTopic = OnSetTopic;
pci->OnCreateSession = OnCreateSession;
- pci->OnRemoveSession = OnRemoveSession;
pci->OnReplaceSession = OnReplaceSession;
- pci->OnDblClickSession = OnDblClickSession;
- pci->OnSetStatusBar = OnSetStatusBar;
pci->OnChangeNick = OnChangeNick;
pci->ShowRoom = ShowRoom;
pci->OnLoadSettings = OnLoadSettings;
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index b1f45c943e..0f30acdbc1 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -93,32 +93,12 @@ static void OnCreateModule(MODULEINFO *mi)
ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
}
-static void OnDblClickSession(SESSION_INFO *si)
-{
- if (g_Settings.bTabsEnable)
- SendMessage(GetParent(GetParent(si->hWnd)), GC_REMOVETAB, 0, (LPARAM)si->pDlg);
- else
- PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
-}
-
-static void OnRemoveSession(SESSION_INFO *si)
-{
- if (si->hWnd)
- SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
-}
-
static void OnReplaceSession(SESSION_INFO *si)
{
if (si->hWnd)
RedrawWindow(GetDlgItem(si->hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE);
}
-static void OnSetStatusBar(SESSION_INFO *si)
-{
- if (si->hWnd)
- SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
-}
-
static void OnNewUser(SESSION_INFO *si, USERINFO*)
{
if (si->hWnd)
@@ -230,12 +210,9 @@ void Load_ChatModule()
pci->OnNewUser = OnNewUser;
pci->OnCreateModule = OnCreateModule;
- pci->OnRemoveSession = OnRemoveSession;
pci->OnReplaceSession = OnReplaceSession;
- pci->OnDblClickSession = OnDblClickSession;
pci->OnLoadSettings = OnLoadSettings;
- pci->OnSetStatusBar = OnSetStatusBar;
pci->OnFlashWindow = OnFlashWindow;
pci->OnFlashHighlight = OnFlashHighlight;
pci->ShowRoom = ShowRoom;
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index c2aec1fb3e..27268d8a8d 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -117,13 +117,8 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM)
SESSION_INFO *si = 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_MODULE, "ToggleVisibility", 0) == 1 &&
- !cli.pfnGetEvent(hContact, 0) &&
- IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd))
- {
- if (chatApi.OnDblClickSession)
- chatApi.OnDblClickSession(si);
+ if (si->hWnd != NULL && db_get_b(NULL, CHAT_MODULE, "ToggleVisibility", 0) == 1 && !cli.pfnGetEvent(hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) {
+ PostMessage(si->hWnd, GC_CLOSEWINDOW, 0, 0);
return 1;
}
chatApi.ShowRoom(si, WINDOW_VISIBLE, TRUE);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 3c0bc47c8a..7ea1f9bdd1 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -99,37 +99,37 @@ int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL removeCon
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = chatApi.wndList, *pLast = NULL;
- while (pTemp != NULL) {
+ SESSION_INFO *si = chatApi.wndList, *pLast = NULL;
+ while (si != NULL) {
// match
- if ((!pszID && pTemp->iType != GCW_SERVER || !mir_wstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
- if (chatApi.OnRemoveSession)
- chatApi.OnRemoveSession(pTemp);
- DoEventHook(pTemp->ptszID, pTemp->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)pTemp->pItemData);
+ if ((!pszID && si->iType != GCW_SERVER || !mir_wstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
+ if (si->hWnd)
+ SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
+ DoEventHook(si->ptszID, si->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)si->pItemData);
if (pLast == NULL)
- chatApi.wndList = pTemp->next;
+ chatApi.wndList = si->next;
else
- pLast->next = pTemp->next;
+ pLast->next = si->next;
// contact may have been deleted here already, since function may be called after deleting
// contact so the handle may be invalid, therefore db_get_b shall return 0
- if (pTemp->hContact && removeContact)
- db_delete_contact(pTemp->hContact);
+ if (si->hContact && removeContact)
+ db_delete_contact(si->hContact);
- SM_FreeSession(pTemp);
+ SM_FreeSession(si);
if (pszID)
return 1;
if (pLast)
- pTemp = pLast->next;
+ si = pLast->next;
else
- pTemp = chatApi.wndList;
+ si = chatApi.wndList;
}
else {
- pLast = pTemp;
- pTemp = pTemp->next;
+ pLast = si;
+ si = si->next;
}
}
return FALSE;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index a7fbb86c97..edd6dab94e 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -674,8 +674,8 @@ MIR_APP_DLL(int) Chat_SetStatusbarText(const char *szModule, const wchar_t *wszI
else
db_set_s(si->hContact, si->pszModule, "StatusBar", "");
- if (chatApi.OnSetStatusBar)
- chatApi.OnSetStatusBar(si);
+ if (si->hWnd)
+ SendMessage(si->hWnd, GC_UPDATESTATUSBAR, 0, 0);
}
return 0;
}