summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdchat/src/chat.h32
-rw-r--r--src/core/stdchat/src/clist.cpp2
-rw-r--r--src/core/stdchat/src/log.cpp2
-rw-r--r--src/core/stdchat/src/manager.cpp16
-rw-r--r--src/core/stdchat/src/message.cpp8
-rw-r--r--src/core/stdchat/src/services.cpp104
-rw-r--r--src/core/stdchat/src/tools.cpp83
-rw-r--r--src/core/stdchat/src/window.cpp26
8 files changed, 136 insertions, 137 deletions
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h
index e15a85e06e..b6c2bc1488 100644
--- a/src/core/stdchat/src/chat.h
+++ b/src/core/stdchat/src/chat.h
@@ -309,7 +309,7 @@ typedef struct
LOGINFO* lin;
BOOL bStripFormat;
BOOL bRedraw;
- SESSION_INFO* si;
+ SESSION_INFO *si;
}
LOGSTREAMDATA;
@@ -396,7 +396,7 @@ typedef struct{
int yPosition;
HWND hWndTarget;
BOOL bForeground;
- SESSION_INFO* si;
+ SESSION_INFO *si;
}
COLORCHOOSER;
@@ -412,7 +412,7 @@ void UpgradeCheck(void);
INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
//log.c
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedraw, BOOL bPhaseTwo);
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo);
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
void ValidateFilename (TCHAR * filename);
@@ -439,11 +439,11 @@ void CreateServiceFunctions(void);
void CreateHookableEvents(void);
void DestroyHookableEvents(void);
void TabsInit(void);
-void ShowRoom(SESSION_INFO* si, WPARAM wp, BOOL bSetForeground);
+void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);
//manager.c
void SetActiveSession(const TCHAR* pszID, const char* pszModule);
-void SetActiveSessionEx(SESSION_INFO* si);
+void SetActiveSessionEx(SESSION_INFO *si);
SESSION_INFO* GetActiveSession(void);
SESSION_INFO* SM_AddSession(const TCHAR* pszID, const char* pszModule);
int SM_RemoveSession(const TCHAR* pszID, const char* pszModule, BOOL removeContact);
@@ -453,14 +453,14 @@ BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHA
BOOL SM_ChangeNick(const TCHAR* pszID, const char* pszModule, GCEVENT * gce);
BOOL SM_RemoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID);
BOOL SM_SetOffline(const TCHAR* pszID, const char* pszModule);
-BOOL SM_SetTabbedWindowHwnd(SESSION_INFO* si, HWND hwnd);
-HICON SM_GetStatusIcon(SESSION_INFO* si, USERINFO * ui);
+BOOL SM_SetTabbedWindowHwnd(SESSION_INFO *si, HWND hwnd);
+HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui);
BOOL SM_SetStatus(const TCHAR* pszID, const char* pszModule, int wStatus);
BOOL SM_SetStatusEx(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText, int flags );
BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR* pszText);
STATUSINFO* SM_AddStatus(const TCHAR* pszID, const char* pszModule, const TCHAR* pszStatus);
-SESSION_INFO* SM_GetNextWindow(SESSION_INFO* si);
-SESSION_INFO* SM_GetPrevWindow(SESSION_INFO* si);
+SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si);
+SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si);
BOOL SM_AddEventToAllMatchingUID(GCEVENT * gce);
BOOL SM_AddEvent(const TCHAR* pszID, const char* pszModule, GCEVENT * gce, BOOL bIsHighlighted);
LRESULT SM_SendMessage(const TCHAR* pszID, const char* pszModule, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -476,7 +476,7 @@ char* SM_GetPrevCommand(const TCHAR* pszID, const char* pszModule);
char* SM_GetNextCommand(const TCHAR* pszID, const char* pszModule);
int SM_GetCount(const char* pszModule);
SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem);
-char* SM_GetUsers(SESSION_INFO* si);
+char* SM_GetUsers(SESSION_INFO *si);
USERINFO* SM_GetUserFromIndex(const TCHAR* pszID, const char* pszModule, int index);
MODULEINFO* MM_AddModule(const char* pszModule);
MODULEINFO* MM_FindModule(const char* pszModule);
@@ -522,22 +522,22 @@ int WCCmp(TCHAR* wild, TCHAR*string);
//tools.c
TCHAR* RemoveFormatting(const TCHAR* pszText);
-BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighlight, int bManyFix);
+BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighlight, int bManyFix);
int GetColorIndex(const char* pszModule, COLORREF cr);
void CheckColorsInModule(const char* pszModule);
const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) ;
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);
+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 IsEventSupported(int eventType);
-BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce);
+BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce);
// message.c
-char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO* si);
-TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO* si);
+char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si);
+TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO *si);
#pragma comment(lib,"comctl32.lib")
diff --git a/src/core/stdchat/src/clist.cpp b/src/core/stdchat/src/clist.cpp
index b25f555ecf..3c44b166ea 100644
--- a/src/core/stdchat/src/clist.cpp
+++ b/src/core/stdchat/src/clist.cpp
@@ -109,7 +109,7 @@ int CList_RoomDoubleclicked( WPARAM wParam, LPARAM lParam )
return 0;
if ( !db_get_ts( hContact, szProto, "ChatRoomID", &dbv )) {
- SESSION_INFO* si = SM_FindSession( dbv.ptszVal, szProto );
+ SESSION_INFO *si = SM_FindSession( dbv.ptszVal, szProto );
if ( si ) {
// is the "toggle visibility option set, so we need to close the window?
if (si->hWnd != NULL
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp
index 0a465fa7dd..d3574ed603 100644
--- a/src/core/stdchat/src/log.cpp
+++ b/src/core/stdchat/src/log.cpp
@@ -464,7 +464,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
return 0;
}
-void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedraw, BOOL bPhaseTwo)
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw, BOOL bPhaseTwo)
{
EDITSTREAM stream;
LOGSTREAMDATA streamData;
diff --git a/src/core/stdchat/src/manager.cpp b/src/core/stdchat/src/manager.cpp
index 2437cd64db..af7f6b6944 100644
--- a/src/core/stdchat/src/manager.cpp
+++ b/src/core/stdchat/src/manager.cpp
@@ -37,12 +37,12 @@ MODULEINFO *m_ModList = 0;
void SetActiveSession(const TCHAR* pszID, const char* pszModule)
{
- SESSION_INFO* si = SM_FindSession(pszID, pszModule);
+ SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if ( si )
SetActiveSessionEx(si);
}
-void SetActiveSessionEx(SESSION_INFO* si)
+void SetActiveSessionEx(SESSION_INFO *si)
{
if ( si ) {
replaceStr( &pszActiveWndID, si->ptszID );
@@ -51,7 +51,7 @@ void SetActiveSessionEx(SESSION_INFO* si)
SESSION_INFO* GetActiveSession( void )
{
- SESSION_INFO* si = SM_FindSession( pszActiveWndID, pszActiveWndModule );
+ SESSION_INFO *si = SM_FindSession( pszActiveWndID, pszActiveWndModule );
if ( si )
return si;
@@ -244,7 +244,7 @@ BOOL SM_SetStatusEx( const TCHAR* pszID, const char* pszModule, const TCHAR* psz
return TRUE;
}
-HICON SM_GetStatusIcon(SESSION_INFO* si, USERINFO * ui)
+HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
{
STATUSINFO * ti;
if (!ui || !si)
@@ -643,7 +643,7 @@ BOOL SM_SendUserMessage(const TCHAR* pszID, const char* pszModule, const TCHAR*
return TRUE;
}
-SESSION_INFO* SM_GetPrevWindow(SESSION_INFO* si)
+SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si)
{
BOOL bFound = FALSE;
SESSION_INFO* pTemp = m_WndList;
@@ -669,7 +669,7 @@ SESSION_INFO* SM_GetPrevWindow(SESSION_INFO* si)
return NULL;
}
-SESSION_INFO* SM_GetNextWindow(SESSION_INFO* si)
+SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -720,7 +720,7 @@ BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID
}
-BOOL SM_SetTabbedWindowHwnd(SESSION_INFO* si, HWND hwnd)
+BOOL SM_SetTabbedWindowHwnd(SESSION_INFO *si, HWND hwnd)
{
SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
@@ -915,7 +915,7 @@ SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem)
}
-char* SM_GetUsers(SESSION_INFO* si)
+char* SM_GetUsers(SESSION_INFO *si)
{
SESSION_INFO* pTemp = m_WndList;
USERINFO* utemp = NULL;
diff --git a/src/core/stdchat/src/message.cpp b/src/core/stdchat/src/message.cpp
index f7659fe154..1da5c7f1ae 100644
--- a/src/core/stdchat/src/message.cpp
+++ b/src/core/stdchat/src/message.cpp
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "chat.h"
#include <math.h>
-static int RTFColorToIndex(int *pIndex, int iCol, SESSION_INFO* si)
+static int RTFColorToIndex(int *pIndex, int iCol, SESSION_INFO *si)
{
int i;
MODULEINFO * pMod = MM_FindModule(si->pszModule);
@@ -34,7 +34,7 @@ static int RTFColorToIndex(int *pIndex, int iCol, SESSION_INFO* si)
return -1;
}
-static void CreateColorMap( char* Text, int *pIndex, SESSION_INFO* si)
+static void CreateColorMap( char* Text, int *pIndex, SESSION_INFO *si)
{
char *p1, *p2, *pEnd;
int iIndex = 1;
@@ -77,7 +77,7 @@ static int ReadInteger( const char* p, int* result )
return i;
}
-TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si)
+TCHAR* DoRtfToTags( char* pszText, SESSION_INFO *si)
{
char *p1;
int* pIndex;
@@ -337,7 +337,7 @@ static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff,
return 0;
}
-char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO* si)
+char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si)
{
EDITSTREAM stream;
char* pszText = NULL;
diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp
index b222f17c95..9c57522cae 100644
--- a/src/core/stdchat/src/services.cpp
+++ b/src/core/stdchat/src/services.cpp
@@ -66,7 +66,7 @@ static HANDLE
#endif
-void ShowRoom(SESSION_INFO* si, WPARAM wp, BOOL bSetForeground)
+void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
{
if (!si)
return;
@@ -222,7 +222,7 @@ static INT_PTR Service_GetCount(WPARAM wParam,LPARAM lParam)
static INT_PTR Service_GetInfo(WPARAM wParam,LPARAM lParam)
{
GC_INFO * gci = (GC_INFO *) lParam;
- SESSION_INFO* si = NULL;
+ SESSION_INFO *si = NULL;
if (!gci || !gci->pszModule)
return 1;
@@ -327,7 +327,7 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
if (( mi = MM_FindModule( gcw->pszModule )) != NULL ) {
TCHAR* ptszID = a2tf( gcw->ptszID, gcw->dwFlags );
- SESSION_INFO* si = SM_AddSession( ptszID, gcw->pszModule);
+ SESSION_INFO *si = SM_AddSession( ptszID, gcw->pszModule);
// create a new session and set the defaults
if ( si != NULL ) {
@@ -405,7 +405,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
switch (wp) {
case WINDOW_HIDDEN:
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
si->bInitDone = TRUE;
SetActiveSession(si->ptszID, si->pszModule);
@@ -420,7 +420,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
case WINDOW_VISIBLE:
case SESSION_INITDONE:
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
si->bInitDone = TRUE;
if (wp != SESSION_INITDONE || db_get_b(NULL, "Chat", "PopupOnJoin", 0) == 0)
@@ -439,7 +439,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
case WINDOW_CLEARLOG:
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if ( si ) {
LM_RemoveAll(&si->pLog, &si->pLogEnd);
if ( si->hWnd ) {
@@ -464,7 +464,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->pszText)
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if ( si ) {
replaceStr( &si->ptszName, gce->ptszText );
if ( si->hWnd )
@@ -476,13 +476,13 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
} } }
else if (gce->pDest->iType == GC_EVENT_SETITEMDATA) {
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ 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);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
gce->dwItemData = si->dwItemData;
return si->dwItemData;
@@ -491,7 +491,7 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
}
else if (gce->pDest->iType == GC_EVENT_SETSBTEXT)
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si) {
replaceStr( &si->ptszStatusbarText, gce->ptszText );
if ( si->ptszStatusbarText )
@@ -522,23 +522,26 @@ static int DoControl(GCEVENT * gce, WPARAM wp)
static void AddUser(GCEVENT * gce)
{
- SESSION_INFO* si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule);
- if ( si ) {
- WORD status = TM_StringToWord( si->pStatuses, gce->ptszStatus );
- USERINFO * ui = SM_AddUser( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszNick, status);
- if (ui) {
- ui->pszNick = mir_tstrdup( gce->ptszNick );
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si == NULL) return;
+
+ WORD status = TM_StringToWord(si->pStatuses, gce->ptszStatus);
+ USERINFO *ui = SM_AddUser(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszNick, status);
+ if (ui == NULL) return;
+
+ ui->pszNick = mir_tstrdup(gce->ptszNick);
- if (gce->bIsMe)
- si->pMe = ui;
+ if (gce->bIsMe)
+ si->pMe = ui;
- ui->Status = status;
- ui->Status |= si->pStatuses->Status;
+ ui->Status = status;
+ ui->Status |= si->pStatuses->Status;
- if (si->hWnd) {
- g_TabSession.pUsers = si->pUsers;
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
-} } } }
+ if (si->hWnd) {
+ g_TabSession.pUsers = si->pUsers;
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ }
+}
static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
{
@@ -565,15 +568,15 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
EnterCriticalSection(&cs);
- if ( !( gce->dwFlags & GC_UNICODE )) {
+ if (!(gce->dwFlags & GC_UNICODE)) {
save_gce = *gce;
save_gcd = *gce->pDest;
- gce->pDest->ptszID = a2tf( gce->pDest->ptszID, gce->dwFlags );
- gce->ptszUID = a2tf( gce->ptszUID, gce->dwFlags );
- gce->ptszNick = a2tf( gce->ptszNick, gce->dwFlags );
- gce->ptszStatus = a2tf( gce->ptszStatus, gce->dwFlags );
- gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
- gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
+ gce->pDest->ptszID = a2tf(gce->pDest->ptszID, gce->dwFlags);
+ gce->ptszUID = a2tf(gce->ptszUID, gce->dwFlags);
+ gce->ptszNick = a2tf(gce->ptszNick, gce->dwFlags);
+ gce->ptszStatus = a2tf(gce->ptszStatus, gce->dwFlags);
+ gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
+ gce->ptszUserInfo = a2tf(gce->ptszUserInfo, gce->dwFlags);
}
// Do different things according to type of event
@@ -605,38 +608,39 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
case GC_EVENT_TOPIC:
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if ( si ) {
- if ( gce->pszText ) {
- replaceStr( &si->ptszTopic, gce->ptszText);
- if ( si->hWnd )
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si) {
+ if (gce->pszText) {
+ replaceStr(&si->ptszTopic, gce->ptszText);
+ if (si->hWnd)
g_TabSession.ptszTopic = si->ptszTopic;
- db_set_ts( si->hContact, si->pszModule , "Topic", RemoveFormatting( si->ptszTopic ));
- if ( db_get_b( NULL, "Chat", "TopicOnClist", 0 ))
- db_set_ts( si->hContact, "CList" , "StatusMsg", RemoveFormatting( si->ptszTopic ));
- } }
+ db_set_ts(si->hContact, si->pszModule, "Topic", RemoveFormatting(si->ptszTopic));
+ if (db_get_b(NULL, "Chat", "TopicOnClist", 0))
+ db_set_ts(si->hContact, "CList", "StatusMsg", RemoveFormatting(si->ptszTopic));
+ }
+ }
break;
}
case GC_EVENT_ADDSTATUS:
- SM_GiveStatus( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus );
+ SM_GiveStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
break;
case GC_EVENT_REMOVESTATUS:
- SM_TakeStatus( gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
+ SM_TakeStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, gce->ptszStatus);
break;
case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
- if ( !gce->bIsMe && gce->pDest->pszID && gce->pszText ) {
- SESSION_INFO* si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule );
- if ( si )
- if ( IsHighlighted( si, gce->ptszText ))
+ if (!gce->bIsMe && gce->pDest->ptszID && gce->pszText) {
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ if (si)
+ if (IsHighlighted(si, gce->ptszText))
bIsHighlighted = TRUE;
}
break;
case GC_EVENT_NICK:
- SM_ChangeNick( gce->pDest->ptszID, gce->pDest->pszModule, gce);
+ SM_ChangeNick(gce->pDest->ptszID, gce->pDest->pszModule, gce);
break;
case GC_EVENT_JOIN:
@@ -651,12 +655,12 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
}
// Decide which window (log) should have the event
- if ( gcd->pszID ) {
+ if (gcd->ptszID) {
pWnd = gcd->ptszID;
pMod = gcd->pszModule;
}
else if ( gcd->iType == GC_EVENT_NOTICE || gcd->iType == GC_EVENT_INFORMATION ) {
- SESSION_INFO* si = GetActiveSession();
+ SESSION_INFO *si = GetActiveSession();
if ( si && !lstrcmpA( si->pszModule, gcd->pszModule )) {
pWnd = si->ptszID;
pMod = si->pszModule;
@@ -676,7 +680,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
// add to log
if ( pWnd ) {
- SESSION_INFO* si = SM_FindSession(pWnd, pMod);
+ SESSION_INFO *si = SM_FindSession(pWnd, pMod);
// fix for IRC's old stuyle mode notifications. Should not affect any other protocol
if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !( gce->dwFlags & GCEF_ADDTOLOG )) {
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp
index 3d4bbb0ba1..e2babc70e9 100644
--- a/src/core/stdchat/src/tools.cpp
+++ b/src/core/stdchat/src/tools.cpp
@@ -89,7 +89,7 @@ TCHAR* RemoveFormatting(const TCHAR* pszWord)
static void __stdcall ShowRoomFromPopup(void * pi)
{
- SESSION_INFO* si = (SESSION_INFO*) pi;
+ SESSION_INFO *si = (SESSION_INFO*) pi;
ShowRoom(si, WINDOW_VISIBLE, TRUE);
}
@@ -123,7 +123,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
return DefWindowProc(hWnd, message, wParam, lParam);
}
-static int ShowPopup(HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
+static int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...)
{
POPUPDATAT pd = {0};
va_list marker;
@@ -169,7 +169,7 @@ static int ShowPopup(HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* pszP
return PUAddPopupT(&pd);
}
-static BOOL DoTrayIcon(SESSION_INFO* si, GCEVENT * gce)
+static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce)
{
int iEvent = gce->pDest->iType;
@@ -220,7 +220,7 @@ static BOOL DoTrayIcon(SESSION_INFO* si, GCEVENT * gce)
return TRUE;
}
-static BOOL DoPopup(SESSION_INFO* si, GCEVENT * gce)
+static BOOL DoPopup(SESSION_INFO *si, GCEVENT * gce)
{
int iEvent = gce->pDest->iType;
@@ -285,7 +285,7 @@ static BOOL DoPopup(SESSION_INFO* si, GCEVENT * gce)
return TRUE;
}
-BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO* si, GCEVENT * gce, BOOL bHighlight, int bManyFix)
+BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT * gce, BOOL bHighlight, int bManyFix)
{
if (!gce || !si || gce->bIsMe || si->iType == GCW_SERVER)
return FALSE;
@@ -430,7 +430,7 @@ const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2)
return NULL;
}
-BOOL IsHighlighted(SESSION_INFO* si, const TCHAR* pszText)
+BOOL IsHighlighted(SESSION_INFO *si, const TCHAR* pszText)
{
if ( g_Settings.HighlightEnabled && g_Settings.pszHighlightWords && pszText && si->pMe ) {
TCHAR* p1 = g_Settings.pszHighlightWords;
@@ -508,7 +508,7 @@ BOOL IsHighlighted(SESSION_INFO* si, const TCHAR* pszText)
return FALSE;
}
-BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
+BOOL LogToFile(SESSION_INFO *si, GCEVENT * gce)
{
MODULEINFO * mi = NULL;
TCHAR szBuffer[4096];
@@ -681,7 +681,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
return FALSE;
}
-UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO* si, TCHAR* pszUID, TCHAR* pszWordText)
+UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText)
{
GCMENUITEMS gcmi = {0};
int i;
@@ -784,27 +784,25 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
gcd->pszModule = mir_strdup( pszModule );
- {
- SESSION_INFO* si;
- if (( si = SM_FindSession(pszID, pszModule)) == NULL )
- return FALSE;
-
- if ( !( si->dwFlags & GC_UNICODE )) {
- gcd->pszID = mir_t2a( pszID );
- gch->pszUID = mir_t2a( pszUID );
- gch->pszText = mir_t2a( pszText );
- }
- else {
- gcd->ptszID = mir_tstrdup( pszID );
- gch->ptszUID = mir_tstrdup( pszUID );
- gch->ptszText = mir_tstrdup( pszText );
- }
+ SESSION_INFO *si = SM_FindSession(pszID, pszModule);
+ if (si == NULL)
+ return FALSE;
+
+ if (!(si->dwFlags & GC_UNICODE)) {
+ gcd->ptszID = (LPTSTR)mir_t2a(pszID);
+ gch->pszUID = mir_t2a(pszUID);
+ gch->pszText = mir_t2a(pszText);
+ }
+ else {
+ gcd->ptszID = mir_tstrdup(pszID);
+ gch->ptszUID = mir_tstrdup(pszUID);
+ gch->ptszText = mir_tstrdup(pszText);
}
gcd->iType = iType;
gch->dwData = dwItem;
gch->pDest = gcd;
- PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM) gch);
+ PostMessage(hwnd, GC_FIREHOOK, 0, (LPARAM)gch);
return TRUE;
}
@@ -815,32 +813,29 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
gcd.pszModule = (char*)pszModule;
- {
- SESSION_INFO* si;
- if (( si = SM_FindSession(pszID, pszModule)) == NULL )
- return FALSE;
-
- if ( !( si->dwFlags & GC_UNICODE )) {
- gcd.pszID = mir_t2a( pszID );
- gch.pszUID = mir_t2a( pszUID );
- gch.pszText = mir_t2a( pszText );
- }
- else {
- gcd.ptszID = mir_tstrdup( pszID );
- gch.ptszUID = mir_tstrdup( pszUID );
- gch.ptszText = mir_tstrdup( pszText );
- }
+ SESSION_INFO *si = SM_FindSession(pszID, pszModule);
+ if (si == NULL)
+ return FALSE;
+
+ if (!(si->dwFlags & GC_UNICODE)) {
+ gcd.ptszID = (LPTSTR)mir_t2a(pszID);
+ gch.pszUID = mir_t2a(pszUID);
+ gch.pszText = mir_t2a(pszText);
+ }
+ else {
+ gcd.ptszID = mir_tstrdup(pszID);
+ gch.ptszUID = mir_tstrdup(pszUID);
+ gch.ptszText = mir_tstrdup(pszText);
}
gcd.iType = iType;
gch.dwData = dwItem;
gch.pDest = &gcd;
- NotifyEventHooks(hSendEvent,0,(WPARAM)&gch);
-
- mir_free( gcd.pszID );
- mir_free( gch.ptszUID );
- mir_free( gch.ptszText );
+ NotifyEventHooks(hSendEvent, 0, (WPARAM)&gch);
+ mir_free(gcd.ptszID);
+ mir_free(gch.ptszUID);
+ mir_free(gch.ptszText);
return TRUE;
}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 9c343c9d60..f59dc49f2e 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -131,7 +131,7 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
{
RECT rc, rcTabs;
- SESSION_INFO* si = (SESSION_INFO*)lParam;
+ SESSION_INFO *si = (SESSION_INFO*)lParam;
int TabHeight;
BOOL bControl = (BOOL)db_get_b(NULL, "Chat", "ShowTopButtons", 1);
BOOL bFormat = (BOOL)db_get_b(NULL, "Chat", "ShowFormatButtons", 1);
@@ -734,7 +734,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
- static SESSION_INFO* si = NULL;
+ static SESSION_INFO *si = NULL;
switch (uMsg) {
case WM_INITDIALOG:
si = (SESSION_INFO*)lParam;
@@ -968,7 +968,7 @@ static LRESULT CALLBACK TabSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
i = TabCtrl_HitTest(hwnd, &tci);
if (i != -1 ) {
TCITEM tc;
- SESSION_INFO* si ;
+ SESSION_INFO *si ;
tc.mask = TCIF_PARAM;
TabCtrl_GetItem(hwnd, i, &tc);
@@ -1150,7 +1150,7 @@ int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth)
static void __cdecl phase2(void * lParam)
{
- SESSION_INFO* si = (SESSION_INFO*) lParam;
+ SESSION_INFO *si = (SESSION_INFO*) lParam;
Sleep(30);
if (si && si->hWnd)
PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
@@ -2014,16 +2014,16 @@ LABEL_SHOWWINDOW:
case GC_FIREHOOK:
if (lParam) {
- GCHOOK* gch = (GCHOOK *) lParam;
- NotifyEventHooks(hSendEvent,0,(WPARAM)gch);
- if ( gch->pDest ) {
- mir_free( gch->pDest->pszID );
- mir_free( gch->pDest->pszModule );
- mir_free( gch->pDest );
+ GCHOOK *gch = (GCHOOK *)lParam;
+ NotifyEventHooks(hSendEvent, 0, (WPARAM)gch);
+ if (gch->pDest) {
+ mir_free(gch->pDest->ptszID);
+ mir_free(gch->pDest->pszModule);
+ mir_free(gch->pDest);
}
- mir_free( gch->ptszText );
- mir_free( gch->ptszUID );
- mir_free( gch );
+ mir_free(gch->ptszText);
+ mir_free(gch->ptszUID);
+ mir_free(gch);
}
break;