summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-04 22:23:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-04 22:23:23 +0000
commitdc58876a244067b91cd927dad812a8f812a61712 (patch)
tree9e1a04f5f3fcfc02519f72087c597e63399a6e7b /plugins
parentca88cf375915e8da3e9c461bdc4b21ebb383fe05 (diff)
Scriver suddenly has its own replaceStrA/replaceStrT functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@7505 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Scriver/src/chat/chat.h6
-rw-r--r--plugins/Scriver/src/chat/manager.cpp51
-rw-r--r--plugins/Scriver/src/chat/options.cpp11
-rw-r--r--plugins/Scriver/src/chat/services.cpp14
-rw-r--r--plugins/Scriver/src/chat/tools.cpp219
-rw-r--r--plugins/Scriver/src/chat/window.cpp2
-rw-r--r--plugins/Scriver/src/msglog.cpp112
-rw-r--r--plugins/Scriver/src/msgoptions.cpp368
8 files changed, 371 insertions, 412 deletions
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index 0a702cd0f6..e88221baae 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -422,16 +422,14 @@ 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 IsEventSupported(int eventType);
-BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce);
+BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
// message.c
TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO *si);
//////////////////////////////////////////////////////////////////////////////////
-TCHAR* a2tf( const TCHAR* str, int flags );
-TCHAR* replaceStr( TCHAR** dest, const TCHAR* src );
-char* replaceStrA( char** dest, const char* src );
+TCHAR* a2tf(const TCHAR *str, int flags);
#define DEFLOGFILENAME _T("%miranda_logpath%\\%proto%\\%userid%.log")
#endif
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp
index 0c54c89940..02c6854f88 100644
--- a/plugins/Scriver/src/chat/manager.cpp
+++ b/plugins/Scriver/src/chat/manager.cpp
@@ -39,10 +39,11 @@ void SetActiveSession(const TCHAR* pszID, const char* pszModule)
void SetActiveSessionEx(SESSION_INFO *si)
{
- if ( si ) {
- replaceStr( &pszActiveWndID, si->ptszID );
- replaceStrA( &pszActiveWndModule, si->pszModule );
-} }
+ if (si) {
+ replaceStrT(pszActiveWndID, si->ptszID);
+ replaceStr(pszActiveWndModule, si->pszModule);
+ }
+}
SESSION_INFO* GetActiveSession( void )
{
@@ -631,9 +632,9 @@ BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID
while ( pTemp != NULL ) {
if (( !pszID || !lstrcmpi( pTemp->ptszID, pszID )) && !lstrcmpiA( pTemp->pszModule, pszModule )) {
- USERINFO* ui = UM_FindUser( pTemp->pUsers, pszUID );
- if ( ui )
- replaceStr( &ui->pszUID, pszNewUID );
+ USERINFO *ui = UM_FindUser(pTemp->pUsers, pszUID);
+ if (ui)
+ replaceStrT(ui->pszUID, pszNewUID);
if ( pszID )
return TRUE;
@@ -655,11 +656,11 @@ BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT * gce)
while ( pTemp != NULL ) {
if (( !pszID || !lstrcmpi( pTemp->ptszID, pszID )) && !lstrcmpiA( pTemp->pszModule, pszModule )) {
USERINFO* ui = UM_FindUser(pTemp->pUsers, gce->ptszUID );
- if ( ui ) {
- replaceStr( &ui->pszNick, gce->ptszText);
- SM_MoveUser( pTemp->ptszID, pTemp->pszModule, ui->pszUID );
- if ( pTemp->hWnd )
- SendMessage( pTemp->hWnd, GC_UPDATENICKLIST, 0, 0 );
+ if (ui) {
+ replaceStrT(ui->pszNick, gce->ptszText);
+ SM_MoveUser(pTemp->ptszID, pTemp->pszModule, ui->pszUID);
+ if (pTemp->hWnd)
+ SendMessage(pTemp->hWnd, GC_UPDATENICKLIST, 0, 0);
}
if (pszID)
@@ -670,11 +671,11 @@ BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT * gce)
}
return TRUE;
}
-BOOL SM_RemoveAll (void)
+
+BOOL SM_RemoveAll(void)
{
- while (m_WndList)
- {
- SESSION_INFO*pLast = m_WndList->next;
+ while (m_WndList) {
+ SESSION_INFO *pLast = m_WndList->next;
if (m_WndList->hWnd)
SendMessage(m_WndList->hWnd, GC_EVENT_CONTROL+WM_USER+500, SESSION_TERMINATE, 0);
@@ -691,12 +692,12 @@ BOOL SM_RemoveAll (void)
m_WndList->iStatusCount = 0;
m_WndList->nUsersInNicklist = 0;
- mir_free( m_WndList->pszModule );
- mir_free( m_WndList->ptszID );
- mir_free( m_WndList->ptszName );
- mir_free( m_WndList->ptszStatusbarText );
- mir_free( m_WndList->ptszTopic );
- mir_free( m_WndList->pszHeader);
+ mir_free(m_WndList->pszModule);
+ mir_free(m_WndList->ptszID);
+ mir_free(m_WndList->ptszName);
+ mir_free(m_WndList->ptszStatusbarText);
+ mir_free(m_WndList->ptszTopic);
+ mir_free(m_WndList->pszHeader);
tcmdlist_free(m_WndList->windowData.cmdList);
mir_free(m_WndList);
m_WndList = pLast;
@@ -926,7 +927,7 @@ STATUSINFO * TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int
if ( !TM_FindStatus(*ppStatusList, pszStatus)) {
STATUSINFO *node = (STATUSINFO*)mir_calloc(sizeof(STATUSINFO));
- replaceStr( &node->pszGroup, pszStatus );
+ replaceStrT(node->pszGroup, pszStatus);
node->hIcon = (HICON)(*iCount);
while ((INT_PTR)node->hIcon > STATUSICONCOUNT - 1)
node->hIcon--;
@@ -1117,14 +1118,14 @@ USERINFO* UM_AddUser(STATUSINFO* pStatusList, USERINFO** ppUserList, const TCHAR
// if (!UM_FindUser(*ppUserList, pszUI, wStatus)
{
USERINFO *node = (USERINFO*)mir_calloc(sizeof(USERINFO));
- replaceStr( &node->pszUID, pszUID );
+ replaceStrT(node->pszUID, pszUID);
if (*ppUserList == NULL) { // list is empty
*ppUserList = node;
node->next = NULL;
}
else {
- if ( pLast ) {
+ if (pLast) {
node->next = pTemp;
pLast->next = node;
}
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp
index 35a34aac4b..2d5370980f 100644
--- a/plugins/Scriver/src/chat/options.cpp
+++ b/plugins/Scriver/src/chat/options.cpp
@@ -225,21 +225,20 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p
void LoadLogFonts(void)
{
- int i;
- for ( i = 0; i<OPTIONS_FONTCOUNT; i++)
+ for (int i = 0; i<OPTIONS_FONTCOUNT; i++)
LoadMsgDlgFont(i, &aFonts[i].lf, &aFonts[i].color, TRUE);
}
-static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
+static void InitSetting(TCHAR **ppPointer, char *pszSetting, TCHAR *pszDefault)
{
DBVARIANT dbv;
if ( !db_get_ts(NULL, "Chat", pszSetting, &dbv )) {
- replaceStr( ppPointer, dbv.ptszVal );
+ replaceStrT(*ppPointer, dbv.ptszVal);
db_free(&dbv);
}
- else replaceStr( ppPointer, pszDefault );
- }
+ else replaceStrT(*ppPointer, pszDefault);
+}
#define OPT_FIXHEADINGS (WM_USER+1)
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp
index aa1b4c5891..30c4d1928b 100644
--- a/plugins/Scriver/src/chat/services.cpp
+++ b/plugins/Scriver/src/chat/services.cpp
@@ -306,28 +306,24 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp)
}
SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_EVENT_CONTROL + WM_USER + 500, wp, 0);
}
-
else if (gce->pDest->iType == GC_EVENT_CHUID && gce->pszText)
{
SM_ChangeUID( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText);
}
-
else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->pszText)
{
SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if ( si ) {
- replaceStr( &si->ptszName, gce->ptszText );
+ if (si) {
+ replaceStrT(si->ptszName, gce->ptszText);
if (si->hWnd)
SendMessage(si->hWnd, DM_UPDATETITLEBAR, 0, 0);
}
}
-
else if (gce->pDest->iType == GC_EVENT_SETITEMDATA) {
SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si)
si->dwItemData = gce->dwItemData;
}
-
else if (gce->pDest->iType ==GC_EVENT_GETITEMDATA) {
SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
@@ -340,8 +336,8 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp)
{
SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
- replaceStr( &si->ptszStatusbarText, gce->ptszText );
- if ( si->ptszStatusbarText )
+ replaceStrT(si->ptszStatusbarText, gce->ptszText);
+ if (si->ptszStatusbarText)
db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
else
db_set_s(si->windowData.hContact, si->pszModule, "StatusBar", "");
@@ -475,7 +471,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
case GC_EVENT_TOPIC:
if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
if (gce->pszText) {
- replaceStr( &si->ptszTopic, gce->ptszText);
+ replaceStrT(si->ptszTopic, gce->ptszText);
db_set_ts(si->windowData.hContact, si->pszModule , "Topic", RemoveFormatting(si->ptszTopic));
if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 ))
db_set_ts(si->windowData.hContact, "CList" , "StatusMsg", RemoveFormatting(si->ptszTopic));
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index ea3ce9918a..1f8dcc3389 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -27,12 +27,12 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord)
int i = 0;
int j = 0;
- if ( pszWord == 0 || lstrlen(pszWord) == 0 )
+ if (pszWord == 0 || lstrlen(pszWord) == 0)
return NULL;
- while(j < 9999 && i <= lstrlen( pszWord )) {
+ while (j < 9999 && i <= lstrlen(pszWord)) {
if (pszWord[i] == '%') {
- switch ( pszWord[i+1] ) {
+ switch (pszWord[i + 1]) {
case '%':
szTemp[j] = '%';
j++;
@@ -60,7 +60,8 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord)
j++;
i++;
break;
- } }
+ }
+ }
else {
szTemp[j] = pszWord[i];
j++;
@@ -68,7 +69,7 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord)
}
}
- return (TCHAR*) &szTemp;
+ return (TCHAR*)&szTemp;
}
static void __stdcall ShowRoomFromPopup(void * pi)
@@ -79,26 +80,22 @@ static void __stdcall ShowRoomFromPopup(void * pi)
static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) {
- SESSION_INFO *si = (SESSION_INFO*) PUGetPluginData(hWnd);
-
+ SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
CallFunctionAsync(ShowRoomFromPopup, si);
-
PUDeletePopup(hWnd);
return TRUE;
}
break;
case WM_CONTEXTMENU:
- {
- SESSION_INFO *si = (SESSION_INFO*) PUGetPluginData(hWnd);
- if (si->windowData.hContact)
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
+ if (si->windowData.hContact)
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- PUDeletePopup( hWnd );
- }
+ PUDeletePopup( hWnd );
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -116,20 +113,16 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszP
mir_vsntprintf(szBuf, 4096, fmt, marker);
va_end(marker);
- POPUPDATAT pd = {0};
+ POPUPDATAT pd = { 0 };
pd.lchContact = hContact;
-
- if ( hIcon )
- pd.lchIcon = hIcon ;
- else
- pd.lchIcon = GetCachedIcon("chat_window");
+ pd.lchIcon = (hIcon) ? hIcon : GetCachedIcon("chat_window");
PROTOACCOUNT *pa = ProtoGetAccount(pszProtoName);
- mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME-1, _T("%s - %s"),
+ mir_sntprintf(pd.lptzContactName, MAX_CONTACTNAME - 1, _T("%s - %s"),
(pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
pcli->pfnGetContactDisplayName(hContact, 0));
- lstrcpyn( pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
+ lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
pd.iSeconds = g_Settings.iPopupTimeout;
if (g_Settings.iPopupStyle == 2) {
@@ -154,13 +147,13 @@ static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce)
{
int iEvent = gce->pDest->iType;
- if ( iEvent&g_Settings.dwTrayIconFlags ) {
- switch ( iEvent ) {
- case GC_EVENT_MESSAGE|GC_EVENT_HIGHLIGHT :
- case GC_EVENT_ACTION|GC_EVENT_HIGHLIGHT :
+ if (iEvent&g_Settings.dwTrayIconFlags) {
+ switch (iEvent) {
+ case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
+ case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
CList_AddEvent(si->windowData.hContact, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), "chaticon", 0, TranslateT("%s wants your attention in %s"), gce->ptszNick, si->ptszName);
break;
- case GC_EVENT_MESSAGE :
+ case GC_EVENT_MESSAGE:
CList_AddEvent(si->windowData.hContact, GetCachedIcon("chat_log_message_in"), "chaticon", CLEF_ONLYAFEW, TranslateT("%s speaks in %s"), gce->ptszNick, si->ptszName);
break;
case GC_EVENT_ACTION:
@@ -206,16 +199,16 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce)
{
int iEvent = gce->pDest->iType;
- if ( iEvent & g_Settings.dwPopupFlags ) {
+ if (iEvent & g_Settings.dwPopupFlags) {
switch (iEvent) {
- case GC_EVENT_MESSAGE|GC_EVENT_HIGHLIGHT :
- ShowPopup(si->windowData.hContact, si, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting( gce->ptszText ));
+ case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
+ ShowPopup(si->windowData.hContact, si, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, aFonts[16].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
- case GC_EVENT_ACTION|GC_EVENT_HIGHLIGHT :
+ case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
ShowPopup(si->windowData.hContact, si, LoadSkinnedIcon(SKINICON_EVENT_MESSAGE), si->pszModule, si->ptszName, aFonts[16].color, _T("%s %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
- case GC_EVENT_MESSAGE :
- ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_message_in"), si->pszModule, si->ptszName, aFonts[9].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting( gce->ptszText));
+ case GC_EVENT_MESSAGE:
+ ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_message_in"), si->pszModule, si->ptszName, aFonts[9].color, TranslateT("%s says: %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION:
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_action"), si->pszModule, si->ptszName, aFonts[15].color, _T("%s %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
@@ -233,7 +226,7 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce)
if (!gce->pszText)
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_quit"), si->pszModule, si->ptszName, aFonts[5].color, TranslateT("%s has disconnected"), gce->ptszNick);
else
- ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_quit"), si->pszModule, si->ptszName, aFonts[5].color, TranslateT("%s has disconnected (%s)"), gce->ptszNick,RemoveFormatting(gce->ptszText));
+ ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_quit"), si->pszModule, si->ptszName, aFonts[5].color, TranslateT("%s has disconnected (%s)"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_NICK:
ShowPopup(si->windowData.hContact, si, GetCachedIcon("chat_log_nick"), si->pszModule, si->ptszName, aFonts[7].color, TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
@@ -270,7 +263,7 @@ static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce)
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighlight, int bManyFix)
{
- if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
+ if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
BOOL bInactive = si->hWnd == NULL || GetForegroundWindow() != GetParent(si->hWnd);
@@ -278,7 +271,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighligh
int iEvent = gce->pDest->iType;
- if ( bHighlight ) {
+ if (bHighlight) {
gce->pDest->iType |= GC_EVENT_HIGHLIGHT;
if (bInactive || !g_Settings.SoundsFocus)
SkinPlaySound("ChatHighlight");
@@ -334,9 +327,9 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighligh
if (bInactive && g_Settings.FlashWindow && si->hWnd)
SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- if (bInactive && !( si->wState & STATE_TALK )) {
+ if (bInactive && !(si->wState & STATE_TALK)) {
si->wState |= STATE_TALK;
- db_set_w(si->windowData.hContact, si->pszModule,"ApparentMode",(LPARAM)(WORD) 40071);
+ db_set_w(si->windowData.hContact, si->pszModule, "ApparentMode", (LPARAM)(WORD)40071);
}
if (bInactive && si->hWnd)
SendMessage(si->hWnd, GC_SETTABHIGHLIGHT, 0, 0);
@@ -365,7 +358,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighligh
int GetColorIndex(const char* pszModule, COLORREF cr)
{
- MODULEINFO * pMod = MM_FindModule(pszModule);
+ MODULEINFO *pMod = MM_FindModule(pszModule);
if (!pMod || pMod->nColorCount == 0)
return -1;
@@ -383,18 +376,18 @@ int GetColorIndex(const char* pszModule, COLORREF cr)
void CheckColorsInModule(const char* pszModule)
{
- MODULEINFO *pMod = MM_FindModule( pszModule );
+ MODULEINFO *pMod = MM_FindModule(pszModule);
COLORREF crFG;
COLORREF crBG = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFG, FALSE);
- if ( !pMod )
+ if (!pMod)
return;
for (int i = 0; i < pMod->nColorCount; i++) {
if (pMod->crColors[i] == crFG || pMod->crColors[i] == crBG) {
- if (pMod->crColors[i] == RGB(255,255,255))
+ if (pMod->crColors[i] == RGB(255, 255, 255))
pMod->crColors[i]--;
else
pMod->crColors[i]++;
@@ -402,19 +395,19 @@ void CheckColorsInModule(const char* pszModule)
}
}
-TCHAR* my_strstri( const TCHAR* s1, const TCHAR* s2)
+TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2)
{
- for(int i=0;s1[i];i++)
- for(int j=i,k=0; _totlower(s1[j]) == _totlower(s2[k]);j++,k++)
- if (!s2[k+1])
- return (TCHAR*)(s1+i);
+ for (int i = 0; s1[i]; i++)
+ for (int j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
+ if (!s2[k + 1])
+ return (TCHAR*)(s1 + i);
return NULL;
}
BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
{
- if ( g_Settings.HighlightEnabled && g_Settings.pszHighlightWords && pszText && si->pMe ) {
+ if (g_Settings.HighlightEnabled && g_Settings.pszHighlightWords && pszText && si->pMe) {
TCHAR* p1 = g_Settings.pszHighlightWords;
TCHAR* p2 = NULL;
const TCHAR* p3 = pszText;
@@ -426,7 +419,7 @@ BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
while (*p1 != '\0') {
// find the next/first word in the highlight word string
// skip 'spaces' be4 the word
- while(*p1 == ' ' && *p1 != '\0')
+ while (*p1 == ' ' && *p1 != '\0')
p1 += 1;
//find the end of the word
@@ -437,7 +430,7 @@ BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
return FALSE;
// copy the word into szWord1
- lstrcpyn(szWord1, p1, p2-p1>998?999:p2-p1+1);
+ lstrcpyn(szWord1, p1, p2 - p1 > 998 ? 999 : p2 - p1 + 1);
p1 = p2;
// replace %m with the users nickname
@@ -451,10 +444,9 @@ BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
}
// time to get the next/first word in the incoming text string
- while(*p3 != '\0')
- {
+ while (*p3 != '\0') {
// skip 'spaces' be4 the word
- while(*p3 == ' ' && *p3 != '\0')
+ while (*p3 == ' ' && *p3 != '\0')
p3 += 1;
//find the end of the word
@@ -465,11 +457,11 @@ BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
if (p3 != p2) {
// eliminate ending character if needed
- if (p2-p3 > 1 && _tcschr(szTrimString, p2[-1]))
+ if (p2 - p3 > 1 && _tcschr(szTrimString, p2[-1]))
p2 -= 1;
// copy the word into szWord2 and remove formatting
- lstrcpyn(szWord2, p3, p2-p3>998?999:p2-p3+1);
+ lstrcpyn(szWord2, p3, p2 - p3 > 998 ? 999 : p2 - p3 + 1);
// reset the pointer if it was touched because of an ending character
if (*p2 != '\0' && *p2 != ' ')
@@ -482,10 +474,12 @@ BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
// compare the words, using wildcards
if (WCCmp(szWord1, RemoveFormatting(szWord2)))
return TRUE;
- } }
+ }
+ }
p3 = pszText;
- } }
+ }
+ }
return FALSE;
}
@@ -503,7 +497,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
return FALSE;
MODULEINFO *mi = MM_FindModule(si->pszModule);
- if ( !mi )
+ if (!mi)
return FALSE;
szBuffer[0] = '\0';
@@ -523,10 +517,10 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
TCHAR* pszNick = NULL;
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
- if ( gce->ptszNick ) {
- if ( g_Settings.LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
+ if (gce->ptszNick) {
+ if (g_Settings.LogLimitNames && lstrlen(gce->ptszNick) > 20) {
lstrcpyn(szTemp2, gce->ptszNick, 20);
- lstrcpyn(szTemp2+20, _T("..."), 4);
+ lstrcpyn(szTemp2 + 20, _T("..."), 4);
}
else lstrcpyn(szTemp2, gce->ptszNick, 511);
@@ -536,15 +530,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), szTemp2);
pszNick = szTemp;
}
- switch (gce->pDest->iType)
- {
+ switch (gce->pDest->iType) {
case GC_EVENT_MESSAGE:
- case GC_EVENT_MESSAGE|GC_EVENT_HIGHLIGHT:
+ case GC_EVENT_MESSAGE | GC_EVENT_HIGHLIGHT:
p = '*';
mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s * %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
case GC_EVENT_ACTION:
- case GC_EVENT_ACTION|GC_EVENT_HIGHLIGHT:
+ case GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT:
p = '*';
mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s %s"), gce->ptszNick, RemoveFormatting(gce->ptszText));
break;
@@ -558,14 +551,14 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left"), (char*)pszNick);
else
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has left (%s)"), (char*)pszNick, RemoveFormatting(gce->ptszText));
- break;
+ break;
case GC_EVENT_QUIT:
p = '<';
if (!gce->pszText)
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected"), (char*)pszNick);
else
- mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected (%s)"), (char*)pszNick,RemoveFormatting(gce->ptszText));
- break;
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s has disconnected (%s)"), (char*)pszNick, RemoveFormatting(gce->ptszText));
+ break;
case GC_EVENT_NICK:
p = '^';
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s is now known as %s"), gce->ptszNick, gce->ptszText);
@@ -623,9 +616,9 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
size_t read = 0;
pBuffer = (BYTE *)mir_alloc(g_Settings.LoggingLimit * 1024 + 2);
- pBuffer[g_Settings.LoggingLimit*1024] = '\0';
- pBuffer[g_Settings.LoggingLimit*1024+1] = '\0';
- fseek(hFile, -g_Settings.LoggingLimit*1024, SEEK_END);
+ pBuffer[g_Settings.LoggingLimit * 1024] = '\0';
+ pBuffer[g_Settings.LoggingLimit * 1024 + 1] = '\0';
+ fseek(hFile, -g_Settings.LoggingLimit * 1024, SEEK_END);
read = fread(pBuffer, 1, g_Settings.LoggingLimit * 1024, hFile);
fclose(hFile);
hFile = NULL;
@@ -633,9 +626,10 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
// trim to whole lines, should help with broken log files I hope.
pBufferTemp = (BYTE*)_tcschr((TCHAR*)pBuffer, _T('\n'));
if (pBufferTemp) {
- pBufferTemp+= sizeof(TCHAR);
+ pBufferTemp += sizeof(TCHAR);
read = read - (pBufferTemp - pBuffer);
- } else pBufferTemp = pBuffer;
+ }
+ else pBufferTemp = pBuffer;
if (read > 0) {
hFile = _tfopen(tszFile, _T("wb"));
@@ -644,9 +638,12 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
fwrite(pBufferTemp, 1, read, hFile);
fclose(hFile);
hFile = NULL;
- } }
+ }
+ }
mir_free(pBuffer);
- } } }
+ }
+ }
+ }
if (hFile)
fclose(hFile);
@@ -658,7 +655,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText)
{
- GCMENUITEMS gcmi = {0};
+ GCMENUITEMS gcmi = { 0 };
HMENU hSubMenu = 0;
*hMenu = GetSubMenu(g_hMenu, iIndex);
@@ -676,17 +673,16 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s
EnableMenuItem(*hMenu, IDM_CLEAR, MF_BYCOMMAND | MF_GRAYED);
}
- if ( pszWordText && pszWordText[0] ) {
+ if (pszWordText && pszWordText[0]) {
TCHAR szMenuText[4096];
- mir_sntprintf( szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWordText );
- ModifyMenu( *hMenu, 4, MF_STRING|MF_BYPOSITION, 4, szMenuText );
+ mir_sntprintf(szMenuText, 4096, TranslateT("Look up \'%s\':"), pszWordText);
+ ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText);
SetSearchEngineIcons(*hMenu, g_dat.hSearchEngineIconList);
}
- else ModifyMenu( *hMenu, 4, MF_STRING|MF_GRAYED|MF_BYPOSITION, 4, TranslateT( "No word to look up" ));
+ else ModifyMenu(*hMenu, 4, MF_STRING | MF_GRAYED | MF_BYPOSITION, 4, TranslateT("No word to look up"));
gcmi.Type = MENU_ON_LOG;
}
- else if (iIndex == 0)
- {
+ else if (iIndex == 0) {
TCHAR szTemp[50];
if (pszWordText)
mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("&Message %s"), pszWordText);
@@ -705,8 +701,8 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s
AppendMenu(*hMenu, MF_SEPARATOR, 0, 0);
for (int i = 0; i < gcmi.nItems; i++) {
- TCHAR* ptszDescr = a2tf(gcmi.Item[i].pszDesc, si->dwFlags);
- TCHAR* ptszText = TranslateTS(ptszDescr);
+ TCHAR *ptszDescr = a2tf(gcmi.Item[i].pszDesc, si->dwFlags);
+ TCHAR *ptszText = TranslateTS(ptszDescr);
DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0;
if (gcmi.Item[i].uType == MENU_NEWPOPUP) {
@@ -750,26 +746,23 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex)
BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
{
- GCHOOK* gch = (GCHOOK*)mir_alloc( sizeof( GCHOOK ));
- GCDEST* gcd = (GCDEST*)mir_alloc( sizeof( GCDEST ));
-
- memset( gch, 0, sizeof( GCHOOK ));
- memset( gcd, 0, sizeof( GCDEST ));
+ GCHOOK *gch = (GCHOOK*)mir_calloc(sizeof(GCHOOK));
+ GCDEST *gcd = (GCDEST*)mir_calloc(sizeof(GCDEST));
- replaceStrA( &gcd->pszModule, pszModule);
+ replaceStr(gcd->pszModule, pszModule);
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
return FALSE;
- if ( !( si->dwFlags & GC_UNICODE )) {
+ if (!(si->dwFlags & GC_UNICODE)) {
gcd->pszID = mir_t2a(pszID);
gch->pszUID = mir_t2a(pszUID);
gch->pszText = mir_t2a(pszText);
}
else {
- replaceStr(&gcd->ptszID, pszID);
- replaceStr(&gch->ptszUID, pszUID);
- replaceStr(&gch->ptszText, pszText);
+ replaceStrT(gcd->ptszID, pszID);
+ replaceStrT(gch->ptszUID, pszUID);
+ replaceStrT(gch->ptszText, pszText);
}
gcd->iType = iType;
@@ -781,15 +774,15 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
{
- GCHOOK gch = {0};
- GCDEST gcd = {0};
+ GCHOOK gch = { 0 };
+ GCDEST gcd = { 0 };
gcd.pszModule = (char*)pszModule;
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
return FALSE;
- if ( !(si->dwFlags & GC_UNICODE)) {
+ if (!(si->dwFlags & GC_UNICODE)) {
gcd.pszID = mir_t2a(pszID);
gch.pszUID = mir_t2a(pszUID);
gch.pszText = mir_t2a(pszText);
@@ -845,7 +838,7 @@ BOOL IsEventSupported(int eventType)
return FALSE;
}
-TCHAR* a2tf( const TCHAR* str, int flags )
+TCHAR* a2tf(const TCHAR* str, int flags)
{
if (str == NULL)
return NULL;
@@ -856,7 +849,7 @@ TCHAR* a2tf( const TCHAR* str, int flags )
int codepage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
int cbLen = MultiByteToWideChar(codepage, 0, (char*)str, -1, 0, 0);
- TCHAR *result = (TCHAR*)mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
+ TCHAR *result = (TCHAR*)mir_alloc(sizeof(TCHAR)*(cbLen + 1));
if (result == NULL)
return NULL;
@@ -865,26 +858,12 @@ TCHAR* a2tf( const TCHAR* str, int flags )
return result;
}
-TCHAR* replaceStr( TCHAR** dest, const TCHAR* src )
-{
- mir_free(*dest);
- *dest = mir_tstrdup(src);
- return *dest;
-}
-
-char* replaceStrA( char** dest, const char* src )
-{
- mir_free(*dest);
- *dest = mir_strdup(src);
- return *dest;
-}
-
-TCHAR* GetChatLogsFilename (HANDLE hContact, time_t tTime)
+TCHAR* GetChatLogsFilename(HANDLE hContact, time_t tTime)
{
REPLACEVARSARRAY rva[11];
- TCHAR *p = {0}, *tszParsedName = {0};
+ TCHAR *p = { 0 }, *tszParsedName = { 0 };
- if (g_Settings.pszLogDir[_tcslen(g_Settings.pszLogDir)-1] == '\\')
+ if (g_Settings.pszLogDir[_tcslen(g_Settings.pszLogDir) - 1] == '\\')
_tcscat(g_Settings.pszLogDir, _T("%userid%.log"));
if (!tTime)
time(&tTime);
@@ -933,11 +912,11 @@ TCHAR* GetChatLogsFilename (HANDLE hContact, time_t tTime)
_tcsncpy(tszFileName, tszParsedName, MAX_PATH);
mir_free(tszParsedName);
- for (int i=0; i < SIZEOF(rva);i++)
+ for (int i = 0; i < SIZEOF(rva); i++)
mir_free(rva[i].lptzValue);
for (p = tszFileName + 2; *p; ++p)
- if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|' )
+ if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|')
*p = _T('_');
return tszFileName;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 3b699c035a..20ae57859c 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -1614,7 +1614,7 @@ LABEL_SHOWWINDOW:
case GC_FIREHOOK:
if (lParam) {
- GCHOOK* gch = (GCHOOK *) lParam;
+ GCHOOK *gch = (GCHOOK *) lParam;
NotifyEventHooks(hSendEvent,0,(WPARAM)gch);
if ( gch->pDest ) {
mir_free( gch->pDest->pszID );
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 86a0061116..f1255c6456 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -124,8 +124,8 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto)
int DbEventIsCustomForMsgWindow(DBEVENTINFO *dbei)
{
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
- return et && ( et->flags & DETF_MSGWINDOW );
+ DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)CallService(MS_DB_EVENT_GETTYPE, (WPARAM)dbei->szModule, (LPARAM)dbei->eventType);
+ return et && (et->flags & DETF_MSGWINDOW);
}
int DbEventIsMessageOrCustom(DBEVENTINFO* dbei)
@@ -151,7 +151,7 @@ int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat)
return DbEventIsCustomForMsgWindow(dbei);
}
-EventData *getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent)
+EventData* getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent)
{
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = db_event_getBlobSize(hDbEvent);
@@ -168,7 +168,7 @@ EventData *getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hD
evt->custom = DbEventIsCustomForMsgWindow(&dbei);
if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_URL || evt->custom)) {
db_event_markRead(hContact, hDbEvent);
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM) hContact, (LPARAM)hDbEvent);
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hDbEvent);
}
else if (dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE)
db_event_markRead(hContact, hDbEvent);
@@ -177,7 +177,7 @@ EventData *getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hD
evt->dwFlags = (dbei.flags & DBEF_READ ? IEEDF_READ : 0) | (dbei.flags & DBEF_SENT ? IEEDF_SENT : 0) | (dbei.flags & DBEF_RTL ? IEEDF_RTL : 0);
evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
- if ( dat->flags & SMF_RTL)
+ if (dat->flags & SMF_RTL)
evt->dwFlags |= IEEDF_RTL;
evt->time = dbei.timestamp;
@@ -193,32 +193,30 @@ EventData *getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hD
char *filename = ((char*)dbei.pBlob) + sizeof(DWORD);
char *descr = filename + lstrlenA(filename) + 1;
evt->pszTextT = DbGetEventStringT(&dbei, filename);
- if ( *descr != 0 )
+ if (*descr != 0)
evt->pszText2T = DbGetEventStringT(&dbei, descr);
}
- else evt->pszTextT = DbGetEventTextT( &dbei, dat->windowData.codePage );
+ else evt->pszTextT = DbGetEventTextT(&dbei, dat->windowData.codePage);
- if ( !(dat->flags & SMF_RTL))
- if ( RTL_Detect(evt->pszTextT))
- evt->dwFlags |= IEEDF_RTL;
+ if (!(dat->flags & SMF_RTL) && RTL_Detect(evt->pszTextT))
+ evt->dwFlags |= IEEDF_RTL;
mir_free(dbei.pBlob);
return evt;
}
-static EventData *GetTestEvent(DWORD flags)
+static EventData* GetTestEvent(DWORD flags)
{
- EventData *evt = (EventData *) mir_alloc(sizeof(EventData));
- memset(evt, 0, sizeof(EventData));
+ EventData *evt = (EventData *)mir_calloc(sizeof(EventData));
evt->eventType = EVENTTYPE_MESSAGE;
evt->dwFlags = IEEDF_READ | flags;
evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
evt->time = time(NULL);
evt->codePage = CP_ACP;
- return evt;
+ return evt;
}
-static EventData *GetTestEvents()
+static EventData* GetTestEvents()
{
EventData *evt, *firstEvent, *prevEvent;
firstEvent = prevEvent = evt = GetTestEvent(IEEDF_SENT);
@@ -261,7 +259,7 @@ static int AppendUnicodeOrAnsiiToBufferL(char **buffer, int *cbBufferEnd, int *c
int lineLen = (int)wcslen(line) * 9 + 8;
if (*cbBufferEnd + lineLen > *cbBufferAlloced) {
cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024);
- *buffer = (char*) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char*)mir_realloc(*buffer, *cbBufferAlloced);
}
char *d = *buffer + *cbBufferEnd;
@@ -293,10 +291,10 @@ static int AppendUnicodeOrAnsiiToBufferL(char **buffer, int *cbBufferEnd, int *c
}
else if (*line == '\\' || *line == '{' || *line == '}') {
*d++ = '\\';
- *d++ = (char) *line;
+ *d++ = (char)*line;
}
else if (*line < 128) {
- *d++ = (char) *line;
+ *d++ = (char)*line;
}
else if (isAnsii) {
d += sprintf(d, "\\'%02x", (*line) & 0xFF); //!!!!!!!!!!
@@ -312,7 +310,7 @@ static int AppendUnicodeOrAnsiiToBufferL(char **buffer, int *cbBufferEnd, int *c
strcpy(d, "}");
d++;
- *cbBufferEnd = (int) (d - *buffer);
+ *cbBufferEnd = (int)(d - *buffer);
return textCharsCount;
}
@@ -392,29 +390,27 @@ static char *CreateRTFHeader(struct SrmmWindowData *dat, struct GlobalMessageDat
}
//mir_free() the return value
-static char *CreateRTFTail()
+static char* CreateRTFTail()
{
int bufferAlloced = 1024, bufferEnd = 0;
- char *buffer = (char*) mir_alloc(bufferAlloced);
+ char *buffer = (char*)mir_alloc(bufferAlloced);
buffer[0] = '\0';
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "}");
return buffer;
}
//return value is static
-static char *SetToStyle(int style)
+static char* SetToStyle(int style)
{
static char szStyle[128];
LOGFONT lf;
-
LoadMsgDlgFont(style, &lf, NULL, FALSE);
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;
}
// mode: 0 - date & time, 1 - date, 2 - time
-
-TCHAR *TimestampToString(DWORD dwFlags, time_t check, int mode)
+TCHAR* TimestampToString(DWORD dwFlags, time_t check, int mode)
{
static TCHAR szResult[512];
TCHAR str[80];
@@ -463,10 +459,9 @@ TCHAR *TimestampToString(DWORD dwFlags, time_t check, int mode)
int isSameDate(time_t time1, time_t time2)
{
- struct tm tm_t1, tm_t2;
- tm_t1 = *localtime((time_t *)(&time1));
- tm_t2 = *localtime((time_t *)(&time2));
- if (tm_t1.tm_year == tm_t2.tm_year && tm_t1.tm_mon == tm_t2.tm_mon
+ struct tm tm_t1 = *localtime((time_t *)(&time1));
+ struct tm tm_t2 = *localtime((time_t *)(&time2));
+ if (tm_t1.tm_year == tm_t2.tm_year && tm_t1.tm_mon == tm_t2.tm_mon
&& tm_t1.tm_mday == tm_t2.tm_mday) {
return 1;
}
@@ -506,11 +501,10 @@ static int DetectURL(wchar_t *text, BOOL firstChar) {
}
if (found) {
for (; text[len]!='\n' && text[len]!='\r' && text[len]!='\t' && text[len]!=' ' && text[len]!='\0'; len++);
- for (; len > 0; len --) {
- if ((text[len-1] >= '0' && text[len-1]<='9') || iswalpha(text[len-1])) {
+ for (; len > 0; len --)
+ if ((text[len-1] >= '0' && text[len-1]<='9') || iswalpha(text[len-1]))
break;
- }
- }
+
return len;
}
}
@@ -536,9 +530,9 @@ static void AppendWithCustomLinks(EventData *evt, int style, char **buffer, int
wText = evt->pszTextW;
len = (int)wcslen(evt->pszTextW);
}
- for (j = 0; j < len ; j++) {
+ for (j = 0; j < len; j++) {
int newtoken = 0;
- int l = DetectURL(wText + j, j==0);
+ int l = DetectURL(wText + j, j == 0);
if (l > 0)
newtoken = 1;
@@ -569,7 +563,7 @@ static void AppendWithCustomLinks(EventData *evt, int style, char **buffer, int
}
//mir_free() the return value
-static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *evt, struct GlobalMessageData *gdat, struct LogStreamData *streamData)
+static char* CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *evt, struct GlobalMessageData *gdat, struct LogStreamData *streamData)
{
char *buffer;
int bufferAlloced, bufferEnd;
@@ -601,7 +595,7 @@ static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *evt, stru
if (!streamData->isFirst && isGroupBreak && (gdat->flags & SMF_DRAWLINES))
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\sl-1\\slmult0\\highlight%d\\cf%d\\fs1 \\par\\sl0", fontOptionsListSize + 4, fontOptionsListSize + 4);
- if ( streamData->isFirst ) {
+ if (streamData->isFirst) {
if (evt->dwFlags & IEEDF_RTL)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\rtlpar");
else
@@ -618,7 +612,7 @@ static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *evt, stru
else
highlight = fontOptionsListSize + 1;
- AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d\\cf%d", highlight , highlight );
+ AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\highlight%d\\cf%d", highlight, highlight);
if (!streamData->isFirst && dat->isMixed) {
if (isGroupBreak)
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\sl-1 \\par\\sl0");
@@ -654,7 +648,7 @@ static char *CreateRTFFromEvent(struct SrmmWindowData *dat, EventData *evt, stru
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\fs1 ");
while (bufferAlloced - bufferEnd < logIconBmpSize[i])
bufferAlloced += 1024;
- buffer = (char*) mir_realloc(buffer, bufferAlloced);
+ buffer = (char*)mir_realloc(buffer, bufferAlloced);
CopyMemory(buffer + bufferEnd, pLogIconBmpBits[i], logIconBmpSize[i]);
bufferEnd += logIconBmpSize[i];
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, " ");
@@ -806,7 +800,8 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
dat->hDbEvent = db_event_next(dat->hDbEvent);
if (--dat->eventsToInsert == 0)
break;
- } while (dat->buffer == NULL && dat->hDbEvent);
+ }
+ while (dat->buffer == NULL && dat->hDbEvent);
}
if (dat->buffer)
break;
@@ -835,16 +830,17 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
void StreamInTestEvents(HWND hEditWnd, struct GlobalMessageData *gdat)
{
- EDITSTREAM stream = { 0 };
- struct LogStreamData streamData = { 0 };
struct SrmmWindowData dat = { 0 };
+ struct LogStreamData streamData = { 0 };
streamData.isFirst = TRUE;
streamData.events = GetTestEvents();
streamData.dlgDat = &dat;
streamData.gdat = gdat;
+
+ EDITSTREAM stream = { 0 };
stream.pfnCallback = LogStreamInEvents;
stream.dwCookie = (DWORD_PTR) & streamData;
- SendMessage(hEditWnd, EM_STREAMIN, SF_RTF, (LPARAM)& stream);
+ SendMessage(hEditWnd, EM_STREAMIN, SF_RTF, (LPARAM)&stream);
SendMessage(hEditWnd, EM_HIDESELECTION, FALSE, 0);
}
@@ -856,7 +852,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
struct SrmmWindowData *dat = (struct SrmmWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
CHARRANGE oldSel, sel;
-// IEVIew MOD Begin
+ // IEVIew MOD Begin
if (dat->windowData.hwndLog != NULL) {
IEVIEWEVENT evt;
IEVIEWWINDOW ieWindow;
@@ -896,17 +892,18 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
streamData.isFirst = fAppend ? GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE) == 0 : 1;
streamData.gdat = &g_dat;
stream.pfnCallback = LogStreamInEvents;
- stream.dwCookie = (DWORD_PTR) & streamData;
+ stream.dwCookie = (DWORD_PTR)& streamData;
sel.cpMin = 0;
if (fAppend) {
- GETTEXTLENGTHEX gtxl = {0};
+ GETTEXTLENGTHEX gtxl = { 0 };
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
gtxl.codepage = 1200;
gtxl.codepage = 1200;
fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)&gtxl, 0);
sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& sel);
- } else {
+ }
+ else {
SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, FALSE, 0);
SetDlgItemText(hwndDlg, IDC_LOG, _T(""));
sel.cpMin = 0;
@@ -916,7 +913,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
dat->isMixed = 0;
}
- SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)& stream);
+ SendDlgItemMessage(hwndDlg, IDC_LOG, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)& stream);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)& oldSel);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_HIDESELECTION, FALSE, 0);
if (g_dat.smileyAddInstalled) {
@@ -924,8 +921,8 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend)
smre.cbSize = sizeof(SMADD_RICHEDIT3);
smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG);
smre.Protocolname = dat->szProto;
- if (dat->szProto != NULL && strcmp(dat->szProto,"MetaContacts") == 0) {
- HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0);
+ if (dat->szProto != NULL && strcmp(dat->szProto, "MetaContacts") == 0) {
+ HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0);
if (hContact != NULL)
smre.Protocolname = GetContactProto(hContact);
}
@@ -976,7 +973,7 @@ void LoadMsgLogIcons(void)
HDC hdc = GetDC(NULL);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
- PBYTE pBmpBits = (PBYTE) mir_alloc(widthBytes * bih.biHeight);
+ PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight);
HBRUSH hBrush = hBkgBrush;
for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++) {
switch (i) {
@@ -996,19 +993,19 @@ void LoadMsgLogIcons(void)
hBrush = hBkgBrush;
break;
}
- pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2);
+ pLogIconBmpBits[i] = (PBYTE)mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2);
//I can't seem to get binary mode working. No matter.
- int rtfHeaderSize = sprintf((char*)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, (UINT) bih.biWidth, (UINT)bih.biHeight); //!!!!!!!!!!!
- HBITMAP hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp);
+ int rtfHeaderSize = sprintf((char*)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, (UINT)bih.biWidth, (UINT)bih.biHeight); //!!!!!!!!!!!
+ HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBrush);
DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
SelectObject(hdcMem, hoBmp);
- GetDIBits(hdc, hBmp, 0, bih.biHeight, pBmpBits, (BITMAPINFO *) & bih, DIB_RGB_COLORS);
+ GetDIBits(hdc, hBmp, 0, bih.biHeight, pBmpBits, (BITMAPINFO *)& bih, DIB_RGB_COLORS);
DestroyIcon(hIcon);
int n;
for (n = 0; n < sizeof(BITMAPINFOHEADER); n++)
- sprintf((char*)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]); //!!!!!!!!!!!!!!
+ sprintf((char*)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE)& bih)[n]); //!!!!!!!!!!!!!!
for (n = 0; n < widthBytes * bih.biHeight; n += 4)
sprintf((char*)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]); //!!!!!!!!!!!!!!!!
@@ -1026,8 +1023,9 @@ void LoadMsgLogIcons(void)
void FreeMsgLogIcons(void)
{
- for (int i = 0; i < sizeof(pLogIconBmpBits) / sizeof(pLogIconBmpBits[0]); i++)
+ for (int i = 0; i < SIZEOF(pLogIconBmpBits); i++)
mir_free(pLogIconBmpBits[i]);
+
ImageList_RemoveAll(g_hImageList);
ImageList_Destroy(g_hImageList);
}
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index 28be26a9dd..84fa594a11 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -30,19 +30,20 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar
INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-typedef struct TabDefStruct {
+struct TabDef
+{
DLGPROC dlgProc;
DWORD dlgId;
const char *tabName;
-} TabDef;
+};
static const TabDef tabPages[] = {
- {DlgProcOptions, IDD_OPT_MSGDLG, LPGEN("General")},
- {DlgProcTabsOptions, IDD_OPT_MSGTABS, LPGEN("Tabs")},
- {DlgProcLayoutOptions, IDD_OPT_LAYOUT, LPGEN("Layout")},
- {DlgProcLogOptions, IDD_OPT_MSGLOG, LPGEN("Event Log")},
- {DlgProcOptions1, IDD_OPTIONS1, LPGEN("Group Chat")},
- {DlgProcOptions2, IDD_OPTIONS2, LPGEN("Group Chat Log")}
+ { DlgProcOptions, IDD_OPT_MSGDLG, LPGEN("General") },
+ { DlgProcTabsOptions, IDD_OPT_MSGTABS, LPGEN("Tabs") },
+ { DlgProcLayoutOptions, IDD_OPT_LAYOUT, LPGEN("Layout") },
+ { DlgProcLogOptions, IDD_OPT_MSGLOG, LPGEN("Event Log") },
+ { DlgProcOptions1, IDD_OPTIONS1, LPGEN("Group Chat") },
+ { DlgProcOptions2, IDD_OPTIONS2, LPGEN("Group Chat Log") }
};
#define FONTF_BOLD 1
@@ -117,10 +118,8 @@ static const colourOptionsList[] = {
{ LPGENT("Info bar background"), SRMSGSET_INFOBARBKGCOLOUR, 0, COLOR_3DLIGHT},
};
-
int Chat_FontsChanged(WPARAM wParam,LPARAM lParam);
-
int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam)
{
LoadMsgLogIcons();
@@ -132,21 +131,21 @@ int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam)
static BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
{
- return DEFAULT_CHARSET;
+ return DEFAULT_CHARSET;
}
-void RegisterFontServiceFonts() {
+void RegisterFontServiceFonts()
+{
int i;
- char szTemp[100];
- FontIDT fid = {0};
- ColourIDT cid = {0};
- fid.cbSize = sizeof(FontIDT);
- mir_sntprintf(fid.group, SIZEOF(fid.group), _T("%s"), LPGENT("Messaging"));
- mir_sntprintf(fid.backgroundGroup, SIZEOF(fid.backgroundGroup), _T("%s"), LPGENT("Messaging"));
+ FontIDT fid = { sizeof(fid) };
+ mir_sntprintf(fid.group, SIZEOF(fid.group), _T("%s"), LPGENT("Messaging"));
+ mir_sntprintf(fid.backgroundGroup, SIZEOF(fid.backgroundGroup), _T("%s"), LPGENT("Messaging"));
strncpy(fid.dbSettingsGroup, (SRMMMOD), SIZEOF(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID | FIDF_DEFAULTVALID;
for (i = 0; i < SIZEOF(fontOptionsList); i++) {
fid.order = i;
+
+ char szTemp[100];
mir_snprintf(szTemp, SIZEOF(szTemp), "SRMFont%d", i);
strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
@@ -158,26 +157,27 @@ void RegisterFontServiceFonts() {
_tcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName));
FontRegisterT(&fid);
}
- cid.cbSize = sizeof(ColourIDT);
- mir_sntprintf(cid.group, SIZEOF(cid.group), _T("%s"), LPGENT("Messaging"));
+
+ ColourIDT cid = { sizeof(cid) };
+ mir_sntprintf(cid.group, SIZEOF(cid.group), _T("%s"), LPGENT("Messaging"));
strncpy(cid.dbSettingsGroup, (SRMMMOD), SIZEOF(fid.dbSettingsGroup));
cid.flags = 0;
for (i = 0; i < SIZEOF(colourOptionsList); i++) {
cid.order = i;
_tcsncpy(cid.name, colourOptionsList[i].szName, SIZEOF(cid.name));
- if (colourOptionsList[i].systemColor != -1) {
+ if (colourOptionsList[i].systemColor != -1)
cid.defcolour = GetSysColor(colourOptionsList[i].systemColor);
- } else {
+ else
cid.defcolour = colourOptionsList[i].defColour;
- }
+
strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting));
ColourRegisterT(&cid);
}
}
-void RegisterChatFonts( void )
+void RegisterChatFonts(void)
{
- FontIDT fid = {0};
+ FontIDT fid = { 0 };
ColourIDT colourid;
char idstr[10];
int index = 0, i;
@@ -252,7 +252,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode)
char str[32];
int style;
DBVARIANT dbv;
- const char * module = chatMode ? "ChatFonts" : SRMMMOD;
+ const char * module = chatMode ? "ChatFonts" : SRMMMOD;
const char * prefix = chatMode ? "Font" : "SRMFont";
const FontOptionsList * fontList = chatMode ? chatFontOptionsList : fontOptionsList;
@@ -262,7 +262,7 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode)
}
if (lf) {
mir_snprintf(str, SIZEOF(str), "%s%dSize", prefix, i);
- lf->lfHeight = (char) db_get_b(NULL, module, str, fontList[i].defSize);
+ lf->lfHeight = (char)db_get_b(NULL, module, str, fontList[i].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
@@ -290,54 +290,52 @@ void LoadMsgDlgFont(int i, LOGFONT * lf, COLORREF * colour, BOOL chatMode)
struct CheckBoxValues_t
{
- DWORD style;
- const TCHAR* szDescr;
+ DWORD style;
+ const TCHAR* szDescr;
};
static const struct CheckBoxValues_t statusValues[] =
{
- { MODEF_OFFLINE, LPGENT("Offline") },
- { PF2_ONLINE, LPGENT("Online") },
- { PF2_SHORTAWAY, LPGENT("Away") },
- { PF2_LONGAWAY, LPGENT("NA") },
- { PF2_LIGHTDND, LPGENT("Occupied") },
- { PF2_HEAVYDND, LPGENT("DND") },
- { PF2_FREECHAT, LPGENT("Free for chat") },
- { PF2_INVISIBLE, LPGENT("Invisible") },
- { PF2_OUTTOLUNCH, LPGENT("Out to lunch") },
- { PF2_ONTHEPHONE, LPGENT("On the phone") }
+ { MODEF_OFFLINE, LPGENT("Offline") },
+ { PF2_ONLINE, LPGENT("Online") },
+ { PF2_SHORTAWAY, LPGENT("Away") },
+ { PF2_LONGAWAY, LPGENT("NA") },
+ { PF2_LIGHTDND, LPGENT("Occupied") },
+ { PF2_HEAVYDND, LPGENT("DND") },
+ { PF2_FREECHAT, LPGENT("Free for chat") },
+ { PF2_INVISIBLE, LPGENT("Invisible") },
+ { PF2_OUTTOLUNCH, LPGENT("Out to lunch") },
+ { PF2_ONTHEPHONE, LPGENT("On the phone") }
};
static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style)
{
TVINSERTSTRUCT tvis;
- int i;
-
tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- for (i = 0; i < nValues; i++) {
+ for (int i = 0; i < nValues; i++) {
tvis.item.lParam = values[i].style;
tvis.item.pszText = TranslateTS(values[i].szDescr);
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.state = INDEXTOSTATEIMAGEMASK((style & tvis.item.lParam) != 0 ? 2 : 1);
- TreeView_InsertItem( hwndTree, &tvis );
-} }
+ TreeView_InsertItem(hwndTree, &tvis);
+ }
+}
static DWORD MakeCheckBoxTreeFlags(HWND hwndTree)
{
- DWORD flags = 0;
- TVITEM tvi;
-
- tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
- tvi.hItem = TreeView_GetRoot(hwndTree);
- while (tvi.hItem) {
- TreeView_GetItem(hwndTree, &tvi);
- if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
- flags |= tvi.lParam;
- tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
- }
- return flags;
+ DWORD flags = 0;
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_STATE;
+ tvi.hItem = TreeView_GetRoot(hwndTree);
+ while (tvi.hItem) {
+ TreeView_GetItem(hwndTree, &tvi);
+ if (((tvi.state & TVIS_STATEIMAGEMASK) >> 12 == 2))
+ flags |= tvi.lParam;
+ tvi.hItem = TreeView_GetNextSibling(hwndTree, tvi.hItem);
+ }
+ return flags;
}
static int changed = 0;
@@ -360,20 +358,20 @@ static void MarkChanges(int i, HWND hWnd) {
static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ int bChecked;
+
switch (msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
- int limitLength;
- int bChecked;
- TranslateDialogDefault(hwndDlg);
CheckDlgButton(hwndDlg, IDC_USETABS, db_get_b(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS));
CheckDlgButton(hwndDlg, IDC_ALWAYSSHOWTABS, !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB));
CheckDlgButton(hwndDlg, IDC_TABSATBOTTOM, db_get_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM));
CheckDlgButton(hwndDlg, IDC_SWITCHTOACTIVE, db_get_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, SRMSGDEFSET_SWITCHTOACTIVE));
CheckDlgButton(hwndDlg, IDC_TABCLOSEBUTTON, db_get_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, SRMSGDEFSET_TABCLOSEBUTTON));
CheckDlgButton(hwndDlg, IDC_LIMITNAMES, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES));
- limitLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
- (int)SetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, limitLength >= SRMSGSET_LIMITNAMESLEN_MIN ? limitLength : SRMSGDEFSET_LIMITNAMESLEN, FALSE);
+ int limitLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, SRMSGDEFSET_LIMITNAMESLEN);
+ SetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, limitLength >= SRMSGSET_LIMITNAMESLEN_MIN ? limitLength : SRMSGDEFSET_LIMITNAMESLEN, FALSE);
CheckDlgButton(hwndDlg, IDC_LIMITTABS, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, SRMSGDEFSET_LIMITTABS));
limitLength = db_get_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, SRMSGDEFSET_LIMITTABSNUM);
@@ -402,83 +400,76 @@ static INT_PTR CALLBACK DlgProcTabsOptions(HWND hwndDlg, UINT msg, WPARAM wParam
EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked );
bChecked = bChecked && IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked );
- return TRUE;
}
+ return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_USETABS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked);
- }
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SWITCHTOACTIVE), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ALWAYSSHOWTABS), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TABCLOSEBUTTON), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SEPARATECHATSCONTAINERS), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABS), bChecked);
+
case IDC_LIMITTABS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUM), bChecked);
- }
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITTABSNUM), bChecked);
+
case IDC_SEPARATECHATSCONTAINERS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked);
- }
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABS), bChecked);
+
case IDC_LIMITCHATSTABS:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS) &&
- IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked);
- }
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS) &&
+ IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITCHATSTABSNUM), bChecked);
+
case IDC_LIMITNAMES:
- {
- int bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES) && IsDlgButtonChecked(hwndDlg, IDC_USETABS);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
- }
+ bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES) && IsDlgButtonChecked(hwndDlg, IDC_USETABS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMESLEN), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHARS), bChecked);
break;
case IDC_LIMITNAMESLEN:
case IDC_LIMITTABSNUM:
case IDC_LIMITCHATSTABSNUM:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return 0;
break;
}
MarkChanges(8, hwndDlg);
break;
+
case WM_NOTIFY:
switch (((LPNMHDR) lParam)->idFrom) {
case 0:
switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
- {
- int limitLength;
- db_set_b(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS));
- db_set_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
- db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
- (limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE)) >= SRMSGSET_LIMITNAMESLEN_MIN ? GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) : SRMSGSET_LIMITNAMESLEN_MIN;
- db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
-
- db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
- limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) : 1;
- db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
- db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
- limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1;
- db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
-
- db_set_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
- db_set_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
-
- ApplyChanges(8);
- return TRUE;
- }
+ int limitLength;
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES));
+ (limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE)) >= SRMSGSET_LIMITNAMESLEN_MIN ? GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) : SRMSGSET_LIMITNAMESLEN_MIN;
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITNAMESLEN, limitLength);
+
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITTABS));
+ limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITTABSNUM, NULL, TRUE) : 1;
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITTABSNUM, limitLength);
+ db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITCHATSTABS));
+ limitLength = GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) >= 1 ? GetDlgItemInt(hwndDlg, IDC_LIMITCHATSTABSNUM, NULL, TRUE) : 1;
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_LIMITCHATSTABSNUM, limitLength);
+
+ db_set_b(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) !IsDlgButtonChecked(hwndDlg, IDC_ALWAYSSHOWTABS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SWITCHTOACTIVE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SWITCHTOACTIVE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TABCLOSEBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABCLOSEBUTTON));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SEPARATECHATSCONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SEPARATECHATSCONTAINERS));
+
+ ApplyChanges(8);
+ return TRUE;
}
- break;
}
break;
}
@@ -558,36 +549,33 @@ static INT_PTR CALLBACK DlgProcLayoutOptions(HWND hwndDlg, UINT msg, WPARAM wPar
break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- UINT lines;
+ UINT lines;
- db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTOOLBAR));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOBAR, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOBAR));
- db_set_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
- db_set_dw(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0));
- db_set_dw(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg, IDC_ATRANSPARENCYVALUE, TBM_GETPOS, 0, 0));
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg, IDC_ITRANSPARENCYVALUE, TBM_GETPOS, 0, 0));
- db_set_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS));
- db_set_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT));
- lines = GetDlgItemInt(hwndDlg, IDC_INPUTLINES, NULL, FALSE);
- db_set_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
- LoadInfobarFonts();
+ lines = GetDlgItemInt(hwndDlg, IDC_INPUTLINES, NULL, FALSE);
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_AUTORESIZELINES, lines ? lines : SRMSGDEFSET_AUTORESIZELINES);
+ LoadInfobarFonts();
- ApplyChanges(16);
- return TRUE;
- }
+ ApplyChanges(16);
+ return TRUE;
}
- break;
}
break;
}
@@ -598,9 +586,9 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
switch (msg) {
case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
{
DWORD msgTimeout;
- TranslateDialogDefault(hwndDlg);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, sizeof(statusValues) / sizeof(statusValues[0]),
db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
@@ -623,9 +611,9 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
EnableWindow(GetDlgItem(hwndDlg, IDC_POPLIST), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
-
- return TRUE;
}
+ return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_AUTOPOPUP:
@@ -635,7 +623,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_AUTOMIN:
break;
case IDC_SECONDS:
- if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())
+ if (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())
return 0;
break;
case IDC_SENDONENTER:
@@ -653,58 +641,58 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
MarkChanges(2, hwndDlg);
break;
+
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_POPLIST:
- if (((LPNMHDR) lParam)->code == NM_CLICK) {
+ if (((LPNMHDR)lParam)->code == NM_CLICK) {
TVHITTESTINFO hti;
- hti.pt.x = (short) LOWORD(GetMessagePos());
- hti.pt.y = (short) HIWORD(GetMessagePos());
- ScreenToClient(((LPNMHDR) lParam)->hwndFrom, &hti.pt);
- if (TreeView_HitTest(((LPNMHDR) lParam)->hwndFrom, &hti))
- if (hti.flags & TVHT_ONITEMSTATEICON) {
- TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvi.hItem = hti.hItem;
- TreeView_GetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
- tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
- TreeView_SetItem(((LPNMHDR) lParam)->hwndFrom, &tvi);
- MarkChanges(2, hwndDlg);
- }
- } else if (((LPNMHDR) lParam)->code == TVN_KEYDOWN) {
- if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) {
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(((LPNMHDR)lParam)->hwndFrom, &hti.pt);
+ if (TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &hti))
+ if (hti.flags & TVHT_ONITEMSTATEICON) {
+ TVITEM tvi;
+ tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvi.hItem = hti.hItem;
+ TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ tvi.iImage = tvi.iSelectedImage = tvi.iImage == 1 ? 2 : 1;
+ TreeView_SetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
+ MarkChanges(2, hwndDlg);
+ }
+ }
+ else if (((LPNMHDR)lParam)->code == TVN_KEYDOWN) {
+ if (((LPNMTVKEYDOWN)lParam)->wVKey == VK_SPACE) {
MarkChanges(2, hwndDlg);
}
}
break;
+
case 0:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- {
- DWORD msgTimeout;
- db_set_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
- db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
- db_set_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
- db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
+ DWORD msgTimeout;
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEDRAFTS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEDRAFTS));
- db_set_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
- msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT;
- db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
+ db_set_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DELTEMP));
+ msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT;
+ db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout);
- db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
- db_set_b(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CASCADE));
- db_set_b(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_HIDECONTAINERS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_HIDECONTAINERS));
- ApplyChanges(2);
+ ApplyChanges(2);
- return TRUE;
- }
+ return TRUE;
}
- break;
}
break;
}
@@ -777,9 +765,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES));
- if (!g_dat.ieviewInstalled) {
+ if (!g_dat.ieviewInstalled)
EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE);
- }
+
CheckDlgButton(hwndDlg, IDC_USEIEVIEW, db_get_b(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW));
CheckDlgButton(hwndDlg, IDC_GROUPMESSAGES, db_get_b(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES));
@@ -811,6 +799,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
}
ShowPreview(hwndDlg);
return TRUE;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_FONTSCOLORS:
@@ -909,7 +898,6 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
ApplyChanges(4);
return TRUE;
}
- break;
}
break;
}
@@ -925,7 +913,7 @@ static void ResetCList(HWND hwndDlg)
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0);
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP) NULL);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKBITMAP, 0, (LPARAM)(HBITMAP)NULL);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETBKCOLOR, GetSysColor(COLOR_WINDOW), 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT, 10, 0);
for (int i = 0; i <= FONTID_MAX; i++)
@@ -936,30 +924,30 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
{
BYTE defType = db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW);
if (hItemNew && defType)
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemNew, 1);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemNew, 1);
if (hItemUnknown && db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemUnknown, 1);
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType))
- SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
+ SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
}
}
static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown)
{
if (hItemNew)
- db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemNew, 0) ? 1 : 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemNew, 0) ? 1 : 0));
if (hItemUnknown)
- db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0));
+ db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemUnknown, 0) ? 1 : 0));
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
+ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem)
- db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0));
+ db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0) ? 1 : 0));
}
}
@@ -997,13 +985,13 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam
SetWindowText(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TranslateT("Show balloon popup (unsupported system)"));
}
break;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_TYPETRAY:
if (IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)) {
- if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
+ if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY))
EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE);
- }
else {
EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE);