diff options
24 files changed, 444 insertions, 662 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 550b4fcdaa..747c734067 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_chat.h>
-#define OPTIONS_FONTCOUNT 17
+#define OPTIONS_FONTCOUNT 20
#define STATUSICONCOUNT 6
#define GC_UPDATETITLE (WM_USER+100)
@@ -288,6 +288,13 @@ struct GlobalLogSettingsBase /////////////////////////////////////////////////////////////////////////////////////////
+struct CHAT_MANAGER_INITDATA
+{
+ GlobalLogSettingsBase *pSettings;
+ int cbModuleInfo, cbSession;
+ TCHAR *szFontGroup;
+};
+
struct CHAT_MANAGER
{
void (*SetActiveSession)(const TCHAR *pszID, const char *pszModule);
@@ -363,12 +370,20 @@ struct CHAT_MANAGER HANDLE (*FindRoom)(const char *pszModule, const TCHAR *pszRoom);
char* (*Log_CreateRTF)(LOGSTREAMDATA *streamData);
+ char* (*Log_CreateRtfHeader)(MODULEINFO *mi);
void (*LoadMsgDlgFont)(int i, LOGFONT *lf, COLORREF *color);
TCHAR* (*MakeTimeStamp)(TCHAR *pszStamp, time_t time);
+
+ BOOL (*DoEventHook)(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem);
+ BOOL (*DoEventHookAsync)(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, INT_PTR dwItem);
+
+ BOOL (*DoSoundsFlashPopupTrayStuff)(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
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, ...);
+ BOOL (*LogToFile)(SESSION_INFO *si, GCEVENT *gce);
+
TCHAR* (*RemoveFormatting)(const TCHAR *pszText);
- BOOL (*DoSoundsFlashPopupTrayStuff)(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
+ void (*ReloadSettings)(void);
int logPixelSY, logPixelSX;
char *szActiveWndModule;
@@ -407,17 +422,13 @@ struct CHAT_MANAGER void (*OnLoadSettings)(void);
void (*OnFlashWindow)(SESSION_INFO *si, int);
-
- // data
- GlobalLogSettingsBase *pSettings;
- int cbModuleInfo, cbSession;
};
extern CHAT_MANAGER ci, *pci;
-__forceinline void mir_getCI(GlobalLogSettingsBase *pSettings)
+__forceinline void mir_getCI(CHAT_MANAGER_INITDATA *pData)
{
- pci = (CHAT_MANAGER*)CallService("GChat/GetInterface", 0, (LPARAM)pSettings);
+ pci = (CHAT_MANAGER*)CallService("GChat/GetInterface", 0, (LPARAM)pData);
}
#endif // M_CHAT_INT_H__
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index d37559ea20..6a54c7b865 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -21,9 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h"
-void RegisterChatFonts( void );
-
-//globals
+// globals
CHAT_MANAGER *pci;
HMENU g_hMenu = NULL;
@@ -144,9 +142,8 @@ void LoadChatIcons(void) int Chat_Load()
{
- mir_getCI(&g_Settings);
- pci->cbModuleInfo = sizeof(MODULEINFO);
- pci->cbSession = sizeof(SESSION_INFO);
+ CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging")_T("/")LPGENT("Group chats") };
+ mir_getCI(&data);
pci->OnCreateModule = OnCreateModule;
pci->OnNewUser = OnNewUser;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 091bab7cbd..40ae167644 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -470,7 +470,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, UINT u2 = 0;
COLORREF cr;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr);
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
@@ -1142,7 +1142,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar {
// messagebox
COLORREF crFore;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore);
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
@@ -1893,7 +1893,7 @@ LABEL_SHOWWINDOW: }
else {
COLORREF cr;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr);
cf.dwMask = CFM_COLOR;
cf.crTextColor = cr;
if (pInfo->bSingleFormat)
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 943895004d..65a04c3f12 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -219,7 +219,7 @@ static BOOL CALLBACK LangAddCallback(CHAR * str) void LoadInfobarFonts()
{
LOGFONT lf;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL, FALSE);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL);
g_dat.minInputAreaHeight = db_get_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat.logPixelSY / 72;
if (g_dat.hInfobarBrush != NULL)
DeleteObject(g_dat.hInfobarBrush);
diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index a7ce5bfa30..d4c7caee6d 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -31,7 +31,7 @@ void SetupInfobar(InfobarWindowData* idat) { DWORD colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR);
SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETBKGNDCOLOR, 0, colour);
SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETBKGNDCOLOR, 0, colour);
- LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour, FALSE);
+ LoadMsgDlgFont(MSGFONTID_INFOBAR_NAME, &lf, &colour);
cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
cf2.cbSize = sizeof(cf2);
cf2.crTextColor = colour;
@@ -43,7 +43,7 @@ void SetupInfobar(InfobarWindowData* idat) { cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
SendDlgItemMessageA(hwnd, IDC_INFOBAR_NAME, EM_SETCHARFORMAT, 0, (LPARAM)&cf2);
- LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour, FALSE);
+ LoadMsgDlgFont(MSGFONTID_INFOBAR_STATUS, &lf, &colour);
cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
cf2.cbSize = sizeof(cf2);
cf2.crTextColor = colour;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 8a43b212e7..51bf39deb2 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1154,7 +1154,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, colour);
InvalidateRect(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, FALSE);
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour, FALSE);
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour);
cf2.cbSize = sizeof(cf2);
cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
cf2.crTextColor = colour;
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index f1255c6456..a6c124cb08 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -363,13 +363,13 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat, struct GlobalMessageDat buffer[0] = '\0';
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced,"{\\rtf1\\ansi\\deff0{\\fonttbl");
for (i = 0; i < fontOptionsListSize; i++) {
- LoadMsgDlgFont(i, &lf, NULL, FALSE);
+ LoadMsgDlgFont(i, &lf, NULL);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "{\\f%u\\fnil\\fcharset%u %S;}", i,
(!forceCharset) ? lf.lfCharSet : charset, lf.lfFaceName);
}
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}{\\colortbl ");
for (i = 0; i < fontOptionsListSize; i++) {
- LoadMsgDlgFont(i, NULL, &colour, FALSE);
+ LoadMsgDlgFont(i, NULL, &colour);
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour));
}
if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL)
@@ -404,7 +404,7 @@ static char* SetToStyle(int style) {
static char szStyle[128];
LOGFONT lf;
- LoadMsgDlgFont(style, &lf, NULL, FALSE);
+ LoadMsgDlgFont(style, &lf, NULL);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY);
return szStyle;
}
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index e14213c100..21a5586116 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -78,30 +78,6 @@ static const FontOptionsList fontOptionsList[] = { int fontOptionsListSize = SIZEOF(fontOptionsList);
-//remeber to put these in the Translate( ) template file too
-static const FontOptionsList chatFontOptionsList[] = {
- { LPGENT("Timestamp"), RGB(50, 50, 240), _T("Terminal"), 0, -8, LPGENT("Background")},
- { LPGENT("Others nicknames"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")},
- { LPGENT("Your nickname"), RGB(0, 0, 0), _T("Verdana"), FONTF_BOLD, -13, LPGENT("Background")},
- { LPGENT("User has joined"), RGB(90, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("User has left"), RGB(160, 160, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("User has disconnected"), RGB(160, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("User kicked ..."), RGB(100, 100, 100), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("User is now known as ..."), RGB(90, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Notice from user"), RGB(160, 130, 60), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Incoming message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Outgoing message"), RGB(90, 90, 90), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("The topic is ..."), RGB(70, 70, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Information messages"), RGB(130, 130, 195), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("User enables status for ..."), RGB(70, 150, 70), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("User disables status for ..."), RGB(150, 70, 70), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Action message"), RGB(160, 90, 160), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Highlighted message"), RGB(180, 150, 80), _T("Verdana"), 0, -13, LPGENT("Background")},
- { LPGENT("Message typing area"), RGB(0, 0, 40), _T("Verdana"), 0, -14, LPGENT("Message background")},
- { LPGENT("User list members (online)"), RGB(0,0, 0), _T("Verdana"), 0, -12, LPGENT("User list background")},
- { LPGENT("User list members (away)"), RGB(170, 170, 170), _T("Verdana"), 0, -12, LPGENT("User list background")},
-};
-
struct ColourOptionsList
{
const TCHAR *szName;
@@ -172,58 +148,6 @@ void RegisterFontServiceFonts() }
}
-void RegisterChatFonts(void)
-{
- FontIDT fid = { 0 };
- ColourIDT colourid;
- char idstr[10];
- int index = 0, i;
- fid.cbSize = sizeof(FontIDT);
- mir_sntprintf(fid.group, SIZEOF(fid.group), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats"));
- mir_sntprintf(fid.backgroundGroup, SIZEOF(fid.backgroundGroup), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats"));
- strncpy(fid.dbSettingsGroup, "ChatFonts", sizeof(fid.dbSettingsGroup));
- fid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART;
- for (i = 0; i < SIZEOF(chatFontOptionsList); i++) {
- if (i == 17) continue;
- fid.order = index++;
- mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i);
- strncpy(fid.prefix, idstr, sizeof(fid.prefix));
- _tcsncpy(fid.name, chatFontOptionsList[i].szDescr, SIZEOF(fid.name));
- fid.deffontsettings.colour = chatFontOptionsList[i].defColour;
- fid.deffontsettings.size = chatFontOptionsList[i].defSize;
- fid.deffontsettings.style = chatFontOptionsList[i].defStyle;
- fid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace);
- _tcsncpy(fid.deffontsettings.szFace, chatFontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace));
- _tcsncpy(fid.backgroundName, chatFontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName));
- FontRegisterT(&fid);
- }
-
- colourid.cbSize = sizeof(ColourIDT);
- colourid.order = 0;
- strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup));
-
- strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name));
- mir_sntprintf(colourid.group, SIZEOF(colourid.group), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group chats"));
- colourid.defcolour = GetSysColor(COLOR_WINDOW);
- ColourRegisterT(&colourid);
-
- strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("User list background"), SIZEOF(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_WINDOW);
- ColourRegisterT(&colourid);
-
- strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("User list lines"), SIZEOF(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER);
- ColourRegisterT(&colourid);
-
- strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting));
- _tcsncpy(colourid.name, LPGENT("User list background (selected)"), SIZEOF(colourid.name));
- colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
- ColourRegisterT(&colourid);
-}
-
int IconsChanged(WPARAM wParam, LPARAM lParam)
{
ReleaseIcons();
@@ -242,27 +166,23 @@ int SmileySettingsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode)
+void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
{
char str[32];
- int style;
- DBVARIANT dbv;
- const char * module = chatMode ? "ChatFonts" : SRMMMOD;
- const char * prefix = chatMode ? "Font" : "SRMFont";
- const FontOptionsList * fontList = chatMode ? chatFontOptionsList : fontOptionsList;
if (colour) {
- mir_snprintf(str, SIZEOF(str), "%s%dCol", prefix, i);
- *colour = db_get_dw(NULL, module, str, fontList[i].defColour);
+ mir_snprintf(str, SIZEOF(str), "%s%dCol", "SRMFont", i);
+ *colour = db_get_dw(NULL, SRMMMOD, str, fontOptionsList[i].defColour);
}
+
if (lf) {
- mir_snprintf(str, SIZEOF(str), "%s%dSize", prefix, i);
- lf->lfHeight = (char)db_get_b(NULL, module, str, fontList[i].defSize);
+ mir_snprintf(str, SIZEOF(str), "%s%dSize", "SRMFont", i);
+ lf->lfHeight = (char)db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
- mir_snprintf(str, SIZEOF(str), "%s%dSty", prefix, i);
- style = db_get_b(NULL, module, str, fontList[i].defStyle);
+ mir_snprintf(str, SIZEOF(str), "%s%dSty", "SRMFont", i);
+ int style = db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defStyle);
lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = 0;
@@ -271,15 +191,16 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode) lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- mir_snprintf(str, SIZEOF(str), "%s%d", prefix, i);
- if (db_get_ts(NULL, module, str, &dbv))
- lstrcpy(lf->lfFaceName, fontList[i].szDefFace);
- else {
- _tcsncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
- db_free(&dbv);
- }
- mir_snprintf(str, SIZEOF(str), "%s%dSet", prefix, i);
- lf->lfCharSet = db_get_b(NULL, module, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName));
+ mir_snprintf(str, SIZEOF(str), "%s%d", "SRMFont", i);
+
+ ptrT tszFace(db_get_tsa(NULL, SRMMMOD, str));
+ if (tszFace == NULL)
+ lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
+ else
+ _tcsncpy(lf->lfFaceName, tszFace, SIZEOF(lf->lfFaceName));
+
+ mir_snprintf(str, SIZEOF(str), "%s%dSet", "SRMFont", i);
+ lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName));
}
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 39c8f53331..7e593ec9a4 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -250,7 +250,7 @@ int IsAutoPopup(HANDLE hContact); #define MSGFONTID_INFOBAR_NAME 12
#define MSGFONTID_INFOBAR_STATUS 13
-void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode);
+void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour);
extern int fontOptionsListSize;
#define LOADHISTORY_UNREAD 0
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index e2bc495ffa..60b1a4598b 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -140,7 +140,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);
TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
-char* Log_CreateRtfHeader(MODULEINFO * mi);
void Log_SetStyles();
// window.c
@@ -148,9 +147,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth);
// options.c
-enum { FONTSECTION_AUTO, FONTSECTION_CHAT, FONTSECTION_IM, FONTSECTION_IP };
+enum { FONTSECTION_AUTO, FONTSECTION_IM, FONTSECTION_IP };
int OptionsInit(void);
-int OptionsUnInit(void);
void LoadMsgDlgFont(int section, int i, LOGFONT * lf, COLORREF * colour, char* szMod);
void AddIcons(void);
HICON LoadIconEx(int iIndex, char * pszIcoLibName, int iX, int iY);
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 88d00c2fce..424c5526ff 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -755,7 +755,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) // ### RTF HEADER
if (0 == mi->pszHeader)
- mi->pszHeader = Log_CreateRtfHeader(mi);
+ mi->pszHeader = pci->Log_CreateRtfHeader(mi);
header = mi->pszHeader;
streamData->crCount = mi->nColorCount;
@@ -1125,82 +1125,6 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr }
}
-char * Log_CreateRtfHeader(MODULEINFO * mi)
-{
- char *buffer;
- int bufferAlloced, bufferEnd, i = 0;
-
- // guesstimate amount of memory for the RTF header
- bufferEnd = 0;
- bufferAlloced = 4096;
- buffer = (char *) mir_realloc(mi->pszHeader, bufferAlloced);
- buffer[0] = '\0';
-
-
- //get the number of pixels per logical inch
- if (logPixelSY == 0) {
- HDC hdc;
- hdc = GetDC(NULL);
- logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
- logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
- ReleaseDC(NULL, hdc);
- }
-
- // ### RTF HEADER
-
- // font table
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "{\\rtf1\\ansi\\deff0{\\fonttbl");
- for (i=0; i < OPTIONS_FONTCOUNT ; i++)
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "{\\f%u\\fnil\\fcharset%u%S;}", i, pci->aFonts[i].lf.lfCharSet, pci->aFonts[i].lf.lfFaceName);
-
- // colour table
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "}{\\colortbl ;");
-
- for (i=0; i < OPTIONS_FONTCOUNT; i++)
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(pci->aFonts[i].color), GetGValue(pci->aFonts[i].color), GetBValue(pci->aFonts[i].color));
-
- for (i=0; i < mi->nColorCount; i++)
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(mi->crColors[i]), GetGValue(mi->crColors[i]), GetBValue(mi->crColors[i]));
-
- for (i=0; i < 5; i++)
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(g_Settings.nickColors[i]), GetGValue(g_Settings.nickColors[i]), GetBValue(g_Settings.nickColors[i]));
-
- // new paragraph
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "}\\pard\\sl%d", 1000);
-
- // set tabs and indents
- {
- int iIndent = 0;
-
- if (g_Settings.bLogSymbols) {
- TCHAR szString[2];
- LOGFONT lf;
- HFONT hFont;
- int iText;
-
- szString[1] = 0;
- szString[0] = 0x28;
- LoadMsgDlgFont(FONTSECTION_CHAT, 17, &lf, NULL, CHAT_FONTMODULE);
- hFont = CreateFontIndirect(&lf);
- iText = GetTextPixelSize(szString, hFont, true) + 3;
- DeleteObject(hFont);
- iIndent += (iText * 1440) / logPixelSX;
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
- } else if (g_Settings.dwIconFlags) {
- iIndent += ((g_Settings.bScaleIcons ? 14 : 20) * 1440) / logPixelSX;
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
- }
- if (g_Settings.ShowTime) {
- int iSize = (g_Settings.LogTextIndent * 1440) / logPixelSX;
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize);
- if (g_Settings.LogIndentEnabled)
- iIndent += iSize;
- }
- Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\fi-%u\\li%u", iIndent, iIndent);
- }
- return buffer;
-}
-
void Log_SetStyles()
{
if (logPixelSY == 0) {
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index 5a8a10c014..690e5665e4 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -171,13 +171,13 @@ static void OnLoadSettings() DeleteObject(g_Settings.UserListFonts[CHAT_STATUS_OFFLINE]);
}
- LoadMsgDlgFont(FONTSECTION_CHAT, 18, &lf, NULL, CHAT_FONTMODULE);
+ pci->LoadMsgDlgFont(18, &lf, NULL);
g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf);
- LoadMsgDlgFont(FONTSECTION_CHAT, 19, &lf, NULL, CHAT_FONTMODULE);
+ pci->LoadMsgDlgFont(19, &lf, NULL);
g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf);
- LoadMsgDlgFont(FONTSECTION_CHAT, 5, &lf, NULL, CHAT_FONTMODULE);
+ pci->LoadMsgDlgFont(5, &lf, NULL);
g_Settings.UserListFonts[CHAT_STATUS_OFFLINE] = CreateFontIndirect(&lf);
int ih = GetTextPixelSize(_T("AQGglo"), g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false);
@@ -232,12 +232,47 @@ void Chat_ModulesLoaded() static CHAT_MANAGER saveCI;
+static int CopyChatSetting(const char *szSetting, LPARAM param)
+{
+ LIST<char> *szSettings = (LIST<char>*)param;
+ szSettings->insert(mir_strdup(szSetting));
+ return 0;
+}
+
+static void CheckUpdate()
+{
+ // already converted?
+ if (db_get_b(NULL, "Compatibility", "TabChatFonts", false))
+ return;
+
+ LIST<char> szSettings(120);
+
+ DBCONTACTENUMSETTINGS dbces = { 0 };
+ dbces.szModule = CHAT_OLDFONTMODULE;
+ dbces.pfnEnumProc = CopyChatSetting;
+ dbces.lParam = (LPARAM)&szSettings;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+
+ DBVARIANT dbv;
+ for (int i = szSettings.getCount() - 1; i >= 0; i--) {
+ char *p = szSettings[i];
+ db_get(NULL, CHAT_OLDFONTMODULE, p, &dbv);
+ db_set(NULL, CHAT_FONTMODULE, p, &dbv);
+ db_free(&dbv);
+ mir_free(p);
+ }
+
+ CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)CHAT_OLDFONTMODULE);
+ db_set_b(NULL, "Compatibility", "TabChatFonts", true);
+}
+
int Chat_Load()
{
- mir_getCI(&g_Settings);
+ CheckUpdate();
+
+ CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Message Sessions")_T("/")LPGENT("Group chats") };
+ mir_getCI(&data);
saveCI = *pci;
- pci->cbModuleInfo = sizeof(MODULEINFO);
- pci->cbSession = sizeof(SESSION_INFO);
pci->OnCreateModule = OnCreateModule;
pci->OnNewUser = OnNewUser;
@@ -263,7 +298,6 @@ int Chat_Load() g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
- OnLoadSettings();
OptionsInit();
return 0;
}
@@ -276,6 +310,5 @@ int Chat_Unload(void) {
*pci = saveCI;
DestroyMenu(g_hMenu);
- OptionsUnInit();
return 0;
}
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 4ea5b77987..6b94c5d6e9 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -59,9 +59,9 @@ struct ColorOptionsList };
/*
- * note: bits 24-31 in default color indicates that color is a system color index
- * (GetSysColor(default_color & 0x00ffffff)), not a rgb value.
- */
+* note: bits 24-31 in default color indicates that color is a system color index
+* (GetSysColor(default_color & 0x00ffffff)), not a rgb value.
+*/
static ColorOptionsList _clrs[] = {
0, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), LPGENT("Group chat log background"), SRMSGSET_BKGCOLOUR_MUC, SRMSGDEFSET_BKGCOLOUR,
1, LPGENT("Message Sessions"), LPGENT("Input area background"), "inputbg", SRMSGDEFSET_BKGCOLOUR,
@@ -96,64 +96,38 @@ static ColorOptionsList _tabclrs[] = { extern LOGFONT lfDefault;
-//remember to put these in the Translate( ) template file too
-static FontOptionsList CHAT_fontOptionsList[] = {
- {LPGENT("Timestamp"), RGB(50, 50, 240), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Others nicknames"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("Your nickname"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("User has joined"), RGB(90, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User has left"), RGB(160, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User has disconnected"), RGB(160, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User kicked ..."), RGB(100, 100, 100), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User is now known as ..."), RGB(90, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Notice from user"), RGB(160, 130, 60), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Incoming message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Outgoing message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("The topic is ..."), RGB(70, 70, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Information messages"), RGB(130, 130, 195), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User enables status for ..."), RGB(70, 150, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User disables status for ..."), RGB(150, 70, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Action message"), RGB(160, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Highlighted message"), RGB(180, 150, 80), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Chat log symbols (Webdings)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User list members (Online)"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("User list members (away)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
-};
-
-const int msgDlgFontCount = SIZEOF(CHAT_fontOptionsList);
-
static FontOptionsList IM_fontOptionsList[] = {
- {LPGENT(">> Outgoing messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT(">> Outgoing misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("<< Incoming messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("<< Incoming misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT(">> Outgoing name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT(">> Outgoing timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("<< Incoming name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("<< Incoming timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT(">> Outgoing messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT(">> Outgoing misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("<< Incoming messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("<< Incoming misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT(">> Outgoing name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT(">> Outgoing timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("<< Incoming name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("<< Incoming timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12},
- {LPGENT("* Message Input Area"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("* Status changes"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("* Dividers"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("* Error and warning Messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("* Symbols (incoming)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12},
- {LPGENT("* Symbols (outgoing)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12},
+ { LPGENT(">> Outgoing messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT(">> Outgoing misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("<< Incoming messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("<< Incoming misc events"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT(">> Outgoing name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT(">> Outgoing timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT("<< Incoming name"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT("<< Incoming timestamp"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT(">> Outgoing messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT(">> Outgoing misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("<< Incoming messages (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("<< Incoming misc events (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT(">> Outgoing name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT(">> Outgoing timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT("<< Incoming name (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT("<< Incoming timestamp (old)"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENT("* Message Input Area"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("* Status changes"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("* Dividers"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("* Error and warning Messages"), RGB(50, 50, 50), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("* Symbols (incoming)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12 },
+ { LPGENT("* Symbols (outgoing)"), RGB(50, 50, 50), _T("Webdings"), SYMBOL_CHARSET, 0, -12 },
};
static FontOptionsList IP_fontOptionsList[] = {
- {LPGENT("Nickname"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("UIN"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Status"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Protocol"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Contacts local time"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
- {LPGENT("Window caption (skinned mode)"), RGB(255, 255, 255), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12},
+ { LPGENT("Nickname"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("UIN"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("Status"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("Protocol"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("Contacts local time"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENT("Window caption (skinned mode)"), RGB(255, 255, 255), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
};
static FontOptionsList *fontOptionsList = IM_fontOptionsList;
@@ -167,48 +141,40 @@ struct branch_t { HTREEITEM hItem;
};
static branch_t branch1[] = {
- {LPGENT("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, NULL},
- {LPGENT("Flash window when someone speaks"), "FlashWindow", 0, 0, NULL},
- {LPGENT("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL},
-//TODO Fix for 3.0 !!!
-
-#if !defined(__DELAYED_FOR_3_1)
- {LPGENT("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0,0, NULL},
- {LPGENT("Activate chat window on highlight"), "AnnoyingHighlight", 0,0, NULL},
-#endif
-
- {LPGENT("Show list of users in the chat room"), "ShowNicklist", 0, 1, NULL},
- {LPGENT("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, NULL},
- {LPGENT("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, NULL},
- {LPGENT("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, NULL},
- {LPGENT("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, NULL},
- {LPGENT("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, NULL},
- {LPGENT("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, NULL},
- {LPGENT("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, NULL},
- {LPGENT("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, NULL},
- //MAD: simple customization improvement
- {LPGENT("Use IRC style status indicators in the user list"), "ClassicIndicators", 0, 0, NULL},
- {LPGENT("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, NULL},
+ { LPGENT("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, NULL },
+ { LPGENT("Flash window when someone speaks"), "FlashWindow", 0, 0, NULL },
+ { LPGENT("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL },
+ { LPGENT("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0, 0, NULL },
+ { LPGENT("Activate chat window on highlight"), "AnnoyingHighlight", 0, 0, NULL },
+ { LPGENT("Show list of users in the chat room"), "ShowNicklist", 0, 1, NULL },
+ { LPGENT("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, NULL },
+ { LPGENT("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, NULL },
+ { LPGENT("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, NULL },
+ { LPGENT("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, NULL },
+ { LPGENT("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, NULL },
+ { LPGENT("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, NULL },
+ { LPGENT("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, NULL },
+ { LPGENT("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, NULL },
+ { LPGENT("Use IRC style status indicators in the user list"), "ClassicIndicators", 0, 0, NULL },
+ { LPGENT("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, NULL },
};
static branch_t branch2[] = {
- {LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL},
- {LPGENT("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, NULL},
- {LPGENT("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, NULL},
- {LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL},
- {LPGENT("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, NULL},
- {LPGENT("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, NULL},
- {LPGENT("Start private conversation on doubleclick in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, NULL},
- {LPGENT("Strip colors from messages in the log"), "StripFormatting", 0, 0, NULL},
- {LPGENT("Enable the \'event filter\' for new rooms"), "FilterEnabled", 0, 0, NULL},
-//MAD: simple customization improvement
- {LPGENT("Use IRC style status indicators in the log"), "LogClassicIndicators", 0,0, NULL},
-//
- {LPGENT("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL},
- {LPGENT("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL},
- {LPGENT("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL},
- {LPGENT("Place a separator in the log after a window lost its foreground status"), "UseDividers", 0, 1, NULL},
- {LPGENT("Only place a separator when an incoming event is announced with a popup"), "DividersUsePopupConfig", 0, 1, NULL}
+ { LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL },
+ { LPGENT("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, NULL },
+ { LPGENT("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, NULL },
+ { LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL },
+ { LPGENT("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, NULL },
+ { LPGENT("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, NULL },
+ { LPGENT("Start private conversation on doubleclick in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, NULL },
+ { LPGENT("Strip colors from messages in the log"), "StripFormatting", 0, 0, NULL },
+ { LPGENT("Enable the \'event filter\' for new rooms"), "FilterEnabled", 0, 0, NULL },
+ { LPGENT("Use IRC style status indicators in the log"), "LogClassicIndicators", 0, 0, NULL },
+ { LPGENT("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL },
+ { LPGENT("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL },
+ { LPGENT("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL },
+ { LPGENT("Place a separator in the log after a window lost its foreground status"), "UseDividers", 0, 1, NULL },
+ { LPGENT("Only place a separator when an incoming event is announced with a popup"), "DividersUsePopupConfig", 0, 1, NULL }
};
static HWND hPathTip = 0;
@@ -222,7 +188,6 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM FontOptionsList *fol = fontOptionsList;
switch (section) {
- case FONTSECTION_CHAT: fol = CHAT_fontOptionsList; break;
case FONTSECTION_IM: fol = IM_fontOptionsList; break;
case FONTSECTION_IP: fol = IP_fontOptionsList; break;
}
@@ -231,9 +196,10 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
*colour = M.GetDword(szMod, str, fol[j].defColour);
}
+
if (lf) {
mir_snprintf(str, SIZEOF(str), "Font%dSize", i);
- lf->lfHeight = (char) M.GetByte(szMod, str, fol[j].defSize);
+ lf->lfHeight = (char)M.GetByte(szMod, str, fol[j].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
@@ -249,7 +215,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
- lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0;
+ lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0;
}
mir_snprintf(str, SIZEOF(str), "Font%dSet", i);
lf->lfCharSet = M.GetByte(szMod, str, fol[j].defCharset);
@@ -261,10 +227,11 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM if ((i == 17 && !strcmp(szMod, CHAT_FONTMODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) {
lf->lfCharSet = SYMBOL_CHARSET;
lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName));
- } else {
- if (db_get_ts(NULL, szMod, str, &dbv)) {
+ }
+ else {
+ if (db_get_ts(NULL, szMod, str, &dbv))
lstrcpy(lf->lfFaceName, fol[j].szDefFace);
- } else {
+ else {
lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
db_free(&dbv);
}
@@ -296,7 +263,7 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, branch_t *branch, int n tvis.hParent = hParent;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_TEXT | TVIF_STATE;
- for (int i=0;i < nValues;i++) {
+ for (int i = 0; i < nValues; i++) {
tvis.item.pszText = TranslateTS(branch[i].szDescr);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
if (branch[i].iMode)
@@ -315,7 +282,7 @@ static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues) int iState = 0;
tvi.mask = TVIF_HANDLE | TVIF_STATE;
- for (int i=0;i < nValues;i++) {
+ for (int i = 0; i < nValues; i++) {
tvi.hItem = branch[i].hItem;
TreeView_GetItem(hwndTree, &tvi);
bChecked = ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2) ? 0 : 1;
@@ -325,7 +292,8 @@ static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues) if (iState & GC_EVENT_ADDSTATUS)
iState |= GC_EVENT_REMOVESTATUS;
db_set_dw(0, "Chat", branch[i].szDBName, (DWORD)iState);
- } else db_set_b(0, "Chat", branch[i].szDBName, bChecked);
+ }
+ else db_set_b(0, "Chat", branch[i].szDBName, bChecked);
}
}
@@ -364,7 +332,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.hItem = hHeading;
TreeView_GetItem(hwndTree, &tvi);
- if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 3)||((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 1))
+ if (((tvi.state&TVIS_STATEIMAGEMASK) >> 12 == 3) || ((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 1))
bChecked = FALSE;
tvi.stateMask = TVIS_STATEIMAGEMASK;
@@ -372,7 +340,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) TreeView_SetItem(hwndTree, &tvi);
tvi.hItem = TreeView_GetNextItem(hwndTree, hHeading, TVGN_CHILD);
while (tvi.hItem) {
- tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 3:2);
+ tvi.state = INDEXTOSTATEIMAGEMASK(bChecked ? 3 : 2);
if (tvi.hItem != branch1[0].hItem && tvi.hItem != branch1[1].hItem)
TreeView_SetItem(hwndTree, &tvi);
tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
@@ -388,19 +356,13 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p break;
case BFFM_SELCHANGED:
- if (SHGetPathFromIDListA((LPITEMIDLIST) lp , szDir))
+ if (SHGetPathFromIDListA((LPITEMIDLIST)lp, szDir))
SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir);
break;
}
return 0;
}
-static void LoadLogFonts(void)
-{
- for (int i=0; i < OPTIONS_FONTCOUNT; i++)
- LoadMsgDlgFont(FONTSECTION_CHAT, i, &pci->aFonts[i].lf, &pci->aFonts[i].color, CHAT_FONTMODULE);
-}
-
static IconItem _icons[] =
{
{ LPGEN("Window Icon"), "chat_window", IDI_CHANMGR },
@@ -478,10 +440,10 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) ti.hwnd = hwndParent;
ti.hinst = g_hInst;
ti.lpszText = ptszText;
- GetClientRect (hwndParent, &ti.rect);
+ GetClientRect(hwndParent, &ti.rect);
ti.rect.left = -65;
- SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO) &ti);
+ SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO)&ti);
SendMessage(hwndTT, TTM_SETTITLE, 1, (LPARAM)ptszTitle);
SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, (LPARAM)640);
return hwndTT;
@@ -494,8 +456,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM switch (uMsg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
HIMAGELIST himlOptions = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_CHECKBOXES, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)CreateStateImageList());
@@ -535,7 +497,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (((LPNMHDR)lParam)->code == TVN_KEYDOWN)
hti.flags |= TVHT_ONITEMSTATEICON;
if (hti.flags&TVHT_ONITEMSTATEICON) {
- TVITEM tvi = {0};
+ TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_STATE;
tvi.stateMask = TVIS_STATEIMAGEMASK | TVIS_BOLD;
@@ -550,7 +512,8 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (tvi.state & TVIS_BOLD && hti.flags & TVHT_ONITEMSTATEICON) {
tvi.state = INDEXTOSTATEIMAGEMASK(0) | TVIS_BOLD;
SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
- } else if (hti.flags&TVHT_ONITEMSTATEICON) {
+ }
+ else if (hti.flags&TVHT_ONITEMSTATEICON) {
if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12) == 3) {
tvi.state = INDEXTOSTATEIMAGEMASK(1);
SendDlgItemMessageA(hwndDlg, IDC_CHECKBOXES, TVM_SETITEMA, 0, (LPARAM)&tvi);
@@ -565,31 +528,27 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case 0:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- int iLen;
- TCHAR *pszText = NULL;
- BYTE b;
-
- iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
- if (iLen > 0) {
- pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR));
- GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
- db_set_ts(NULL, "Chat", "AddToGroup", pszText);
- } else
- db_set_ts(NULL, "Chat", "AddToGroup", _T(""));
-
- g_Settings.hGroup = 0;
-
- mir_free(pszText);
-
- b = M.GetByte("Chat", "Tabs", 1);
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1));
- SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2));
-
- pci->MM_FontsChanged();
- pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
- SM_ReconfigureFilters();
+ int iLen;
+ TCHAR *pszText = NULL;
+ BYTE b;
+
+ iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP));
+ if (iLen > 0) {
+ pszText = (TCHAR*)mir_realloc(pszText, (iLen + 2) * sizeof(TCHAR));
+ GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1);
+ db_set_ts(NULL, "Chat", "AddToGroup", pszText);
}
+ else db_set_ts(NULL, "Chat", "AddToGroup", _T(""));
+
+ mir_free(pszText);
+
+ b = M.GetByte("Chat", "Tabs", 1);
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, SIZEOF(branch1));
+ SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, SIZEOF(branch2));
+
+ pci->MM_FontsChanged();
+ pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
+ SM_ReconfigureFilters();
return TRUE;
}
}
@@ -604,12 +563,11 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM return FALSE;
}
-static TCHAR* chatcolorsnames[] ={
-// LPGENT("Your nickname"),
+static TCHAR* chatcolorsnames[] =
+{
LPGENT("Channel operators"),
LPGENT("Half operators"),
LPGENT("Voiced"),
-// LPGENT("Others nicknames"),
LPGENT("Extended mode 1"),
LPGENT("Extended mode 2"),
LPGENT("Selection background"),
@@ -628,15 +586,15 @@ void RegisterFontServiceFonts() { strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for (int i=0; i < SIZEOF(IM_fontOptionsList); i++) {
- fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
- LoadMsgDlgFont(FONTSECTION_IM, i , &lf, &fontOptionsList[i].colour, FONTMODULE);
+ for (int i = 0; i < SIZEOF(IM_fontOptionsList); i++) {
+ fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
+ LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
fid.order = i;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
- fid.deffontsettings.size = (char) lf.lfHeight;
+ fid.deffontsettings.size = (char)lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
fid.deffontsettings.charset = lf.lfCharSet;
fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
@@ -688,25 +646,25 @@ void RegisterFontServiceFonts() { }
fontOptionsList = IP_fontOptionsList;
- fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
+ fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
//fid.flags|=FIDF_SAVEPOINTSIZE;
_tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group));
_tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName));
- for (int i=0; i < IPFONTCOUNT; i++) {
- LoadMsgDlgFont(FONTSECTION_IP, i + 100 , &lf, &fontOptionsList[i].colour, FONTMODULE);
+ for (int i = 0; i < IPFONTCOUNT; i++) {
+ LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i + 100);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
- fid.order = i + 100 ;
+ fid.order = i + 100;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
- fid.deffontsettings.size = (char) lf.lfHeight;
+ fid.deffontsettings.size = (char)lf.lfHeight;
fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
fid.deffontsettings.charset = lf.lfCharSet;
fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
fid.deffontsettings.charset = lf.lfCharSet;
_tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
- if (i==IPFONTCOUNT-1){
+ if (i == IPFONTCOUNT - 1) {
_tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup));
_tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName));
_tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group));
@@ -714,36 +672,12 @@ void RegisterFontServiceFonts() { FontRegisterT(&fid);
}
- fontOptionsList = CHAT_fontOptionsList;
- fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS;
- fid.flags&=~FIDF_SAVEPOINTSIZE;
- _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(fid.group));
- strncpy(fid.dbSettingsGroup, CHAT_FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for (int i=0; i < msgDlgFontCount; i++) {
- LoadMsgDlgFont(FONTSECTION_CHAT, i , &lf, &fontOptionsList[i].colour, CHAT_FONTMODULE);
- mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
- fid.order = i;
- _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
- fid.deffontsettings.colour = fontOptionsList[i].colour;
- fid.deffontsettings.size = (char) lf.lfHeight;
- fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0);
- fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL);
- fid.deffontsettings.charset = lf.lfCharSet;
- _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE);
- _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(fid.backgroundGroup));
- _tcsncpy(fid.backgroundName, LPGENT("Group chat log background"), SIZEOF(fid.backgroundName));
- if (i == 18 || i == 19)
- _tcsncpy(fid.backgroundName, LPGENT("Userlist background"), SIZEOF(fid.backgroundName));
- FontRegisterT(&fid);
- }
-
_tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group));
strncpy(cid.dbSettingsGroup, "Chat", SIZEOF(cid.dbSettingsGroup));
- for (int i=0; i <= 7; i++) {
+ for (int i = 0; i <= 7; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i);
_tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name));
- cid.order=i+1;
+ cid.order = i + 1;
strncpy(cid.setting, szTemp, SIZEOF(cid.setting));
switch (i) {
case 5:
@@ -753,24 +687,22 @@ void RegisterFontServiceFonts() { cid.defcolour = GetSysColor(COLOR_HIGHLIGHTTEXT);
break;
default:
- cid.defcolour =RGB(0, 0, 0);
+ cid.defcolour = RGB(0, 0, 0);
break;
}
ColourRegisterT(&cid);
}
- cid.order=8;
+ cid.order = 8;
_tcsncpy(cid.name, LPGENT("Userlist background"), SIZEOF(cid.name));
strncpy(cid.setting, "ColorNicklistBG", SIZEOF(cid.setting));
cid.defcolour = SRMSGDEFSET_BKGCOLOUR;
ColourRegisterT(&cid);
- /*
- * static colors (info panel, tool bar background etc...)
- */
+ // static colors (info panel, tool bar background etc...)
strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for (int i=0; i < SIZEOF(_clrs); i++) {
+ for (int i = 0; i < SIZEOF(_clrs); i++) {
cid.order = _clrs[i].order;
_tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
@@ -784,10 +716,8 @@ void RegisterFontServiceFonts() { strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup));
- /*
- * text and background colors for tabs
- */
- for (int i=0; i < SIZEOF(_tabclrs); i++) {
+ // text and background colors for tabs
+ for (int i = 0; i < SIZEOF(_tabclrs); i++) {
cid.order = _tabclrs[i].order;
_tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
@@ -803,21 +733,6 @@ void RegisterFontServiceFonts() { int FontServiceFontsChanged(WPARAM,LPARAM)
{
- LoadLogFonts();
-
- LOGFONT lf;
- LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
- HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(pci->MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
- DeleteObject(hFont);
- g_Settings.LogTextIndent = iText;
- g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
-
- pci->MM_FontsChanged();
- pci->MM_FixColors();
- pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
-
PluginConfig.reloadSettings();
CSkin::initAeroEffect();
CacheMsgLogIcons();
@@ -829,10 +744,12 @@ int FontServiceFontsChanged(WPARAM,LPARAM) return 0;
}
-
-static UINT _o2chatcontrols[] = { IDC_CHAT_SPIN2, IDC_LIMIT, IDC_CHAT_SPIN4, IDC_LOGTIMESTAMP, IDC_TIMESTAMP,
- IDC_OUTSTAMP, IDC_FONTCHOOSE, IDC_LOGGING, IDC_LOGDIRECTORY, IDC_INSTAMP, IDC_CHAT_SPIN2, IDC_CHAT_SPIN3, IDC_NICKROW2, IDC_LOGLIMIT,
- IDC_STATIC110, IDC_STATIC112, 0};
+static UINT _o2chatcontrols[] =
+{
+ IDC_CHAT_SPIN2, IDC_LIMIT, IDC_CHAT_SPIN4, IDC_LOGTIMESTAMP, IDC_TIMESTAMP,
+ IDC_OUTSTAMP, IDC_FONTCHOOSE, IDC_LOGGING, IDC_LOGDIRECTORY, IDC_INSTAMP, IDC_CHAT_SPIN2, IDC_CHAT_SPIN3, IDC_NICKROW2, IDC_LOGLIMIT,
+ IDC_STATIC110, IDC_STATIC112, 0
+};
static UINT _o3chatcontrols[] = {0};
@@ -841,7 +758,6 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
-
{
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "Chat", "LogLimit", 100), 0));
@@ -1062,17 +978,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM DeleteObject(pci->hListBkgBrush);
pci->hListBkgBrush = CreateSolidBrush(M.GetDword("Chat", "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
- LoadLogFonts();
-
- LOGFONT lf;
- LoadMsgDlgFont(FONTSECTION_CHAT, 0, &lf, NULL, CHAT_FONTMODULE);
- HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(pci->MakeTimeStamp(g_Settings.pszTimeStamp, time(NULL)), hFont, true);
- DeleteObject(hFont);
- g_Settings.LogTextIndent = iText;
- g_Settings.LogTextIndent = g_Settings.LogTextIndent * 12 / 10;
- g_Settings.LogIndentEnabled = M.GetBool("Chat", "LogIndentEnabled", true);
-
+ pci->ReloadSettings();
pci->MM_FontsChanged();
pci->MM_FixColors();
pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
@@ -1205,14 +1111,6 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM int OptionsInit(void)
{
- LoadLogFonts();
-
g_Settings.Highlight = new CMUCHighlight();
-
- return 0;
-}
-
-int OptionsUnInit(void)
-{
return 0;
}
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 59c6f052a9..0f36e33eed 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2443,7 +2443,7 @@ LABEL_SHOWWINDOW: CSkin::UpdateToolbarBG(dat, RDW_ALLCHILDREN);
SendMessage(dat->hwnd, WM_SIZE, 0, 0);
}
- else if ((HWND) lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
+ else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PANELSPLITTER)) {
POINT pt = { 0, wParam };
ScreenToClient(hwndDlg, &pt);
GetClientRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rc);
@@ -2456,12 +2456,12 @@ LABEL_SHOWWINDOW: SendMessage(hwndDlg, WM_SIZE, DM_SPLITTERMOVED, 0);
break;
}
- }
+ }
break;
case GC_FIREHOOK:
if (lParam) {
- GCHOOK* gch = (GCHOOK*) lParam;
+ GCHOOK *gch = (GCHOOK*)lParam;
NotifyEventHooks(pci->hSendEvent, 0, (WPARAM)gch);
if (gch->pDest) {
mir_free((void*)gch->pDest->ptszID);
@@ -2483,7 +2483,7 @@ LABEL_SHOWWINDOW: si->hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), dat->pContainer->hwnd, FilterWndProc, (LPARAM)si);
TranslateDialogDefault(si->hwndStatus);
{
- RECT rcFilter, rcLog;
+ RECT rcFilter, rcLog;
GetClientRect(si->hwndStatus, &rcFilter);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rcLog);
POINT pt = { rcLog.right, rcLog.bottom };
@@ -2570,9 +2570,9 @@ LABEL_SHOWWINDOW: if (msg == WM_KEYDOWN) {
if ((wp == VK_INSERT && isShift && !isCtrl && !isMenu) || (wp == 'V' && !isShift && !isMenu && isCtrl)) {
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_PASTESPECIAL, CF_UNICODETEXT, 0);
- ((MSGFILTER *) lParam)->msg = WM_NULL;
- ((MSGFILTER *) lParam)->wParam = 0;
- ((MSGFILTER *) lParam)->lParam = 0;
+ ((MSGFILTER*)lParam)->msg = WM_NULL;
+ ((MSGFILTER*)lParam)->wParam = 0;
+ ((MSGFILTER*)lParam)->lParam = 0;
return(_dlgReturn(hwndDlg, 1));
}
}
diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h index b05930662e..60470d7e59 100644 --- a/plugins/TabSRMM/src/commonheaders.h +++ b/plugins/TabSRMM/src/commonheaders.h @@ -33,9 +33,7 @@ #ifndef __COMMONHEADERS_H
#define __COMMONHEADERS_H
-#if !defined __DELAYED_FOR_3_1
- #define __FEAT_EXP_AUTOSPLITTER 1
-#endif
+#define __FEAT_EXP_AUTOSPLITTER 1
#define WINVER 0x0600
#define _WIN32_WINNT 0x0600
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 12943f05fd..7baa7be4ce 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -692,8 +692,6 @@ private: #define IPFONTID_PROTO 3
#define IPFONTID_TIME 4
-extern const int msgDlgFontCount;
-
#define LOADHISTORY_UNREAD 0
#define LOADHISTORY_COUNT 1
#define LOADHISTORY_TIME 2
@@ -744,7 +742,7 @@ extern const int msgDlgFontCount; #define SRMSGDEFSET_SHOWTYPINGCLIST 1
// rtl support
-#define SRMSGDEFSET_MOD_RTL 0
+#define SRMSGDEFSET_MOD_RTL 0
#define TIMEOUT_FLASHWND 900
#define TIMERID_HEARTBEAT 2
@@ -755,7 +753,8 @@ extern const int msgDlgFontCount; #define SRMSGMOD "SRMsg"
#define SRMSGMOD_T "Tab_SRMsg"
#define FONTMODULE "TabSRMM_Fonts"
-#define CHAT_FONTMODULE "TabSRMM_chat_Fonts"
+#define CHAT_OLDFONTMODULE "TabSRMM_chat_Fonts"
+#define CHAT_FONTMODULE "ChatFonts"
#define IDM_STAYONTOP (WM_USER + 1)
#define IDM_NOTITLE (WM_USER + 2)
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index a6b6d2d9e3..5a991a6d39 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -137,8 +137,7 @@ int LoadDefaultModules(void) if (LoadSkinHotkeys()) return 1;
if (LoadFontserviceModule()) return 1;
if (LoadSrmmModule()) return 1;
- InitChatModule();
-
+ if (LoadChatModule()) return 1;
if (LoadDescButtonModule()) return 1;
if (LoadOptionsModule()) return 1;
if (LoadNetlibModule()) return 1;
@@ -148,7 +147,6 @@ int LoadDefaultModules(void) LoadDbAccounts(); // retrieves the account array from a database
if (LoadContactsModule()) return 1;
if (LoadContactListModule()) return 1; // prepare contact list interface
- // LoadChatModule();
if (LoadAddContactModule()) return 1;
if (LoadNewPluginsModule()) return 1; // will call Load(void) on everything, clist will load first
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 18e16c34cd..95fd00ef68 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -262,9 +262,8 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfo);
mir_getCLI();
- mir_getCI(&g_Settings);
- pci->cbModuleInfo = sizeof(MODULEINFO);
- pci->cbSession = sizeof(SESSION_INFO);
+ CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Chat module") };
+ mir_getCI(&data);
pci->OnAddUser = OnAddUser;
pci->OnNewUser = OnNewUser;
pci->OnRemoveUser = OnRemoveUser;
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index 91caba9bde..74855f1785 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -36,6 +36,9 @@ struct GCPTRS };
extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
+extern GlobalLogSettingsBase *g_Settings;
+extern int g_cbSession, g_cbModuleInfo;
+extern TCHAR *g_szFontGroup;
// log.c
void LoadMsgLogBitmaps(void);
@@ -66,11 +69,11 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour); void LoadGlobalSettings(void);
HICON LoadIconEx(char* pszIcoLibName, BOOL big);
void LoadLogFonts(void);
-void SetIndentSize();
+void SetIndentSize(void);
+void RegisterFonts(void);
// services.c
-void InitChatModule(void);
-void LoadChatModule(void);
+int LoadChatModule(void);
void UnloadChatModule(void);
// tools.c
@@ -83,8 +86,8 @@ int GetRichTextLength(HWND hwnd); BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* 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);
-BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, DWORD dwItem);
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, INT_PTR dwItem);
+BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce);
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index e32f7f467d..6917d0be6f 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -26,6 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern SESSION_INFO g_TabSession;
+GlobalLogSettingsBase *g_Settings;
+int g_cbSession, g_cbModuleInfo;
+TCHAR *g_szFontGroup;
+
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
struct FontOptionsList
@@ -67,9 +71,9 @@ static const fontOptionsList[] = { static void LoadColors()
{
- ci.pSettings->crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
- ci.pSettings->crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
- ci.pSettings->crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
+ g_Settings->crLogBackground = db_get_dw(NULL, "Chat", "ColorLogBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crUserListBGColor = db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crUserListSelectedBGColor = db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT));
}
void LoadLogFonts(void)
@@ -80,18 +84,17 @@ void LoadLogFonts(void) if (ci.hListBkgBrush != NULL)
DeleteObject(ci.hListBkgBrush);
- ci.hListBkgBrush = CreateSolidBrush(ci.pSettings->crUserListBGColor);
+ ci.hListBkgBrush = CreateSolidBrush(g_Settings->crUserListBGColor);
if (ci.hListSelectedBkgBrush != NULL)
DeleteObject(ci.hListSelectedBkgBrush);
- ci.hListSelectedBkgBrush = CreateSolidBrush(ci.pSettings->crUserListSelectedBGColor);
+ ci.hListSelectedBkgBrush = CreateSolidBrush(g_Settings->crUserListSelectedBGColor);
}
void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
{
char str[32];
int style;
- DBVARIANT dbv;
if (colour) {
mir_snprintf(str, SIZEOF(str), "Font%dCol", i);
@@ -116,12 +119,12 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font%d", i);
- if (db_get_ts(NULL, "ChatFonts", str, &dbv))
+
+ ptrT tszFace(db_get_tsa(NULL, "ChatFonts", str));
+ if (tszFace == NULL)
lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
- else {
- lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
- db_free(&dbv);
- }
+ else
+ _tcsncpy_s(lf->lfFaceName, SIZEOF(lf->lfFaceName), tszFace, _TRUNCATE);
}
}
@@ -133,7 +136,7 @@ void RegisterFonts(void) fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART;
for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) {
strncpy(fontid.dbSettingsGroup, "ChatFonts", sizeof(fontid.dbSettingsGroup));
- _tcsncpy(fontid.group, _T("Chat module"), SIZEOF(fontid.group));
+ _tcsncpy(fontid.group, g_szFontGroup, SIZEOF(fontid.group));
_tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
char idstr[10];
@@ -146,7 +149,7 @@ void RegisterFonts(void) fontid.deffontsettings.size = fontOptionsList[i].defSize;
fontid.deffontsettings.style = fontOptionsList[i].defStyle;
_tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace));
- _tcsncpy(fontid.backgroundGroup, _T("Chat module"), SIZEOF(fontid.backgroundGroup));
+ _tcsncpy(fontid.backgroundGroup, g_szFontGroup, SIZEOF(fontid.backgroundGroup));
switch (i) {
case 17:
_tcsncpy(fontid.backgroundName, _T("Message background"), SIZEOF(fontid.backgroundName));
@@ -164,9 +167,10 @@ void RegisterFonts(void) ColourIDT colourid = { sizeof(colourid) };
strncpy(colourid.dbSettingsGroup, "Chat", sizeof(colourid.dbSettingsGroup));
+ _tcsncpy(colourid.group, g_szFontGroup, SIZEOF(colourid.group));
+
strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name));
- _tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
@@ -214,46 +218,46 @@ static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault) void LoadGlobalSettings(void)
{
- ci.pSettings->LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1);
- ci.pSettings->ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1);
- ci.pSettings->SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0);
- ci.pSettings->ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
- ci.pSettings->TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
- ci.pSettings->iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
- ci.pSettings->dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
- ci.pSettings->dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
- ci.pSettings->dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
- ci.pSettings->LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100);
- ci.pSettings->LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
- ci.pSettings->FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
- ci.pSettings->HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
- ci.pSettings->crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0, 0, 0));
- ci.pSettings->crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170, 170, 170));
- ci.pSettings->StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
- ci.pSettings->TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
- ci.pSettings->PopupInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopupInactiveOnly", 1);
- ci.pSettings->AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
- ci.pSettings->iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
- ci.pSettings->iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
- ci.pSettings->crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
- ci.pSettings->crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0);
- ci.pSettings->ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
- ci.pSettings->ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
+ g_Settings->LogLimitNames = db_get_b(NULL, "Chat", "LogLimitNames", 1);
+ g_Settings->ShowTime = db_get_b(NULL, "Chat", "ShowTimeStamp", 1);
+ g_Settings->SoundsFocus = db_get_b(NULL, "Chat", "SoundsFocus", 0);
+ g_Settings->ShowTimeIfChanged = (BOOL)db_get_b(NULL, "Chat", "ShowTimeStampIfChanged", 0);
+ g_Settings->TimeStampEventColour = (BOOL)db_get_b(NULL, "Chat", "TimeStampEventColour", 0);
+ g_Settings->iEventLimit = db_get_w(NULL, "Chat", "LogLimit", 100);
+ g_Settings->dwIconFlags = db_get_dw(NULL, "Chat", "IconFlags", 0x0000);
+ g_Settings->dwTrayIconFlags = db_get_dw(NULL, "Chat", "TrayIconFlags", 0x1000);
+ g_Settings->dwPopupFlags = db_get_dw(NULL, "Chat", "PopupFlags", 0x0000);
+ g_Settings->LoggingLimit = db_get_w(NULL, "Chat", "LoggingLimit", 100);
+ g_Settings->LoggingEnabled = (BOOL)db_get_b(NULL, "Chat", "LoggingEnabled", 0);
+ g_Settings->FlashWindow = (BOOL)db_get_b(NULL, "Chat", "FlashWindow", 0);
+ g_Settings->HighlightEnabled = (BOOL)db_get_b(NULL, "Chat", "HighlightEnabled", 1);
+ g_Settings->crUserListColor = db_get_dw(NULL, "ChatFonts", "Font18Col", RGB(0, 0, 0));
+ g_Settings->crUserListHeadingsColor = db_get_dw(NULL, "ChatFonts", "Font19Col", RGB(170, 170, 170));
+ g_Settings->StripFormat = (BOOL)db_get_b(NULL, "Chat", "StripFormatting", 0);
+ g_Settings->TrayIconInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "TrayIconInactiveOnly", 1);
+ g_Settings->PopupInactiveOnly = (BOOL)db_get_b(NULL, "Chat", "PopupInactiveOnly", 1);
+ g_Settings->AddColonToAutoComplete = (BOOL)db_get_b(NULL, "Chat", "AddColonToAutoComplete", 1);
+ g_Settings->iPopupStyle = db_get_b(NULL, "Chat", "PopupStyle", 1);
+ g_Settings->iPopupTimeout = db_get_w(NULL, "Chat", "PopupTimeout", 3);
+ g_Settings->crPUBkgColour = db_get_dw(NULL, "Chat", "PopupColorBG", GetSysColor(COLOR_WINDOW));
+ g_Settings->crPUTextColour = db_get_dw(NULL, "Chat", "PopupColorText", 0);
+ g_Settings->ShowContactStatus = db_get_b(NULL, "Chat", "ShowContactStatus", 0);
+ g_Settings->ContactStatusFirst = db_get_b(NULL, "Chat", "ContactStatusFirst", 0);
LoadColors();
if (ci.OnLoadSettings)
ci.OnLoadSettings();
- InitSetting(&ci.pSettings->pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
- InitSetting(&ci.pSettings->pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
- InitSetting(&ci.pSettings->pszIncomingNick, "HeaderIncoming", _T("%n:"));
- InitSetting(&ci.pSettings->pszOutgoingNick, "HeaderOutgoing", _T("%n:"));
- InitSetting(&ci.pSettings->pszHighlightWords, "HighlightWords", _T("%m"));
+ InitSetting(&g_Settings->pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
+ InitSetting(&g_Settings->pszTimeStampLog, "LogTimestamp", _T("[%d %b %y %H:%M]"));
+ InitSetting(&g_Settings->pszIncomingNick, "HeaderIncoming", _T("%n:"));
+ InitSetting(&g_Settings->pszOutgoingNick, "HeaderOutgoing", _T("%n:"));
+ InitSetting(&g_Settings->pszHighlightWords, "HighlightWords", _T("%m"));
TCHAR pszTemp[MAX_PATH];
DBVARIANT dbv;
- ci.pSettings->pszLogDir = (TCHAR *)mir_realloc(ci.pSettings->pszLogDir, MAX_PATH*sizeof(TCHAR));
+ g_Settings->pszLogDir = (TCHAR *)mir_realloc(g_Settings->pszLogDir, MAX_PATH*sizeof(TCHAR));
if (!db_get_ts(NULL, "Chat", "LogDirectory", &dbv)) {
lstrcpyn(pszTemp, dbv.ptszVal, MAX_PATH);
db_free(&dbv);
@@ -264,54 +268,56 @@ void LoadGlobalSettings(void) mir_free(tmpPath);
}
- PathToAbsoluteT(pszTemp, ci.pSettings->pszLogDir);
+ PathToAbsoluteT(pszTemp, g_Settings->pszLogDir);
- ci.pSettings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
LOGFONT lf;
- if (ci.pSettings->MessageBoxFont)
- DeleteObject(ci.pSettings->MessageBoxFont);
+ if (g_Settings->MessageBoxFont)
+ DeleteObject(g_Settings->MessageBoxFont);
LoadMsgDlgFont(17, &lf, NULL);
- ci.pSettings->MessageBoxFont = CreateFontIndirect(&lf);
+ g_Settings->MessageBoxFont = CreateFontIndirect(&lf);
- if (ci.pSettings->UserListFont)
- DeleteObject(ci.pSettings->UserListFont);
+ if (g_Settings->UserListFont)
+ DeleteObject(g_Settings->UserListFont);
LoadMsgDlgFont(18, &lf, NULL);
- ci.pSettings->UserListFont = CreateFontIndirect(&lf);
+ g_Settings->UserListFont = CreateFontIndirect(&lf);
- if (ci.pSettings->UserListHeadingsFont)
- DeleteObject(ci.pSettings->UserListHeadingsFont);
+ if (g_Settings->UserListHeadingsFont)
+ DeleteObject(g_Settings->UserListHeadingsFont);
LoadMsgDlgFont(19, &lf, NULL);
- ci.pSettings->UserListHeadingsFont = CreateFontIndirect(&lf);
+ g_Settings->UserListHeadingsFont = CreateFontIndirect(&lf);
+
+ SetIndentSize();
}
static void FreeGlobalSettings(void)
{
- mir_free(ci.pSettings->pszTimeStamp);
- mir_free(ci.pSettings->pszTimeStampLog);
- mir_free(ci.pSettings->pszIncomingNick);
- mir_free(ci.pSettings->pszOutgoingNick);
- mir_free(ci.pSettings->pszHighlightWords);
- mir_free(ci.pSettings->pszLogDir);
- if (ci.pSettings->MessageBoxFont)
- DeleteObject(ci.pSettings->MessageBoxFont);
- if (ci.pSettings->UserListFont)
- DeleteObject(ci.pSettings->UserListFont);
- if (ci.pSettings->UserListHeadingsFont)
- DeleteObject(ci.pSettings->UserListHeadingsFont);
+ mir_free(g_Settings->pszTimeStamp);
+ mir_free(g_Settings->pszTimeStampLog);
+ mir_free(g_Settings->pszIncomingNick);
+ mir_free(g_Settings->pszOutgoingNick);
+ mir_free(g_Settings->pszHighlightWords);
+ mir_free(g_Settings->pszLogDir);
+ if (g_Settings->MessageBoxFont)
+ DeleteObject(g_Settings->MessageBoxFont);
+ if (g_Settings->UserListFont)
+ DeleteObject(g_Settings->UserListFont);
+ if (g_Settings->UserListHeadingsFont)
+ DeleteObject(g_Settings->UserListHeadingsFont);
}
void SetIndentSize()
{
- if (ci.pSettings->ShowTime) {
+ if (g_Settings->ShowTime) {
LOGFONT lf;
LoadMsgDlgFont(0, &lf, NULL);
HFONT hFont = CreateFontIndirect(&lf);
- int iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE);
+ int iText = GetTextPixelSize(MakeTimeStamp(g_Settings->pszTimeStamp, time(NULL)), hFont, TRUE);
DeleteObject(hFont);
- ci.pSettings->LogTextIndent = iText * 12 / 10;
+ g_Settings->LogTextIndent = iText * 12 / 10;
}
- else ci.pSettings->LogTextIndent = 0;
+ else g_Settings->LogTextIndent = 0;
}
int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
@@ -339,21 +345,21 @@ int OptionsInit(void) lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0;
lf.lfHeight = -17;
lf.lfWeight = FW_BOLD;
- ci.pSettings->NameFont = CreateFontIndirect(&lf);
- ci.pSettings->UserListFont = NULL;
- ci.pSettings->UserListHeadingsFont = NULL;
- ci.pSettings->MessageBoxFont = NULL;
- ci.pSettings->iX = db_get_dw(NULL, "Chat", "roomx", -1);
- ci.pSettings->iY = db_get_dw(NULL, "Chat", "roomy", -1);
- ci.pSettings->iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1);
- ci.pSettings->iHeight = db_get_dw(NULL, "Chat", "roomheight", -1);
-
- ci.pSettings->iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
- if (ci.pSettings->iSplitterX <= 50)
- ci.pSettings->iSplitterX = 105;
- ci.pSettings->iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90);
- if (ci.pSettings->iSplitterY <= 65)
- ci.pSettings->iSplitterY = 90;
+ g_Settings->NameFont = CreateFontIndirect(&lf);
+ g_Settings->UserListFont = NULL;
+ g_Settings->UserListHeadingsFont = NULL;
+ g_Settings->MessageBoxFont = NULL;
+ g_Settings->iX = db_get_dw(NULL, "Chat", "roomx", -1);
+ g_Settings->iY = db_get_dw(NULL, "Chat", "roomy", -1);
+ g_Settings->iWidth = db_get_dw(NULL, "Chat", "roomwidth", -1);
+ g_Settings->iHeight = db_get_dw(NULL, "Chat", "roomheight", -1);
+
+ g_Settings->iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
+ if (g_Settings->iSplitterX <= 50)
+ g_Settings->iSplitterX = 105;
+ g_Settings->iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90);
+ if (g_Settings->iSplitterY <= 65)
+ g_Settings->iSplitterY = 90;
LoadGlobalSettings();
@@ -369,16 +375,14 @@ int OptionsInit(void) SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected"));
SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed"));
- if (ci.pSettings->LoggingEnabled)
- CreateDirectoryTreeT(ci.pSettings->pszLogDir);
-
- SetIndentSize();
+ if (g_Settings->LoggingEnabled)
+ CreateDirectoryTreeT(g_Settings->pszLogDir);
return 0;
}
int OptionsUnInit(void)
{
FreeGlobalSettings();
- DeleteObject(ci.pSettings->NameFont);
+ DeleteObject(g_Settings->NameFont);
return 0;
}
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index f39318bc32..5bbd5caeba 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -29,8 +29,6 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM); HGENMENU hJoinMenuItem, hLeaveMenuItem;
CRITICAL_SECTION cs;
-void RegisterFonts(void);
-
static HANDLE
hServiceRegister = NULL,
hServiceNewChat = NULL,
@@ -51,7 +49,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) LoadLogFonts();
SetIndentSize();
- ci.pSettings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings->LogIndentEnabled = (db_get_b(NULL, "Chat", "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
ci.MM_FontsChanged();
ci.MM_FixColors();
@@ -184,8 +182,8 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->dwFlags = gcw->dwFlags;
si->ptszName = mir_tstrdup(gcw->ptszName);
si->ptszStatusbarText = mir_tstrdup(gcw->ptszStatusbarText);
- si->iSplitterX = ci.pSettings->iSplitterX;
- si->iSplitterY = ci.pSettings->iSplitterY;
+ si->iSplitterX = g_Settings->iSplitterX;
+ si->iSplitterY = g_Settings->iSplitterY;
si->iLogFilterFlags = (int)db_get_dw(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = db_get_b(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = db_get_b(NULL, "Chat", "ShowNicklist", 1);
@@ -477,8 +475,8 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (ci.OnAddLog)
ci.OnAddLog(si, isOk);
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
- if ((gce->dwFlags & GCEF_ADDTOLOG) && ci.pSettings->LoggingEnabled)
+ ci.DoSoundsFlashPopupTrayStuff(si, gce, bIsHighlighted, 0);
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->LoggingEnabled)
LogToFile(si, gce);
}
@@ -503,9 +501,27 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
+
char* mods[3] = { "Chat", "ChatFonts" };
CallService("DBEditorpp/RegisterModule", (WPARAM)mods, 2);
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = -2000090001;
+ mi.flags = CMIF_DEFAULT;
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);
+ mi.pszName = LPGEN("&Join");
+ mi.pszService = "GChat/JoinChat";
+ hJoinMenuItem = Menu_AddContactMenuItem(&mi);
+
+ mi.position = -2000090000;
+ mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_LEAVE);
+ mi.flags = CMIF_NOTOFFLINE;
+ mi.pszName = LPGEN("&Leave");
+ mi.pszService = "GChat/LeaveChat";
+ hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
+
ci.SetAllOffline(TRUE, NULL);
return 0;
}
@@ -513,22 +529,11 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Service creation
-static bool bInited = false;
-
-void InitChatModule(void)
-{
- CreateServiceFunction("GChat/GetInterface", SvcGetChatManager);
-}
-
-void LoadChatModule(void)
+int LoadChatModule(void)
{
- if (bInited)
- return;
-
InitializeCriticalSection(&cs);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
@@ -543,39 +548,18 @@ void LoadChatModule(void) CreateServiceFunction("GChat/PrebuildMenuEvent", PrebuildContactMenuSvc);
CreateServiceFunction("GChat/JoinChat", JoinChat);
CreateServiceFunction("GChat/LeaveChat", LeaveChat);
+ CreateServiceFunction("GChat/GetInterface", SvcGetChatManager);
ci.hSendEvent = CreateHookableEvent(ME_GC_EVENT);
ci.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU);
- RegisterFonts();
-
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.position = -2000090001;
- mi.flags = CMIF_DEFAULT;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_JOIN);
- mi.pszName = LPGEN("&Join");
- mi.pszService = "GChat/JoinChat";
- hJoinMenuItem = Menu_AddContactMenuItem(&mi);
-
- mi.position = -2000090000;
- mi.icolibItem = LoadSkinnedIconHandle(SKINICON_CHAT_LEAVE);
- mi.flags = CMIF_NOTOFFLINE;
- mi.pszName = LPGEN("&Leave");
- mi.pszService = "GChat/LeaveChat";
- hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
-
HookEvent(ME_FONT_RELOAD, FontsChanged);
HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
- HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
-
- bInited = true;
+ return 0;
}
void UnloadChatModule(void)
{
- if (!bInited)
- return;
-
OptionsUnInit();
DeleteCriticalSection(&cs);
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index c8fd06a5a9..18a95b518b 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -146,7 +146,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff case 'c':
case 'f':
- if (ci.pSettings->StripFormat || streamData->bStripFormat)
+ if (g_Settings->StripFormat || streamData->bStripFormat)
line += 2;
else if ( line[1] != '\0' && line[2] != '\0') {
@@ -164,7 +164,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff break;
case 'C':
case 'F':
- if ( !ci.pSettings->StripFormat && !streamData->bStripFormat) {
+ if ( !g_Settings->StripFormat && !streamData->bStripFormat) {
int j = streamData->lin->bIsHighlighted ? 16 : EventToIndex(streamData->lin);
if ( *line == 'C' )
mir_snprintf(szTemp, SIZEOF(szTemp), "\\cf%u ", j+1);
@@ -225,7 +225,7 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, TCHAR szTemp[512], szTemp2[512];
TCHAR* pszNick = NULL;
if (streamData->lin->ptszNick) {
- if (ci.pSettings->LogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
+ if (g_Settings->LogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
lstrcpyn(szTemp2, streamData->lin->ptszNick, 20);
lstrcpyn(szTemp2 + 20, _T("..."), 4);
}
@@ -346,8 +346,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\par%s ", Log_SetStyle(0, 0));
// Insert icon
- if (lin->iType & ci.pSettings->dwIconFlags || lin->bIsHighlighted&&ci.pSettings->dwIconFlags & GC_EVENT_HIGHLIGHT) {
- int iIndex = (lin->bIsHighlighted && ci.pSettings->dwIconFlags & GC_EVENT_HIGHLIGHT) ? ICON_HIGHLIGHT : EventToIcon(lin);
+ if (lin->iType & g_Settings->dwIconFlags || lin->bIsHighlighted&&g_Settings->dwIconFlags & GC_EVENT_HIGHLIGHT) {
+ int iIndex = (lin->bIsHighlighted && g_Settings->dwIconFlags & GC_EVENT_HIGHLIGHT) ? ICON_HIGHLIGHT : EventToIcon(lin);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < logIconBmpSize[0])
bufferAlloced += 4096;
@@ -356,7 +356,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) bufferEnd += logIconBmpSize[iIndex];
}
- if (ci.pSettings->TimeStampEventColour) {
+ if (g_Settings->TimeStampEventColour) {
LOGFONT &lf = ci.aFonts[0].lf;
// colored timestamps
@@ -376,16 +376,16 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) else Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(0, 0));
// insert a TAB if necessary to put the timestamp in the right position
- if (ci.pSettings->dwIconFlags)
+ if (g_Settings->dwIconFlags)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tab ");
//insert timestamp
- if (ci.pSettings->ShowTime) {
+ if (g_Settings->ShowTime) {
TCHAR szTimeStamp[30], szOldTimeStamp[30];
- lstrcpyn(szTimeStamp, MakeTimeStamp(ci.pSettings->pszTimeStamp, lin->time), 30);
- lstrcpyn(szOldTimeStamp, MakeTimeStamp(ci.pSettings->pszTimeStamp, streamData->si->LastTime), 30);
- if (!ci.pSettings->ShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) {
+ lstrcpyn(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
+ lstrcpyn(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
+ if (!g_Settings->ShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
}
@@ -397,7 +397,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) TCHAR pszTemp[300], *p1;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1, lin->bIsMe ? 2 : 1));
- lstrcpyn(pszTemp, lin->bIsMe ? ci.pSettings->pszOutgoingNick : ci.pSettings->pszIncomingNick, 299);
+ lstrcpyn(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
p1 = _tcsstr(pszTemp, _T("%n"));
if (p1)
p1[1] = 's';
@@ -458,14 +458,14 @@ char* Log_CreateRtfHeader(MODULEINFO *mi) // set tabs and indents
int iIndent = 0;
- if (ci.pSettings->dwIconFlags) {
+ if (g_Settings->dwIconFlags) {
iIndent += (14 * 1440) / ci.logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent);
}
- if (ci.pSettings->ShowTime) {
- int iSize = (ci.pSettings->LogTextIndent * 1440) / ci.logPixelSX;
+ if (g_Settings->ShowTime) {
+ int iSize = (g_Settings->LogTextIndent * 1440) / ci.logPixelSX;
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tx%u", iIndent + iSize);
- if (ci.pSettings->LogIndentEnabled)
+ if (g_Settings->LogIndentEnabled)
iIndent += iSize;
}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index 7dd26e8713..ac110f3429 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -66,7 +66,7 @@ static SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char *pszModule) if (ci.SM_FindSession(pszID, pszModule))
return NULL;
- SESSION_INFO *node = (SESSION_INFO*)mir_calloc(ci.cbSession);
+ SESSION_INFO *node = (SESSION_INFO*)mir_calloc(g_cbSession);
node->ptszID = mir_tstrdup(pszID);
node->pszModule = mir_strdup(pszModule);
@@ -257,10 +257,10 @@ static BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce) ci.OnEventBroadcast(pTemp, gce);
if (!(gce->dwFlags & GCEF_NOTNOTIFY))
- DoSoundsFlashPopupTrayStuff(pTemp, gce, FALSE, bManyFix);
+ ci.DoSoundsFlashPopupTrayStuff(pTemp, gce, FALSE, bManyFix);
bManyFix++;
- if ((gce->dwFlags & GCEF_ADDTOLOG) && ci.pSettings->LoggingEnabled)
+ if ((gce->dwFlags & GCEF_ADDTOLOG) && g_Settings->LoggingEnabled)
LogToFile(pTemp, gce);
}
}
@@ -293,10 +293,10 @@ static BOOL SM_AddEvent(const TCHAR *pszID, const char *pszModule, GCEVENT *gce, li->time = gce->time;
li->bIsHighlighted = bIsHighlighted;
- if (ci.pSettings->iEventLimit > 0 && pTemp->iEventCount > ci.pSettings->iEventLimit + 20) {
- ci.LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - ci.pSettings->iEventLimit);
+ if (g_Settings->iEventLimit > 0 && pTemp->iEventCount > g_Settings->iEventLimit + 20) {
+ ci.LM_TrimLog(&pTemp->pLog, &pTemp->pLogEnd, pTemp->iEventCount - g_Settings->iEventLimit);
pTemp->bTrimmed = true;
- pTemp->iEventCount = ci.pSettings->iEventLimit;
+ pTemp->iEventCount = g_Settings->iEventLimit;
return FALSE;
}
return TRUE;
@@ -858,7 +858,7 @@ static MODULEINFO* MM_AddModule(const char *pszModule) if (ci.MM_FindModule(pszModule))
return NULL;
- MODULEINFO *node = (MODULEINFO*)mir_calloc(ci.cbModuleInfo);
+ MODULEINFO *node = (MODULEINFO*)mir_calloc(g_cbModuleInfo);
replaceStr(node->pszModule, pszModule);
if (ci.OnCreateModule)
ci.OnCreateModule(node);
@@ -1459,20 +1459,35 @@ CHAT_MANAGER ci = SetAllOffline,
AddEvent,
FindRoom,
+
Log_CreateRTF,
+ Log_CreateRtfHeader,
LoadMsgDlgFont,
MakeTimeStamp,
+
+ DoEventHook,
+ DoEventHookAsync,
+
+ DoSoundsFlashPopupTrayStuff,
DoPopup,
ShowPopup,
- RemoveFormatting
+ LogToFile,
+
+ RemoveFormatting,
+ LoadGlobalSettings
};
INT_PTR SvcGetChatManager(WPARAM, LPARAM lParam)
{
- LoadChatModule();
-
+ // wipe out old junk
memset(PBYTE(&ci) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER)-offsetof(CHAT_MANAGER, OnCreateModule));
- ci.pSettings = (GlobalLogSettingsBase*)lParam;
+
+ CHAT_MANAGER_INITDATA *pInit = (CHAT_MANAGER_INITDATA*)lParam;
+ g_Settings = pInit->pSettings;
+ g_szFontGroup = pInit->szFontGroup;
+ g_cbSession = pInit->cbSession;
+ g_cbModuleInfo = pInit->cbModuleInfo;
+ RegisterFonts();
OptionsInit();
return (INT_PTR)&ci;
}
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index c34c1064bb..182861b422 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -142,18 +142,18 @@ int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName cli.pfnGetContactDisplayName(hContact, 0));
lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
- pd.iSeconds = ci.pSettings->iPopupTimeout;
+ pd.iSeconds = g_Settings->iPopupTimeout;
- if (ci.pSettings->iPopupStyle == 2) {
+ if (g_Settings->iPopupStyle == 2) {
pd.colorBack = 0;
pd.colorText = 0;
}
- else if (ci.pSettings->iPopupStyle == 3) {
- pd.colorBack = ci.pSettings->crPUBkgColour;
- pd.colorText = ci.pSettings->crPUTextColour;
+ else if (g_Settings->iPopupStyle == 3) {
+ pd.colorBack = g_Settings->crPUBkgColour;
+ pd.colorText = g_Settings->crPUTextColour;
}
else {
- pd.colorBack = ci.pSettings->crLogBackground;
+ pd.colorBack = g_Settings->crLogBackground;
pd.colorText = crBkg;
}
@@ -166,7 +166,7 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) {
int iEvent = gce->pDest->iType;
- if (iEvent&ci.pSettings->dwTrayIconFlags) {
+ if (iEvent&g_Settings->dwTrayIconFlags) {
switch (iEvent) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
@@ -218,7 +218,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) {
int iEvent = gce->pDest->iType;
- if (iEvent & ci.pSettings->dwPopupFlags) {
+ if (iEvent & g_Settings->dwPopupFlags) {
switch (iEvent) {
case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
ShowPopup(si->hContact, si, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, ci.aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
@@ -291,13 +291,13 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (bHighlight) {
gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatHighlight");
if (db_get_b(si->hContact, "CList", "Hidden", 0) != 0)
db_unset(si->hContact, "CList", "Hidden");
if (bInactive)
DoTrayIcon(si, gce);
- if (bInactive || !ci.pSettings->PopupInactiveOnly)
+ if (bInactive || !g_Settings->PopupInactiveOnly)
DoPopup(si, gce);
if (ci.OnFlashWindow)
ci.OnFlashWindow(si, bInactive);
@@ -305,40 +305,40 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight }
// do blinking icons in tray
- if (bInactive || !ci.pSettings->TrayIconInactiveOnly)
+ if (bInactive || !g_Settings->TrayIconInactiveOnly)
DoTrayIcon(si, gce);
// stupid thing to not create multiple popups for a QUIT event for instance
if (bManyFix == 0) {
// do popups
- if (bInactive || !ci.pSettings->PopupInactiveOnly)
+ if (bInactive || !g_Settings->PopupInactiveOnly)
DoPopup(si, gce);
// do sounds and flashing
switch (iEvent) {
case GC_EVENT_JOIN:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatJoin");
break;
case GC_EVENT_PART:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatPart");
break;
case GC_EVENT_QUIT:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatQuit");
break;
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatMode");
break;
case GC_EVENT_KICK:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatKick");
break;
case GC_EVENT_MESSAGE:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatMessage");
if (bInactive && !(si->wState & STATE_TALK)) {
@@ -349,19 +349,19 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight ci.OnFlashWindow(si, bInactive);
break;
case GC_EVENT_ACTION:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatAction");
break;
case GC_EVENT_NICK:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatNick");
break;
case GC_EVENT_NOTICE:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatNotice");
break;
case GC_EVENT_TOPIC:
- if (bInactive || !ci.pSettings->SoundsFocus)
+ if (bInactive || !g_Settings->SoundsFocus)
SkinPlaySound("ChatTopic");
break;
}
@@ -425,8 +425,8 @@ const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
{
- if (ci.pSettings->HighlightEnabled && ci.pSettings->pszHighlightWords && pszText && si->pMe) {
- TCHAR* p1 = ci.pSettings->pszHighlightWords;
+ if (g_Settings->HighlightEnabled && g_Settings->pszHighlightWords && pszText && si->pMe) {
+ TCHAR* p1 = g_Settings->pszHighlightWords;
TCHAR* p2 = NULL;
const TCHAR* p3 = pszText;
static TCHAR szWord1[1000];
@@ -521,7 +521,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) mir_sntprintf(szName, MAX_PATH, _T("%s"), mi->ptszModDispName ? mi->ptszModDispName : (szModName = mir_a2t(si->pszModule)));
mir_free(szModName);
ValidateFilename(szName);
- mir_sntprintf(szFolder, MAX_PATH, _T("%s\\%s"), ci.pSettings->pszLogDir, szName );
+ mir_sntprintf(szFolder, MAX_PATH, _T("%s\\%s"), g_Settings->pszLogDir, szName );
CreateDirectoryTreeT(szFolder);
@@ -529,14 +529,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) ValidateFilename(szName);
mir_sntprintf(szFile, MAX_PATH, _T("%s\\%s"), szFolder, szName );
- lstrcpyn(szTime, MakeTimeStamp(ci.pSettings->pszTimeStampLog, gce->time), 99);
+ lstrcpyn(szTime, MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
FILE *hFile = _tfopen(szFile, _T("at+"));
if (hFile) {
TCHAR szTemp[512], szTemp2[512];
TCHAR* pszNick = NULL;
if ( gce->ptszNick ) {
- if ( ci.pSettings->LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
+ if ( g_Settings->LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
lstrcpyn(szTemp2, gce->ptszNick, 20);
lstrcpyn(szTemp2+20, _T("..."), 4);
}
@@ -622,23 +622,23 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) fputs(p, hFile);
mir_free(p);
- if (ci.pSettings->LoggingLimit > 0) {
+ if (g_Settings->LoggingLimit > 0) {
DWORD dwSize;
DWORD trimlimit;
fseek(hFile, 0, SEEK_END);
dwSize = ftell(hFile);
rewind(hFile);
- trimlimit = ci.pSettings->LoggingLimit * 1024 + 1024 * 10;
+ trimlimit = g_Settings->LoggingLimit * 1024 + 1024 * 10;
if (dwSize > trimlimit) {
BYTE * pBuffer = 0;
BYTE * pBufferTemp = 0;
int read = 0;
- pBuffer = (BYTE *)mir_alloc(ci.pSettings->LoggingLimit * 1024 + 1);
- pBuffer[ci.pSettings->LoggingLimit * 1024] = '\0';
- fseek(hFile, -ci.pSettings->LoggingLimit * 1024, SEEK_END);
- read = (int)fread(pBuffer, 1, ci.pSettings->LoggingLimit * 1024, hFile);
+ pBuffer = (BYTE *)mir_alloc(g_Settings->LoggingLimit * 1024 + 1);
+ pBuffer[g_Settings->LoggingLimit * 1024] = '\0';
+ fseek(hFile, -g_Settings->LoggingLimit * 1024, SEEK_END);
+ read = (int)fread(pBuffer, 1, g_Settings->LoggingLimit * 1024, hFile);
fclose(hFile);
hFile = NULL;
@@ -671,7 +671,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) return FALSE;
}
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, INT_PTR dwItem)
{
SESSION_INFO *si = ci.SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -691,7 +691,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int return TRUE;
}
-BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, DWORD dwItem)
+BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem)
{
SESSION_INFO *si = ci.SM_FindSession(pszID, pszModule);
if (si == NULL)
|