summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h17
-rw-r--r--src/core/stdchat/src/chat.h4
-rw-r--r--src/core/stdchat/src/log.cpp3
-rw-r--r--src/core/stdchat/src/main.cpp5
-rw-r--r--src/modules/chat/chat.h4
-rw-r--r--src/modules/chat/chat_opts.cpp6
-rw-r--r--src/modules/chat/log.cpp64
7 files changed, 61 insertions, 42 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index cccf5475b7..b98bc2cfc1 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -96,7 +96,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//structs
-struct MODULEINFO
+struct SESSION_INFO;
+struct MODULEINFO;
+struct LOGSTREAMDATA;
+
+struct GCModuleInfoBase
{
char* pszModule;
TCHAR* ptszModDispName;
@@ -164,7 +168,7 @@ struct USERINFO
USERINFO *next;
};
-struct SESSION_INFO
+struct GCSessionInfoBase
{
HWND hWnd;
@@ -215,10 +219,10 @@ struct SESSION_INFO
int iOldItemID;
interface IAccPropServices* pAccPropServicesForNickList;
- SESSION_INFO *next;
+ SESSION_INFO *next;
};
-struct LOGSTREAMDATA
+struct GCLogStreamDataBase
{
char* buffer;
int bufferOffset, bufferLen;
@@ -226,7 +230,7 @@ struct LOGSTREAMDATA
LOGINFO* lin;
BOOL bStripFormat;
BOOL bRedraw;
- SESSION_INFO *si;
+ SESSION_INFO *si;
};
struct GlobalLogSettingsBase
@@ -279,6 +283,8 @@ struct GlobalLogSettingsBase
BOOL ContactStatusFirst;
};
+/////////////////////////////////////////////////////////////////////////////////////////
+
struct CHAT_MANAGER
{
void (*SetActiveSession)(const TCHAR *pszID, const char *pszModule);
@@ -390,6 +396,7 @@ struct CHAT_MANAGER
TCHAR *szActiveWndID;
char *szActiveWndModule;
int logPixelSY, logPixelSX;
+ int cbModuleInfo, cbSession;
};
extern CHAT_MANAGER ci, *pci;
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h
index c0221d4f86..81cda11d63 100644
--- a/src/core/stdchat/src/chat.h
+++ b/src/core/stdchat/src/chat.h
@@ -79,6 +79,10 @@ struct TABLIST
TABLIST *next;
};
+struct MODULEINFO : public GCModuleInfoBase {};
+struct SESSION_INFO : public GCSessionInfoBase {};
+struct LOGSTREAMDATA : public GCLogStreamDataBase {};
+
struct GlobalLogSettings : public GlobalLogSettingsBase
{
BOOL TabsEnable;
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp
index ce1d10b9f6..1942fe9a3f 100644
--- a/src/core/stdchat/src/log.cpp
+++ b/src/core/stdchat/src/log.cpp
@@ -68,7 +68,8 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedr
HWND hwndRich = GetDlgItem(hwndDlg, IDC_LOG);
- LOGSTREAMDATA streamData = { 0 };
+ LOGSTREAMDATA streamData;
+ ZeroMemory(&streamData, sizeof(streamData));
streamData.hwnd = hwndRich;
streamData.si = si;
streamData.lin = lin;
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index b169f56595..ffacc93dc9 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -253,11 +253,12 @@ static void OnLoadSettings()
extern "C" __declspec(dllexport) int Load(void)
{
- // set the memory & utf8 managers
mir_getLP(&pluginInfo);
mir_getCLI();
mir_getCI(&g_Settings);
+ pci->cbModuleInfo = sizeof(MODULEINFO);
+ pci->cbSession = sizeof(SESSION_INFO);
pci->OnAddUser = OnAddUser;
pci->OnNewUser = OnNewUser;
pci->OnRemoveUser = OnRemoveUser;
@@ -284,6 +285,8 @@ extern "C" __declspec(dllexport) int Load(void)
g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));
AddIcons();
LoadIcons();
+
+ OnLoadSettings();
OptionsInit();
HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown);
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h
index 534a209855..b543d2f424 100644
--- a/src/modules/chat/chat.h
+++ b/src/modules/chat/chat.h
@@ -23,6 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_popup.h>
#include <m_fontservice.h>
+struct MODULEINFO : public GCModuleInfoBase {};
+struct SESSION_INFO : public GCSessionInfoBase {};
+struct LOGSTREAMDATA : public GCLogStreamDataBase {};
+
// special service for tweaking performance
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
typedef INT_PTR(*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp
index 0d5d422310..341d56db21 100644
--- a/src/modules/chat/chat_opts.cpp
+++ b/src/modules/chat/chat_opts.cpp
@@ -328,9 +328,9 @@ int OptionsInit(void)
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", 50);
- if (ci.pSettings->iSplitterY <= 20)
- ci.pSettings->iSplitterY = 50;
+ ci.pSettings->iSplitterY = db_get_w(NULL, "Chat", "SplitterY", 90);
+ if (ci.pSettings->iSplitterY <= 65)
+ ci.pSettings->iSplitterY = 90;
LoadGlobalSettings();
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp
index 61bbde9585..9f82a32b66 100644
--- a/src/modules/chat/log.cpp
+++ b/src/modules/chat/log.cpp
@@ -224,28 +224,28 @@ 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 ) {
- lstrcpyn( szTemp2, streamData->lin->ptszNick, 20 );
- lstrcpyn( szTemp2+20, _T("..."), 4);
+ if (streamData->lin->ptszNick) {
+ if (ci.pSettings->LogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
+ lstrcpyn(szTemp2, streamData->lin->ptszNick, 20);
+ lstrcpyn(szTemp2 + 20, _T("..."), 4);
}
- else lstrcpyn( szTemp2, streamData->lin->ptszNick, 511 );
+ else lstrcpyn(szTemp2, streamData->lin->ptszNick, 511);
- if ( streamData->lin->ptszUserInfo )
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, streamData->lin->ptszUserInfo );
+ if (streamData->lin->ptszUserInfo)
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, streamData->lin->ptszUserInfo);
else
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%s"), szTemp2 );
+ mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), szTemp2);
pszNick = szTemp;
}
- if ( streamData && streamData->lin ) {
- switch ( streamData->lin->iType ) {
+ if (streamData && streamData->lin) {
+ switch (streamData->lin->iType) {
case GC_EVENT_MESSAGE:
- if ( streamData->lin->ptszText )
- Log_AppendRTF( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText );
+ if (streamData->lin->ptszText)
+ Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
break;
case GC_EVENT_ACTION:
- if ( streamData->lin->ptszNick && streamData->lin->ptszText) {
+ if (streamData->lin->ptszNick && streamData->lin->ptszText) {
Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, _T("%s "), streamData->lin->ptszNick);
Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
}
@@ -286,7 +286,7 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
break;
case GC_EVENT_NOTICE:
if (pszNick && streamData->lin->ptszText) {
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s: "), pszNick );
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("Notice from %s: "), pszNick);
Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), streamData->lin->ptszText);
}
break;
@@ -294,9 +294,9 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
if (streamData->lin->ptszText)
Log_AppendRTF(streamData, FALSE, buffer, bufferEnd, bufferAlloced, TranslateT("The topic is \'%s%s\'"), streamData->lin->ptszText, _T("%r"));
if (streamData->lin->ptszNick)
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
- streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)"): TranslateT(" (set by %s)"),
- streamData->lin->ptszNick, streamData->lin->ptszUserInfo);
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced,
+ streamData->lin->ptszUserInfo ? TranslateT(" (set by %s on %s)") : TranslateT(" (set by %s)"),
+ streamData->lin->ptszNick, streamData->lin->ptszUserInfo);
break;
case GC_EVENT_INFORMATION:
if (streamData->lin->ptszText)
@@ -308,14 +308,14 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
break;
case GC_EVENT_REMOVESTATUS:
if (streamData->lin->ptszNick && streamData->lin->ptszText && streamData->lin->ptszStatus)
- Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s disables \'%s\' status for %s"), streamData->lin->ptszText , streamData->lin->ptszStatus, streamData->lin->ptszNick);
+ Log_AppendRTF(streamData, TRUE, buffer, bufferEnd, bufferAlloced, TranslateT("%s disables \'%s\' status for %s"), streamData->lin->ptszText, streamData->lin->ptszStatus, streamData->lin->ptszNick);
break;
} } }
-TCHAR* MakeTimeStamp( TCHAR* pszStamp, time_t time)
+TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time)
{
static TCHAR szTime[30];
- if ( !_tcsftime(szTime, SIZEOF(szTime)-1, pszStamp, localtime(&time)))
+ if (!_tcsftime(szTime, SIZEOF(szTime) - 1, pszStamp, localtime(&time)))
_tcsncpy(szTime, TranslateT("<invalid>"), SIZEOF(szTime));
return szTime;
}
@@ -329,8 +329,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
// guesstimate amount of memory for the RTF
bufferEnd = 0;
- bufferAlloced = streamData->bRedraw ? 1024 * (streamData->si->iEventCount+2) : 2048;
- buffer = (char *) mir_alloc(bufferAlloced);
+ bufferAlloced = streamData->bRedraw ? 1024 * (streamData->si->iEventCount + 2) : 2048;
+ buffer = (char *)mir_alloc(bufferAlloced);
buffer[0] = '\0';
// ### RTF HEADER
@@ -352,7 +352,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\f0\\fs14");
while (bufferAlloced - bufferEnd < logIconBmpSize[0])
bufferAlloced += 4096;
- buffer = (char *) mir_realloc(buffer, bufferAlloced);
+ buffer = (char *)mir_realloc(buffer, bufferAlloced);
CopyMemory(buffer + bufferEnd, pLogIconBmpBits[iIndex], logIconBmpSize[iIndex]);
bufferEnd += logIconBmpSize[iIndex];
}
@@ -364,17 +364,17 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
static char szStyle[256];
int iii;
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
- iii = lin->bIsHighlighted?16:(lin->bIsMe ? 2 : 1);
+ iii = lin->bIsHighlighted ? 16 : (lin->bIsMe ? 2 : 1);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
else {
- iii = lin->bIsHighlighted?16:EventToIndex(lin);
+ iii = lin->bIsHighlighted ? 16 : EventToIndex(lin);
mir_snprintf(szStyle, SIZEOF(szStyle), "\\f0\\cf%u\\ul0\\highlight0\\b%d\\i%d\\fs%u", iii + 1, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / ci.logPixelSY);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", szStyle);
}
}
- else Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(0, 0 ));
+ 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)
@@ -384,11 +384,11 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (ci.pSettings->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(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)) {
streamData->si->LastTime = lin->time;
- Log_AppendRTF( streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp );
+ Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
}
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\tab ");
}
@@ -408,7 +408,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
}
// Insert the message
- i = lin->bIsHighlighted?16:EventToIndex(lin);
+ i = lin->bIsHighlighted ? 16 : EventToIndex(lin);
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(i, i));
streamData->lin = lin;
AddEventToBuffer(&buffer, &bufferEnd, &bufferAlloced, streamData);
@@ -450,7 +450,7 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
for (i = 0; i < OPTIONS_FONTCOUNT; i++)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "\\red%u\\green%u\\blue%u;", GetRValue(ci.aFonts[i].color), GetGValue(ci.aFonts[i].color), GetBValue(ci.aFonts[i].color));
- for(i = 0; i < mi->nColorCount; i++)
+ 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]));
// new paragraph