diff options
-rw-r--r-- | include/m_chat_int.h | 31 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/chat.h | 1 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/log.cpp | 8 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/main.cpp | 26 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/services.cpp | 23 | ||||
-rw-r--r-- | plugins/Scriver/src/chat/tools.cpp | 20 | ||||
-rw-r--r-- | src/core/stdchat/src/chat.h | 9 | ||||
-rw-r--r-- | src/core/stdchat/src/log.cpp | 8 | ||||
-rw-r--r-- | src/core/stdchat/src/main.cpp | 26 | ||||
-rw-r--r-- | src/core/stdchat/src/window.cpp | 8 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 12 | ||||
-rw-r--r-- | src/modules/chat/manager.cpp | 78 |
12 files changed, 110 insertions, 140 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index c96a8a4a03..46c62a3917 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -121,8 +121,6 @@ struct GCModuleInfoBase HICON hOfflineIcon;
HICON hOnlineTalkIcon;
HICON hOfflineTalkIcon;
- int OnlineIconIndex;
- int OfflineIconIndex;
int iMaxText;
MODULEINFO* next;
};
@@ -366,14 +364,26 @@ struct CHAT_MANAGER void (*LoadMsgDlgFont)(int i, LOGFONT *lf, COLORREF *color);
TCHAR* (*MakeTimeStamp)(TCHAR *pszStamp, time_t time);
+ int logPixelSY, logPixelSX;
+ char *szActiveWndModule;
+ TCHAR *szActiveWndID;
+ HICON hIcons[30];
+ HBRUSH hListBkgBrush, hListSelectedBkgBrush;
+ HANDLE hBuildMenuEvent, hSendEvent;
+ FONTINFO aFonts[OPTIONS_FONTCOUNT];
+ SESSION_INFO *wndList;
+
+ // user-defined custom callbacks
+ void (*OnCreateModule)(MODULEINFO*);
+
void (*OnSessionDblClick)(SESSION_INFO*);
void (*OnSessionOffline)(SESSION_INFO*);
void (*OnSessionRemove)(SESSION_INFO*);
void (*OnSessionRename)(SESSION_INFO*);
void (*OnSessionReplace)(SESSION_INFO*);
- void(*ShowRoom)(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
- void(*OnAddLog)(SESSION_INFO*, int);
+ void (*ShowRoom)(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
+ void (*OnAddLog)(SESSION_INFO*, int);
void (*OnClearLog)(SESSION_INFO*);
void (*OnEventBroadcast)(SESSION_INFO *si, GCEVENT *gce);
@@ -392,18 +402,7 @@ struct CHAT_MANAGER // data
GlobalLogSettingsBase *pSettings;
-
- HIMAGELIST hImageList, hIconsList;
- HANDLE hBuildMenuEvent, hSendEvent;
- HBRUSH hListBkgBrush, hListSelectedBkgBrush;
- HICON hIcons[30];
- FONTINFO aFonts[OPTIONS_FONTCOUNT];
- TCHAR *szActiveWndID;
- char *szActiveWndModule;
- int logPixelSY, logPixelSX;
- int cbModuleInfo, cbSession;
-
- SESSION_INFO *wndList;
+ int cbModuleInfo, cbSession;
};
extern CHAT_MANAGER ci, *pci;
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index 82b52be14b..a14407e314 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -93,7 +93,6 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRed void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
TCHAR* GetChatLogsFilename (HANDLE hContact, time_t tTime);
-TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time);
char* Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO *si);
//window.c
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index 31ec53b3db..613669777d 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -24,14 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef EM_GETSCROLLPOS
#define EM_GETSCROLLPOS (WM_USER+221)
#endif
-TCHAR* MakeTimeStamp( TCHAR* pszStamp, time_t time)
-{
- static TCHAR szTime[30];
- if ( !_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
- _tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
- return szTime;
-}
-
static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 6c26bc6fd4..5a2cb0854c 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -29,6 +29,24 @@ HMENU g_hMenu = NULL; GlobalLogSettings g_Settings;
+void LoadModuleIcons(MODULEINFO *mi)
+{
+ HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
+
+ int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay"));
+ ImageList_SetOverlayImage(hList, overlayIcon, 1);
+
+ int index = ImageList_AddIcon(hList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
+ mi->hOnlineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
+ mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+
+ index = ImageList_AddIcon(hList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+ mi->hOfflineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
+ mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+
+ ImageList_Destroy(hList);
+}
+
static void OnAddLog(SESSION_INFO *si, int isOk)
{
if (isOk && si->hWnd)
@@ -93,11 +111,19 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive) SendMessage(si->hWnd, GC_SETMESSAGEHIGHLIGHT, 0, 0);
}
+static void OnCreateModule(MODULEINFO *mi)
+{
+ LoadModuleIcons(mi);
+ mi->hOnlineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_ONLINE);
+ mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE);
+}
+
int Chat_Load()
{
mir_getCI(&g_Settings);
pci->cbModuleInfo = sizeof(MODULEINFO);
pci->cbSession = sizeof(SESSION_INFO);
+ pci->OnCreateModule = OnCreateModule;
pci->OnNewUser = OnNewUser;
pci->OnSetStatus = OnSetStatus;
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp index 5910841a66..9945563c48 100644 --- a/plugins/Scriver/src/chat/services.cpp +++ b/plugins/Scriver/src/chat/services.cpp @@ -23,13 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
{
- HWND hParent = NULL;
if (!si)
return;
//Do we need to create a window?
if (si->hWnd == NULL) {
- hParent = GetParentWindow(si->windowData.hContact, TRUE);
+ HWND hParent = GetParentWindow(si->windowData.hContact, TRUE);
si->hWnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_CHANNEL), hParent, RoomWndProc, (LPARAM)si);
}
SendMessage(si->hWnd, DM_UPDATETABCONTROL, -1, (LPARAM)si);
@@ -38,23 +37,3 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground) SendMessage(si->hWnd, WM_MOUSEACTIVATE, 0, 0);
SetFocus(GetDlgItem(si->hWnd, IDC_CHAT_MESSAGE));
}
-
-void LoadModuleIcons(MODULEINFO *mi)
-{
- HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
-
- int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay"));
- ImageList_SetOverlayImage(hList, overlayIcon, 1);
-
- mi->hOnlineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_ONLINE);
- mi->hOnlineIcon = LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_ONLINE);
- int index = ImageList_AddIcon(hList, mi->hOnlineIcon);
- mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
-
- mi->hOfflineIconBig = LoadSkinnedProtoIconBig(mi->pszModule, ID_STATUS_OFFLINE);
- mi->hOfflineIcon = LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_OFFLINE);
- index = ImageList_AddIcon(hList, mi->hOfflineIcon);
- mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
-
- ImageList_Destroy(hList);
-}
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 0745ad83c6..e5b2cfc617 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -164,34 +164,34 @@ TCHAR* GetChatLogsFilename(HANDLE hContact, time_t tTime) // day 1-31
rva[0].lptzKey = _T("d");
- rva[0].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%#d"), tTime));
+ rva[0].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%#d"), tTime));
// day 01-31
rva[1].lptzKey = _T("dd");
- rva[1].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%d"), tTime));
+ rva[1].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%d"), tTime));
// month 1-12
rva[2].lptzKey = _T("m");
- rva[2].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%#m"), tTime));
+ rva[2].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%#m"), tTime));
// month 01-12
rva[3].lptzKey = _T("mm");
- rva[3].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%m"), tTime));
+ rva[3].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%m"), tTime));
// month text short
rva[4].lptzKey = _T("mon");
- rva[4].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%b"), tTime));
+ rva[4].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%b"), tTime));
// month text
rva[5].lptzKey = _T("month");
- rva[5].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%B"), tTime));
+ rva[5].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%B"), tTime));
// year 01-99
rva[6].lptzKey = _T("yy");
- rva[6].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%y"), tTime));
+ rva[6].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%y"), tTime));
// year 1901-9999
rva[7].lptzKey = _T("yyyy");
- rva[7].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%Y"), tTime));
+ rva[7].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%Y"), tTime));
// weekday short
rva[8].lptzKey = _T("wday");
- rva[8].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%a"), tTime));
+ rva[8].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%a"), tTime));
// weekday
rva[9].lptzKey = _T("weekday");
- rva[9].lptzValue = mir_tstrdup(MakeTimeStamp(_T("%A"), tTime));
+ rva[9].lptzValue = mir_tstrdup(pci->MakeTimeStamp(_T("%A"), tTime));
// end of array
rva[10].lptzKey = NULL;
rva[10].lptzValue = NULL;
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 9f7e9cba7a..c8433da7ef 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -79,7 +79,12 @@ struct TABLIST TABLIST *next;
};
-struct MODULEINFO : public GCModuleInfoBase {};
+struct MODULEINFO : public GCModuleInfoBase
+{
+ int OnlineIconIndex;
+ int OfflineIconIndex;
+};
+
struct SESSION_INFO : public GCSessionInfoBase {};
struct LOGSTREAMDATA : public GCLogStreamDataBase {};
@@ -95,6 +100,7 @@ extern GlobalLogSettings g_Settings; extern SESSION_INFO g_TabSession;
extern TABLIST *g_TabList;
extern HMENU g_hMenu;
+extern HIMAGELIST hIconsList;
extern HINSTANCE g_hInst;
extern BOOL SmileyAddInstalled, PopupInstalled;
@@ -145,7 +151,6 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L // log.c
void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo);
void ValidateFilename (TCHAR * filename);
-TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time);
char* Log_CreateRtfHeader(MODULEINFO * mi);
// window.c
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 1942fe9a3f..10b6f8097e 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -23,14 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // The code for streaming the text is to a large extent copied from
// the srmm module and then modified to fit the chat module.
-TCHAR* MakeTimeStamp( TCHAR* pszStamp, time_t time)
-{
- static TCHAR szTime[30];
- if ( !_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
- _tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
- return szTime;
-}
-
static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
{
LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA *) dwCookie;
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index eb345b53ab..18e16c34cd 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -31,6 +31,7 @@ HINSTANCE g_hInst; int hLangpack;
BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE;
+HIMAGELIST hIconsList;
GlobalLogSettings g_Settings;
@@ -69,9 +70,23 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CHAT, M int OnShutdown(WPARAM, LPARAM)
{
TabM_RemoveAll();
+ ImageList_Destroy(hIconsList);
return 0;
}
+static void OnCreateModule(MODULEINFO *mi)
+{
+ mi->OnlineIconIndex = ImageList_AddIcon(hIconsList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
+ mi->hOnlineIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT);
+ mi->hOnlineTalkIcon = ImageList_GetIcon(hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+ ImageList_AddIcon(hIconsList, mi->hOnlineTalkIcon);
+
+ mi->OfflineIconIndex = ImageList_AddIcon(hIconsList, LoadSkinnedProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+ mi->hOfflineIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT);
+ mi->hOfflineTalkIcon = ImageList_GetIcon(hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+ ImageList_AddIcon(hIconsList, mi->hOfflineTalkIcon);
+}
+
static void OnAddLog(SESSION_INFO *si, int isOk)
{
if (isOk && si->hWnd) {
@@ -327,13 +342,10 @@ void LoadIcons(void) LoadLogIcons();
- pci->hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 3);
- pci->hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
- ImageList_AddIcon(pci->hIconsList, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- ImageList_AddIcon(pci->hIconsList, LoadIconEx("overlay", FALSE));
- ImageList_SetOverlayImage(pci->hIconsList, 1, 1);
- ImageList_AddIcon(pci->hImageList, (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0));
- ImageList_AddIcon(pci->hImageList, (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0));
+ hIconsList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 100);
+ ImageList_AddIcon(hIconsList, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
+ ImageList_AddIcon(hIconsList, LoadIconEx("overlay", FALSE));
+ ImageList_SetOverlayImage(hIconsList, 1, 1);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index b0bdffc27a..181dfa24e2 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -872,9 +872,10 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR s = (SESSION_INFO*)tc.lParam;
if (s) {
BOOL bOnline = db_get_w(s->hContact, s->pszModule, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONLINE ? TRUE : FALSE;
+ MODULEINFO *mi = pci->MM_FindModule(s->pszModule);
bDragging = TRUE;
iBeginIndex = i;
- ImageList_BeginDrag(pci->hIconsList, bOnline ? (pci->MM_FindModule(s->pszModule))->OnlineIconIndex : (pci->MM_FindModule(s->pszModule))->OfflineIconIndex, 8, 8);
+ ImageList_BeginDrag(hIconsList, bOnline ? mi->OnlineIconIndex : mi->OfflineIconIndex, 8, 8);
ImageList_DragEnter(hwnd, tci.pt.x, tci.pt.y);
SetCapture(hwnd);
}
@@ -1150,13 +1151,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)* 0x7FFFFFFF, 0);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback);
- // RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_MESSAGE));
- // RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_LOG));
-
si->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP | SBT_TOOLTIPS, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL);
SendMessage(si->hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
TabCtrl_SetMinTabWidth(GetDlgItem(hwndDlg, IDC_TAB), 80);
- TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TAB), pci->hIconsList);
+ TabCtrl_SetImageList(GetDlgItem(hwndDlg, IDC_TAB), hIconsList);
// enable tooltips
si->iOldItemID = -1;
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 4e8f9b114f..a89d70cc3e 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -153,18 +153,6 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF)* gcr->nColors);
}
- mi->OnlineIconIndex = ImageList_AddIcon(ci.hIconsList, LoadSkinnedProtoIcon(gcr->pszModule, ID_STATUS_ONLINE));
- mi->hOnlineIcon = ImageList_GetIcon(ci.hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT);
-
- mi->hOnlineTalkIcon = ImageList_GetIcon(ci.hIconsList, mi->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(ci.hIconsList, mi->hOnlineTalkIcon);
-
- mi->OfflineIconIndex = ImageList_AddIcon(ci.hIconsList, LoadSkinnedProtoIcon(gcr->pszModule, ID_STATUS_OFFLINE));
- mi->hOfflineIcon = ImageList_GetIcon(ci.hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT);
-
- mi->hOfflineTalkIcon = ImageList_GetIcon(ci.hIconsList, mi->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_AddIcon(ci.hIconsList, mi->hOfflineTalkIcon);
-
mi->pszHeader = Log_CreateRtfHeader(mi);
CheckColorsInModule((char*)gcr->pszModule);
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index d2f50ba864..488b038a7d 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -385,7 +385,6 @@ static USERINFO* SM_GetUserFromIndex(const TCHAR *pszID, const char *pszModule, return NULL;
}
-
STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char *pszModule, const TCHAR *pszStatus)
{
if (!pszID || !pszModule)
@@ -847,55 +846,40 @@ static char* SM_GetUsers(SESSION_INFO *si) static MODULEINFO* MM_AddModule(const char *pszModule)
{
- if (!pszModule)
+ if (pszModule == NULL)
return NULL;
- if (!ci.MM_FindModule(pszModule)) {
- MODULEINFO *node = (MODULEINFO*)mir_alloc(sizeof(MODULEINFO));
- ZeroMemory(node, sizeof(MODULEINFO));
- node->pszModule = (char*)mir_alloc(lstrlenA(pszModule) + 1);
- lstrcpyA(node->pszModule, pszModule);
+ if (ci.MM_FindModule(pszModule))
+ return NULL;
- if (m_ModList == NULL) // list is empty
- {
- m_ModList = node;
- node->next = NULL;
- }
- else {
- node->next = m_ModList;
- m_ModList = node;
- }
- return node;
+ MODULEINFO *node = (MODULEINFO*)mir_calloc(ci.cbModuleInfo);
+ replaceStr(node->pszModule, pszModule);
+ if (ci.OnCreateModule)
+ ci.OnCreateModule(node);
+
+ if (m_ModList == NULL) { // list is empty
+ m_ModList = node;
+ node->next = NULL;
}
- return FALSE;
+ else {
+ node->next = m_ModList;
+ m_ModList = node;
+ }
+ return node;
}
static void MM_IconsChanged(void)
{
- ImageList_ReplaceIcon(ci.hIconsList, 0, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE));
- ImageList_ReplaceIcon(ci.hIconsList, 1, LoadIconEx("overlay", FALSE));
-
MODULEINFO *pTemp = m_ModList;
while (pTemp != NULL) {
- pTemp->OnlineIconIndex = ImageList_ReplaceIcon(ci.hIconsList, pTemp->OnlineIconIndex, LoadSkinnedProtoIcon(pTemp->pszModule, ID_STATUS_ONLINE));
- pTemp->OfflineIconIndex = ImageList_ReplaceIcon(ci.hIconsList, pTemp->OfflineIconIndex, LoadSkinnedProtoIcon(pTemp->pszModule, ID_STATUS_OFFLINE));
-
- if (pTemp->hOfflineIcon)
- DestroyIcon(pTemp->hOfflineIcon);
- if (pTemp->hOnlineIcon)
- DestroyIcon(pTemp->hOnlineIcon);
- if (pTemp->hOnlineTalkIcon)
- DestroyIcon(pTemp->hOnlineTalkIcon);
- if (pTemp->hOfflineTalkIcon)
- DestroyIcon(pTemp->hOfflineTalkIcon);
- pTemp->hOfflineIcon = ImageList_GetIcon(ci.hIconsList, pTemp->OfflineIconIndex, ILD_TRANSPARENT);
- pTemp->hOnlineIcon = ImageList_GetIcon(ci.hIconsList, pTemp->OnlineIconIndex, ILD_TRANSPARENT);
-
- pTemp->hOnlineTalkIcon = ImageList_GetIcon(ci.hIconsList, pTemp->OnlineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_ReplaceIcon(ci.hIconsList, pTemp->OnlineIconIndex + 1, pTemp->hOnlineTalkIcon);
-
- pTemp->hOfflineTalkIcon = ImageList_GetIcon(ci.hIconsList, pTemp->OfflineIconIndex, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
- ImageList_ReplaceIcon(ci.hIconsList, pTemp->OfflineIconIndex + 1, pTemp->hOfflineTalkIcon);
+ Safe_DestroyIcon(pTemp->hOnlineIcon);
+ Safe_DestroyIcon(pTemp->hOfflineIcon);
+ Safe_DestroyIcon(pTemp->hOnlineTalkIcon);
+ Safe_DestroyIcon(pTemp->hOfflineTalkIcon);
+
+ if (ci.OnCreateModule) // recreate icons
+ ci.OnCreateModule(pTemp);
+
pTemp = pTemp->next;
}
}
@@ -945,14 +929,10 @@ static BOOL MM_RemoveAll(void) mir_free(m_ModList->pszHeader);
mir_free(m_ModList->crColors);
- if (m_ModList->hOfflineIcon)
- DestroyIcon(m_ModList->hOfflineIcon);
- if (m_ModList->hOnlineIcon)
- DestroyIcon(m_ModList->hOnlineIcon);
- if (m_ModList->hOnlineTalkIcon)
- DestroyIcon(m_ModList->hOnlineTalkIcon);
- if (m_ModList->hOfflineTalkIcon)
- DestroyIcon(m_ModList->hOfflineTalkIcon);
+ 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;
@@ -1482,7 +1462,7 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam) {
LoadChatModule();
- memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnSessionDblClick), 0, sizeof(CHAT_MANAGER) - offsetof(CHAT_MANAGER, OnSessionDblClick));
+ memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER)-offsetof(CHAT_MANAGER, OnCreateModule));
ci.pSettings = (GlobalLogSettingsBase*)lParam;
OptionsInit();
return (INT_PTR)&ci;
|