summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h4
-rw-r--r--plugins/Scriver/src/chat.h4
-rw-r--r--plugins/Scriver/src/chat_main.cpp15
-rw-r--r--plugins/TabSRMM/src/chat_main.cpp4
-rw-r--r--src/core/stdmsg/src/chat_manager.cpp19
-rw-r--r--src/core/stdmsg/src/chat_window.cpp2
-rw-r--r--src/core/stdmsg/src/stdafx.h3
-rw-r--r--src/mir_app/src/chat_manager.cpp14
-rw-r--r--src/mir_app/src/chat_svc.cpp3
9 files changed, 29 insertions, 39 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 13acfeb308..4871a636bd 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -94,10 +94,6 @@ struct GCModuleInfoBase
bool bFontSize;
int nColorCount;
COLORREF* crColors;
- HICON hOnlineIcon;
- HICON hOfflineIcon;
- HICON hOnlineTalkIcon;
- HICON hOfflineTalkIcon;
int iMaxText;
MODULEINFO* next;
};
diff --git a/plugins/Scriver/src/chat.h b/plugins/Scriver/src/chat.h
index f4bee7dcfb..384bfd2ab3 100644
--- a/plugins/Scriver/src/chat.h
+++ b/plugins/Scriver/src/chat.h
@@ -47,8 +47,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct MODULEINFO : public GCModuleInfoBase
{
- HICON hOnlineIconBig;
- HICON hOfflineIconBig;
+ HICON hOnlineIcon, hOnlineTalkIcon, hOnlineIconBig;
+ HICON hOfflineIcon, hOfflineTalkIcon, hOfflineIconBig;
};
struct LOGSTREAMDATA : public GCLogStreamDataBase
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp
index 5c7e1183f7..2c845d7a0a 100644
--- a/plugins/Scriver/src/chat_main.cpp
+++ b/plugins/Scriver/src/chat_main.cpp
@@ -37,11 +37,19 @@ void LoadModuleIcons(MODULEINFO *mi)
ImageList_SetOverlayImage(hList, overlayIcon, 1);
int index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
+
+ if (mi->hOnlineIcon) DestroyIcon(mi->hOnlineIcon);
mi->hOnlineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
+
+ if (mi->hOnlineTalkIcon) DestroyIcon(mi->hOnlineTalkIcon);
mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+
+ if (mi->hOfflineIcon) DestroyIcon(mi->hOfflineIcon);
mi->hOfflineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
+
+ if (mi->hOfflineTalkIcon) DestroyIcon(mi->hOfflineTalkIcon);
mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
ImageList_Destroy(hList);
@@ -53,12 +61,6 @@ static void OnReplaceSession(SESSION_INFO *si)
RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), nullptr, nullptr, RDW_INVALIDATE);
}
-static void OnNewUser(SESSION_INFO *si, USERINFO*)
-{
- if (si->pDlg)
- si->pDlg->UpdateNickList();
-}
-
static void OnSetStatus(SESSION_INFO *si, int)
{
if (si->pDlg)
@@ -135,7 +137,6 @@ int Chat_Load()
pci = Chat_GetInterface(&data);
pci->OnCreateModule = OnCreateModule;
- pci->OnNewUser = OnNewUser;
pci->OnLoadSettings = OnLoadSettings;
pci->OnSetStatus = OnSetStatus;
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp
index d461209b05..c7131cc174 100644
--- a/plugins/TabSRMM/src/chat_main.cpp
+++ b/plugins/TabSRMM/src/chat_main.cpp
@@ -61,10 +61,8 @@ static void OnSetTopic(SESSION_INFO *si)
static void OnNewUser(SESSION_INFO *si, USERINFO*)
{
- if (si->pDlg) {
- si->pDlg->UpdateNickList();
+ if (si->pDlg)
si->pDlg->GetMyNick();
- }
}
static void OnChangeNick(SESSION_INFO *si)
diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp
index c1a2a3488c..fe7a0c3db7 100644
--- a/src/core/stdmsg/src/chat_manager.cpp
+++ b/src/core/stdmsg/src/chat_manager.cpp
@@ -69,13 +69,21 @@ GlobalLogSettings g_Settings;
static void OnCreateModule(MODULEINFO *mi)
{
mi->OnlineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
+ mi->OfflineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+
+ if (mi->hOnlineIcon) DestroyIcon(mi->hOnlineIcon);
mi->hOnlineIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT);
+
+ if (mi->hOnlineTalkIcon) DestroyIcon(mi->hOnlineTalkIcon);
mi->hOnlineTalkIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(hIconsList, mi->hOnlineTalkIcon);
- mi->OfflineIconIndex = ImageList_AddIcon(hIconsList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+ if (mi->hOfflineIcon) DestroyIcon(mi->hOfflineIcon);
mi->hOfflineIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT);
+
+ if (mi->hOfflineTalkIcon) DestroyIcon(mi->hOfflineTalkIcon);
mi->hOfflineTalkIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+
+ ImageList_AddIcon(hIconsList, mi->hOnlineTalkIcon);
ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
}
@@ -85,12 +93,6 @@ static void OnReplaceSession(SESSION_INFO *si)
RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), nullptr, nullptr, RDW_INVALIDATE);
}
-static void OnNewUser(SESSION_INFO *si, USERINFO*)
-{
- if (si->pDlg)
- si->pDlg->UpdateNickList();
-}
-
static void OnFlashHighlight(SESSION_INFO *si, int bInactive)
{
if (!bInactive)
@@ -241,7 +243,6 @@ void Load_ChatModule()
CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Chat module"), FONTMODE_SKIP };
pci = Chat_GetInterface(&data);
- pci->OnNewUser = OnNewUser;
pci->OnCreateModule = OnCreateModule;
pci->OnReplaceSession = OnReplaceSession;
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index ea68c9c571..bc644da732 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -283,7 +283,7 @@ void CChatRoomDlg::UpdateOptions()
if (m_si->iType == GCW_CHATROOM)
EnableWindow(m_btnChannelMgr.GetHwnd(), mi->bChanMgr);
- HICON hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
+ HICON hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
if (!hIcon) {
pci->MM_IconsChanged();
hIcon = (m_si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h
index bb849b85d6..53cfdb2a66 100644
--- a/src/core/stdmsg/src/stdafx.h
+++ b/src/core/stdmsg/src/stdafx.h
@@ -88,6 +88,9 @@ extern CREOleCallback reOleCallback;
struct MODULEINFO : public GCModuleInfoBase
{
+ HICON hOnlineIcon, hOnlineTalkIcon;
+ HICON hOfflineIcon, hOfflineTalkIcon;
+
int OnlineIconIndex;
int OfflineIconIndex;
};
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 7fa0e4c000..6909f66690 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -544,15 +544,9 @@ static void MM_IconsChanged()
{
LoadChatIcons();
- for (MODULEINFO *mi = m_ModList; mi != nullptr; mi = mi->next) {
- Safe_DestroyIcon(mi->hOnlineIcon);
- Safe_DestroyIcon(mi->hOfflineIcon);
- Safe_DestroyIcon(mi->hOnlineTalkIcon);
- Safe_DestroyIcon(mi->hOfflineTalkIcon);
-
+ for (MODULEINFO *mi = m_ModList; mi != nullptr; mi = mi->next)
if (chatApi.OnCreateModule) // recreate icons
chatApi.OnCreateModule(mi);
- }
}
static void MM_FontsChanged()
@@ -588,12 +582,6 @@ static BOOL MM_RemoveAll(void)
mir_free(m_ModList->ptszModDispName);
mir_free(m_ModList->pszHeader);
mir_free(m_ModList->crColors);
-
- Safe_DestroyIcon(m_ModList->hOnlineIcon);
- Safe_DestroyIcon(m_ModList->hOfflineIcon);
- Safe_DestroyIcon(m_ModList->hOnlineTalkIcon);
- Safe_DestroyIcon(m_ModList->hOfflineTalkIcon);
-
mir_free(m_ModList);
m_ModList = pLast;
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 002742a66c..990eeb5169 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -392,6 +392,9 @@ static void AddUser(GCEVENT *gce)
ui->Status = status;
ui->Status |= si->pStatuses->Status;
+ if (si->pDlg)
+ si->pDlg->UpdateNickList();
+
if (chatApi.OnNewUser)
chatApi.OnNewUser(si, ui);
}