summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/chat
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver/src/chat')
-rw-r--r--plugins/Scriver/src/chat/chat.h32
-rw-r--r--plugins/Scriver/src/chat/clist.cpp2
-rw-r--r--plugins/Scriver/src/chat/colorchooser.cpp2
-rw-r--r--plugins/Scriver/src/chat/log.cpp4
-rw-r--r--plugins/Scriver/src/chat/manager.cpp12
-rw-r--r--plugins/Scriver/src/chat/message.cpp6
-rw-r--r--plugins/Scriver/src/chat/options.cpp20
-rw-r--r--plugins/Scriver/src/chat/services.cpp52
-rw-r--r--plugins/Scriver/src/chat/tools.cpp24
-rw-r--r--plugins/Scriver/src/chat/window.cpp1406
10 files changed, 781 insertions, 779 deletions
diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h
index b8671fdb82..c1f6427781 100644
--- a/plugins/Scriver/src/chat/chat.h
+++ b/plugins/Scriver/src/chat/chat.h
@@ -231,8 +231,8 @@ typedef struct
LOGINFO* lin;
BOOL bStripFormat;
BOOL bRedraw;
- BOOL isFirst;
- SESSION_INFO* si;
+ BOOL isFirst;
+ SESSION_INFO *si;
}
LOGSTREAMDATA;
@@ -288,7 +288,7 @@ typedef struct{
int yPosition;
HWND hWndTarget;
BOOL bForeground;
- SESSION_INFO* si;
+ SESSION_INFO *si;
}
COLORCHOOSER;
@@ -301,12 +301,12 @@ 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);
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw);
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
TCHAR* GetChatLogsFilename (HANDLE hContact, time_t tTime);
TCHAR* MakeTimeStamp(TCHAR* pszStamp, time_t time);
-char* Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO* si);
+char* Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO *si);
//window.c
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
@@ -331,22 +331,22 @@ int Chat_FontsChanged(WPARAM wParam,LPARAM lParam);
int Chat_SmileyOptionsChanged(WPARAM wParam,LPARAM lParam);
int Chat_PreShutdown(WPARAM wParam,LPARAM lParam);
int Chat_IconsChanged(WPARAM wParam,LPARAM lParam);
-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);
SESSION_INFO* SM_FindSession(const TCHAR* pszID, const char* pszModule);
HWND SM_FindWindowByContact(HANDLE hContact);
-USERINFO* SM_AddUser(SESSION_INFO* si, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus);
+USERINFO* SM_AddUser(SESSION_INFO *si, const TCHAR* pszUID, const TCHAR* pszNick, WORD wStatus);
BOOL SM_ChangeUID(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID, const TCHAR* pszNewUID);
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);
-HICON SM_GetStatusIcon(SESSION_INFO* si, USERINFO * ui);
+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);
@@ -363,9 +363,9 @@ BOOL SM_TakeStatus(const TCHAR* pszID, const char* pszModule, const TCH
BOOL SM_MoveUser(const TCHAR* pszID, const char* pszModule, const TCHAR* pszUID);
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);
-char SM_GetStatusIndicator(SESSION_INFO* si, USERINFO * ui);
+char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO * ui);
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent);
MODULEINFO* MM_AddModule(const char* pszModule);
MODULEINFO* MM_FindModule(const char* pszModule);
@@ -413,20 +413,20 @@ 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);
TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) ;
-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
-TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO* si);
+TCHAR* DoRtfToTags( char* pszRtfText, SESSION_INFO *si);
//////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp
index fe4bf64128..4cb3d46be0 100644
--- a/plugins/Scriver/src/chat/clist.cpp
+++ b/plugins/Scriver/src/chat/clist.cpp
@@ -130,7 +130,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/plugins/Scriver/src/chat/colorchooser.cpp b/plugins/Scriver/src/chat/colorchooser.cpp
index c9e51e9be8..179072f0fe 100644
--- a/plugins/Scriver/src/chat/colorchooser.cpp
+++ b/plugins/Scriver/src/chat/colorchooser.cpp
@@ -96,7 +96,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L
SetDlgItemText(hwndDlg, IDC_CHAT_COLORTEXT, pCC->bForeground?TranslateT("Text colour"):TranslateT("Background colour"));
- SetWindowPos(GetDlgItem(hwndDlg, IDC_CHAT_COLORTEXT), NULL, 0, 0, width, 20, 0);
+ SetWindowPos(GetDlgItem(hwndDlg, IDC_CHAT_COLORTEXT), NULL, 0, 0, width, 20, 0);
SetWindowPos(hwndDlg, NULL, pCC->xPosition, pCC->yPosition, width, height, SWP_SHOWWINDOW);
}
break;
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp
index 07ad481eea..e9b84c405f 100644
--- a/plugins/Scriver/src/chat/log.cpp
+++ b/plugins/Scriver/src/chat/log.cpp
@@ -747,7 +747,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)
+void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw)
{
EDITSTREAM stream;
LOGSTREAMDATA streamData;
@@ -862,7 +862,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO* si, BOOL bRedr
InvalidateRect(hwndRich, NULL, TRUE);
} } }
-char * Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO* si)
+char * Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO *si)
{
char *buffer;
int bufferAlloced, bufferEnd, i = 0;
diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp
index 50bb2287fe..17a0745726 100644
--- a/plugins/Scriver/src/chat/manager.cpp
+++ b/plugins/Scriver/src/chat/manager.cpp
@@ -32,12 +32,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 );
@@ -46,7 +46,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;
@@ -229,7 +229,7 @@ BOOL SM_SetStatusEx( const TCHAR* pszID, const char* pszModule, const TCHAR* psz
return TRUE;
}
-char SM_GetStatusIndicator(SESSION_INFO* si, USERINFO * ui)
+char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO * ui)
{
STATUSINFO * ti;
if (!ui || !si)
@@ -260,7 +260,7 @@ char SM_GetStatusIndicator(SESSION_INFO* si, USERINFO * ui)
return '\0';
}
-HICON SM_GetStatusIcon(SESSION_INFO* si, USERINFO * ui)
+HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
{
STATUSINFO * ti;
if (!ui || !si)
@@ -740,7 +740,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/plugins/Scriver/src/chat/message.cpp b/plugins/Scriver/src/chat/message.cpp
index 3103d279c2..c87e67674b 100644
--- a/plugins/Scriver/src/chat/message.cpp
+++ b/plugins/Scriver/src/chat/message.cpp
@@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../commonheaders.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);
@@ -33,7 +33,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;
@@ -76,7 +76,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;
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp
index f465caeea7..87577884a3 100644
--- a/plugins/Scriver/src/chat/options.cpp
+++ b/plugins/Scriver/src/chat/options.cpp
@@ -893,17 +893,17 @@ int OptionsInit(void)
g_Settings.iSplitterX = db_get_w(NULL, "Chat", "SplitterX", 105);
LoadGlobalSettings();
- SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message"));
+ SkinAddNewSoundEx("ChatMessage", LPGEN("Group chats"), LPGEN("Incoming message"));
SkinAddNewSoundEx("ChatHighlight", LPGEN("Group chats"), LPGEN("Message is highlighted"));
- SkinAddNewSoundEx("ChatAction", LPGEN("Group chats"), LPGEN("User has performed an action"));
- SkinAddNewSoundEx("ChatJoin", LPGEN("Group chats"), LPGEN("User has joined"));
- SkinAddNewSoundEx("ChatPart", LPGEN("Group chats"), LPGEN("User has left"));
- SkinAddNewSoundEx("ChatKick", LPGEN("Group chats"), LPGEN("User has kicked some other user"));
- SkinAddNewSoundEx("ChatMode", LPGEN("Group chats"), LPGEN("User's status was changed"));
- SkinAddNewSoundEx("ChatNick", LPGEN("Group chats"), LPGEN("User has changed name"));
- SkinAddNewSoundEx("ChatNotice", LPGEN("Group chats"), LPGEN("User has sent a notice"));
- SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected"));
- SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed"));
+ SkinAddNewSoundEx("ChatAction", LPGEN("Group chats"), LPGEN("User has performed an action"));
+ SkinAddNewSoundEx("ChatJoin", LPGEN("Group chats"), LPGEN("User has joined"));
+ SkinAddNewSoundEx("ChatPart", LPGEN("Group chats"), LPGEN("User has left"));
+ SkinAddNewSoundEx("ChatKick", LPGEN("Group chats"), LPGEN("User has kicked some other user"));
+ SkinAddNewSoundEx("ChatMode", LPGEN("Group chats"), LPGEN("User's status was changed"));
+ SkinAddNewSoundEx("ChatNick", LPGEN("Group chats"), LPGEN("User has changed name"));
+ SkinAddNewSoundEx("ChatNotice", LPGEN("Group chats"), LPGEN("User has sent a notice"));
+ SkinAddNewSoundEx("ChatQuit", LPGEN("Group chats"), LPGEN("User has disconnected"));
+ SkinAddNewSoundEx("ChatTopic", LPGEN("Group chats"), LPGEN("The topic has been changed"));
SetIndentSize();
return 0;
}
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp
index 9c2bbbe244..c37df582ea 100644
--- a/plugins/Scriver/src/chat/services.cpp
+++ b/plugins/Scriver/src/chat/services.cpp
@@ -203,7 +203,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);
if (mi->hOfflineIcon == NULL) {
LoadModuleIcons(mi);
@@ -284,7 +284,7 @@ static INT_PTR 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);
@@ -299,7 +299,7 @@ static INT_PTR 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)
@@ -318,7 +318,7 @@ static INT_PTR 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);
si->iEventCount = 0;
@@ -339,7 +339,7 @@ static INT_PTR 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)
@@ -349,13 +349,13 @@ static INT_PTR 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;
@@ -364,7 +364,7 @@ static INT_PTR 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 )
@@ -396,7 +396,7 @@ static INT_PTR DoControl(GCEVENT * gce, WPARAM wp)
static void AddUser(GCEVENT * gce)
{
- SESSION_INFO* si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule);
+ 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( si, gce->ptszUID, gce->ptszNick, status);
@@ -465,11 +465,11 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
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->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
@@ -501,7 +501,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
case GC_EVENT_TOPIC:
{
- SESSION_INFO* si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if ( si ) {
if ( gce->pszText ) {
replaceStr( &si->ptszTopic, gce->ptszText);
@@ -522,7 +522,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
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 );
+ SESSION_INFO *si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule );
if ( si )
if ( IsHighlighted( si, gce->ptszText ))
bIsHighlighted = TRUE;
@@ -550,7 +550,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
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;
@@ -570,7 +570,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 )) {
@@ -641,17 +641,17 @@ void HookEvents(void)
void CreateServiceFunctions(void)
{
- CreateServiceFunction(MS_GC_REGISTER, Service_Register);
- CreateServiceFunction(MS_GC_NEWSESSION, Service_NewChat);
- CreateServiceFunction(MS_GC_EVENT, Service_AddEvent);
- CreateServiceFunction(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
- CreateServiceFunction(MS_GC_GETINFO, Service_GetInfo);
+ CreateServiceFunction(MS_GC_REGISTER, Service_Register);
+ CreateServiceFunction(MS_GC_NEWSESSION, Service_NewChat);
+ CreateServiceFunction(MS_GC_EVENT, Service_AddEvent);
+ CreateServiceFunction(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
+ CreateServiceFunction(MS_GC_GETINFO, Service_GetInfo);
CreateServiceFunction(MS_GC_GETSESSIONCOUNT, Service_GetCount);
- CreateServiceFunction("GChat/DblClickEvent", CList_EventDoubleclickedSvc);
+ CreateServiceFunction("GChat/DblClickEvent", CList_EventDoubleclickedSvc);
CreateServiceFunction("GChat/PrebuildMenuEvent", CList_PrebuildContactMenuSvc);
- CreateServiceFunction("GChat/JoinChat", CList_JoinChat);
- CreateServiceFunction("GChat/LeaveChat", CList_LeaveChat);
+ CreateServiceFunction("GChat/JoinChat", CList_JoinChat);
+ CreateServiceFunction("GChat/LeaveChat", CList_LeaveChat);
}
void CreateHookableEvents(void)
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index a09a1d290a..140912f604 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -72,7 +72,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);
}
@@ -81,7 +81,7 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
switch(message) {
case WM_COMMAND:
if (HIWORD(wParam) == STN_CLICKED) {
- SESSION_INFO* si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);;
+ SESSION_INFO *si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);;
CallFunctionAsync(ShowRoomFromPopup, si);
@@ -91,7 +91,7 @@ static INT_PTR CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
break;
case WM_CONTEXTMENU:
{
- SESSION_INFO* si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
+ SESSION_INFO *si = (SESSION_INFO*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,0);
if (si->windowData.hContact)
if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
@@ -103,7 +103,7 @@ static INT_PTR 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;
@@ -146,7 +146,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* psz
return PUAddPopUpT(&pd);
}
-static BOOL DoTrayIcon(SESSION_INFO* si, GCEVENT * gce)
+static BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT * gce)
{
int iEvent = gce->pDest->iType;
@@ -197,7 +197,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;
@@ -263,7 +263,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)
{
BOOL bInactive;
int iEvent;
@@ -411,7 +411,7 @@ 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;
@@ -489,7 +489,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];
@@ -658,7 +658,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce)
return FALSE;
}
-UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO* si, TCHAR* pszUID, TCHAR* pszWordText)
+UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText)
{
GCMENUITEMS gcmi = {0};
int i;
@@ -754,7 +754,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex)
BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
{
- SESSION_INFO* si;
+ SESSION_INFO *si;
GCHOOK* gch = (GCHOOK*)mir_alloc( sizeof( GCHOOK ));
GCDEST* gcd = (GCDEST*)mir_alloc( sizeof( GCDEST ));
@@ -785,7 +785,7 @@ 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)
{
- SESSION_INFO* si;
+ SESSION_INFO *si;
GCHOOK gch = {0};
GCDEST gcd = {0};
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 97f6ab1afd..ad0a535308 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -26,18 +26,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
static ToolbarButton toolbarButtons[] = {
- {LPGENT("Bold"), IDC_CHAT_BOLD, 0, 4, 24},
- {LPGENT("Italic"), IDC_CHAT_ITALICS, 0, 0, 24},
- {LPGENT("Underline"), IDC_CHAT_UNDERLINE, 0, 0, 24},
- {LPGENT("Text color"), IDC_CHAT_COLOR, 0, 0, 24},
- {LPGENT("Background color"), IDC_CHAT_BKGCOLOR, 0, 0, 24},
-// {LPGENT("Font size"), IDC_CHAT_FONTSIZE, 0, 0, 48},
- {LPGENT("Smiley"), IDC_CHAT_SMILEY, 0, 8, 24},
- {LPGENT("History"), IDC_CHAT_HISTORY, 1, 0, 24},
- {LPGENT("Filter"), IDC_CHAT_FILTER, 1, 0, 24},
- {LPGENT("Manager"), IDC_CHAT_CHANMGR, 1, 0, 24},
- {LPGENT("Nick list"), IDC_CHAT_SHOWNICKLIST, 1, 0, 24},
- {LPGENT("Send"), IDOK, 1, 0, 38},
+ { LPGENT("Bold"), IDC_CHAT_BOLD, 0, 4, 24},
+ { LPGENT("Italic"), IDC_CHAT_ITALICS, 0, 0, 24},
+ { LPGENT("Underline"), IDC_CHAT_UNDERLINE, 0, 0, 24},
+ { LPGENT("Text color"), IDC_CHAT_COLOR, 0, 0, 24},
+ { LPGENT("Background color"), IDC_CHAT_BKGCOLOR, 0, 0, 24},
+ { LPGENT("Smiley"), IDC_CHAT_SMILEY, 0, 8, 24},
+ { LPGENT("History"), IDC_CHAT_HISTORY, 1, 0, 24},
+ { LPGENT("Filter"), IDC_CHAT_FILTER, 1, 0, 24},
+ { LPGENT("Manager"), IDC_CHAT_CHANMGR, 1, 0, 24},
+ { LPGENT("Nick list"), IDC_CHAT_SHOWNICKLIST, 1, 0, 24},
+ { LPGENT("Send"), IDOK, 1, 0, 38},
};
typedef struct
@@ -63,7 +62,8 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP
return TRUE;
}
return 0;
- case WM_LBUTTONDOWN:
+
+ case WM_LBUTTONDOWN:
SetCapture(hwnd);
return 0;
@@ -83,7 +83,7 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP
return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
-static void InitButtons(HWND hwndDlg, SESSION_INFO* si)
+static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
{
MODULEINFO * pInfo = MM_FindModule(si->pszModule);
@@ -128,9 +128,7 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO* si)
SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
- if (pInfo)
- {
-
+ if (pInfo) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_BOLD), pInfo->bBold);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_ITALICS), pInfo->bItalics);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_UNDERLINE), pInfo->bUnderline);
@@ -143,22 +141,20 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO* si)
static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
- int logBottom, toolbarTopY;
+ int logBottom, toolbarTopY;
HDWP hdwp;
- BOOL bNick = si->iType!=GCW_SERVER && si->bNicklistEnabled;
- BOOL bToolbar = SendMessage(GetParent(hwndDlg), CM_GETTOOLBARSTATUS, 0, 0);
- int buttonVisibility = bToolbar ? g_dat.chatBbuttonVisibility : 0;
- int hSplitterMinTop = TOOLBAR_HEIGHT + si->windowData.minLogBoxHeight, hSplitterMinBottom = si->windowData.minEditBoxHeight;
- int toolbarHeight = bToolbar ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
+ BOOL bNick = si->iType!=GCW_SERVER && si->bNicklistEnabled;
+ BOOL bToolbar = SendMessage(GetParent(hwndDlg), CM_GETTOOLBARSTATUS, 0, 0);
+ int buttonVisibility = bToolbar ? g_dat.chatBbuttonVisibility : 0;
+ int hSplitterMinTop = TOOLBAR_HEIGHT + si->windowData.minLogBoxHeight, hSplitterMinBottom = si->windowData.minEditBoxHeight;
+ int toolbarHeight = bToolbar ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat.chatBbuttonVisibility) ? TOOLBAR_HEIGHT : TOOLBAR_HEIGHT / 3 : 0;
si->iSplitterY = si->desiredInputAreaHeight + SPLITTER_HEIGHT + 3;
- if (h - si->iSplitterY < hSplitterMinTop) {
+ if (h - si->iSplitterY < hSplitterMinTop)
si->iSplitterY = h - hSplitterMinTop;
- }
- if (si->iSplitterY < hSplitterMinBottom) {
+ if (si->iSplitterY < hSplitterMinBottom)
si->iSplitterY = hSplitterMinBottom;
- }
ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, buttonVisibility, SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), bNick?SW_SHOW:SW_HIDE);
@@ -171,7 +167,8 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_SHOWNICKLIST), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_CHANMGR), FALSE);
- } else {
+ }
+ else {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_SHOWNICKLIST), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), TRUE);
if (si->iType == GCW_CHATROOM)
@@ -180,11 +177,11 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
hdwp = BeginDeferWindowPos(20);
toolbarTopY = bToolbar ? h - si->iSplitterY - toolbarHeight : h - si->iSplitterY;
- if (si->windowData.hwndLog != NULL) {
+ if (si->windowData.hwndLog != NULL)
logBottom = toolbarTopY / 2;
- } else {
+ else
logBottom = toolbarTopY;
- }
+
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_LOG), 0, 1, 0, bNick?w - si->iSplitterX - 1:w - 2, logBottom, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_LIST), 0, w - si->iSplitterX + 2, 0, si->iSplitterX - 3, toolbarTopY, SWP_NOZORDER);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), 0, w - si->iSplitterX, 1, 2, toolbarTopY - 1, SWP_NOZORDER);
@@ -209,46 +206,41 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
ieWindow.cx = bNick ? w - si->iSplitterX:w;
ieWindow.cy = logBottom;
CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow);
- } else {
- RedrawWindow(GetDlgItem(hwndDlg,IDC_CHAT_LOG), NULL, NULL, RDW_INVALIDATE);
}
+ else RedrawWindow(GetDlgItem(hwndDlg,IDC_CHAT_LOG), NULL, NULL, RDW_INVALIDATE);
+
RedrawWindow(GetDlgItem(hwndDlg,IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE), NULL, NULL, RDW_INVALIDATE);
}
-
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int start;
- int result;
- MESSAGESUBDATA *dat;
- SESSION_INFO* Parentsi;
- CommonWindowData *windowData;
BOOL isShift = GetKeyState(VK_SHIFT) & 0x8000;
BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- Parentsi=(SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
- dat = (MESSAGESUBDATA *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- windowData = &Parentsi->windowData;
+ SESSION_INFO *Parentsi=(SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ MESSAGESUBDATA *dat = (MESSAGESUBDATA *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ CommonWindowData *windowData = &Parentsi->windowData;
- result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
+ int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
if (result != -1)
return result;
- switch (msg) {
- case EM_SUBCLASSED:
- dat = (MESSAGESUBDATA *) mir_alloc(sizeof(MESSAGESUBDATA));
- ZeroMemory(dat, sizeof(MESSAGESUBDATA));
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) dat);
- return 0;
+ switch (msg) {
+ case EM_SUBCLASSED:
+ dat = (MESSAGESUBDATA *) mir_alloc(sizeof(MESSAGESUBDATA));
+ ZeroMemory(dat, sizeof(MESSAGESUBDATA));
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) dat);
+ return 0;
- case WM_MOUSEWHEEL:
- if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0) {
- SendMessage(GetDlgItem(GetParent(hwnd), IDC_CHAT_LOG), WM_MOUSEWHEEL, wParam, lParam);
- }
- dat->lastEnterTime = 0;
- return TRUE;
+ case WM_MOUSEWHEEL:
+ if ((GetWindowLongPtr(hwnd, GWL_STYLE) & WS_VSCROLL) == 0)
+ SendMessage(GetDlgItem(GetParent(hwnd), IDC_CHAT_LOG), WM_MOUSEWHEEL, wParam, lParam);
+
+ dat->lastEnterTime = 0;
+ return TRUE;
case EM_REPLACESEL:
PostMessage(hwnd, EM_ACTIVATE, 0, 0);
@@ -259,384 +251,393 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_KEYDOWN:
- {
- if (wParam == VK_RETURN) {
- mir_free(dat->szSearchQuery);
- dat->szSearchQuery = NULL;
- mir_free(dat->szSearchResult);
- dat->szSearchResult = NULL;
- if (( isCtrl != 0 ) ^ (0 != db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
- if (dat->lastEnterTime + 2 < time(NULL))
- dat->lastEnterTime = time(NULL);
- else {
- SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
- SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- } } } else {
- dat->lastEnterTime = 0;
- }
-
-
- if (wParam == VK_TAB && isShift && !isCtrl) { // SHIFT-TAB (go to nick list)
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_LIST));
- return TRUE;
- }
-
- if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
- int iLen, end, topicStart;
- BOOL isTopic = FALSE;
- BOOL isRoom = FALSE;
- TCHAR* pszText = NULL;
- GETTEXTEX gt = {0};
- LRESULT lResult = (LRESULT)SendMessage(hwnd, EM_GETSEL, 0, 0);
-
- SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- start = LOWORD(lResult);
- end = HIWORD(lResult);
- SendMessage(hwnd, EM_SETSEL, end, end);
-
- gt.codepage = 1200;
- iLen = GetRichTextLength(hwnd, gt.codepage, TRUE);
- if (iLen >0) {
- TCHAR *pszName = NULL;
- pszText = (TCHAR *)mir_alloc(iLen + 100 * sizeof(TCHAR));
- gt.cb = iLen + 99 * sizeof(TCHAR);
- gt.flags = GT_DEFAULT;
-
- SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)pszText);
- if (start > 1 && pszText[start-1] == ' ' && pszText[start-2] == ':') {
- start--;
+ {
+ if (wParam == VK_RETURN) {
+ mir_free(dat->szSearchQuery);
+ dat->szSearchQuery = NULL;
+ mir_free(dat->szSearchResult);
+ dat->szSearchResult = NULL;
+ if (( isCtrl != 0 ) ^ (0 != db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
}
- while ( start >0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
- start--;
- while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end-1] != VK_TAB)
- end ++;
- if (pszText[start] == '#') {
- isRoom = TRUE;
- } else {
- topicStart = start;
- while ( topicStart >0 && (pszText[topicStart-1] == ' ' || pszText[topicStart-1] == 13 || pszText[topicStart-1] == VK_TAB))
- topicStart--;
- if (topicStart > 5 && _tcsstr(&pszText[topicStart-6], _T("/topic")) == &pszText[topicStart-6]) {
- isTopic = TRUE;
+ if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) {
+ if (dat->lastEnterTime + 2 < time(NULL))
+ dat->lastEnterTime = time(NULL);
+ else {
+ SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
+ SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
}
}
- if ( dat->szSearchQuery == NULL) {
- dat->szSearchQuery = (TCHAR *)mir_alloc( sizeof(TCHAR)*( end-start+1 ));
- lstrcpyn( dat->szSearchQuery, pszText+start, end-start+1);
- dat->szSearchResult = mir_tstrdup(dat->szSearchQuery);
- dat->lastSession = NULL;
- }
- if (isTopic) {
- pszName = Parentsi->ptszTopic;
- } else if (isRoom) {
- dat->lastSession = SM_FindSessionAutoComplete(Parentsi->pszModule, Parentsi, dat->lastSession, dat->szSearchQuery, dat->szSearchResult);
- if (dat->lastSession != NULL) {
- pszName = dat->lastSession->ptszName;
+ }
+ else dat->lastEnterTime = 0;
+
+ if (wParam == VK_TAB && isShift && !isCtrl) { // SHIFT-TAB (go to nick list)
+ SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_LIST));
+ return TRUE;
+ }
+
+ if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
+ int iLen, end, topicStart;
+ BOOL isTopic = FALSE;
+ BOOL isRoom = FALSE;
+ TCHAR* pszText = NULL;
+ GETTEXTEX gt = {0};
+ LRESULT lResult = (LRESULT)SendMessage(hwnd, EM_GETSEL, 0, 0);
+
+ SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+ start = LOWORD(lResult);
+ end = HIWORD(lResult);
+ SendMessage(hwnd, EM_SETSEL, end, end);
+
+ gt.codepage = 1200;
+ iLen = GetRichTextLength(hwnd, gt.codepage, TRUE);
+ if (iLen >0) {
+ TCHAR *pszName = NULL;
+ pszText = (TCHAR *)mir_alloc(iLen + 100 * sizeof(TCHAR));
+ gt.cb = iLen + 99 * sizeof(TCHAR);
+ gt.flags = GT_DEFAULT;
+
+ SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)pszText);
+ if (start > 1 && pszText[start-1] == ' ' && pszText[start-2] == ':') {
+ start--;
}
- } else {
- pszName = UM_FindUserAutoComplete(Parentsi->pUsers, dat->szSearchQuery, dat->szSearchResult);
- }
- mir_free(pszText);
- pszText = NULL;
- mir_free(dat->szSearchResult);
- dat->szSearchResult = NULL;
- if (pszName == NULL) {
- if (end !=start) {
- SendMessage(hwnd, EM_SETSEL, start, end);
- SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)dat->szSearchQuery);
+ while ( start >0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
+ start--;
+ while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end-1] != VK_TAB)
+ end ++;
+ if (pszText[start] == '#') {
+ isRoom = TRUE;
+ } else {
+ topicStart = start;
+ while ( topicStart >0 && (pszText[topicStart-1] == ' ' || pszText[topicStart-1] == 13 || pszText[topicStart-1] == VK_TAB))
+ topicStart--;
+ if (topicStart > 5 && _tcsstr(&pszText[topicStart-6], _T("/topic")) == &pszText[topicStart-6]) {
+ isTopic = TRUE;
+ }
+ }
+ if ( dat->szSearchQuery == NULL) {
+ dat->szSearchQuery = (TCHAR *)mir_alloc( sizeof(TCHAR)*( end-start+1 ));
+ lstrcpyn( dat->szSearchQuery, pszText+start, end-start+1);
+ dat->szSearchResult = mir_tstrdup(dat->szSearchQuery);
+ dat->lastSession = NULL;
}
- mir_free(dat->szSearchQuery);
- dat->szSearchQuery = NULL;
- } else {
- dat->szSearchResult = mir_tstrdup(pszName);
- if (end !=start) {
- if (!isRoom && !isTopic && g_Settings.AddColonToAutoComplete && start == 0) {
- pszText = (TCHAR *)mir_alloc((_tcslen(pszName) + 4) * sizeof(TCHAR));
- _tcscpy(pszText, pszName);
- _tcscat(pszText, _T(": "));
- pszName = pszText;
+ if (isTopic) {
+ pszName = Parentsi->ptszTopic;
+ } else if (isRoom) {
+ dat->lastSession = SM_FindSessionAutoComplete(Parentsi->pszModule, Parentsi, dat->lastSession, dat->szSearchQuery, dat->szSearchResult);
+ if (dat->lastSession != NULL) {
+ pszName = dat->lastSession->ptszName;
}
- SendMessage(hwnd, EM_SETSEL, start, end);
- SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)pszName);
+ } else {
+ pszName = UM_FindUserAutoComplete(Parentsi->pUsers, dat->szSearchQuery, dat->szSearchResult);
}
mir_free(pszText);
+ pszText = NULL;
+ mir_free(dat->szSearchResult);
+ dat->szSearchResult = NULL;
+ if (pszName == NULL) {
+ if (end !=start) {
+ SendMessage(hwnd, EM_SETSEL, start, end);
+ SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)dat->szSearchQuery);
+ }
+ mir_free(dat->szSearchQuery);
+ dat->szSearchQuery = NULL;
+ } else {
+ dat->szSearchResult = mir_tstrdup(pszName);
+ if (end !=start) {
+ if (!isRoom && !isTopic && g_Settings.AddColonToAutoComplete && start == 0) {
+ pszText = (TCHAR *)mir_alloc((_tcslen(pszName) + 4) * sizeof(TCHAR));
+ _tcscpy(pszText, pszName);
+ _tcscat(pszText, _T(": "));
+ pszName = pszText;
+ }
+ SendMessage(hwnd, EM_SETSEL, start, end);
+ SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)pszName);
+ }
+ mir_free(pszText);
+ }
}
+
+ SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+ RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ return 0;
+ }
+ if (wParam != VK_RIGHT && wParam != VK_LEFT) {
+ mir_free(dat->szSearchQuery);
+ dat->szSearchQuery = NULL;
+ mir_free(dat->szSearchResult);
+ dat->szSearchResult = NULL;
+ }
+ if (wParam == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_ITALICS) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_ITALICS, 0), 0);
+ return TRUE;
}
- SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- return 0;
- } else if (wParam != VK_RIGHT && wParam != VK_LEFT) {
- mir_free(dat->szSearchQuery);
- dat->szSearchQuery = NULL;
- mir_free(dat->szSearchResult);
- dat->szSearchResult = NULL;
- }
- if (wParam == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_ITALICS) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_ITALICS, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x42 && isCtrl && !isAlt) { // ctrl-b (bold)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BOLD) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x55 && isCtrl && !isAlt) { // ctrl-u (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_UNDERLINE) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4b && isCtrl && !isAlt) { // ctrl-k (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_COLOR, 0), 0);
- return TRUE;
- }
-
- if (wParam == VK_SPACE && isCtrl && !isAlt) { // ctrl-space (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, BST_UNCHECKED);
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BKGCOLOR, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_COLOR, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_ITALICS, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4c && isCtrl && !isAlt) { // ctrl-l (paste clean text)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BKGCOLOR, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (paste clean text)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHAT_FILTER)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_FILTER, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4e && isCtrl && !isAlt) { // ctrl-n (nicklist)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHAT_SHOWNICKLIST)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_SHOWNICKLIST, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x48 && isCtrl && !isAlt) { // ctrl-h (history)
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_HISTORY, 0), 0);
- return TRUE;
- }
-
- if (wParam == 0x4f && isCtrl && !isAlt) { // ctrl-o (options)
- if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHAT_CHANMGR)))
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_CHANMGR, 0), 0);
- return TRUE;
- }
-
- if (wParam == VK_NEXT || wParam == VK_PRIOR) {
- HWND htemp = GetParent(hwnd);
- SendDlgItemMessage(htemp, IDC_CHAT_LOG, msg, wParam, lParam);
- return TRUE;
- }
- break;
- }
- case WM_LBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_KILLFOCUS:
- dat->lastEnterTime = 0;
- break;
- case WM_CONTEXTMENU:
+ if (wParam == 0x42 && isCtrl && !isAlt) { // ctrl-b (bold)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BOLD) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x55 && isCtrl && !isAlt) { // ctrl-u (paste clean text)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_UNDERLINE) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x4b && isCtrl && !isAlt) { // ctrl-k (paste clean text)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_COLOR, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == VK_SPACE && isCtrl && !isAlt) { // ctrl-space (paste clean text)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, BST_UNCHECKED);
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_UNCHECKED);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BKGCOLOR, 0), 0);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_COLOR, 0), 0);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BOLD, 0), 0);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_UNDERLINE, 0), 0);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_ITALICS, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x4c && isCtrl && !isAlt) { // ctrl-l (paste clean text)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR) == BST_UNCHECKED?BST_CHECKED:BST_UNCHECKED);
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_BKGCOLOR, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x46 && isCtrl && !isAlt) { // ctrl-f (paste clean text)
+ if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHAT_FILTER)))
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_FILTER, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x4e && isCtrl && !isAlt) { // ctrl-n (nicklist)
+ if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHAT_SHOWNICKLIST)))
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_SHOWNICKLIST, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x48 && isCtrl && !isAlt) { // ctrl-h (history)
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_HISTORY, 0), 0);
+ return TRUE;
+ }
+
+ if (wParam == 0x4f && isCtrl && !isAlt) { // ctrl-o (options)
+ if (IsWindowEnabled(GetDlgItem(GetParent(hwnd), IDC_CHAT_CHANMGR)))
+ SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(IDC_CHAT_CHANMGR, 0), 0);
+ return TRUE;
+ }
+
+ if (((wParam == VK_INSERT && isShift) || (wParam == 'V' && isCtrl)) && !isAlt) { // ctrl-v (paste clean text)
+ SendMessage(hwnd, EM_PASTESPECIAL, CF_UNICODETEXT, 0);
+ return TRUE;
+ }
+
+ if (wParam == VK_NEXT || wParam == VK_PRIOR) {
+ HWND htemp = GetParent(hwnd);
+ SendDlgItemMessage(htemp, IDC_CHAT_LOG, msg, wParam, lParam);
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_KILLFOCUS:
+ dat->lastEnterTime = 0;
+ break;
+
+ case WM_CONTEXTMENU:
InputAreaContextMenu(hwnd, wParam, lParam, Parentsi->windowData.hContact);
return TRUE;
- case WM_KEYUP:
- case WM_LBUTTONUP:
- case WM_RBUTTONUP:
- case WM_MBUTTONUP:
- {
- CHARFORMAT2 cf;
- UINT u = 0;
- UINT u2 = 0;
- COLORREF cr;
-
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
-
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_BACKCOLOR|CFM_COLOR;
- SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
-
- if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bColor) {
- int index = GetColorIndex(Parentsi->pszModule, cf.crTextColor);
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR);
-
- if (index >= 0) {
- Parentsi->bFGSet = TRUE;
- Parentsi->iFG = index;
- }
-
- if (u == BST_UNCHECKED && cf.crTextColor != cr)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_CHECKED);
- else if (u == BST_CHECKED && cf.crTextColor == cr)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_UNCHECKED);
- }
-
- if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBkgColor) {
- int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
- COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
-
- if (index >= 0) {
- Parentsi->bBGSet = TRUE;
- Parentsi->iBG = index;
- }
- if (u == BST_UNCHECKED && cf.crBackColor != crB)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_CHECKED);
- else if (u == BST_CHECKED && cf.crBackColor == crB)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_UNCHECKED);
- }
-
- if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBold) {
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BOLD);
- u2 = cf.dwEffects;
- u2 &= CFE_BOLD;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_UNCHECKED);
- }
-
- if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bItalics) {
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_ITALICS);
- u2 = cf.dwEffects;
- u2 &= CFE_ITALIC;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_UNCHECKED);
- }
-
- if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bUnderline) {
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_UNDERLINE);
- u2 = cf.dwEffects;
- u2 &= CFE_UNDERLINE;
- if (u == BST_UNCHECKED && u2)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, BST_CHECKED);
- else if (u == BST_CHECKED && u2 == 0)
- CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, BST_UNCHECKED);
- } }
- break;
-
- case EM_UNSUBCLASSED:
+ case WM_KEYUP:
+ case WM_LBUTTONUP:
+ case WM_RBUTTONUP:
+ case WM_MBUTTONUP:
+ {
+ UINT u = 0;
+ UINT u2 = 0;
+ COLORREF cr;
+
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
+
+ CHARFORMAT2 cf;
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_BACKCOLOR|CFM_COLOR;
+ SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
+
+ if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bColor) {
+ int index = GetColorIndex(Parentsi->pszModule, cf.crTextColor);
+ u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_COLOR);
+
+ if (index >= 0) {
+ Parentsi->bFGSet = TRUE;
+ Parentsi->iFG = index;
+ }
+
+ if (u == BST_UNCHECKED && cf.crTextColor != cr)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_CHECKED);
+ else if (u == BST_CHECKED && cf.crTextColor == cr)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_COLOR, BST_UNCHECKED);
+ }
+
+ if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBkgColor) {
+ int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
+ COLORREF crB = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
+
+ if (index >= 0) {
+ Parentsi->bBGSet = TRUE;
+ Parentsi->iBG = index;
+ }
+ if (u == BST_UNCHECKED && cf.crBackColor != crB)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_CHECKED);
+ else if (u == BST_CHECKED && cf.crBackColor == crB)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BKGCOLOR, BST_UNCHECKED);
+ }
+
+ if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bBold) {
+ u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_BOLD);
+ u2 = cf.dwEffects;
+ u2 &= CFE_BOLD;
+ if (u == BST_UNCHECKED && u2)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_CHECKED);
+ else if (u == BST_CHECKED && u2 == 0)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_BOLD, BST_UNCHECKED);
+ }
+
+ if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bItalics) {
+ u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_ITALICS);
+ u2 = cf.dwEffects;
+ u2 &= CFE_ITALIC;
+ if (u == BST_UNCHECKED && u2)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_CHECKED);
+ else if (u == BST_CHECKED && u2 == 0)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_ITALICS, BST_UNCHECKED);
+ }
+
+ if (MM_FindModule(Parentsi->pszModule) && MM_FindModule(Parentsi->pszModule)->bUnderline) {
+ u = IsDlgButtonChecked(GetParent(hwnd), IDC_CHAT_UNDERLINE);
+ u2 = cf.dwEffects;
+ u2 &= CFE_UNDERLINE;
+ if (u == BST_UNCHECKED && u2)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, BST_CHECKED);
+ else if (u == BST_CHECKED && u2 == 0)
+ CheckDlgButton(GetParent(hwnd), IDC_CHAT_UNDERLINE, BST_UNCHECKED);
+ } }
+ break;
+
+ case EM_UNSUBCLASSED:
mir_free(dat->szSearchQuery);
- mir_free(dat->szSearchResult);
+ mir_free(dat->szSearchResult);
mir_free(dat);
return 0;
- }
+ }
return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
- static SESSION_INFO* si = NULL;
- switch (uMsg) {
- case WM_INITDIALOG:
- si = (SESSION_INFO *)lParam;
- CheckDlgButton(hwndDlg, IDC_CHAT_1, si->iLogFilterFlags&GC_EVENT_ACTION);
- CheckDlgButton(hwndDlg, IDC_CHAT_2, si->iLogFilterFlags&GC_EVENT_MESSAGE);
- CheckDlgButton(hwndDlg, IDC_CHAT_3, si->iLogFilterFlags&GC_EVENT_NICK);
- CheckDlgButton(hwndDlg, IDC_CHAT_4, si->iLogFilterFlags&GC_EVENT_JOIN);
- CheckDlgButton(hwndDlg, IDC_CHAT_5, si->iLogFilterFlags&GC_EVENT_PART);
- CheckDlgButton(hwndDlg, IDC_CHAT_6, si->iLogFilterFlags&GC_EVENT_TOPIC);
- CheckDlgButton(hwndDlg, IDC_CHAT_7, si->iLogFilterFlags&GC_EVENT_ADDSTATUS);
- CheckDlgButton(hwndDlg, IDC_CHAT_8, si->iLogFilterFlags&GC_EVENT_INFORMATION);
- CheckDlgButton(hwndDlg, IDC_CHAT_9, si->iLogFilterFlags&GC_EVENT_QUIT);
- CheckDlgButton(hwndDlg, IDC_CHAT_10, si->iLogFilterFlags&GC_EVENT_KICK);
- CheckDlgButton(hwndDlg, IDC_CHAT_11, si->iLogFilterFlags&GC_EVENT_NOTICE);
- break;
-
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORSTATIC:
- SetTextColor((HDC)wParam,RGB(60,60,150));
- SetBkColor((HDC)wParam,GetSysColor(COLOR_WINDOW));
- return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
-
- case WM_ACTIVATE:
- if (LOWORD(wParam) == WA_INACTIVE) {
- int iFlags = 0;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_1) == BST_CHECKED)
- iFlags |= GC_EVENT_ACTION;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_2) == BST_CHECKED)
- iFlags |= GC_EVENT_MESSAGE;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_3) == BST_CHECKED)
- iFlags |= GC_EVENT_NICK;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_4) == BST_CHECKED)
- iFlags |= GC_EVENT_JOIN;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_5) == BST_CHECKED)
- iFlags |= GC_EVENT_PART;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_6) == BST_CHECKED)
- iFlags |= GC_EVENT_TOPIC;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_7) == BST_CHECKED)
- iFlags |= GC_EVENT_ADDSTATUS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_8) == BST_CHECKED)
- iFlags |= GC_EVENT_INFORMATION;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_9) == BST_CHECKED)
- iFlags |= GC_EVENT_QUIT;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_10) == BST_CHECKED)
- iFlags |= GC_EVENT_KICK;
- if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_11) == BST_CHECKED)
- iFlags |= GC_EVENT_NOTICE;
-
- if (iFlags&GC_EVENT_ADDSTATUS)
- iFlags |= GC_EVENT_REMOVESTATUS;
-
- SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags);
- if (si->bFilterEnabled)
- SendMessage(si->hWnd, GC_REDRAWLOG, 0, 0);
- PostMessage(hwndDlg, WM_CLOSE, 0, 0);
- }
- break;
+ static SESSION_INFO *si = NULL;
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ si = (SESSION_INFO *)lParam;
+ CheckDlgButton(hwndDlg, IDC_CHAT_1, si->iLogFilterFlags&GC_EVENT_ACTION);
+ CheckDlgButton(hwndDlg, IDC_CHAT_2, si->iLogFilterFlags&GC_EVENT_MESSAGE);
+ CheckDlgButton(hwndDlg, IDC_CHAT_3, si->iLogFilterFlags&GC_EVENT_NICK);
+ CheckDlgButton(hwndDlg, IDC_CHAT_4, si->iLogFilterFlags&GC_EVENT_JOIN);
+ CheckDlgButton(hwndDlg, IDC_CHAT_5, si->iLogFilterFlags&GC_EVENT_PART);
+ CheckDlgButton(hwndDlg, IDC_CHAT_6, si->iLogFilterFlags&GC_EVENT_TOPIC);
+ CheckDlgButton(hwndDlg, IDC_CHAT_7, si->iLogFilterFlags&GC_EVENT_ADDSTATUS);
+ CheckDlgButton(hwndDlg, IDC_CHAT_8, si->iLogFilterFlags&GC_EVENT_INFORMATION);
+ CheckDlgButton(hwndDlg, IDC_CHAT_9, si->iLogFilterFlags&GC_EVENT_QUIT);
+ CheckDlgButton(hwndDlg, IDC_CHAT_10, si->iLogFilterFlags&GC_EVENT_KICK);
+ CheckDlgButton(hwndDlg, IDC_CHAT_11, si->iLogFilterFlags&GC_EVENT_NOTICE);
+ break;
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
- }
+ case WM_CTLCOLOREDIT:
+ case WM_CTLCOLORSTATIC:
+ SetTextColor((HDC)wParam,RGB(60,60,150));
+ SetBkColor((HDC)wParam,GetSysColor(COLOR_WINDOW));
+ return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
+
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) == WA_INACTIVE) {
+ int iFlags = 0;
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_1) == BST_CHECKED)
+ iFlags |= GC_EVENT_ACTION;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_2) == BST_CHECKED)
+ iFlags |= GC_EVENT_MESSAGE;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_3) == BST_CHECKED)
+ iFlags |= GC_EVENT_NICK;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_4) == BST_CHECKED)
+ iFlags |= GC_EVENT_JOIN;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_5) == BST_CHECKED)
+ iFlags |= GC_EVENT_PART;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_6) == BST_CHECKED)
+ iFlags |= GC_EVENT_TOPIC;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_7) == BST_CHECKED)
+ iFlags |= GC_EVENT_ADDSTATUS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_8) == BST_CHECKED)
+ iFlags |= GC_EVENT_INFORMATION;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_9) == BST_CHECKED)
+ iFlags |= GC_EVENT_QUIT;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_10) == BST_CHECKED)
+ iFlags |= GC_EVENT_KICK;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_11) == BST_CHECKED)
+ iFlags |= GC_EVENT_NOTICE;
+
+ if (iFlags&GC_EVENT_ADDSTATUS)
+ iFlags |= GC_EVENT_REMOVESTATUS;
+
+ SendMessage(si->hWnd, GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags);
+ if (si->bFilterEnabled)
+ SendMessage(si->hWnd, GC_REDRAWLOG, 0, 0);
+ PostMessage(hwndDlg, WM_CLOSE, 0, 0);
+ }
+ break;
- return(FALSE);
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ break;
+ }
+
+ return(FALSE);
}
static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg) {
- case WM_RBUTTONUP:
- {
- HWND hFilter = GetDlgItem(GetParent(hwnd), IDC_CHAT_FILTER);
- HWND hColor = GetDlgItem(GetParent(hwnd), IDC_CHAT_COLOR);
- HWND hBGColor = GetDlgItem(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
-
- if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) {
- if (hFilter == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
- if (hColor == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
- if (hBGColor == hwnd)
- SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
- } }
- break;
- }
+ switch (msg) {
+ case WM_RBUTTONUP:
+ {
+ HWND hFilter = GetDlgItem(GetParent(hwnd), IDC_CHAT_FILTER);
+ HWND hColor = GetDlgItem(GetParent(hwnd), IDC_CHAT_COLOR);
+ HWND hBGColor = GetDlgItem(GetParent(hwnd), IDC_CHAT_BKGCOLOR);
+
+ if (db_get_b(NULL, "Chat", "RightClickFilter", 0) != 0) {
+ if (hFilter == hwnd)
+ SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
+ if (hColor == hwnd)
+ SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_COLOR);
+ if (hBGColor == hwnd)
+ SendMessage(GetParent(hwnd), GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
+ }
+ }
+ break;
+ }
return mir_callNextSubclass(hwnd, ButtonSubclassProc, msg, wParam, lParam);
}
@@ -644,11 +645,11 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static BOOL inMenu = FALSE;
- SESSION_INFO* si =(SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, &si->windowData);
- if (result != -1) {
+ if (result != -1)
return result;
- }
+
switch (msg) {
case WM_MEASUREITEM:
MeasureMenuItem(wParam, lParam);
@@ -660,100 +661,99 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SetCursor(LoadCursor(NULL, IDC_ARROW));
return TRUE;
}
- break;
+ break;
case WM_LBUTTONUP:
- {
- CHARRANGE sel;
-
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax)
- {
- SendMessage(hwnd, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
- }
- SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE));
- break;
- }
+ {
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin != sel.cpMax) {
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ sel.cpMin = sel.cpMax ;
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
+ }
+ SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE));
+ break;
+ }
- case WM_ACTIVATE:
- if (LOWORD(wParam) == WA_INACTIVE) {
- CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
- if (sel.cpMin != sel.cpMax) {
- sel.cpMin = sel.cpMax ;
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
- } }
- break;
+ case WM_ACTIVATE:
+ if (LOWORD(wParam) == WA_INACTIVE) {
+ CHARRANGE sel;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (sel.cpMin != sel.cpMax) {
+ sel.cpMin = sel.cpMax ;
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
+ }
+ }
+ break;
case WM_CONTEXTMENU:
- {
- CHARRANGE sel, all = { 0, -1 };
- POINT pt;
- UINT uID = 0;
- HMENU hMenu = 0;
- TCHAR *pszWord = NULL;
- POINTL ptl;
-
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel);
- if (lParam == 0xFFFFFFFF) {
- SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM) & pt, (LPARAM)sel.cpMax);
- ClientToScreen(hwnd, &pt);
- } else {
- pt.x = (short) LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
- }
- ptl.x = (LONG)pt.x;
- ptl.y = (LONG)pt.y;
- ScreenToClient(hwnd, (LPPOINT)&ptl);
- pszWord = GetRichTextWord(hwnd, &ptl);
- inMenu = TRUE;
- uID = CreateGCMenu(hwnd, &hMenu, 1, pt, si, NULL, pszWord);
- inMenu = FALSE;
- switch (uID) {
- case 0:
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
- break;
+ {
+ CHARRANGE sel, all = { 0, -1 };
+ POINT pt;
+ POINTL ptl;
- case ID_COPYALL:
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel);
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all);
- SendMessage(hwnd, WM_COPY, 0, 0);
- SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
- break;
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
+ if (lParam == 0xFFFFFFFF) {
+ SendMessage(hwnd, EM_POSFROMCHAR, (WPARAM)&pt, (LPARAM)sel.cpMax);
+ ClientToScreen(hwnd, &pt);
+ }
+ else {
+ pt.x = (short) LOWORD(lParam);
+ pt.y = (short) HIWORD(lParam);
+ }
+ ptl.x = (LONG)pt.x;
+ ptl.y = (LONG)pt.y;
+ ScreenToClient(hwnd, (LPPOINT)&ptl);
+ TCHAR *pszWord = GetRichTextWord(hwnd, &ptl);
+ inMenu = TRUE;
+ HMENU hMenu = NULL;
+ UINT uID = CreateGCMenu(hwnd, &hMenu, 1, pt, si, NULL, pszWord);
+ inMenu = FALSE;
+ switch (uID) {
+ case 0:
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ break;
- case IDM_CLEAR:
- if (si)
- {
- SetWindowText(hwnd, _T(""));
- LM_RemoveAll(&si->pLog, &si->pLogEnd);
- si->iEventCount = 0;
- si->LastTime = 0;
+ case ID_COPYALL:
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& all);
+ SendMessage(hwnd, WM_COPY, 0, 0);
+ SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
- }
- break;
+ break;
- case IDM_SEARCH_GOOGLE:
- case IDM_SEARCH_BING:
- case IDM_SEARCH_YANDEX:
- case IDM_SEARCH_YAHOO:
- case IDM_SEARCH_WIKIPEDIA:
- case IDM_SEARCH_FOODNETWORK:
- case IDM_SEARCH_GOOGLE_MAPS:
- case IDM_SEARCH_GOOGLE_TRANSLATE:
- SearchWord(pszWord, uID - IDM_SEARCH_GOOGLE + SEARCHENGINE_GOOGLE);
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
- break;
- default:
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
- DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
- break;
+ case IDM_CLEAR:
+ if (si) {
+ SetWindowText(hwnd, _T(""));
+ LM_RemoveAll(&si->pLog, &si->pLogEnd);
+ si->iEventCount = 0;
+ si->LastTime = 0;
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ }
+ break;
+
+ case IDM_SEARCH_GOOGLE:
+ case IDM_SEARCH_BING:
+ case IDM_SEARCH_YANDEX:
+ case IDM_SEARCH_YAHOO:
+ case IDM_SEARCH_WIKIPEDIA:
+ case IDM_SEARCH_FOODNETWORK:
+ case IDM_SEARCH_GOOGLE_MAPS:
+ case IDM_SEARCH_GOOGLE_TRANSLATE:
+ SearchWord(pszWord, uID - IDM_SEARCH_GOOGLE + SEARCHENGINE_GOOGLE);
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ break;
+
+ default:
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
+ break;
+ }
+ DestroyGCMenu(&hMenu, 5);
+ mir_free(pszWord);
}
- DestroyGCMenu(&hMenu, 5);
- mir_free(pszWord);
break;
- }
+
case WM_CHAR:
SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE));
SendMessage(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE), WM_CHAR, wParam, lParam);
@@ -768,43 +768,37 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
static int currentHovered=-1;
static HWND hwndToolTip=NULL;
static HWND oldParent=NULL;
- TOOLINFO ti={0};
RECT clientRect;
BOOL bNewTip=FALSE;
USERINFO *ui1 = NULL;
- if (hoveredItem==currentHovered) return;
- currentHovered=hoveredItem;
+ if (hoveredItem == currentHovered)
+ return;
+ currentHovered = hoveredItem;
- if (oldParent!=hwnd && hwndToolTip) {
+ if (oldParent != hwnd && hwndToolTip) {
SendMessage(hwndToolTip, TTM_DELTOOL, 0, 0);
DestroyWindow(hwndToolTip);
- hwndToolTip=NULL;
+ hwndToolTip = NULL;
}
- if (hoveredItem==-1) {
-
- SendMessage( hwndToolTip, TTM_ACTIVATE, 0, 0 );
-
- } else {
-
+ if (hoveredItem == -1)
+ SendMessage(hwndToolTip, TTM_ACTIVATE, 0, 0);
+ else {
if (!hwndToolTip) {
- hwndToolTip=CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
+ hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
- hwnd, NULL, g_hInst, NULL );
- //SetWindowPos(hwndToolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
- bNewTip=TRUE;
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ hwnd, NULL, g_hInst, NULL);
+ bNewTip = TRUE;
}
GetClientRect(hwnd,&clientRect);
- ti.cbSize=sizeof(TOOLINFO);
- ti.uFlags=TTF_SUBCLASS;
- ti.hinst=g_hInst;
- ti.hwnd=hwnd;
- ti.uId=1;
- ti.rect=clientRect;
-
- ti.lpszText=NULL;
+ TOOLINFO ti = { sizeof(TOOLINFO) };
+ ti.uFlags = TTF_SUBCLASS;
+ ti.hinst = g_hInst;
+ ti.hwnd = hwnd;
+ ti.uId = 1;
+ ti.rect = clientRect;
ui1 = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui1) {
@@ -835,11 +829,11 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO* si =(SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
+ SESSION_INFO *si = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, &si->windowData);
- if (result != -1) {
+ if (result != -1)
return result;
- }
+
switch (msg) {
case WM_ERASEBKGND:
{
@@ -851,120 +845,128 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (index == LB_ERR || si->nUsersInNicklist <= 0)
return 0;
- items = si->nUsersInNicklist - index;
- height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ items = si->nUsersInNicklist - index;
+ height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- if (height != LB_ERR) {
- RECT rc = {0};
- GetClientRect(hwnd, &rc);
+ if (height != LB_ERR) {
+ RECT rc = {0};
+ GetClientRect(hwnd, &rc);
- if (rc.bottom-rc.top > items * height) {
- rc.top = items*height;
- FillRect(dc, &rc, hListBkgBrush);
- } } } }
- return 1;
+ if (rc.bottom-rc.top > items * height) {
+ rc.top = items*height;
+ FillRect(dc, &rc, hListBkgBrush);
+ }
+ }
+ }
+ }
+ return 1;
- case WM_RBUTTONDOWN:
- SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
- break;
+ case WM_RBUTTONDOWN:
+ SendMessage(hwnd, WM_LBUTTONDOWN, wParam, lParam);
+ break;
- case WM_RBUTTONUP:
- SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
- break;
+ case WM_RBUTTONUP:
+ SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam);
+ break;
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
if (mis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
- return FALSE;
}
+ return FALSE;
+
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
- return FALSE;
}
- case WM_CONTEXTMENU:
- {
- TVHITTESTINFO hti;
- DWORD item;
- int height=0;
- USERINFO * ui;
-
- hti.pt.x = (short) LOWORD(lParam);
- hti.pt.y = (short) HIWORD(lParam);
- if (hti.pt.x == -1 && hti.pt.y == -1) {
- int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
- int top = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
- height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
- hti.pt.x = 4;
- hti.pt.y = (index - top)*height + 1;
- }
- else ScreenToClient(hwnd,&hti.pt);
-
- item = (DWORD)(SendMessage(hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- if ( HIWORD( item ) == 1 )
- item = (DWORD)(-1);
- else
- item &= 0xFFFF;
- ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, (int)item);
- if (ui) {
- HMENU hMenu = 0;
- UINT uID;
- USERINFO uinew;
-
- memcpy(&uinew, ui, sizeof(USERINFO));
- if (hti.pt.x == -1 && hti.pt.y == -1)
- hti.pt.y += height - 4;
- ClientToScreen(hwnd, &hti.pt);
- uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, si, uinew.pszUID, NULL);
-
- switch (uID) {
- case 0:
- break;
-
- case ID_MESS:
- DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
- break;
-
- default:
- DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
- break;
- }
- DestroyGCMenu(&hMenu, 1);
- return TRUE;
- } }
- break;
-
- case WM_GETDLGCODE :
- {
- BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt;
-
- LPMSG lpmsg;
- if ( ( lpmsg = (LPMSG)lParam ) != NULL ) {
- if ( lpmsg->message == WM_KEYDOWN
- && (lpmsg->wParam == VK_RETURN || lpmsg->wParam == VK_ESCAPE || (lpmsg->wParam == VK_TAB && (isAlt || isCtrl))))
- return DLGC_WANTALLKEYS;
- }
- break;
- }
- case WM_KEYDOWN:
- if (wParam == VK_RETURN) {
+ return FALSE;
+
+ case WM_CONTEXTMENU:
+ {
+ TVHITTESTINFO hti;
+ DWORD item;
+ int height=0;
+ USERINFO * ui;
+
+ hti.pt.x = (short) LOWORD(lParam);
+ hti.pt.y = (short) HIWORD(lParam);
+ if (hti.pt.x == -1 && hti.pt.y == -1) {
int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
- if (index!=LB_ERR) {
- USERINFO *ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
+ int top = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
+ height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
+ hti.pt.x = 4;
+ hti.pt.y = (index - top)*height + 1;
+ }
+ else ScreenToClient(hwnd,&hti.pt);
+
+ item = (DWORD)(SendMessage(hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
+ if ( HIWORD( item ) == 1 )
+ item = (DWORD)(-1);
+ else
+ item &= 0xFFFF;
+ ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, (int)item);
+ if (ui) {
+ HMENU hMenu = 0;
+ UINT uID;
+ USERINFO uinew;
+
+ memcpy(&uinew, ui, sizeof(USERINFO));
+ if (hti.pt.x == -1 && hti.pt.y == -1)
+ hti.pt.y += height - 4;
+ ClientToScreen(hwnd, &hti.pt);
+ uID = CreateGCMenu(hwnd, &hMenu, 0, hti.pt, si, uinew.pszUID, NULL);
+
+ switch (uID) {
+ case 0:
+ break;
+
+ case ID_MESS:
DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ break;
+
+ default:
+ DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui->pszUID, NULL, (LPARAM)uID);
+ break;
}
- break;
+ DestroyGCMenu(&hMenu, 1);
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_GETDLGCODE :
+ {
+ BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
+ BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt;
+
+ LPMSG lpmsg;
+ if ( ( lpmsg = (LPMSG)lParam ) != NULL ) {
+ if ( lpmsg->message == WM_KEYDOWN
+ && (lpmsg->wParam == VK_RETURN || lpmsg->wParam == VK_ESCAPE || (lpmsg->wParam == VK_TAB && (isAlt || isCtrl))))
+ return DLGC_WANTALLKEYS;
+ }
+ }
+ break;
+
+ case WM_KEYDOWN:
+ if (wParam == VK_RETURN) {
+ int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
+ if (index!=LB_ERR) {
+ USERINFO *ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
+ DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui->pszUID, NULL, 0);
+ }
+ break;
}
if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT ||
- wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
- si->szSearch[0] = 0;
+ wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
+ si->szSearch[0] = 0;
}
break;
+
case WM_CHAR:
case WM_UNICHAR:
/*
@@ -1041,9 +1043,9 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
nItemUnderMouse &= 0xFFFF;
ProcessNickListHovering(hwnd, (int)nItemUnderMouse, &pt, si);
- } else {
- ProcessNickListHovering(hwnd, -1, &pt, NULL);
- } }
+ }
+ else ProcessNickListHovering(hwnd, -1, &pt, NULL);
+ }
break;
}
@@ -1053,40 +1055,38 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth)
{
- HDC hdc;
- HFONT hOldFont;
- RECT rc = {0};
- int i;
+ if (!pszText || !hFont)
+ return 0;
- if (!pszText || !hFont)
- return 0;
+ HDC hdc = GetDC(NULL);
+ HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
- hdc = GetDC(NULL);
- hOldFont = (HFONT)SelectObject(hdc, hFont);
- i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
- SelectObject(hdc, hOldFont);
- ReleaseDC(NULL,hdc);
- return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
+ RECT rc = {0};
+ int i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+ SelectObject(hdc, hOldFont);
+ ReleaseDC(NULL,hdc);
+ return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
}
static void __cdecl phase2(void * lParam)
{
- SESSION_INFO* si = (SESSION_INFO*) lParam;
- Sleep(30);
- if (si && si->hWnd)
- PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
+ SESSION_INFO *si = (SESSION_INFO*) lParam;
+ Sleep(30);
+ if (si && si->hWnd)
+ PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0);
}
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
static HMENU hToolbarMenu;
- SESSION_INFO * si;
- si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if (!si && uMsg!=WM_INITDIALOG) return FALSE;
+ SESSION_INFO *si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ if (!si && uMsg != WM_INITDIALOG)
+ return FALSE;
+
switch (uMsg) {
case WM_INITDIALOG:
{
- SESSION_INFO* psi = (SESSION_INFO*)lParam;
+ SESSION_INFO *psi = (SESSION_INFO*)lParam;
int mask;
RECT minEditInit;
HWND hNickList = GetDlgItem(hwndDlg,IDC_CHAT_LIST);
@@ -1434,7 +1434,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
if (mis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
-
+
int ih = GetTextPixelSize( _T("AQGgl'"), g_Settings.UserListFont,FALSE);
int ih2 = GetTextPixelSize( _T("AQGg'"), g_Settings.UserListHeadingsFont,FALSE);
int font = ih > ih2?ih:ih2;
@@ -1451,7 +1451,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
-
+
if (dis->CtlID == IDC_CHAT_LIST) {
HFONT hFont, hOldFont;
HICON hIcon;
@@ -1500,7 +1500,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
SelectObject(dis->hDC, hOldFont);
}
return TRUE;
- } }
+ }
+ }
case GC_UPDATENICKLIST:
{
@@ -1522,64 +1523,63 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
}
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, WM_SETREDRAW, TRUE, 0);
InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, FALSE) ;
- UpdateWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST)) ;
+ UpdateWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST)) ;
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
}
break;
case GC_EVENT_CONTROL + WM_USER+500:
- {
- switch(wParam) {
- case SESSION_OFFLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- return TRUE;
+ switch(wParam) {
+ case SESSION_OFFLINE:
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
+ return TRUE;
- case SESSION_ONLINE:
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- return TRUE;
+ case SESSION_ONLINE:
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ return TRUE;
- case WINDOW_HIDDEN:
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case WINDOW_HIDDEN:
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_CLEARLOG:
- SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
- return TRUE;
+ case WINDOW_CLEARLOG:
+ SetDlgItemText(hwndDlg, IDC_CHAT_LOG, _T(""));
+ return TRUE;
- case SESSION_TERMINATE:
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- si->wState &= ~STATE_TALK;
- db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0);
- SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
- return TRUE;
+ case SESSION_TERMINATE:
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ si->wState &= ~STATE_TALK;
+ db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0);
+ SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
+ return TRUE;
- case WINDOW_MINIMIZE:
- ShowWindow(hwndDlg, SW_MINIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MINIMIZE:
+ ShowWindow(hwndDlg, SW_MINIMIZE);
+ goto LABEL_SHOWWINDOW;
- case WINDOW_MAXIMIZE:
- ShowWindow(hwndDlg, SW_MAXIMIZE);
- goto LABEL_SHOWWINDOW;
+ case WINDOW_MAXIMIZE:
+ ShowWindow(hwndDlg, SW_MAXIMIZE);
+ goto LABEL_SHOWWINDOW;
- case SESSION_INITDONE:
- if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0)
- return TRUE;
- // fall through
- case WINDOW_VISIBLE:
- if (IsIconic(hwndDlg))
- ShowWindow(hwndDlg, SW_NORMAL);
-LABEL_SHOWWINDOW:
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
- SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- ShowWindow(hwndDlg, SW_SHOW);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SetForegroundWindow(hwndDlg);
+ case SESSION_INITDONE:
+ if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0)
return TRUE;
- } }
+ // fall through
+ case WINDOW_VISIBLE:
+ if (IsIconic(hwndDlg))
+ ShowWindow(hwndDlg, SW_NORMAL);
+LABEL_SHOWWINDOW:
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG, 0, 0);
+ SendMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ ShowWindow(hwndDlg, SW_SHOW);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SetForegroundWindow(hwndDlg);
+ return TRUE;
+ }
break;
case GC_SPLITTERMOVED:
@@ -1715,12 +1715,14 @@ LABEL_SHOWWINDOW:
}
}
break;
+
case EN_MSGFILTER:
if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP){
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
break;
+
case EN_LINK:
if (pNmhdr->idFrom == IDC_CHAT_LOG) {
switch (((ENLINK *) lParam)->msg) {
@@ -1732,11 +1734,12 @@ LABEL_SHOWWINDOW:
return TRUE;
}
break;
- } }
+ }
+ }
break;
+
case TTN_NEEDTEXT:
- if (pNmhdr->idFrom == (UINT_PTR)GetDlgItem(hwndDlg,IDC_CHAT_LIST))
- {
+ if (pNmhdr->idFrom == (UINT_PTR)GetDlgItem(hwndDlg,IDC_CHAT_LIST)) {
LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lParam;
POINT p;
int item;
@@ -1754,14 +1757,17 @@ LABEL_SHOWWINDOW:
TranslateT( "Unique id" ), ui->pszUID,
TranslateT( "Status" ), TM_WordToString( parentdat->pStatuses, ui->Status ));
lpttd->lpszText = ptszBuf;
- } }
+ }
+ }
break;
- } }
+ }
+ }
break;
case WM_COMMAND:
if (!lParam && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)si->windowData.hContact))
break;
+
switch (LOWORD(wParam)) {
case IDC_CHAT_LIST:
if (HIWORD(wParam) == LBN_DBLCLK) {
@@ -1942,7 +1948,7 @@ LABEL_SHOWWINDOW:
case IDC_CHAT_COLOR:
{
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ MODULEINFO *pInfo = MM_FindModule(si->pszModule);
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwEffects = 0;
@@ -1956,33 +1962,31 @@ LABEL_SHOWWINDOW:
else if (si->bFGSet) {
cf.dwMask = CFM_COLOR;
cf.crTextColor = pInfo->crColors[si->iFG];
- if (pInfo->bSingleFormat) {
+ if (pInfo->bSingleFormat)
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
+ else
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
- } }
+ }
+ }
else {
COLORREF cr;
LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr, FALSE);
cf.dwMask = CFM_COLOR;
cf.crTextColor = cr;
- if (pInfo->bSingleFormat) {
+ if (pInfo->bSingleFormat)
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
+ else
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
-
- } }
+ }
+ }
break;
case IDC_CHAT_BOLD:
case IDC_CHAT_ITALICS:
case IDC_CHAT_UNDERLINE:
-
{
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ MODULEINFO *pInfo = MM_FindModule(si->pszModule);
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
@@ -2000,13 +2004,13 @@ LABEL_SHOWWINDOW:
cf.dwEffects |= CFE_ITALIC;
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_UNDERLINE))
cf.dwEffects |= CFE_UNDERLINE;
- if (pInfo->bSingleFormat) {
+ if (pInfo->bSingleFormat)
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
- } else {
+ else
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
- }
}
break;
+
case IDCANCEL:
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
}
@@ -2016,8 +2020,6 @@ LABEL_SHOWWINDOW:
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
break;
-
-
case WM_GETMINMAXINFO:
{
MINMAXINFO* mmi = (MINMAXINFO*)lParam;
@@ -2068,15 +2070,15 @@ LABEL_SHOWWINDOW:
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
DestroyMenu(hToolbarMenu);
- return TRUE;
}
+ return TRUE;
case DM_GETCONTEXTMENU:
{
HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) si->windowData.hContact, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)hMenu);
- return TRUE;
}
+ return TRUE;
case WM_CONTEXTMENU:
if (GetParent(hwndDlg) == (HWND) wParam) {