summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-08 15:51:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-08 15:51:52 +0000
commit6941b13721285765d6b8df94c1c87d4f78b8be68 (patch)
treea388bc8c059fe4e1550b9bdbb1a6f66d065f57af
parent78f56932d0c04a7b6d3b27fd98ffce64639a1953 (diff)
chat structures slightly cleaned (no changes so far)
git-svn-id: http://svn.miranda-ng.org/main/trunk@7547 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_chat.h258
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp30
-rw-r--r--plugins/Scriver/src/chat/services.cpp96
-rw-r--r--plugins/Scriver/src/chat/tools.cpp6
-rw-r--r--plugins/Scriver/src/chat/window.cpp871
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp8
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp2
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp10
-rw-r--r--protocols/IRCG/src/input.cpp4
-rw-r--r--protocols/IRCG/src/services.cpp2
-rw-r--r--protocols/IRCG/src/tools.cpp530
-rw-r--r--protocols/IRCG/src/windows.cpp4
-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
21 files changed, 1021 insertions, 1079 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index 14c74d2385..3affd8c811 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -133,14 +133,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GC_COLOR 0x0008 //enable the 'foreground color' button
#define GC_BKGCOLOR 0x0010 //enable the 'background color' button
#define GC_ACKMSG 0x0020 //the protocol must acknowlege messages sent
-#define GC_TYPNOTIF 0x0040 //NOT SUPPORTED YET! Enable typing notifications.
+#define GC_TYPNOTIF 0x0040 //enable typing notifications.
#define GC_CHANMGR 0x0080 //enable the 'channel settings' button
-#define GC_SINGLEFORMAT 0x0100 //the protocol supports only 1 formatting per message
-#define GC_FONTSIZE 0x0200 //enable font size selection
+#define GC_SINGLEFORMAT 0x0100 //the protocol supports only 1 formatting per message
+#define GC_FONTSIZE 0x0200 //enable font size selection
-#define GC_UNICODE 0x01000 //NOT SUPPORTED YET! Enable unicode (if chat supports it),
- //Pass UNICODE instead of ASCII. Note that
- //registration will fail if the unicode version of chat is not installed
+#define GC_UNICODE 0x01000 //enable unicode (if chat supports it),
+ //Pass UNICODE instead of ASCII.
#if defined( _UNICODE )
#define GC_TCHAR GC_UNICODE
#else
@@ -148,26 +147,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
// Error messages
-#define GC_REGISTER_WRONGVER 1 //You appear to be using the wrong version of this API. Registration failed.
-#define GC_REGISTER_ERROR 2 //An internal error occurred. Registration failed.
-#define GC_REGISTER_NOUNICODE 3 //MS_GC_REGISTER returns this error if the Unicode version of chat
- //is not installed and GC_UNICODE is set. Registration failed
+#define GC_REGISTER_WRONGVER 1 // You appear to be using the wrong version of this API. Registration failed.
+#define GC_REGISTER_ERROR 2 // An internal error occurred. Registration failed.
+#define GC_REGISTER_NOUNICODE 3 // MS_GC_REGISTER returns this error if the Unicode version of chat
+ // is not installed and GC_UNICODE is set. Registration failed
// GCREGISTER struct
typedef struct {
- int cbSize; //Set to sizeof(GCREGISTER);
- DWORD dwFlags; //Use GC_* flags above to indicate features supported
- const char* pszModule; //This MUST be the protocol name as registered with Miranda IM
+ int cbSize; // Set to sizeof(GCREGISTER);
+ DWORD dwFlags; // Use GC_* flags above to indicate features supported
+ LPCSTR pszModule; // This MUST be the protocol name as registered with Miranda IM
union {
- const char* pszModuleDispName; //This is the protocol's real name as it will be displayed to the user
- const TCHAR* ptszModuleDispName; // used if GC_TCHAR flag is passed
+ LPCSTR pszModuleDispName; //This is the protocol's real name as it will be displayed to the user
+ LPCTSTR ptszModuleDispName; // used if GC_TCHAR flag is passed
};
- int iMaxText; //Max message length the protocol supports. Will limit the typing area input. 0 = no limit
- int nColors; //Number of colors in the colorchooser menu for the color buttons. Max = 100
- COLORREF* pColors; //pointer to the first item in a static COLORREF array containing the colors
- //that should be showed in the colorchooser menu.
- //ie: COLORREF crCols[nColors];
- // pColors = &crCols[0];
+ int iMaxText; // Max message length the protocol supports. Will limit the typing area input. 0 = no limit
+ int nColors; // Number of colors in the colorchooser menu for the color buttons. Max = 100
+ COLORREF* pColors; // pointer to the first item in a static COLORREF array containing the colors
+ // that should be showed in the colorchooser menu.
+ // ie: COLORREF crCols[nColors];
+ // pColors = &crCols[0];
}
GCREGISTER;
@@ -187,47 +186,42 @@ typedef struct {
// Session type
-#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels".
- // A hContact will be added for the session
-#define GCW_SERVER 2 // the session is used as a network console. ex "IRC server window"
- // A hContact will be added for the session, but it will default to being hidden (on the CList)
-#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
- // support for adding more users etc. ex "MSN session".
-
+#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels".
+ // A hContact will be added for the session
+#define GCW_SERVER 2 // the session is used as a network console. ex "IRC server window"
+ // A hContact will be added for the session, but it will default to being hidden (on the CList)
+#define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
+ // support for adding more users etc. ex "MSN session".
// Error messages
-#define GC_NEWSESSION_WRONGVER 1 //You appear to be using the wrong version of this API.
-#define GC_NEWSESSION_ERROR 2 //An internal error occurred.
+#define GC_NEWSESSION_WRONGVER 1 // You appear to be using the wrong version of this API.
+#define GC_NEWSESSION_ERROR 2 // An internal error occurred.
-// GCREGISTER structure
+// GCSESSION structure
typedef struct {
- int cbSize; //Set to sizeof(GCSESSION);
- int iType; //Use one of the GCW_* flags above to set the type of session
- const char *pszModule; //The name of the protocol owning the session (the same as pszModule when you register)
+ int cbSize; // Set to sizeof(GCSESSION);
+ int iType; // Use one of the GCW_* flags above to set the type of session
+ LPCSTR pszModule; // The name of the protocol owning the session (the same as pszModule when you register)
union {
- const char* pszName; //The name of the session as it will be displayed to the user
- const TCHAR* ptszName;
+ LPCSTR pszName; // The name of the session as it will be displayed to the user
+ LPCTSTR ptszName;
};
union {
- const char* pszID; //The unique identifier for the session.
- const TCHAR* ptszID;
+ LPCSTR pszID; // The unique identifier for the session.
+ LPCTSTR ptszID;
};
union {
- const char* pszStatusbarText; //Optional text to set in the statusbar of the chat room window, or NULL.
- const TCHAR* ptszStatusbarText;
+ LPCSTR pszStatusbarText; // Optional text to set in the statusbar of the chat room window, or NULL.
+ LPCTSTR ptszStatusbarText;
};
- DWORD dwFlags;
- DWORD dwItemData; //Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event
- } GCSESSION;
+ DWORD dwFlags;
+ DWORD dwItemData; // Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event
+ }
+ GCSESSION;
#define MS_GC_NEWSESSION "GChat/NewChat"
-
-
-
-
-
/*
Step 3 -- SEND an EVENT --
@@ -465,46 +459,43 @@ typedef struct {
// The GCDEST structure. It is passed to Chat inside GCEVENT.
typedef struct {
- char* pszModule; //Name of the protocol (same as you registered with)
- union {
- char* pszID; //Unique identifier of the session, or NULL to broadcast to all sessions as specified above
- TCHAR* ptszID;
- };
- int iType; //Use GC_EVENT_* as defined above. Only one event per service call.
-} GCDEST;
-
+ LPSTR pszModule; // Name of the protocol (same as you registered with)
+ LPTSTR ptszID; // Unique identifier of the session, or NULL to broadcast to all sessions as specified above
+ int iType; // Use GC_EVENT_* as defined above. Only one event per service call.
+}
+ GCDEST;
// The GCEVENT structure
typedef struct {
- int cbSize; // Set to sizeof(GCEVENT);
- GCDEST* pDest; // pointer to a GCDEST structure which specifies the session to receive the event
+ int cbSize; // Set to sizeof(GCEVENT);
+ GCDEST *pDest; // pointer to a GCDEST structure which specifies the session to receive the event
union {
const char *pszText; // usage depends on type of event, max 2048 characters
const TCHAR *ptszText;
};
union {
- const char* pszNick; // usage depends on type of event
- const TCHAR* ptszNick;
+ LPCSTR pszNick; // usage depends on type of event
+ LPCTSTR ptszNick;
};
union {
- const char* pszUID; // usage depends on type of event, Do NOT use spaces for unique user identifiers.
- const TCHAR* ptszUID;
+ LPCSTR pszUID; // usage depends on type of event, Do NOT use spaces for unique user identifiers.
+ LPCTSTR ptszUID;
};
union {
- const char* pszStatus; // usage depends on type of event
- const TCHAR* ptszStatus;
+ LPCSTR pszStatus; // usage depends on type of event
+ LPCTSTR ptszStatus;
};
union {
- const char* pszUserInfo; // Additional user information that is displayed after the nickname.
- const TCHAR* ptszUserInfo;
+ LPCSTR pszUserInfo; // Additional user information that is displayed after the nickname.
+ LPCTSTR ptszUserInfo;
};
- // IRC use it to display a hostmask for JOIN, PART (and more) events.
- BOOL bIsMe; // Is this event from the Miranda user?
- DWORD dwFlags; // event flags: GCEF_ADDTOLOG, GCEF_NOTNOTIFY, GC_UNICODE
+ // IRC use it to display a hostmask for JOIN, PART (and more) events.
+ BOOL bIsMe; // Is this event from the Miranda user?
+ DWORD dwFlags; // event flags: GCEF_ADDTOLOG, GCEF_NOTNOTIFY, GC_UNICODE
- // FALSE any other time than when initializing the window (before sending SESSION_INITDONE)
- DWORD_PTR dwItemData; // User specified data.
- DWORD time; // Timestamp of the event
+ // FALSE any other time than when initializing the window (before sending SESSION_INITDONE)
+ DWORD_PTR dwItemData; // User specified data.
+ DWORD time; // Timestamp of the event
}
GCEVENT;
@@ -524,7 +515,6 @@ typedef struct {
Use this service to get information on different aspects of the sessions that are registered with Chat.
* Use MS_GC_GETINFO like this: CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)(char *) pszModule);
-
* returns -1 on failure and the sessioncount on success
*/
@@ -532,39 +522,37 @@ typedef struct {
/*
-- GETTING info about a SESSION or session data --
-
Use this service to get information on different aspects of the sessions that are registered with Chat.
* Use MS_GC_GETINFO like this: CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci;
-
* returns 0 on success or error code on failure
*/
// Flags
-#define BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get
-#define BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no
-#define HCONTACT 0x0004 // hContact is valid
-#define DATA 0x0008 // wItemData is valid
-#define ID 0x0010 // pszID is valid.
-#define NAME 0x0020 // pszName is valid
-#define TYPE 0x0040 // iType is valid
-#define COUNT 0x0080 // iCount is valid
-#define USERS 0x0100 // pszUsers is valid
+#define BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get
+#define BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no
+#define HCONTACT 0x0004 // hContact is valid
+#define DATA 0x0008 // wItemData is valid
+#define ID 0x0010 // pszID is valid.
+#define NAME 0x0020 // pszName is valid
+#define TYPE 0x0040 // iType is valid
+#define COUNT 0x0080 // iCount is valid
+#define USERS 0x0100 // pszUsers is valid
// The GC_INFO structure
typedef struct {
- DWORD Flags; // use a combination of the above flags
- int iItem; // session type (GCW_*)
- int iType; // session type (GCW_*)
- char* pszModule; // the module name as registered in MS_GC_REGISTER
- TCHAR* pszID; // unique ID of the session
- TCHAR* pszName; // display name of the session
- DWORD_PTR dwItemData; // user specified data.
- int iCount; // count of users in the nicklist
- char* pszUsers; // space separated string containing the UID's of the users in the user list.
- // NOTE. Use Mirandas mmi_free() on the returned string.
- HANDLE hContact; // hContact for the session (can be NULL)
+ DWORD Flags; // use a combination of the above flags
+ int iItem; // session type (GCW_*)
+ int iType; // session type (GCW_*)
+ LPSTR pszModule; // the module name as registered in MS_GC_REGISTER
+ LPTSTR pszID; // unique ID of the session
+ TCHAR* pszName; // display name of the session
+ DWORD_PTR dwItemData; // user specified data.
+ int iCount; // count of users in the nicklist
+ char* pszUsers; // space separated string containing the UID's of the users in the user list.
+ // NOTE. Use Mirandas mmi_free() on the returned string.
+ HANDLE hContact; // hContact for the session (can be NULL)
}
GC_INFO;
@@ -582,27 +570,28 @@ typedef struct {
* Returning nonzero from your hook will stop other hooks from being called.
*/
-#define GC_USER_MESSAGE 1 // user sent a message, with \n delimiting lines, pszText contains the text.
-#define GC_USER_CHANMGR 2 // user clicked the settings button in a chat room
-#define GC_USER_LOGMENU 3 // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU
-#define GC_USER_NICKLISTMENU 4 // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU
-#define GC_USER_TYPNOTIFY 5 // NOT IMPLEMENTED YET! user is typing
-#define GC_USER_PRIVMESS 6 // user requests to send a private message to a user. pszUID is valid
-#define GC_USER_LEAVE 8 // user requests to leave the session
-#define GC_USER_CLOSEWND 9 // user closed the window (this is usually not an indication that the protocol
- // should take action, but MSN may want to terminate the session here)
-#define GC_SESSION_TERMINATE 7 // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory.
+
+#define GC_USER_MESSAGE 1 // user sent a message, with \n delimiting lines, pszText contains the text.
+#define GC_USER_CHANMGR 2 // user clicked the settings button in a chat room
+#define GC_USER_LOGMENU 3 // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU
+#define GC_USER_NICKLISTMENU 4 // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU
+#define GC_USER_TYPNOTIFY 5 // NOT IMPLEMENTED YET! user is typing
+#define GC_USER_PRIVMESS 6 // user requests to send a private message to a user. pszUID is valid
+#define GC_SESSION_TERMINATE 7 // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory.
+#define GC_USER_LEAVE 8 // user requests to leave the session
+#define GC_USER_CLOSEWND 9 // user closed the window (this is usually not an indication that the protocol
+ // should take action, but MSN may want to terminate the session here)
#define ME_GC_EVENT "GChat/OutgoingEvent"
typedef struct {
- GCDEST* pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered
+ GCDEST *pDest; // pointer to a GCDEST structure which specifies from which session the hook was triggered
union {
- char* pszText; // usage depends on type of event
- TCHAR* ptszText;
+ char *pszText; // usage depends on type of event
+ TCHAR *ptszText;
};
union {
- char* pszUID; // unique identifier, usage depends on type of event
- TCHAR* ptszUID;
+ char *pszUID; // unique identifier, usage depends on type of event
+ TCHAR *ptszUID;
};
DWORD_PTR dwData; // user defined data, usage depends on type of event
}
@@ -619,43 +608,40 @@ typedef struct {
* lParam=(LPARAM)(GCMENUITEM *)gcmi
Returning nonzero from your hook will stop other hooks from being called.
-
*/
// type of item to add to the popup menu
-#define MENU_NEWPOPUP 1 // add submenu
-#define MENU_POPUPITEM 2 // add item to current submenu
-#define MENU_POPUPSEPARATOR 3 // add separator to current submenu
-#define MENU_SEPARATOR 4 // add separator to menu
-#define MENU_ITEM 5 // add item
-
-// Added in Miranda IM 0.8.0.6+
-#define MENU_POPUPCHECK 6 // add checked item to current submenu
-#define MENU_CHECK 7 // add checked item
-#define MENU_POPUPHMENU 8 // add custom submenu to current submenu, use dwID to specify HMENU
-#define MENU_HMENU 9 // add custom submenu, use dwID to specify HMENU
+#define MENU_NEWPOPUP 1 // add submenu
+#define MENU_POPUPITEM 2 // add item to current submenu
+#define MENU_POPUPSEPARATOR 3 // add separator to current submenu
+#define MENU_SEPARATOR 4 // add separator to menu
+#define MENU_ITEM 5 // add item
+#define MENU_POPUPCHECK 6 // add checked item to current submenu
+#define MENU_CHECK 7 // add checked item
+#define MENU_POPUPHMENU 8 // add custom submenu to current submenu, use dwID to specify HMENU
+#define MENU_HMENU 9 // add custom submenu, use dwID to specify HMENU
// type of menu that is being requested
-#define MENU_ON_LOG 1 // pop up menu on the message log
-#define MENU_ON_NICKLIST 2 // pop up menu on the user list
+#define MENU_ON_LOG 1 // pop up menu on the message log
+#define MENU_ON_NICKLIST 2 // pop up menu on the user list
// contains info on a menuitem to be added
struct gc_item {
- TCHAR* pszDesc; // Textual description of the menu item to add
- DWORD dwID; // when/if the user selects this menu item this
- // value will be returned via the above hook, GC_USER_LOGMENU
- // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique.
- int uType; // What kind of menu item is it? Use MENU_* flags above
- BOOL bDisabled; // should the menu item be shown as disabled
+ TCHAR *pszDesc; // Textual description of the menu item to add
+ DWORD dwID; // when/if the user selects this menu item this
+ // value will be returned via the above hook, GC_USER_LOGMENU
+ // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique.
+ int uType; // What kind of menu item is it? Use MENU_* flags above
+ BOOL bDisabled; // should the menu item be shown as disabled
};
typedef struct {
- char * pszModule; // Contains the protocol name, do NOT change.
- TCHAR* pszID; // The unique identifier of the session that triggered the hook, do NOT change.
- TCHAR* pszUID; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change.
- int Type; // Type of menu. MENU_ON_* flags used. do NOT change.
- int nItems; // Set this to the number of menu items you want to add
- struct gc_item* Item; // pointer to the first in the array of gc_item's
+ char *pszModule; // Contains the protocol name, do NOT change.
+ TCHAR *pszID; // The unique identifier of the session that triggered the hook, do NOT change.
+ TCHAR *pszUID; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change.
+ int Type; // Type of menu. MENU_ON_* flags used. do NOT change.
+ int nItems; // Set this to the number of menu items you want to add
+ gc_item *Item; // pointer to the first in the array of gc_item's
}
GCMENUITEMS;
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index ea1739bb24..d586923033 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -843,8 +843,8 @@ void CAppletManager::SendTypingNotification(HANDLE hContact,bool bEnable)
//************************************************************************
HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage)
{
- string strAscii = toNarrowString(strMessage);
- int bufSize = lstrlenA(strAscii.c_str())+1;
+ tstring strAscii = _A2T(toNarrowString(strMessage).c_str());
+ int bufSize = lstrlen(strAscii.c_str())+1;
SMessageJob *pJob = new SMessageJob();
pJob->dwTimestamp = GetTickCount();
pJob->hContact = hContact;
@@ -857,31 +857,24 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage)
if(pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0)
{
GCDEST gcd = {0};
- GCEVENT gce = {0};
DBVARIANT dbv;
- if (!db_get((HANDLE)hContact, szProto, "Nick", &dbv) && dbv.type == DBVT_ASCIIZ )
- gcd.pszID = dbv.pszVal;
+ if (!db_get_ts((HANDLE)hContact, szProto, "Nick", &dbv))
+ gcd.ptszID = dbv.ptszVal;
else
return NULL;
- string strID = string(gcd.pszID) + " - " + toNarrowString(pIRCCon->strNetwork).c_str();
- gcd.pszID = (char*)strID.c_str();
+ tstring strID = tstring(gcd.ptszID) + _T(" - ") + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str()));
+ gcd.ptszID = (LPTSTR)strID.c_str();
gcd.pszModule = szProto;
gcd.iType = GC_EVENT_SENDMESSAGE;
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- gce.pszStatus = "";
- // gce.bAddToLog = true;
- gce.pszUserInfo = NULL;
-
- gce.pszText = (char *)strAscii.c_str();
-
- gce.dwItemData = NULL;
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GC_TCHAR;
+ gce.ptszStatus = _T("");
+ gce.ptszText = (LPTSTR)strAscii.c_str();
gce.time = time(NULL);
gce.bIsMe = true;
-
CallService(MS_GC_EVENT, NULL, (LPARAM) &gce);
pJob->hEvent = NULL;
@@ -928,7 +921,6 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage)
CAppletManager::GetInstance()->AddMessageJob(pJob);
}
-
return pJob->hEvent;
}
@@ -1279,7 +1271,7 @@ int CAppletManager::HookChatInbound(WPARAM wParam,LPARAM lParam)
if(gce == NULL || gcd == NULL)
TRACE(_T("<< [%s] skipping invalid IRC event\n"));
- TRACE(_T("<< [%s:%s] IRC event %04X\n"),toTstring(gcd->pszModule).c_str(),toTstring(gcd->pszID).c_str(),gcd->iType);
+ TRACE(_T("<< [%s:%s] IRC event %04X\n"),toTstring(gcd->pszModule).c_str(), gcd->ptszID, gcd->iType);
// get the matching irc connection entry
CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(gcd->pszModule));
diff --git a/plugins/Scriver/src/chat/services.cpp b/plugins/Scriver/src/chat/services.cpp
index 30c4d1928b..cf6b644971 100644
--- a/plugins/Scriver/src/chat/services.cpp
+++ b/plugins/Scriver/src/chat/services.cpp
@@ -255,17 +255,16 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
static INT_PTR DoControl(GCEVENT *gce, WPARAM wp)
{
+ SESSION_INFO *si;
+
if ( gce->pDest->iType == GC_EVENT_CONTROL ) {
switch (wp) {
case WINDOW_HIDDEN:
- {
- SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- si->bInitDone = TRUE;
- SetActiveSession(si->ptszID, si->pszModule);
- if (si->hWnd)
- ShowRoom(si, wp, FALSE);
- }
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
+ si->bInitDone = TRUE;
+ SetActiveSession(si->ptszID, si->pszModule);
+ if (si->hWnd)
+ ShowRoom(si, wp, FALSE);
}
return 0;
@@ -273,14 +272,12 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp)
case WINDOW_MAXIMIZE:
case WINDOW_VISIBLE:
case SESSION_INITDONE:
- {
- 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)
- ShowRoom(si, wp, TRUE);
- return 0;
- } }
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
+ si->bInitDone = TRUE;
+ if (wp != SESSION_INITDONE || db_get_b(NULL, "Chat", "PopupOnJoin", 0) == 0)
+ ShowRoom(si, wp, TRUE);
+ return 0;
+ }
break;
case SESSION_OFFLINE:
@@ -292,15 +289,13 @@ static INT_PTR DoControl(GCEVENT *gce, WPARAM wp)
break;
case WINDOW_CLEARLOG:
- {
- SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if ( si ) {
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
LM_RemoveAll(&si->pLog, &si->pLogEnd);
si->iEventCount = 0;
si->LastTime = 0;
}
break;
- }
+
case SESSION_TERMINATE:
return SM_RemoveSession(gce->pDest->ptszID, gce->pDest->pszModule, (gce->dwFlags & GCEF_REMOVECONTACT) != 0);
}
@@ -312,21 +307,18 @@ 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);
- if (si) {
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
replaceStrT(si->ptszName, gce->ptszText);
if (si->hWnd)
SendMessage(si->hWnd, DM_UPDATETITLEBAR, 0, 0);
}
}
else if (gce->pDest->iType == GC_EVENT_SETITEMDATA) {
- SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si)
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule))
si->dwItemData = gce->dwItemData;
}
else if (gce->pDest->iType ==GC_EVENT_GETITEMDATA) {
- SESSION_INFO *si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
gce->dwItemData = si->dwItemData;
return si->dwItemData;
}
@@ -334,8 +326,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);
- if (si) {
+ if (si = SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
replaceStrT(si->ptszStatusbarText, gce->ptszText);
if (si->ptszStatusbarText)
db_set_ts(si->windowData.hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
@@ -365,27 +356,22 @@ static INT_PTR 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( si, gce->ptszUID, gce->ptszNick, status);
- if (ui) {
- ui->pszNick = mir_tstrdup( gce->ptszNick );
-
- if (gce->bIsMe)
- si->pMe = ui;
-
- ui->Status = status;
- ui->Status |= si->pStatuses->Status;
-
- if (si->hWnd) {
- SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
- }
- }
- }
+ if (si == NULL) return;
+
+ WORD status = TM_StringToWord(si->pStatuses, gce->ptszStatus);
+ USERINFO *ui = SM_AddUser(si, gce->ptszUID, gce->ptszNick, status);
+ if (ui == NULL) return;
+
+ ui->pszNick = mir_tstrdup(gce->ptszNick);
+ if (gce->bIsMe)
+ si->pMe = ui;
+ ui->Status = status;
+ ui->Status |= si->pStatuses->Status;
+ if (si->hWnd)
+ SendMessage(si->hWnd, GC_UPDATENICKLIST, 0, 0);
}
-
-void ShowRoom(SESSION_INFO * si, WPARAM wp, BOOL bSetForeground)
+void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
{
HWND hParent = NULL;
if (!si)
@@ -489,7 +475,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) {
+ if (!gce->bIsMe && gce->pDest->ptszID && gce->pszText) {
if (si = SM_FindSession( gce->pDest->ptszID, gce->pDest->pszModule))
if ( IsHighlighted(si, gce->ptszText))
bIsHighlighted = TRUE;
@@ -512,13 +498,13 @@ 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 ) {
+ else if (gcd->iType == GC_EVENT_NOTICE || gcd->iType == GC_EVENT_INFORMATION) {
SESSION_INFO *si = GetActiveSession();
- if (si && !lstrcmpA( si->pszModule, gcd->pszModule)) {
+ if (si && !lstrcmpA(si->pszModule, gcd->pszModule)) {
pWnd = si->ptszID;
pMod = si->pszModule;
}
@@ -529,19 +515,19 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
}
else {
// Send the event to all windows with a user pszUID. Used for broadcasting QUIT etc
- SM_AddEventToAllMatchingUID( gce );
- if ( !bRemoveFlag ) {
+ SM_AddEventToAllMatchingUID(gce);
+ if (!bRemoveFlag) {
iRetVal = 0;
goto LBL_Exit;
}
}
// add to log
- if ( pWnd ) {
+ if (pWnd) {
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 )) {
+ if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG)) {
iRetVal = 0;
goto LBL_Exit;
}
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp
index 1f8dcc3389..90f9f447ad 100644
--- a/plugins/Scriver/src/chat/tools.cpp
+++ b/plugins/Scriver/src/chat/tools.cpp
@@ -755,7 +755,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
return FALSE;
if (!(si->dwFlags & GC_UNICODE)) {
- gcd->pszID = mir_t2a(pszID);
+ gcd->ptszID = (LPTSTR)mir_t2a(pszID);
gch->pszUID = mir_t2a(pszUID);
gch->pszText = mir_t2a(pszText);
}
@@ -783,7 +783,7 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
return FALSE;
if (!(si->dwFlags & GC_UNICODE)) {
- gcd.pszID = mir_t2a(pszID);
+ gcd.ptszID = (LPTSTR)mir_t2a(pszID);
gch.pszUID = mir_t2a(pszUID);
gch.pszText = mir_t2a(pszText);
}
@@ -798,7 +798,7 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
gch.pDest = &gcd;
NotifyEventHooks(hSendEvent, 0, (WPARAM)&gch);
- mir_free(gcd.pszID);
+ mir_free(gcd.ptszID);
mir_free(gch.ptszUID);
mir_free(gch.ptszText);
return TRUE;
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 20ae57859c..c71265038d 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -22,33 +22,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../commonheaders.h"
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("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
+struct MESSAGESUBDATA
{
time_t lastEnterTime;
TCHAR* szSearchQuery;
TCHAR* szSearchResult;
SESSION_INFO *lastSession;
-} MESSAGESUBDATA;
-
+};
-static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
- case WM_NCHITTEST:
- return HTCLIENT;
+ switch (msg) {
+ case WM_NCHITTEST:
+ return HTCLIENT;
case WM_SETCURSOR:
{
@@ -60,69 +59,69 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LP
return 0;
case WM_LBUTTONDOWN:
- SetCapture(hwnd);
- return 0;
-
- case WM_MOUSEMOVE:
- if (GetCapture()==hwnd) {
- RECT rc;
- GetClientRect(hwnd,&rc);
- SendMessage(GetParent(hwnd),GC_SPLITTERMOVED,rc.right>rc.bottom?(short)HIWORD(GetMessagePos())+rc.bottom/2:(short)LOWORD(GetMessagePos())+rc.right/2,(LPARAM)hwnd);
- }
- return 0;
-
- case WM_LBUTTONUP:
- ReleaseCapture();
- PostMessage(GetParent(hwnd),WM_SIZE, 0, 0);
- return 0;
- }
+ SetCapture(hwnd);
+ return 0;
+
+ case WM_MOUSEMOVE:
+ if (GetCapture() == hwnd) {
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ SendMessage(GetParent(hwnd), GC_SPLITTERMOVED, rc.right > rc.bottom ? (short)HIWORD(GetMessagePos()) + rc.bottom / 2 : (short)LOWORD(GetMessagePos()) + rc.right / 2, (LPARAM)hwnd);
+ }
+ return 0;
+
+ case WM_LBUTTONUP:
+ ReleaseCapture();
+ PostMessage(GetParent(hwnd), WM_SIZE, 0, 0);
+ return 0;
+ }
return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
{
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SMILEY,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_smiley"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BOLD,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_bold"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_ITALICS,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_italics"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_UNDERLINE,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_underline"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_COLOR,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_fgcol"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BKGCOLOR,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_bkgcol"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_HISTORY,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_history"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_CHANMGR,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon("chat_settings"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2"));
- SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
- SendDlgItemMessage(hwndDlg,IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND"));
-
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SMILEY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BOLD, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_ITALICS, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_UNDERLINE, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BKGCOLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_COLOR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_HISTORY, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_CHANMGR, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER, BUTTONSETASFLATBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDOK, BUTTONSETASFLATBTN, TRUE, 0);
-
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SMILEY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BOLD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_ITALICS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_UNDERLINE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BKGCOLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_COLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nicklist (CTRL+N)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_CHANMGR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
- SendDlgItemMessage(hwndDlg,IDOK, BUTTONADDTOOLTIP, (WPARAM) LPGEN("Send Message"), 0);
-
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BOLD, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
-
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SMILEY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_smiley"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_bold"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_italics"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_underline"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_fgcol"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_bkgcol"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_HISTORY, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_history"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_CHANMGR, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("chat_settings"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
+ SendDlgItemMessage(hwndDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon("scriver_SEND"));
+
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SMILEY, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_HISTORY, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_CHANMGR, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BUTTONSETASFLATBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASFLATBTN, TRUE, 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SMILEY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_HISTORY, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nicklist (CTRL+N)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_CHANMGR, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
+ SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGEN("Send Message"), 0);
+
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BOLD, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
+
MODULEINFO *pInfo = MM_FindModule(si->pszModule);
if (pInfo) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_BOLD), pInfo->bBold);
@@ -135,11 +134,11 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
}
}
-
-static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
+static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h)
+{
int logBottom, toolbarTopY;
HDWP hdwp;
- BOOL bNick = si->iType!=GCW_SERVER && si->bNicklistEnabled;
+ 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;
@@ -153,9 +152,9 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
si->iSplitterY = hSplitterMinBottom;
ShowToolbarControls(hwndDlg, SIZEOF(toolbarButtons), toolbarButtons, buttonVisibility, SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), bNick?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), bNick ? SW_SHOW : SW_HIDE);
if (si->iType != GCW_SERVER)
- ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), si->bNicklistEnabled?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
else
ShowWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), SW_HIDE);
@@ -178,7 +177,7 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
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_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);
hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY), 0, 0, h - si->iSplitterY, w, SPLITTER_HEIGHT, SWP_NOZORDER);
@@ -189,24 +188,24 @@ static void MessageDialogResize(HWND hwndDlg, SESSION_INFO *si, int w, int h) {
RECT rect;
POINT pt;
IEVIEWWINDOW ieWindow;
- GetWindowRect(GetDlgItem(hwndDlg,IDC_CHAT_LOG), &rect);
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &rect);
pt.x = 0;
pt.y = rect.top;
- ScreenToClient(GetDlgItem(hwndDlg,IDC_CHAT_LOG),&pt);
+ ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LOG), &pt);
ieWindow.cbSize = sizeof(IEVIEWWINDOW);
ieWindow.iType = IEW_SETPOS;
ieWindow.parent = hwndDlg;
ieWindow.hwnd = si->windowData.hwndLog;
ieWindow.x = 0;
ieWindow.y = logBottom + 1;
- ieWindow.cx = bNick ? w - si->iSplitterX:w;
+ 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);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), NULL, NULL, RDW_INVALIDATE);
}
static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si)
@@ -215,7 +214,7 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si)
int start = LOWORD(lResult), end = HIWORD(lResult);
SendMessage(hwnd, EM_SETSEL, end, end);
- GETTEXTEX gt = {0};
+ GETTEXTEX gt = { 0 };
gt.codepage = 1200;
int iLen = GetRichTextLength(hwnd, gt.codepage, TRUE);
if (iLen <= 0)
@@ -228,37 +227,37 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si)
gt.flags = GT_DEFAULT;
SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)&gt, (LPARAM)pszText);
- if (start > 1 && pszText[start-1] == ' ' && pszText[start-2] == ':')
+ if (start > 1 && pszText[start - 1] == ' ' && pszText[start - 2] == ':')
start -= 2;
if (dat->szSearchResult != NULL) {
int cbResult = (int)_tcslen(dat->szSearchResult);
- if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText+start-cbResult, cbResult)) {
+ if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) {
start -= cbResult;
goto LBL_SkipEnd;
}
}
- while (start > 0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
+ while (start > 0 && pszText[start - 1] != ' ' && pszText[start - 1] != 13 && pszText[start - 1] != VK_TAB)
start--;
LBL_SkipEnd:
- while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end-1] != VK_TAB)
+ while (end < iLen && pszText[end] != ' ' && pszText[end] != 13 && pszText[end - 1] != VK_TAB)
end++;
if (pszText[start] == '#')
isRoom = true;
else {
int topicStart = start;
- while ( topicStart >0 && (pszText[topicStart-1] == ' ' || pszText[topicStart-1] == 13 || pszText[topicStart-1] == VK_TAB))
+ 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])
+ 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);
+ 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;
}
@@ -305,8 +304,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000;
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
- SESSION_INFO *Parentsi=(SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd),GWLP_USERDATA);
- MESSAGESUBDATA *dat = (MESSAGESUBDATA *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ SESSION_INFO *Parentsi = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
+ MESSAGESUBDATA *dat = (MESSAGESUBDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
CommonWindowData *windowData = &Parentsi->windowData;
int result = InputAreaShortcuts(hwnd, msg, wParam, lParam, windowData);
@@ -315,8 +314,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
switch (msg) {
case EM_SUBCLASSED:
- dat = (MESSAGESUBDATA*) mir_calloc(sizeof(MESSAGESUBDATA));
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) dat);
+ dat = (MESSAGESUBDATA*)mir_calloc(sizeof(MESSAGESUBDATA));
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)dat);
return 0;
case WM_MOUSEWHEEL:
@@ -340,7 +339,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
dat->szSearchQuery = NULL;
mir_free(dat->szSearchResult);
dat->szSearchResult = NULL;
- if (( isCtrl != 0 ) ^ (0 != db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
+ if ((isCtrl != 0) ^ (0 != db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
@@ -376,25 +375,25 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
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);
+ 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);
+ 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);
+ 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);
+ 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;
}
@@ -414,7 +413,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
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);
+ 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;
}
@@ -477,7 +476,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE|CFM_BACKCOLOR|CFM_COLOR;
+ 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) {
@@ -538,7 +537,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
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:
@@ -551,7 +551,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return mir_callNextSubclass(hwnd, MessageSubclassProc, msg, wParam, lParam);
}
-static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static SESSION_INFO *si = NULL;
switch (uMsg) {
@@ -572,8 +572,8 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARA
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
- SetTextColor((HDC)wParam,RGB(60,60,150));
- SetBkColor((HDC)wParam,GetSysColor(COLOR_WINDOW));
+ SetTextColor((HDC)wParam, RGB(60, 60, 150));
+ SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
case WM_ACTIVATE:
@@ -625,19 +625,17 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
{
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);
- }
+ 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;
}
@@ -648,7 +646,7 @@ 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)
return result;
@@ -671,19 +669,19 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);
if (sel.cpMin != sel.cpMax) {
SendMessage(hwnd, WM_COPY, 0, 0);
- sel.cpMin = sel.cpMax ;
+ sel.cpMin = sel.cpMax;
SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
}
SetFocus(GetDlgItem(GetParent(hwnd), IDC_CHAT_MESSAGE));
- break;
}
+ 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 ;
+ sel.cpMin = sel.cpMax;
SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)& sel);
}
}
@@ -701,8 +699,8 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
ClientToScreen(hwnd, &pt);
}
else {
- pt.x = (short) LOWORD(lParam);
- pt.y = (short) HIWORD(lParam);
+ pt.x = (short)LOWORD(lParam);
+ pt.y = (short)HIWORD(lParam);
}
ptl.x = (LONG)pt.x;
ptl.y = (LONG)pt.y;
@@ -714,7 +712,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
inMenu = FALSE;
switch (uID) {
case 0:
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
break;
case ID_COPYALL:
@@ -722,7 +720,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
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 );
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
break;
case IDM_CLEAR:
@@ -731,7 +729,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
LM_RemoveAll(&si->pLog, &si->pLogEnd);
si->iEventCount = 0;
si->LastTime = 0;
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
}
break;
@@ -744,11 +742,11 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
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 );
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
break;
default:
- PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0 );
+ PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0);
DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID);
break;
}
@@ -768,11 +766,11 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESSION_INFO * parentdat)
{
- static int currentHovered=-1;
- static HWND hwndToolTip=NULL;
- static HWND oldParent=NULL;
+ static int currentHovered = -1;
+ static HWND hwndToolTip = NULL;
+ static HWND oldParent = NULL;
RECT clientRect;
- BOOL bNewTip=FALSE;
+ BOOL bNewTip = FALSE;
if (hoveredItem == currentHovered)
return;
@@ -794,7 +792,7 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
bNewTip = TRUE;
}
- GetClientRect(hwnd,&clientRect);
+ GetClientRect(hwnd, &clientRect);
TOOLINFO ti = { sizeof(TOOLINFO) };
ti.uFlags = TTF_SUBCLASS;
ti.hinst = g_hInst;
@@ -805,26 +803,26 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, POINT * pt, SESS
TCHAR tszBuf[1024]; tszBuf[0] = 0;
USERINFO *ui = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered);
if (ui) {
- if ( ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
+ if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) {
TCHAR *p = (TCHAR*)ProtoCallService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui->pszUID);
if (p != NULL) {
_tcsncpy_s(tszBuf, SIZEOF(tszBuf), p, _TRUNCATE);
mir_free(p);
}
}
-
+
if (tszBuf[0] == 0)
mir_sntprintf(tszBuf, SIZEOF(tszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
- TranslateT("Nickname"), ui->pszNick,
- TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui->Status));
+ TranslateT("Nickname"), ui->pszNick,
+ TranslateT("Unique ID"), ui->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui->Status));
ti.lpszText = tszBuf;
}
SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti);
SendMessage(hwndToolTip, TTM_ACTIVATE, ti.lpszText != NULL, 0);
- SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0 , 400);
+ SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 400);
}
}
@@ -850,10 +848,10 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
height = SendMessage(hwnd, LB_GETITEMHEIGHT, 0, 0);
if (height != LB_ERR) {
- RECT rc = {0};
+ RECT rc = { 0 };
GetClientRect(hwnd, &rc);
- if (rc.bottom-rc.top > items * height) {
+ if (rc.bottom - rc.top > items * height) {
rc.top = items*height;
FillRect(dc, &rc, hListBkgBrush);
}
@@ -872,7 +870,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_MEASUREITEM:
{
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
if (mis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
}
@@ -880,7 +878,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_DRAWITEM:
{
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
}
@@ -890,11 +888,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
{
TVHITTESTINFO hti;
DWORD item;
- int height=0;
+ int height = 0;
USERINFO * ui;
- hti.pt.x = (short) LOWORD(lParam);
- hti.pt.y = (short) HIWORD(lParam);
+ 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);
@@ -902,10 +900,10 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
hti.pt.x = 4;
hti.pt.y = (index - top)*height + 1;
}
- else ScreenToClient(hwnd,&hti.pt);
+ else ScreenToClient(hwnd, &hti.pt);
item = (DWORD)(SendMessage(hwnd, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
- if ( HIWORD( item ) == 1 )
+ if (HIWORD(item) == 1)
item = (DWORD)(-1);
else
item &= 0xFFFF;
@@ -939,15 +937,15 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
break;
- case WM_GETDLGCODE :
+ 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))))
+ 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;
}
}
@@ -956,7 +954,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_KEYDOWN:
if (wParam == VK_RETURN) {
int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0);
- if (index!=LB_ERR) {
+ 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);
}
@@ -964,7 +962,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
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;
+ si->szSearch[0] = 0;
}
break;
@@ -984,7 +982,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
else {
TCHAR szNew[2];
- szNew[0] = (TCHAR) wParam;
+ szNew[0] = (TCHAR)wParam;
szNew[1] = '\0';
if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
MessageBeep(MB_OK);
@@ -1021,40 +1019,37 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case WM_MOUSEMOVE:
- {
- POINT pt;
- RECT clientRect;
- BOOL bInClient;
- pt.x=LOWORD(lParam);
- pt.y=HIWORD(lParam);
- GetClientRect(hwnd,&clientRect);
- bInClient=PtInRect(&clientRect, pt);
- //Mouse capturing/releasing
- if ( bInClient && GetCapture()!=hwnd)
- SetCapture(hwnd);
- else if (!bInClient)
- ReleaseCapture();
-
- if (bInClient) {
- //hit test item under mouse
- DWORD nItemUnderMouse=(DWORD)SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
- if ( HIWORD( nItemUnderMouse ) == 1 )
- nItemUnderMouse = (DWORD)(-1);
- else
- nItemUnderMouse &= 0xFFFF;
+ POINT pt;
+ RECT clientRect;
+ BOOL bInClient;
+ pt.x = LOWORD(lParam);
+ pt.y = HIWORD(lParam);
+ GetClientRect(hwnd, &clientRect);
+ bInClient = PtInRect(&clientRect, pt);
+ //Mouse capturing/releasing
+ if (bInClient && GetCapture() != hwnd)
+ SetCapture(hwnd);
+ else if (!bInClient)
+ ReleaseCapture();
+
+ if (bInClient) {
+ //hit test item under mouse
+ DWORD nItemUnderMouse = (DWORD)SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
+ if (HIWORD(nItemUnderMouse) == 1)
+ nItemUnderMouse = (DWORD)(-1);
+ else
+ nItemUnderMouse &= 0xFFFF;
- ProcessNickListHovering(hwnd, (int)nItemUnderMouse, &pt, si);
- }
- else ProcessNickListHovering(hwnd, -1, &pt, NULL);
+ ProcessNickListHovering(hwnd, (int)nItemUnderMouse, &pt, si);
}
- break;
+ else ProcessNickListHovering(hwnd, -1, &pt, NULL);
}
return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam);
}
-int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth)
+int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
{
if (!pszText || !hFont)
return 0;
@@ -1062,25 +1057,25 @@ int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth)
HDC hdc = GetDC(NULL);
HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
- RECT rc = {0};
- int i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+ RECT rc = { 0 };
+ int i = DrawText(hdc, pszText, -1, &rc, DT_CALCRECT);
SelectObject(hdc, hOldFont);
- ReleaseDC(NULL,hdc);
+ 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;
+ 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)
+INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HMENU hToolbarMenu;
- SESSION_INFO *si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ SESSION_INFO *si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!si && uMsg != WM_INITDIALOG)
return FALSE;
@@ -1091,22 +1086,22 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
SESSION_INFO *psi = (SESSION_INFO*)lParam;
int mask;
RECT minEditInit;
- HWND hNickList = GetDlgItem(hwndDlg,IDC_CHAT_LIST);
+ HWND hNickList = GetDlgItem(hwndDlg, IDC_CHAT_LIST);
NotifyLocalWinEvent(psi->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPENING);
TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,(LONG_PTR)psi);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)psi);
si = psi;
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LOG));
RichUtil_SubClass(GetDlgItem(hwndDlg, IDC_CHAT_LIST));
- mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX), SplitterSubclassProc);
- mir_subclassWindow( hNickList, NicklistSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_LOG), LogSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_FILTER), ButtonSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_COLOR), ButtonSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
- mir_subclassWindow( GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE), MessageSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX), SplitterSubclassProc);
+ mir_subclassWindow(hNickList, NicklistSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_LOG), LogSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_COLOR), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_BKGCOLOR), ButtonSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), MessageSubclassProc);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), &minEditInit);
si->windowData.minEditBoxHeight = minEditInit.bottom - minEditInit.top;
@@ -1117,7 +1112,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)*0x7FFFFFFF, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)* 0x7FFFFFFF, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback);
if (db_get_b(NULL, "Chat", "UseIEView", 0)) {
@@ -1151,66 +1146,64 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM) hwndDlg, (LPARAM)psi->windowData.hContact);
+ SendMessage(GetParent(hwndDlg), CM_ADDCHILD, (WPARAM)hwndDlg, (LPARAM)psi->windowData.hContact);
PostMessage(hwndDlg, GC_UPDATENICKLIST, 0, 0);
NotifyLocalWinEvent(psi->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_OPEN);
}
break;
case GC_SETWNDPROPS:
- {
- LoadGlobalSettings();
- InitButtons(hwndDlg, si);
+ LoadGlobalSettings();
+ InitButtons(hwndDlg, si);
- SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
-
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_SETBKGNDCOLOR , 0, g_Settings.crLogBackground);
+ SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
- { //messagebox
- COLORREF crFore;
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_SETBKGNDCOLOR, 0, g_Settings.crLogBackground);
- CHARFORMAT2 cf;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
- cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_COLOR|CFM_BOLD|CFM_UNDERLINE|CFM_BACKCOLOR;
- cf.dwEffects = 0;
- cf.crTextColor = crFore;
- cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR , 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM) g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL , (LPARAM)&cf);
- }
- { // nicklist
- int ih;
- int ih2;
- int font;
- int height;
+ { //messagebox
+ COLORREF crFore;
- ih = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListFont,FALSE);
- ih2 = GetTextPixelSize( _T("AQG_glo'"), g_Settings.UserListHeadingsFont,FALSE);
- height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
- font = ih > ih2?ih:ih2;
- // make sure we have space for icon!
- if (db_get_b(NULL, "Chat", "ShowContactStatus", 0))
- font = font > 16 ? font : 16;
+ CHARFORMAT2 cf;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore, FALSE);
+ cf.cbSize = sizeof(CHARFORMAT2);
+ cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR;
+ cf.dwEffects = 0;
+ cf.crTextColor = crFore;
+ cf.crBackColor = db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETCHARFORMAT, (WPARAM)SCF_ALL, (LPARAM)&cf);
+ }
+ { // nicklist
+ int ih;
+ int ih2;
+ int font;
+ int height;
+
+ ih = GetTextPixelSize(_T("AQG_glo'"), g_Settings.UserListFont, FALSE);
+ ih2 = GetTextPixelSize(_T("AQG_glo'"), g_Settings.UserListHeadingsFont, FALSE);
+ height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
+ font = ih > ih2 ? ih : ih2;
+ // make sure we have space for icon!
+ if (db_get_b(NULL, "Chat", "ShowContactStatus", 0))
+ font = font > 16 ? font : 16;
- SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
- }
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
- SendMessage(hwndDlg, WM_SIZE, 0, 0);
- SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)height > font ? height : font);
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, TRUE);
}
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_REQUESTRESIZE, 0, 0);
+ SendMessage(hwndDlg, WM_SIZE, 0, 0);
+ SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
break;
case DM_UPDATETITLEBAR:
{
- TitleBarData tbd = {0};
- TCHAR szTemp [100];
+ TitleBarData tbd = { 0 };
+ TCHAR szTemp[100];
if (g_dat.flags & SMF_STATUSICON) {
- MODULEINFO* mi = MM_FindModule(si->pszModule);
+ MODULEINFO *mi = MM_FindModule(si->pszModule);
tbd.hIcon = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIcon : mi->hOfflineIcon;
tbd.hIconBig = (si->wStatus == ID_STATUS_ONLINE) ? mi->hOnlineIconBig : mi->hOfflineIconBig;
}
@@ -1218,9 +1211,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
tbd.hIcon = GetCachedIcon("chat_window");
tbd.hIconBig = g_dat.hIconChatBig;
}
- tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
+ tbd.hIconNot = (si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL;
- switch(si->iType) {
+ switch (si->iType) {
case GCW_CHATROOM:
mir_sntprintf(szTemp, SIZEOF(szTemp),
(si->nUsersInNicklist == 1) ? TranslateT("%s: Chat Room (%u user)") : TranslateT("%s: Chat Room (%u users)"),
@@ -1228,7 +1221,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
break;
case GCW_PRIVMESS:
mir_sntprintf(szTemp, SIZEOF(szTemp),
- (si->nUsersInNicklist ==1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
+ (si->nUsersInNicklist == 1) ? TranslateT("%s: Message Session") : TranslateT("%s: Message Session (%u users)"),
si->ptszName, si->nUsersInNicklist);
break;
case GCW_SERVER:
@@ -1237,16 +1230,16 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
}
tbd.iFlags = TBDF_TEXT | TBDF_ICON;
tbd.pszText = szTemp;
- SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM) &tbd, (LPARAM)hwndDlg);
+ SendMessage(GetParent(hwndDlg), CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)hwndDlg);
SendMessage(hwndDlg, DM_UPDATETABCONTROL, 0, 0);
}
break;
case DM_UPDATESTATUSBAR:
{
- MODULEINFO* mi = MM_FindModule(si->pszModule);
+ MODULEINFO *mi = MM_FindModule(si->pszModule);
TCHAR szTemp[512];
- HICON hIcon = si->wStatus==ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
+ HICON hIcon = si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon;
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s : %s"), mi->ptszModDispName, si->ptszStatusbarText ? si->ptszStatusbarText : _T(""));
StatusBarData sbd;
@@ -1254,12 +1247,12 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
sbd.iFlags = SBDF_TEXT | SBDF_ICON;
sbd.hIcon = hIcon;
sbd.pszText = szTemp;
- SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM)hwndDlg);
+ SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)hwndDlg);
sbd.iItem = 1;
sbd.hIcon = NULL;
sbd.pszText = _T("");
- SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM) &sbd, (LPARAM)hwndDlg);
+ SendMessage(GetParent(hwndDlg), CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)hwndDlg);
StatusIconData sid = { sizeof(sid) };
sid.szModule = SRMMMOD;
@@ -1272,7 +1265,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
return TRUE;
case DM_SETCODEPAGE:
- si->windowData.codePage = (int) lParam;
+ si->windowData.codePage = (int)lParam;
si->pszHeader = Log_CreateRtfHeader(MM_FindModule(si->pszModule), si);
SendMessage(hwndDlg, GC_REDRAWLOG2, 0, 0);
break;
@@ -1288,17 +1281,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
if (IsIconic(hwndDlg)) break;
- if (wParam==SIZE_RESTORED || wParam==SIZE_MAXIMIZED) {
+ if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
int dlgWidth, dlgHeight;
RECT rc;
dlgWidth = LOWORD(lParam);
dlgHeight = HIWORD(lParam);
- /*if (dlgWidth == 0 && dlgHeight ==0) */{
- GetClientRect(hwndDlg, &rc);
- dlgWidth = rc.right - rc.left;
- dlgHeight = rc.bottom - rc.top;
- }
+ GetClientRect(hwndDlg, &rc);
+ dlgWidth = rc.right - rc.left;
+ dlgHeight = rc.bottom - rc.top;
MessageDialogResize(hwndDlg, si, dlgWidth, dlgHeight);
}
break;
@@ -1313,7 +1304,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
LOGINFO * pLog = si->pLog;
if (si->iEventCount > 60) {
int index = 0;
- while ( index < 59) {
+ while (index < 59) {
if (pLog->next == NULL)
break;
@@ -1326,7 +1317,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
}
else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
}
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
+ else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
break;
case GC_REDRAWLOG2:
@@ -1345,109 +1336,100 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
if (si->pLogEnd)
Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE);
else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER+500, WINDOW_CLEARLOG, 0);
+ SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
break;
-
case DM_UPDATETABCONTROL:
{
TabControlData tcd;
tcd.iFlags = TCDF_TEXT;
tcd.pszText = si->ptszName;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM)hwndDlg);
-
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
}
case GC_FIXTABICONS:
{
TabControlData tcd;
HICON hIcon;
- if (!(si->wState & GC_EVENT_HIGHLIGHT))
- {
+ if (!(si->wState & GC_EVENT_HIGHLIGHT)) {
if (si->wState & STATE_TALK)
- hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineTalkIcon : MM_FindModule(si->pszModule)->hOfflineTalkIcon;
+ hIcon = (si->wStatus == ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineTalkIcon : MM_FindModule(si->pszModule)->hOfflineTalkIcon;
else
- hIcon = (si->wStatus==ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
- } else {
- hIcon = g_dat.hMsgIcon;
+ hIcon = (si->wStatus == ID_STATUS_ONLINE) ? MM_FindModule(si->pszModule)->hOnlineIcon : MM_FindModule(si->pszModule)->hOfflineIcon;
}
+ else hIcon = g_dat.hMsgIcon;
+
tcd.iFlags = TCDF_ICON;
tcd.hIcon = hIcon;
- SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM) &tcd, (LPARAM)hwndDlg);
+ SendMessage(GetParent(hwndDlg), CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg);
}
break;
case GC_SETMESSAGEHIGHLIGHT:
- {
- si->wState |= GC_EVENT_HIGHLIGHT;
- SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
- SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- }
+ si->wState |= GC_EVENT_HIGHLIGHT;
+ SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ if (db_get_b(NULL, "Chat", "FlashWindowHighlight", 0) != 0 && GetActiveWindow() != hwndDlg && GetForegroundWindow() != GetParent(hwndDlg))
+ SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
break;
case GC_SETTABHIGHLIGHT:
- {
- SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
- SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
- if (g_Settings.FlashWindow && GetActiveWindow() != GetParent(hwndDlg) && GetForegroundWindow() != GetParent(hwndDlg))
- SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
- }
+ SendMessage(si->hWnd, GC_FIXTABICONS, 0, 0);
+ SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
+ if (g_Settings.FlashWindow && GetActiveWindow() != GetParent(hwndDlg) && GetForegroundWindow() != GetParent(hwndDlg))
+ SendMessage(GetParent(si->hWnd), CM_STARTFLASHING, 0, 0);
break;
case DM_ACTIVATE:
- {
- if (si->wState & STATE_TALK) {
- si->wState &= ~STATE_TALK;
+ if (si->wState & STATE_TALK) {
+ si->wState &= ~STATE_TALK;
- db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0);
- }
+ db_set_w(si->windowData.hContact, si->pszModule, "ApparentMode", 0);
+ }
- if (si->wState & GC_EVENT_HIGHLIGHT) {
- si->wState &= ~GC_EVENT_HIGHLIGHT;
+ if (si->wState & GC_EVENT_HIGHLIGHT) {
+ si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- }
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
+ }
- SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
- if (!si->hWnd) {
- ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
- SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0 );
- }
+ SendMessage(hwndDlg, GC_FIXTABICONS, 0, 0);
+ if (!si->hWnd) {
+ ShowRoom(si, (WPARAM)WINDOW_VISIBLE, TRUE);
+ SendMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
}
break;
case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,FALSE,0);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0, (LPARAM)_T(""));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
return TRUE;
case WM_CTLCOLORLISTBOX:
- SetBkColor((HDC) wParam, g_Settings.crUserListBGColor);
- return (INT_PTR) hListBkgBrush;
+ SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
+ return (INT_PTR)hListBkgBrush;
case WM_MEASUREITEM:
if (!MeasureMenuItem(wParam, lParam)) {
- MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam;
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)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;
+ int ih = GetTextPixelSize(_T("AQGgl'"), g_Settings.UserListFont, FALSE);
+ int ih2 = GetTextPixelSize(_T("AQGg'"), g_Settings.UserListHeadingsFont, FALSE);
+ int font = ih > ih2 ? ih : ih2;
int height = db_get_b(NULL, "Chat", "NicklistRowDist", 12);
// make sure we have space for icon!
if (db_get_b(NULL, "Chat", "ShowContactStatus", 0))
font = font > 16 ? font : 16;
- mis->itemHeight = height > font?height:font;
- return TRUE;
+ mis->itemHeight = height > font ? height : font;
}
+ return TRUE;
case WM_DRAWITEM:
if (!DrawMenuItem(wParam, lParam)) {
- DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam;
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
if (dis->CtlType == ODT_MENU)
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
@@ -1463,15 +1445,15 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
height = dis->rcItem.bottom - dis->rcItem.top;
- if (height&1)
+ if (height & 1)
height++;
if (height == 10)
offset = 0;
else
- offset = height/2 - 5;
+ offset = height / 2 - 5;
hIcon = SM_GetStatusIcon(si, ui);
hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
+ hOldFont = (HFONT)SelectObject(dis->hDC, hFont);
SetBkMode(dis->hDC, TRANSPARENT);
if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED)
@@ -1481,21 +1463,21 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) {
HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
Skin_ReleaseIcon(hIcon);
x_offset += 18;
}
- DrawIconEx(dis->hDC,x_offset, dis->rcItem.top + offset,hIcon,10,10,0,NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, hIcon, 10, 10, 0, NULL, DI_NORMAL);
x_offset += 12;
if (g_Settings.ShowContactStatus && !g_Settings.ContactStatusFirst && ui->ContactStatus) {
HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top+offset-3,hIcon,16,16,0,NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
Skin_ReleaseIcon(hIcon);
x_offset += 18;
}
- SetTextColor(dis->hDC, ui->iStatusEx == 0?g_Settings.crUserListColor:g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
+ SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
}
return TRUE;
@@ -1504,31 +1486,32 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
case GC_UPDATENICKLIST:
{
- int index=0;
+ int index = 0;
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, WM_SETREDRAW, FALSE, 0);
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_RESETCONTENT, 0, 0);
- for (index=0; index<si->nUsersInNicklist; index++) {
+ for (index = 0; index<si->nUsersInNicklist; index++) {
USERINFO * ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, index);
if (ui) {
char szIndicator = SM_GetStatusIndicator(si, ui);
if (szIndicator>'\0') {
static TCHAR ptszBuf[128];
- mir_sntprintf( ptszBuf, SIZEOF(ptszBuf), _T("%c%s"), szIndicator, ui->pszNick);
+ mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%c%s"), szIndicator, ui->pszNick);
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_ADDSTRING, 0, (LPARAM)ptszBuf);
- } else {
+ }
+ else {
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_ADDSTRING, 0, (LPARAM)ui->pszNick);
}
}
}
SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, WM_SETREDRAW, TRUE, 0);
- InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, FALSE) ;
- UpdateWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST)) ;
+ InvalidateRect(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, FALSE);
+ UpdateWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST));
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
}
break;
- case GC_EVENT_CONTROL + WM_USER+500:
- switch(wParam) {
+ 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);
@@ -1550,7 +1533,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
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);
+ db_set_w(si->windowData.hContact, si->pszModule, "ApparentMode", (LPARAM)0);
SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0);
return TRUE;
@@ -1563,7 +1546,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
goto LABEL_SHOWWINDOW;
case SESSION_INITDONE:
- if (db_get_b(NULL, "Chat", "PopupOnJoin", 0)!=0)
+ if (db_get_b(NULL, "Chat", "PopupOnJoin", 0) != 0)
return TRUE;
// fall through
case WINDOW_VISIBLE:
@@ -1582,48 +1565,48 @@ LABEL_SHOWWINDOW:
break;
case GC_SPLITTERMOVED:
- if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERX)) {
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERX)) {
POINT pt;
RECT rc;
int oldSplitterX;
- GetClientRect(hwndDlg,&rc);
- pt.x=wParam; pt.y=0;
- ScreenToClient(hwndDlg,&pt);
+ GetClientRect(hwndDlg, &rc);
+ pt.x = wParam; pt.y = 0;
+ ScreenToClient(hwndDlg, &pt);
- oldSplitterX=si->iSplitterX;
- si->iSplitterX=rc.right-pt.x+1;
+ oldSplitterX = si->iSplitterX;
+ si->iSplitterX = rc.right - pt.x + 1;
if (si->iSplitterX < 35)
- si->iSplitterX=35;
- if (si->iSplitterX > rc.right-rc.left-35)
- si->iSplitterX = rc.right-rc.left-35;
+ si->iSplitterX = 35;
+ if (si->iSplitterX > rc.right - rc.left - 35)
+ si->iSplitterX = rc.right - rc.left - 35;
g_Settings.iSplitterX = si->iSplitterX;
}
- else if ((HWND)lParam==GetDlgItem(hwndDlg,IDC_CHAT_SPLITTERY)) {
+ else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_CHAT_SPLITTERY)) {
POINT pt;
RECT rc;
int oldSplitterY;
- GetClientRect(hwndDlg,&rc);
- pt.x=0; pt.y=wParam;
- ScreenToClient(hwndDlg,&pt);
- oldSplitterY=si->iSplitterY;
- si->iSplitterY=rc.bottom-pt.y;
+ GetClientRect(hwndDlg, &rc);
+ pt.x = 0; pt.y = wParam;
+ ScreenToClient(hwndDlg, &pt);
+ oldSplitterY = si->iSplitterY;
+ si->iSplitterY = rc.bottom - pt.y;
g_Settings.iSplitterY = si->iSplitterY;
}
- PostMessage(hwndDlg,WM_SIZE,0,0);
+ PostMessage(hwndDlg, WM_SIZE, 0, 0);
break;
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;
@@ -1637,33 +1620,30 @@ LABEL_SHOWWINDOW:
HWND hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), hwndDlg, FilterWndProc, (LPARAM)si);
TranslateDialogDefault(hwnd);
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_FILTER), &rc);
- SetWindowPos(hwnd, HWND_TOP, rc.left-85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_FILTER))||IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))?rc.top-206:rc.top-186, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);
+ SetWindowPos(hwnd, HWND_TOP, rc.left - 85, (IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_FILTER)) || IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_BOLD))) ? rc.top - 206 : rc.top - 186, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
}
break;
case GC_SHOWCOLORCHOOSER:
{
- HWND ColorWindow;
RECT rc;
- BOOL bFG = lParam == IDC_CHAT_COLOR?TRUE:FALSE;
+ BOOL bFG = lParam == IDC_CHAT_COLOR ? TRUE : FALSE;
COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
-
- GetWindowRect(GetDlgItem(hwndDlg, bFG?IDC_CHAT_COLOR:IDC_CHAT_BKGCOLOR), &rc);
+ GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_CHAT_COLOR : IDC_CHAT_BKGCOLOR), &rc);
pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
pCC->pModule = MM_FindModule(si->pszModule);
- pCC->xPosition = rc.left+3;
- pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_COLOR))?rc.top-1:rc.top+20;
+ pCC->xPosition = rc.left + 3;
+ pCC->yPosition = IsWindowVisible(GetDlgItem(hwndDlg, IDC_CHAT_COLOR)) ? rc.top - 1 : rc.top + 20;
pCC->bForeground = bFG;
pCC->si = si;
-
- ColorWindow= CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC);
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_COLORCHOOSER), hwndDlg, DlgProcColorToolWindow, (LPARAM)pCC);
}
break;
case GC_SCROLLTOBOTTOM:
{
SCROLLINFO si = { 0 };
- if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWL_STYLE) & WS_VSCROLL) != 0){
+ if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHAT_LOG), GWL_STYLE) & WS_VSCROLL) != 0) {
CHARRANGE sel;
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_RANGE;
@@ -1674,7 +1654,8 @@ LABEL_SHOWWINDOW:
sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOG), CP_ACP, FALSE);
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_EXSETSEL, 0, (LPARAM)& sel);
PostMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0);
- } }
+ }
+ }
break;
case WM_ACTIVATE:
@@ -1683,17 +1664,15 @@ LABEL_SHOWWINDOW:
//fall through
case WM_MOUSEACTIVATE:
- {
- if (uMsg != WM_ACTIVATE)
- SetFocus(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE));
+ if (uMsg != WM_ACTIVATE)
+ SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
- SetActiveSession(si->ptszID, si->pszModule);
+ SetActiveSession(si->ptszID, si->pszModule);
- if (db_get_w(si->windowData.hContact, si->pszModule ,"ApparentMode", 0) != 0)
- db_set_w(si->windowData.hContact, si->pszModule ,"ApparentMode",(LPARAM)0);
- if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
- CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
- }
+ if (db_get_w(si->windowData.hContact, si->pszModule, "ApparentMode", 0) != 0)
+ db_set_w(si->windowData.hContact, si->pszModule, "ApparentMode", (LPARAM)0);
+ if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->windowData.hContact, 0))
+ CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->windowData.hContact, (LPARAM)"chaticon");
break;
case WM_NOTIFY:
@@ -1716,7 +1695,7 @@ LABEL_SHOWWINDOW:
break;
case EN_MSGFILTER:
- if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *) lParam)->msg == WM_RBUTTONUP){
+ if (pNmhdr->idFrom == IDC_CHAT_LOG && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -1724,11 +1703,11 @@ LABEL_SHOWWINDOW:
case EN_LINK:
if (pNmhdr->idFrom == IDC_CHAT_LOG) {
- switch (((ENLINK *) lParam)->msg) {
+ switch (((ENLINK *)lParam)->msg) {
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
- if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE),(ENLINK*)lParam)) {
+ if (HandleLinkClick(g_hInst, hwndDlg, GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), (ENLINK*)lParam)) {
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, TRUE);
return TRUE;
}
@@ -1738,23 +1717,23 @@ LABEL_SHOWWINDOW:
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;
USERINFO * ui;
- SESSION_INFO* parentdat =(SESSION_INFO*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
+ SESSION_INFO* parentdat = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetCursorPos( &p );
+ GetCursorPos(&p);
ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LIST), &p);
item = LOWORD(SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y)));
ui = SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
- if ( ui != NULL ) {
- static TCHAR ptszBuf[ 1024 ];
- mir_sntprintf( ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
- TranslateT( "Nickname" ), ui->pszNick,
- TranslateT( "Unique ID" ), ui->pszUID,
- TranslateT( "Status" ), TM_WordToString( parentdat->pStatuses, ui->Status ));
+ if (ui != NULL) {
+ static TCHAR ptszBuf[1024];
+ mir_sntprintf(ptszBuf, SIZEOF(ptszBuf), _T("%s: %s\r\n%s: %s\r\n%s: %s"),
+ TranslateT("Nickname"), ui->pszNick,
+ TranslateT("Unique ID"), ui->pszUID,
+ TranslateT("Status"), TM_WordToString(parentdat->pStatuses, ui->Status));
lpttd->lpszText = ptszBuf;
}
}
@@ -1774,21 +1753,21 @@ LABEL_SHOWWINDOW:
int item;
USERINFO * ui;
- hti.pt.x=(short)LOWORD(GetMessagePos());
- hti.pt.y=(short)HIWORD(GetMessagePos());
- ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LIST),&hti.pt);
+ hti.pt.x = (short)LOWORD(GetMessagePos());
+ hti.pt.y = (short)HIWORD(GetMessagePos());
+ ScreenToClient(GetDlgItem(hwndDlg, IDC_CHAT_LIST), &hti.pt);
item = LOWORD(SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LIST), LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
ui = SM_GetUserFromIndex(si->ptszID, si->pszModule, item);
if (ui) {
- if (GetKeyState(VK_SHIFT) & 0x8000){
+ if (GetKeyState(VK_SHIFT) & 0x8000) {
LRESULT lResult = (LRESULT)SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_GETSEL, 0, 0);
int start = LOWORD(lResult);
TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR)*(lstrlen(ui->pszUID) + 3));
if (start == 0)
- mir_sntprintf(pszName, lstrlen(ui->pszUID)+3, _T("%s: "), ui->pszUID);
+ mir_sntprintf(pszName, lstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
else
- mir_sntprintf(pszName, lstrlen(ui->pszUID)+2, _T("%s "), ui->pszUID);
+ mir_sntprintf(pszName, lstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
@@ -1799,12 +1778,12 @@ LABEL_SHOWWINDOW:
return TRUE;
}
- if ( HIWORD(wParam) == LBN_KILLFOCUS )
+ if (HIWORD(wParam) == LBN_KILLFOCUS)
RedrawWindow(GetDlgItem(hwndDlg, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE);
break;
case IDOK:
- if ( IsWindowEnabled( GetDlgItem(hwndDlg,IDOK))) {
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) {
char *pszRtf = GetRichTextRTF(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
TCmdList *cmdListNew = tcmdlist_last(si->windowData.cmdList);
@@ -1818,18 +1797,18 @@ LABEL_SHOWWINDOW:
TCHAR *p1 = _tcschr(ptszText, '\0');
//remove trailing linebreaks
- while ( p1 > ptszText && (*p1 == '\0' || *p1 == '\r' || *p1 == '\n')) {
+ while (p1 > ptszText && (*p1 == '\0' || *p1 == '\r' || *p1 == '\n')) {
*p1 = '\0';
p1--;
}
- if ( MM_FindModule(si->pszModule)->bAckMsg ) {
- EnableWindow(GetDlgItem(hwndDlg,IDC_CHAT_MESSAGE),FALSE);
- SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,EM_SETREADONLY,TRUE,0);
+ if (MM_FindModule(si->pszModule)->bAckMsg) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), FALSE);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, TRUE, 0);
}
- else SendDlgItemMessage(hwndDlg,IDC_CHAT_MESSAGE,WM_SETTEXT,0,(LPARAM)_T(""));
+ else SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, WM_SETTEXT, 0, (LPARAM)_T(""));
- EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
mir_free(pszRtf);
@@ -1839,14 +1818,14 @@ LABEL_SHOWWINDOW:
break;
case IDC_CHAT_SHOWNICKLIST:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_SHOWNICKLIST)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_SHOWNICKLIST)))
break;
if (si->iType == GCW_SERVER)
break;
si->bNicklistEnabled = !si->bNicklistEnabled;
- SendDlgItemMessage(hwndDlg,IDC_CHAT_SHOWNICKLIST,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bNicklistEnabled?"chat_nicklist":"chat_nicklist2"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_SHOWNICKLIST, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bNicklistEnabled ? "chat_nicklist" : "chat_nicklist2"));
SendMessage(hwndDlg, GC_SCROLLTOBOTTOM, 0, 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
break;
@@ -1860,11 +1839,10 @@ LABEL_SHOWWINDOW:
case IDC_CHAT_SMILEY:
{
- SMADD_SHOWSEL3 smaddInfo;
RECT rc;
-
GetWindowRect(GetDlgItem(hwndDlg, IDC_CHAT_SMILEY), &rc);
+ SMADD_SHOWSEL3 smaddInfo;
smaddInfo.cbSize = sizeof(SMADD_SHOWSEL3);
smaddInfo.hwndParent = GetParent(hwndDlg);
smaddInfo.hwndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE);
@@ -1881,29 +1859,25 @@ LABEL_SHOWWINDOW:
break;
case IDC_CHAT_HISTORY:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
-
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_HISTORY)))
- break;
-
- if ( pInfo )
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_HISTORY))) {
+ MODULEINFO *pInfo = MM_FindModule(si->pszModule);
+ if (pInfo)
ShellExecute(hwndDlg, NULL, GetChatLogsFilename(si->windowData.hContact, 0), NULL, NULL, SW_SHOW);
}
break;
case IDC_CHAT_CHANMGR:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_CHANMGR)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_CHANMGR)))
break;
DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
break;
case IDC_CHAT_FILTER:
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_FILTER)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_FILTER)))
break;
si->bFilterEnabled = !si->bFilterEnabled;
- SendDlgItemMessage(hwndDlg,IDC_CHAT_FILTER,BM_SETIMAGE,IMAGE_ICON,(LPARAM)GetCachedIcon(si->bFilterEnabled?"chat_filter":"chat_filter2"));
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)GetCachedIcon(si->bFilterEnabled ? "chat_filter" : "chat_filter2"));
if (si->bFilterEnabled && db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0) {
SendMessage(hwndDlg, GC_SHOWFILTERMENU, 0, 0);
break;
@@ -1912,37 +1886,33 @@ LABEL_SHOWWINDOW:
break;
case IDC_CHAT_BKGCOLOR:
- {
- MODULEINFO * pInfo = MM_FindModule(si->pszModule);
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_BKGCOLOR))) {
+ MODULEINFO *pInfo = MM_FindModule(si->pszModule);
CHARFORMAT2 cf;
-
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BKGCOLOR)))
- break;
-
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BKGCOLOR)) {
if (db_get_b(NULL, "Chat", "RightClickFilter", 0) == 0)
SendMessage(hwndDlg, GC_SHOWCOLORCHOOSER, 0, (LPARAM)IDC_CHAT_BKGCOLOR);
- else if (si->bBGSet){
+ else if (si->bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = pInfo->crColors[si->iBG];
- 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 {
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = (COLORREF)db_get_dw(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR);
- 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_COLOR:
@@ -1952,7 +1922,7 @@ LABEL_SHOWWINDOW:
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwEffects = 0;
- if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_COLOR)))
+ if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_COLOR)))
break;
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_COLOR)) {
@@ -1987,14 +1957,14 @@ LABEL_SHOWWINDOW:
MODULEINFO *pInfo = MM_FindModule(si->pszModule);
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
- cf.dwMask = CFM_BOLD|CFM_ITALIC|CFM_UNDERLINE;
+ cf.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE;
cf.dwEffects = 0;
- if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_BOLD)))
+ if (LOWORD(wParam) == IDC_CHAT_BOLD && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_BOLD)))
break;
- if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_ITALICS)))
+ if (LOWORD(wParam) == IDC_CHAT_ITALICS && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_ITALICS)))
break;
- if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHAT_UNDERLINE)))
+ if (LOWORD(wParam) == IDC_CHAT_UNDERLINE && !IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHAT_UNDERLINE)))
break;
if (IsDlgButtonChecked(hwndDlg, IDC_CHAT_BOLD))
cf.dwEffects |= CFE_BOLD;
@@ -2042,13 +2012,12 @@ LABEL_SHOWWINDOW:
case WM_RBUTTONUP:
{
- int i;
hToolbarMenu = CreatePopupMenu();
- for (i = 0; i < SIZEOF(toolbarButtons); i++) {
+ for (int i = 0; i < SIZEOF(toolbarButtons); i++) {
MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE | MIIM_DATA | MIIM_BITMAP;
mii.fType = MFT_STRING;
- mii.fState = (g_dat.chatBbuttonVisibility & (1<< i)) ? MFS_CHECKED : MFS_UNCHECKED;
+ mii.fState = (g_dat.chatBbuttonVisibility & (1 << i)) ? MFS_CHECKED : MFS_UNCHECKED;
mii.wID = i + 1;
mii.dwItemData = (ULONG_PTR)g_dat.hChatButtonIconList;
mii.hbmpItem = HBMMENU_CALLBACK;
@@ -2057,11 +2026,11 @@ LABEL_SHOWWINDOW:
}
POINT pt;
- pt.x = (short) LOWORD(GetMessagePos());
- pt.y = (short) HIWORD(GetMessagePos());
- i = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
- if (i > 0) {
- g_dat.chatBbuttonVisibility ^= (1 << (i - 1));
+ pt.x = (short)LOWORD(GetMessagePos());
+ pt.y = (short)HIWORD(GetMessagePos());
+ int res = TrackPopupMenu(hToolbarMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
+ if (res > 0) {
+ g_dat.chatBbuttonVisibility ^= (1 << (res - 1));
db_set_dw(NULL, SRMMMOD, SRMSGSET_CHATBUTTONVISIBILITY, g_dat.chatBbuttonVisibility);
SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
}
@@ -2071,15 +2040,15 @@ LABEL_SHOWWINDOW:
case DM_GETCONTEXTMENU:
{
- HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) si->windowData.hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)si->windowData.hContact, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)hMenu);
}
return TRUE;
case WM_CONTEXTMENU:
- if (GetParent(hwndDlg) == (HWND) wParam) {
+ if (GetParent(hwndDlg) == (HWND)wParam) {
POINT pt;
- HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) si->windowData.hContact, 0);
+ HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)si->windowData.hContact, 0);
GetCursorPos(&pt);
TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, hwndDlg, NULL);
DestroyMenu(hMenu);
@@ -2098,7 +2067,7 @@ LABEL_SHOWWINDOW:
NotifyLocalWinEvent(si->windowData.hContact, hwndDlg, MSG_WINDOW_EVT_CLOSING);
si->hWnd = NULL;
- SetWindowLongPtr(hwndDlg,GWLP_USERDATA,0);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_UNSUBCLASSED, 0, 0);
SendMessage(GetParent(hwndDlg), CM_REMOVECHILD, 0, (LPARAM)hwndDlg);
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index 735738e024..7eba873a60 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -577,8 +577,8 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
return GC_EVENT_ERROR;
int iRetVal = GC_EVENT_ERROR;
- char *pMod = NULL;
- TCHAR *pWnd = NULL;
+ LPCSTR pMod = NULL;
+ LPCTSTR pWnd = NULL;
GCDEST save_gcd;
GCEVENT save_gce;
SESSION_INFO *si = NULL;
@@ -663,7 +663,7 @@ INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
else
gce->ptszText = a2tf(gce->ptszText, gce->dwFlags);
}
- if (!gce->bIsMe && gce->pDest->pszID && gce->pszText && si)
+ if (!gce->bIsMe && gce->pDest->ptszID && gce->pszText && si)
bIsHighlighted = si->Highlight->match(gce, si, CMUCHighlight::MATCH_TEXT | CMUCHighlight::MATCH_NICKNAME) != 0;
break;
@@ -689,7 +689,7 @@ 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;
}
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index d5aa8f1538..bc1e8bd2d1 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -1038,7 +1038,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int
if (!(si->dwFlags & GC_UNICODE)) {
DWORD dwCP = M.GetDword(si->hContact, "ANSIcodepage", 0);
- gcd->pszID = mir_t2a(pszID);
+ gcd->ptszID = (LPTSTR)mir_t2a(pszID);
gch->pszUID = mir_t2a(pszUID);
gch->pszText = mir_t2a_cp(pszText, dwCP);
}
@@ -1066,7 +1066,7 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
if (!(si->dwFlags & GC_UNICODE)) {
DWORD dwCP = M.GetDword(si->hContact, "ANSIcodepage", 0);
- gcd.pszID = mir_t2a(pszID);
+ gcd.ptszID = (LPTSTR)mir_t2a(pszID);
gch.pszUID = mir_t2a(pszUID);
gch.pszText = mir_t2a_cp(pszText, dwCP);
}
@@ -1080,7 +1080,7 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH
gch.pDest = &gcd;
NotifyEventHooks(hSendEvent, 0, (WPARAM)&gch);
- mir_free(gcd.pszID);
+ mir_free(gcd.ptszID);
mir_free(gch.ptszUID);
mir_free(gch.ptszText);
return TRUE;
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 2446a8265e..5cd0acf84e 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -2480,7 +2480,7 @@ LABEL_SHOWWINDOW:
GCHOOK* gch = (GCHOOK*) lParam;
NotifyEventHooks(hSendEvent, 0, (WPARAM)gch);
if (gch->pDest) {
- mir_free(gch->pDest->pszID);
+ mir_free(gch->pDest->ptszID);
mir_free(gch->pDest->pszModule);
mir_free(gch->pDest);
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 27b60e0076..fa9a38b2a4 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -372,7 +372,7 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg)
GCEVENT gce = {0};
gce.cbSize = sizeof(GCEVENT);
- gcd.pszID = NULL;
+ gcd.ptszID = NULL;
gcd.pszModule = m_szModuleName;
gcd.iType = GC_EVENT_CONTROL;
gce.pDest = &gcd;
@@ -429,7 +429,7 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg)
CallChatEvent( SESSION_OFFLINE, (LPARAM)&gce);
if ( m_rejoinIfKicked ) {
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if ( wi && wi->pszPassword )
PostIrcMessage( _T("/JOIN %s %s"), pmsg->parameters[0].c_str(), wi->pszPassword);
else
@@ -512,7 +512,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg)
if (( int )pmsg->parameters.getCount() > iParametercount ) {
if ( !_tcscmp(pmsg->parameters[2].c_str(), m_info.sNick.c_str())) {
char cModeBit = -1;
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent( GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, false, false, 0 );
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent( GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, false, false, 0 );
switch (*p1) {
case 'v': cModeBit = 0; break;
case 'h': cModeBit = 1; break;
@@ -1361,7 +1361,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
//Set the item data for the window
{
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, sChanName, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, sChanName, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (!wi)
wi = new CHANNELINFO;
wi->OwnMode = btOwnMode;
@@ -2386,7 +2386,7 @@ bool CIrcProto::DoOnConnect( const CIrcMessage* )
gci.iItem = i;
gci.pszModule = m_szModuleName;
if ( !CallServiceSync( MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM ) {
- CHANNELINFO* wi = ( CHANNELINFO* )gci.dwItemData;
+ CHANNELINFO *wi = ( CHANNELINFO* )gci.dwItemData;
if ( wi && wi->pszPassword )
PostIrcMessage( _T("/JOIN %s %s"), gci.pszName, wi->pszPassword);
else
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 01bccf2925..eb8125a351 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -480,7 +480,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac
PostIrcMessage( _T("/PART %s"), window );
if (( one.IsEmpty() || !IsChannel( one ))) {
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if ( wi && wi->pszPassword )
PostIrcMessage( _T("/JOIN %s %s"), window, wi->pszPassword);
else
@@ -857,7 +857,7 @@ bool CIrcProto::PostIrcMessageWnd( TCHAR* window, HANDLE hContact, const TCHAR*
if ( Message.IsEmpty())
return 0;
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, windowname, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, windowname, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
int codepage = ( wi ) ? wi->codepage : getCodepage();
// process the message
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index ff75157663..211e9e0dc1 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -954,7 +954,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
int len = min((( temp == NULL ) ? lstrlen( gcmi->pszID ) : ( int )( temp - gcmi->pszID + 1 )), SIZEOF(stzChanName)-1 );
lstrcpyn( stzChanName, gcmi->pszID, len );
stzChanName[ len ] = 0;
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA,stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA,stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
BOOL bServOwner = strchr(sUserModes.c_str(), 'q') == NULL?FALSE:TRUE;
BOOL bServAdmin = strchr(sUserModes.c_str(), 'a') == NULL?FALSE:TRUE;
BOOL bOwner = bServOwner?((wi->OwnMode>>4)&01):FALSE;
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index f477221510..8489a2557a 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -25,25 +25,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand)
{
- CMString res;
+ CMString res;
int pos = 0;
- for ( ;; ) {
- CMString tmp = sCommand.Tokenize( _T(","), pos );
- if ( pos == -1 )
+ for (;;) {
+ CMString tmp = sCommand.Tokenize(_T(","), pos);
+ if (pos == -1)
break;
tmp = op + tmp;
- if ( res.IsEmpty())
+ if (res.IsEmpty())
res = tmp;
else
res += _T(" ") + tmp;
}
DBVARIANT dbv;
- if ( !getTString( "JTemp", &dbv )) {
+ if (!getTString("JTemp", &dbv)) {
res = CMString(dbv.ptszVal) + _T(" ") + res;
- db_free( &dbv );
+ db_free(&dbv);
}
setTString("JTemp", res.c_str());
@@ -51,7 +51,7 @@ void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand)
CMString __stdcall GetWord(const TCHAR* text, int index)
{
- if ( text && *text ) {
+ if (text && *text) {
TCHAR* p1 = (TCHAR*)text;
TCHAR* p2 = NULL;
@@ -59,31 +59,32 @@ CMString __stdcall GetWord(const TCHAR* text, int index)
p1++;
if (*p1 != '\0') {
- for (int i =0; i < index; i++) {
- p2 = _tcschr( p1, ' ' );
- if ( !p2 )
- p2 = _tcschr( p1, '\0' );
+ for (int i = 0; i < index; i++) {
+ p2 = _tcschr(p1, ' ');
+ if (!p2)
+ p2 = _tcschr(p1, '\0');
else
- while ( *p2 == ' ' )
- p2++;
+ while (*p2 == ' ')
+ p2++;
p1 = p2;
}
p2 = _tcschr(p1, ' ');
- if ( !p2 )
+ if (!p2)
p2 = _tcschr(p1, '\0');
if (p1 != p2)
- return CMString( p1, p2-p1 );
- } }
+ return CMString(p1, p2 - p1);
+ }
+ }
return CMString();
}
const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
{
- if ( !text || !lstrlen(text))
+ if (!text || !lstrlen(text))
return text;
const TCHAR* temp = text;
@@ -96,66 +97,67 @@ const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index)
for (int i = 0; i < index; i++) {
temp = _tcschr(temp, ' ');
- if ( !temp )
- temp = ( TCHAR* )_tcschr(text, '\0');
+ if (!temp)
+ temp = (TCHAR*)_tcschr(text, '\0');
else
- while (*temp == ' ')
- temp++;
+ while (*temp == ' ')
+ temp++;
text = temp;
}
return temp;
}
-void __stdcall RemoveLinebreaks( CMString& Message )
+void __stdcall RemoveLinebreaks(CMString& Message)
{
- while ( Message.Find( _T("\r\n\r\n"), 0) != -1 )
- ReplaceString( Message, _T("\r\n\r\n"), _T("\r\n"));
+ while (Message.Find(_T("\r\n\r\n"), 0) != -1)
+ ReplaceString(Message, _T("\r\n\r\n"), _T("\r\n"));
- if (Message.Find( _T("\r\n"), 0) == 0)
- Message.Delete(0,2);
+ if (Message.Find(_T("\r\n"), 0) == 0)
+ Message.Delete(0, 2);
- if ( (Message.GetLength() > 1) && (Message.Find(_T("\r\n"), Message.GetLength()-2) == 0))
- Message.Delete(Message.GetLength()-2, 2);
+ if ((Message.GetLength() > 1) && (Message.Find(_T("\r\n"), Message.GetLength() - 2) == 0))
+ Message.Delete(Message.GetLength() - 2, 2);
}
-String& __stdcall ReplaceString ( String& text, const char* replaceme, const char* newword )
+String& __stdcall ReplaceString(String& text, const char* replaceme, const char* newword)
{
- if ( !text.IsEmpty() && replaceme != NULL) {
+ if (!text.IsEmpty() && replaceme != NULL) {
int i = 0;
- while (( i = text.Find(replaceme, i)) != -1 ) {
- text.Delete(i,lstrlenA(replaceme));
+ while ((i = text.Find(replaceme, i)) != -1) {
+ text.Delete(i, lstrlenA(replaceme));
text.Insert(i, newword);
i = i + lstrlenA(newword);
- } }
+ }
+ }
return text;
}
-CMString& __stdcall ReplaceString ( CMString& text, const TCHAR* replaceme, const TCHAR* newword)
+CMString& __stdcall ReplaceString(CMString& text, const TCHAR* replaceme, const TCHAR* newword)
{
- if ( !text.IsEmpty() && replaceme != NULL) {
+ if (!text.IsEmpty() && replaceme != NULL) {
int i = 0;
- while (( i = text.Find(replaceme, i)) != -1 ) {
- text.Delete(i,lstrlen(replaceme));
+ while ((i = text.Find(replaceme, i)) != -1) {
+ text.Delete(i, lstrlen(replaceme));
text.Insert(i, newword);
i = i + lstrlen(newword);
- } }
+ }
+ }
return text;
}
-char* __stdcall IrcLoadFile( TCHAR* szPath)
+char* __stdcall IrcLoadFile(TCHAR* szPath)
{
char * szContainer = NULL;
DWORD dwSiz = 0;
- FILE *hFile = _tfopen(szPath, _T("rb"));
- if ( hFile != NULL )
- {
- fseek(hFile,0,SEEK_END); // seek to end
+ FILE *hFile = _tfopen(szPath, _T("rb"));
+ if (hFile != NULL) {
+ fseek(hFile, 0, SEEK_END); // seek to end
dwSiz = ftell(hFile); // size
- fseek(hFile,0,SEEK_SET); // seek back to original pos
- szContainer = new char [dwSiz+1];
+ fseek(hFile, 0, SEEK_SET); // seek back to original pos
+ szContainer = new char[dwSiz + 1];
fread(szContainer, 1, dwSiz, hFile);
szContainer[dwSiz] = '\0';
fclose(hFile);
@@ -165,9 +167,9 @@ char* __stdcall IrcLoadFile( TCHAR* szPath)
return 0;
}
-int __stdcall WCCmp( const TCHAR* wild, const TCHAR* string )
+int __stdcall WCCmp(const TCHAR* wild, const TCHAR* string)
{
- if ( wild == NULL || !lstrlen(wild) || string == NULL || !lstrlen(string))
+ if (wild == NULL || !lstrlen(wild) || string == NULL || !lstrlen(string))
return 1;
const TCHAR *cp = NULL, *mp = NULL;
@@ -178,14 +180,14 @@ int __stdcall WCCmp( const TCHAR* wild, const TCHAR* string )
wild++;
string++;
}
-
+
while (*string) {
if (*wild == '*') {
if (!*++wild)
return 1;
mp = wild;
- cp = string+1;
+ cp = string + 1;
}
else if ((*wild == *string) || (*wild == '?')) {
wild++;
@@ -194,22 +196,23 @@ int __stdcall WCCmp( const TCHAR* wild, const TCHAR* string )
else {
wild = mp;
string = cp++;
- } }
-
+ }
+ }
+
while (*wild == '*')
wild++;
return !*wild;
-}
+}
-bool CIrcProto::IsChannel(const TCHAR* sName)
+bool CIrcProto::IsChannel(const TCHAR* sName)
{
- return ( sChannelPrefixes.Find( sName[0] ) != -1 );
+ return (sChannelPrefixes.Find(sName[0]) != -1);
}
String __stdcall GetWord(const char* text, int index)
{
- if ( text && text[0] ) {
+ if (text && text[0]) {
char* p1 = (char*)text;
char* p2 = NULL;
@@ -217,13 +220,13 @@ String __stdcall GetWord(const char* text, int index)
p1++;
if (*p1 != '\0') {
- for (int i =0; i < index; i++) {
- p2 = strchr( p1, ' ' );
- if ( !p2 )
- p2 = strchr( p1, '\0' );
+ for (int i = 0; i < index; i++) {
+ p2 = strchr(p1, ' ');
+ if (!p2)
+ p2 = strchr(p1, '\0');
else
- while ( *p2 == ' ' )
- p2++;
+ while (*p2 == ' ')
+ p2++;
p1 = p2;
}
@@ -233,29 +236,30 @@ String __stdcall GetWord(const char* text, int index)
p2 = strchr(p1, '\0');
if (p1 != p2)
- return String( p1, p2-p1+1 );
- } }
+ return String(p1, p2 - p1 + 1);
+ }
+ }
return String();
}
-bool CIrcProto::IsChannel(const char* sName)
+bool CIrcProto::IsChannel(const char* sName)
{
- return ( sChannelPrefixes.Find( sName[0] ) != -1 );
+ return (sChannelPrefixes.Find(sName[0]) != -1);
}
-TCHAR* __stdcall my_strstri(const TCHAR* s1, const TCHAR* s2)
-{
- int i,j,k;
- for(i=0;s1[i];i++)
- for(j=i,k=0; _totlower(s1[j]) == _totlower(s2[k]);j++,k++)
- if (!s2[k+1])
- return ( TCHAR* )(s1+i);
+TCHAR* __stdcall my_strstri(const TCHAR* s1, const TCHAR* s2)
+{
+ int i, j, k;
+ for (i = 0; s1[i]; i++)
+ for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
+ if (!s2[k + 1])
+ return (TCHAR*)(s1 + i);
- return NULL;
-}
+ return NULL;
+}
-TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePercent)
+TCHAR* __stdcall DoColorCodes(const TCHAR* text, bool bStrip, bool bReplacePercent)
{
static TCHAR szTemp[4000]; szTemp[0] = '\0';
TCHAR* p = szTemp;
@@ -263,34 +267,34 @@ TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePerc
bool bUnderline = false;
bool bItalics = false;
- if ( !text )
+ if (!text)
return szTemp;
- while ( *text != '\0' ) {
+ while (*text != '\0') {
int iFG = -1;
int iBG = -1;
- switch( *text ) {
+ switch (*text) {
case '%': //escape
- *p++ = '%';
- if ( bReplacePercent )
- *p++ = '%';
+ *p++ = '%';
+ if (bReplacePercent)
+ *p++ = '%';
text++;
break;
case 2: //bold
- if ( !bStrip ) {
- *p++ = '%';
- *p++ = bBold ? 'B' : 'b';
+ if (!bStrip) {
+ *p++ = '%';
+ *p++ = bBold ? 'B' : 'b';
}
bBold = !bBold;
text++;
break;
case 15: //reset
- if ( !bStrip ) {
- *p++ = '%';
- *p++ = 'r';
+ if (!bStrip) {
+ *p++ = '%';
+ *p++ = 'r';
}
bUnderline = false;
bBold = false;
@@ -298,18 +302,18 @@ TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePerc
break;
case 22: //italics
- if ( !bStrip ) {
- *p++ = '%';
- *p++ = bItalics ? 'I' : 'i';
+ if (!bStrip) {
+ *p++ = '%';
+ *p++ = bItalics ? 'I' : 'i';
}
bItalics = !bItalics;
text++;
break;
case 31: //underlined
- if ( !bStrip ) {
- *p++ = '%';
- *p++ = bUnderline ? 'U' : 'u';
+ if (!bStrip) {
+ *p++ = '%';
+ *p++ = bUnderline ? 'U' : 'u';
}
bUnderline = !bUnderline;
text++;
@@ -319,8 +323,8 @@ TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePerc
text++;
// do this if the colors should be reset to default
- if ( *text <= 47 || *text >= 58 || *text == '\0' ) {
- if ( !bStrip ) {
+ if (*text <= 47 || *text >= 58 || *text == '\0') {
+ if (!bStrip) {
*p++ = '%';
*p++ = 'C';
*p++ = '%';
@@ -332,67 +336,70 @@ TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePerc
TCHAR buf[3];
// fix foreground index
- if ( text[1] > 47 && text[1] < 58 && text[1] != '\0')
- lstrcpyn( buf, text, 3 );
+ if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
+ lstrcpyn(buf, text, 3);
else
- lstrcpyn( buf, text, 2 );
- text += lstrlen( buf );
- iFG = _ttoi( buf );
+ lstrcpyn(buf, text, 2);
+ text += lstrlen(buf);
+ iFG = _ttoi(buf);
// fix background color
- if ( *text == ',' && text[1] > 47 && text[1] < 58 && text[1] != '\0' ) {
+ if (*text == ',' && text[1] > 47 && text[1] < 58 && text[1] != '\0') {
text++;
- if ( text[1] > 47 && text[1] < 58 && text[1] != '\0' )
- lstrcpyn( buf, text, 3 );
+ if (text[1] > 47 && text[1] < 58 && text[1] != '\0')
+ lstrcpyn(buf, text, 3);
else
- lstrcpyn( buf, text, 2 );
- text += lstrlen( buf );
- iBG = _ttoi( buf );
- } }
-
- if ( iFG >= 0 && iFG != 99 )
- while( iFG > 15 )
- iFG -= 16;
- if ( iBG >= 0 && iBG != 99 )
- while( iBG > 15 )
- iBG -= 16;
+ lstrcpyn(buf, text, 2);
+ text += lstrlen(buf);
+ iBG = _ttoi(buf);
+ }
+ }
+
+ if (iFG >= 0 && iFG != 99)
+ while (iFG > 15)
+ iFG -= 16;
+ if (iBG >= 0 && iBG != 99)
+ while (iBG > 15)
+ iBG -= 16;
// create tag for chat.dll
- if ( !bStrip ) {
+ if (!bStrip) {
TCHAR buf[10];
- if ( iFG >= 0 && iFG != 99 ) {
+ if (iFG >= 0 && iFG != 99) {
*p++ = '%';
*p++ = 'c';
- mir_sntprintf( buf, SIZEOF(buf), _T("%02u"), iFG );
- for (int i = 0; i<2; i++)
+ mir_sntprintf(buf, SIZEOF(buf), _T("%02u"), iFG);
+ for (int i = 0; i < 2; i++)
*p++ = buf[i];
}
else if (iFG == 99) {
*p++ = '%';
*p++ = 'C';
}
-
- if ( iBG >= 0 && iBG != 99 ) {
+
+ if (iBG >= 0 && iBG != 99) {
*p++ = '%';
*p++ = 'f';
- mir_sntprintf( buf, SIZEOF(buf), _T("%02u"), iBG );
- for ( int i = 0; i<2; i++ )
+ mir_sntprintf(buf, SIZEOF(buf), _T("%02u"), iBG);
+ for (int i = 0; i < 2; i++)
*p++ = buf[i];
}
- else if ( iBG == 99 ) {
+ else if (iBG == 99) {
*p++ = '%';
*p++ = 'F';
- } }
+ }
+ }
break;
default:
*p++ = *text++;
break;
- } }
-
+ }
+ }
+
*p = '\0';
return szTemp;
}
@@ -403,11 +410,10 @@ INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, LPARAM lParam)
INT_PTR iVal = 0;
// first see if the scripting module should modify or stop this event
- if ( m_bMbotInstalled && m_scriptingEnabled && gce
- && gce->time != 0 && (gce->pDest->pszID == NULL
- || lstrlen(gce->pDest->ptszID) != 0 && lstrcmpi(gce->pDest->ptszID , SERVERWINDOW)))
- {
- GCEVENT *gcevent= (GCEVENT*) lParam;
+ if (m_bMbotInstalled && m_scriptingEnabled && gce
+ && gce->time != 0 && (gce->pDest->ptszID == NULL
+ || lstrlen(gce->pDest->ptszID) != 0 && lstrcmpi(gce->pDest->ptszID, SERVERWINDOW))) {
+ GCEVENT *gcevent = (GCEVENT*)lParam;
GCEVENT *gcetemp = NULL;
WPARAM wp = wParam;
gcetemp = (GCEVENT *)mir_alloc(sizeof(GCEVENT));
@@ -418,66 +424,66 @@ INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, LPARAM lParam)
gcetemp->cbSize = sizeof(GCEVENT);
gcetemp->dwItemData = gcevent->dwItemData;
gcetemp->time = gcevent->time;
- gcetemp->pDest->ptszID = mir_tstrdup( gcevent->pDest->ptszID );
- gcetemp->pDest->pszModule = mir_strdup( gcevent->pDest->pszModule );
- gcetemp->ptszText = mir_tstrdup( gcevent->ptszText );
- gcetemp->ptszUID = mir_tstrdup( gcevent->ptszUID );
- gcetemp->ptszNick = mir_tstrdup( gcevent->ptszNick );
- gcetemp->ptszStatus = mir_tstrdup( gcevent->ptszStatus );
- gcetemp->ptszUserInfo = mir_tstrdup( gcevent->ptszUserInfo );
-
- if ( Scripting_TriggerMSPGuiIn( &wp, gcetemp ) && gcetemp ) {
+ gcetemp->pDest->ptszID = mir_tstrdup(gcevent->pDest->ptszID);
+ gcetemp->pDest->pszModule = mir_strdup(gcevent->pDest->pszModule);
+ gcetemp->ptszText = mir_tstrdup(gcevent->ptszText);
+ gcetemp->ptszUID = mir_tstrdup(gcevent->ptszUID);
+ gcetemp->ptszNick = mir_tstrdup(gcevent->ptszNick);
+ gcetemp->ptszStatus = mir_tstrdup(gcevent->ptszStatus);
+ gcetemp->ptszUserInfo = mir_tstrdup(gcevent->ptszUserInfo);
+
+ if (Scripting_TriggerMSPGuiIn(&wp, gcetemp) && gcetemp) {
//MBOT CORRECTIONS
//if ( gcetemp && gcetemp->pDest && gcetemp->pDest->ptszID ) {
- if ( gcetemp && gcetemp->pDest && gcetemp->pDest->ptszID &&
+ if (gcetemp && gcetemp->pDest && gcetemp->pDest->ptszID &&
!my_strstri(gcetemp->pDest->ptszID, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"))) {
- CMString sTempId = MakeWndID( gcetemp->pDest->ptszID );
- mir_realloc( gcetemp->pDest->ptszID, sizeof(TCHAR)*(sTempId.GetLength() + 1));
- lstrcpyn(gcetemp->pDest->ptszID, sTempId.c_str(), sTempId.GetLength()+1);
+ CMString sTempId = MakeWndID(gcetemp->pDest->ptszID);
+ mir_realloc(gcetemp->pDest->ptszID, sizeof(TCHAR)*(sTempId.GetLength() + 1));
+ lstrcpyn(gcetemp->pDest->ptszID, sTempId.c_str(), sTempId.GetLength() + 1);
}
- iVal = CallServiceSync(MS_GC_EVENT, wp, (LPARAM) gcetemp);
+ iVal = CallServiceSync(MS_GC_EVENT, wp, (LPARAM)gcetemp);
}
- if ( gcetemp ) {
- mir_free(( void* )gcetemp->pszNick);
- mir_free(( void* )gcetemp->pszUID);
- mir_free(( void* )gcetemp->pszStatus);
- mir_free(( void* )gcetemp->pszUserInfo);
- mir_free(( void* )gcetemp->pszText);
- mir_free(( void* )gcetemp->pDest->pszID);
- mir_free(( void* )gcetemp->pDest->pszModule);
- mir_free(( void* )gcetemp->pDest);
- mir_free(( void* )gcetemp);
+ if (gcetemp) {
+ mir_free((void*)gcetemp->pszNick);
+ mir_free((void*)gcetemp->pszUID);
+ mir_free((void*)gcetemp->pszStatus);
+ mir_free((void*)gcetemp->pszUserInfo);
+ mir_free((void*)gcetemp->pszText);
+ mir_free((void*)gcetemp->pDest->ptszID);
+ mir_free((void*)gcetemp->pDest->pszModule);
+ mir_free((void*)gcetemp->pDest);
+ mir_free((void*)gcetemp);
}
return iVal;
}
- return CallServiceSync( MS_GC_EVENT, wParam, ( LPARAM )gce );
+ return CallServiceSync(MS_GC_EVENT, wParam, (LPARAM)gce);
}
-INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick,
- const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo,
- DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
-{
- GCDEST gcd = {0};
- GCEVENT gce = {0};
+INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick,
+ const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo,
+ DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
+{
+ GCDEST gcd = { 0 };
+ GCEVENT gce = { 0 };
CMString sID;
CMString sText = _T("");
- if ( iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho )
+ if (iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho)
return false;
- if ( pszText ) {
+ if (pszText) {
if (iEvent != GC_EVENT_SENDMESSAGE)
sText = DoColorCodes(pszText, FALSE, TRUE);
else
sText = pszText;
}
- if ( pszWindow ) {
- if ( lstrcmpi( pszWindow, SERVERWINDOW))
+ if (pszWindow) {
+ if (lstrcmpi(pszWindow, SERVERWINDOW))
sID = pszWindow + (CMString)_T(" - ") + m_info.sNetwork;
else
sID = pszWindow;
@@ -495,15 +501,15 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszN
gce.ptszNick = pszNick;
gce.ptszUID = pszNick;
if (iEvent == GC_EVENT_TOPIC)
- gce.ptszUserInfo = pszUserInfo;
+ gce.ptszUserInfo = pszUserInfo;
else
- gce.ptszUserInfo = m_showAddresses ? pszUserInfo : NULL;
+ gce.ptszUserInfo = m_showAddresses ? pszUserInfo : NULL;
- if ( !sText.IsEmpty())
+ if (!sText.IsEmpty())
gce.ptszText = sText.c_str();
gce.dwItemData = dwItemData;
- if(timestamp == 1)
+ if (timestamp == 1)
gce.time = time(NULL);
else
gce.time = timestamp;
@@ -511,10 +517,10 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszN
return CallChatEvent(0, (LPARAM)&gce);
}
-CMString CIrcProto::ModeToStatus(int sMode)
+CMString CIrcProto::ModeToStatus(int sMode)
{
- if ( sUserModes.Find( sMode ) != -1 ) {
- switch( sMode ) {
+ if (sUserModes.Find(sMode) != -1) {
+ switch (sMode) {
case 'q':
return (CMString)_T("Owner");
case 'o':
@@ -527,17 +533,18 @@ CMString CIrcProto::ModeToStatus(int sMode)
return (CMString)_T("Admin");
default:
return (CMString)_T("Unknown");
- } }
+ }
+ }
return (CMString)_T("Normal");
}
-CMString CIrcProto::PrefixToStatus(int cPrefix)
+CMString CIrcProto::PrefixToStatus(int cPrefix)
{
- const TCHAR* p = _tcschr( sUserModePrefixes.c_str(), cPrefix );
- if ( p ) {
- int index = int( p - sUserModePrefixes.c_str());
- return ModeToStatus( sUserModes[index] );
+ const TCHAR* p = _tcschr(sUserModePrefixes.c_str(), cPrefix);
+ if (p) {
+ int index = int(p - sUserModePrefixes.c_str());
+ return ModeToStatus(sUserModes[index]);
}
return (CMString)_T("Normal");
@@ -548,92 +555,93 @@ CMString CIrcProto::PrefixToStatus(int cPrefix)
struct TimerPair
{
- TimerPair( CIrcProto* _pro, UINT_PTR _id ) :
- ppro( _pro ),
- idEvent( _id )
- {}
+ TimerPair(CIrcProto* _pro, UINT_PTR _id) :
+ ppro(_pro),
+ idEvent(_id)
+ {
+ }
UINT_PTR idEvent;
CIrcProto *ppro;
};
-static int CompareTimers( const TimerPair* p1, const TimerPair* p2 )
+static int CompareTimers(const TimerPair* p1, const TimerPair* p2)
{
- if ( p1->idEvent < p2->idEvent )
+ if (p1->idEvent < p2->idEvent)
return -1;
- return ( p1->idEvent == p2->idEvent ) ? 0 : 1;
+ return (p1->idEvent == p2->idEvent) ? 0 : 1;
}
-static OBJLIST<TimerPair> timers( 10, CompareTimers );
+static OBJLIST<TimerPair> timers(10, CompareTimers);
static CRITICAL_SECTION timers_cs;
-void InitTimers( void )
+void InitTimers(void)
{
- InitializeCriticalSection( &timers_cs );
+ InitializeCriticalSection(&timers_cs);
}
-void UninitTimers( void )
+void UninitTimers(void)
{
- EnterCriticalSection( &timers_cs );
+ EnterCriticalSection(&timers_cs);
timers.destroy();
- LeaveCriticalSection( &timers_cs );
- DeleteCriticalSection( &timers_cs );
+ LeaveCriticalSection(&timers_cs);
+ DeleteCriticalSection(&timers_cs);
}
-CIrcProto* GetTimerOwner( UINT_PTR nIDEvent )
+CIrcProto* GetTimerOwner(UINT_PTR nIDEvent)
{
CIrcProto* result;
- EnterCriticalSection( &timers_cs );
- TimerPair temp( NULL, nIDEvent );
- int idx = timers.getIndex( &temp );
- if ( idx == -1 )
+ EnterCriticalSection(&timers_cs);
+ TimerPair temp(NULL, nIDEvent);
+ int idx = timers.getIndex(&temp);
+ if (idx == -1)
result = NULL;
else
- result = timers[ idx ].ppro;
- LeaveCriticalSection( &timers_cs );
+ result = timers[idx].ppro;
+ LeaveCriticalSection(&timers_cs);
return result;
}
-void CIrcProto::SetChatTimer(UINT_PTR &nIDEvent,UINT uElapse, TIMERPROC lpTimerFunc)
+void CIrcProto::SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc)
{
if (nIDEvent)
KillChatTimer(nIDEvent);
- nIDEvent = SetTimer( NULL, NULL, uElapse, lpTimerFunc);
+ nIDEvent = SetTimer(NULL, NULL, uElapse, lpTimerFunc);
- EnterCriticalSection( &timers_cs );
- timers.insert( new TimerPair( this, nIDEvent ));
- LeaveCriticalSection( &timers_cs );
+ EnterCriticalSection(&timers_cs);
+ timers.insert(new TimerPair(this, nIDEvent));
+ LeaveCriticalSection(&timers_cs);
}
void CIrcProto::KillChatTimer(UINT_PTR &nIDEvent)
{
- if ( nIDEvent ) {
- EnterCriticalSection( &timers_cs );
- TimerPair temp( this, nIDEvent );
- int idx = timers.getIndex( &temp );
- if ( idx != -1 )
- timers.remove( idx );
+ if (nIDEvent) {
+ EnterCriticalSection(&timers_cs);
+ TimerPair temp(this, nIDEvent);
+ int idx = timers.getIndex(&temp);
+ if (idx != -1)
+ timers.remove(idx);
- LeaveCriticalSection( &timers_cs );
+ LeaveCriticalSection(&timers_cs);
KillTimer(NULL, nIDEvent);
nIDEvent = NULL;
-} }
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////
int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi)
{
CMString sTemp = _T("");
- if(wi->pszMode)
- {
+ if (wi->pszMode) {
sTemp += _T("[");
sTemp += wi->pszMode;
sTemp += _T("] ");
}
- if(wi->pszTopic)
+ if (wi->pszTopic)
sTemp += wi->pszTopic;
sTemp = DoColorCodes(sTemp.c_str(), TRUE, FALSE);
return DoEvent(GC_EVENT_SETSBTEXT, sWindow.c_str(), NULL, sTemp.c_str(), NULL, NULL, NULL, FALSE, FALSE, 0);
@@ -642,22 +650,22 @@ int CIrcProto::SetChannelSBText(CMString sWindow, CHANNELINFO * wi)
CMString CIrcProto::MakeWndID(const TCHAR* sWindow)
{
TCHAR buf[200];
- mir_sntprintf( buf, SIZEOF(buf), _T("%s - %s"), sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
+ mir_sntprintf(buf, SIZEOF(buf), _T("%s - %s"), sWindow, (IsConnected()) ? m_info.sNetwork.c_str() : TranslateT("Offline"));
return CMString(buf);
}
bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis)
{
- CHANNELINFO* wi;
- if ( !wis )
+ CHANNELINFO *wi;
+ if (!wis)
wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
else
wi = wis;
- if ( wi ) {
+ if (wi) {
delete[] wi->pszLimit;
- delete[]wi->pszMode;
- delete[]wi->pszPassword;
- delete[]wi->pszTopic;
+ delete[] wi->pszMode;
+ delete[] wi->pszPassword;
+ delete[] wi->pszTopic;
delete wi;
return true;
}
@@ -666,23 +674,23 @@ bool CIrcProto::FreeWindowItemData(CMString window, CHANNELINFO* wis)
bool CIrcProto::AddWindowItemData(CMString window, const TCHAR* pszLimit, const TCHAR* pszMode, const TCHAR* pszPassword, const TCHAR* pszTopic)
{
- CHANNELINFO* wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
- if ( wi ) {
- if ( pszLimit ) {
- wi->pszLimit = ( TCHAR* )realloc( wi->pszLimit, sizeof(TCHAR)*(lstrlen(pszLimit)+1));
- lstrcpy( wi->pszLimit, pszLimit );
+ CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ if (wi) {
+ if (pszLimit) {
+ wi->pszLimit = (TCHAR*)realloc(wi->pszLimit, sizeof(TCHAR)*(lstrlen(pszLimit) + 1));
+ lstrcpy(wi->pszLimit, pszLimit);
}
- if ( pszMode ) {
- wi->pszMode = ( TCHAR* )realloc( wi->pszMode, sizeof(TCHAR)*(lstrlen(pszMode)+1));
- lstrcpy( wi->pszMode, pszMode );
+ if (pszMode) {
+ wi->pszMode = (TCHAR*)realloc(wi->pszMode, sizeof(TCHAR)*(lstrlen(pszMode) + 1));
+ lstrcpy(wi->pszMode, pszMode);
}
- if ( pszPassword ) {
- wi->pszPassword = ( TCHAR* )realloc( wi->pszPassword, sizeof(TCHAR)*(lstrlen(pszPassword)+1));
- lstrcpy( wi->pszPassword, pszPassword );
+ if (pszPassword) {
+ wi->pszPassword = (TCHAR*)realloc(wi->pszPassword, sizeof(TCHAR)*(lstrlen(pszPassword) + 1));
+ lstrcpy(wi->pszPassword, pszPassword);
}
- if ( pszTopic ) {
- wi->pszTopic = ( TCHAR* )realloc( wi->pszTopic, sizeof(TCHAR)*(lstrlen(pszTopic)+1));
- lstrcpy( wi->pszTopic, pszTopic );
+ if (pszTopic) {
+ wi->pszTopic = (TCHAR*)realloc(wi->pszTopic, sizeof(TCHAR)*(lstrlen(pszTopic) + 1));
+ lstrcpy(wi->pszTopic, pszTopic);
}
SetChannelSBText(window, wi);
@@ -694,20 +702,21 @@ bool CIrcProto::AddWindowItemData(CMString window, const TCHAR* pszLimit, const
void CIrcProto::FindLocalIP(HANDLE con) // inspiration from jabber
{
// Determine local IP
- int socket = CallService(MS_NETLIB_GETSOCKET, (WPARAM) con, 0);
- if ( socket != INVALID_SOCKET ) {
+ int socket = CallService(MS_NETLIB_GETSOCKET, (WPARAM)con, 0);
+ if (socket != INVALID_SOCKET) {
struct sockaddr_in saddr;
int len = sizeof(saddr);
getsockname(socket, (struct sockaddr *) &saddr, &len);
lstrcpynA(m_myLocalHost, inet_ntoa(saddr.sin_addr), 49);
- m_myLocalPort = ntohs(saddr.sin_port );
-} }
+ m_myLocalPort = ntohs(saddr.sin_port);
+ }
+}
void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendCommand, CMString userhostparams, ...)
{
TCHAR temp[4096];
CMString S = _T("");
- switch( type ) {
+ switch (type) {
case 1:
S = _T("USERHOST");
break;
@@ -725,44 +734,44 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman
va_end(ap);
// Add reason
- if ( type == 1 )
- vUserhostReasons.insert( new CMString( reason ));
- else if ( type == 2 )
- vWhoInProgress.insert( new CMString( reason));
+ if (type == 1)
+ vUserhostReasons.insert(new CMString(reason));
+ else if (type == 2)
+ vWhoInProgress.insert(new CMString(reason));
// Do command
- if ( IsConnected() && bSendCommand )
- SendIrcMessage( temp, false );
+ if (IsConnected() && bSendCommand)
+ SendIrcMessage(temp, false);
}
CMString CIrcProto::GetNextUserhostReason(int type)
{
CMString reason = _T("");
- switch( type ) {
+ switch (type) {
case 1:
- if ( !vUserhostReasons.getCount())
+ if (!vUserhostReasons.getCount())
return CMString();
// Get reason
reason = vUserhostReasons[0];
- vUserhostReasons.remove( 0 );
+ vUserhostReasons.remove(0);
break;
case 2:
- if ( !vWhoInProgress.getCount())
+ if (!vWhoInProgress.getCount())
return CMString();
// Get reason
reason = vWhoInProgress[0];
- vWhoInProgress.remove( 0 );
+ vWhoInProgress.remove(0);
break;
}
return reason;
}
-CMString CIrcProto::PeekAtReasons( int type )
+CMString CIrcProto::PeekAtReasons(int type)
{
- switch ( type ) {
+ switch (type) {
case 1:
if (!vUserhostReasons.getCount())
return CMString();
@@ -786,13 +795,14 @@ void CIrcProto::ClearUserhostReasons(int type)
case 2:
vWhoInProgress.destroy();
break;
-} }
+ }
+}
////////////////////////////////////////////////////////////////////
SERVER_INFO::~SERVER_INFO()
{
- mir_free( m_name );
- mir_free( m_address );
- mir_free( m_group );
+ mir_free(m_name);
+ mir_free(m_address);
+ mir_free(m_group);
}
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 78f2f3fe7a..a2973e3c99 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -1075,7 +1075,7 @@ void CManagerDlg::OnApplyModes( CCtrlButton* )
{
TCHAR window[256];
GetDlgItemText( m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- CHANNELINFO* wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if ( wi ) {
TCHAR toadd[10]; *toadd = '\0';
TCHAR toremove[10]; *toremove = '\0';
@@ -1266,7 +1266,7 @@ void CManagerDlg::InitManager( int mode, const TCHAR* window )
{
SetWindowText( GetDlgItem( m_hwnd, IDC_CAPTION ), window );
- CHANNELINFO* wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if ( wi ) {
if ( m_proto->IsConnected()) {
TCHAR temp[1000];
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;