summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-17 16:37:24 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-17 16:37:24 +0000
commite5d58fc3bbbce2773b7c6c3f8b7da6faa66b672e (patch)
tree6432409a59b53d8098ac38aa1d3072ae2e5f9e4b
parent17e345e621254103a98bbc7e662a2829b7aa3ce6 (diff)
chats: more functions, less structures
git-svn-id: http://svn.miranda-ng.org/main/trunk@17309 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_app.libbin79712 -> 81820 bytes
-rw-r--r--bin10/lib/mir_app64.libbin76542 -> 78444 bytes
-rw-r--r--bin12/lib/mir_app.libbin79712 -> 81820 bytes
-rw-r--r--bin12/lib/mir_app64.libbin76542 -> 78444 bytes
-rw-r--r--bin14/lib/mir_app.libbin79712 -> 81820 bytes
-rw-r--r--bin14/lib/mir_app64.libbin76542 -> 78444 bytes
-rw-r--r--include/m_chat.h157
-rw-r--r--include/m_chat_int.h4
-rw-r--r--plugins/Dropbox/src/dropbox_utils.cpp9
-rw-r--r--plugins/MirLua/src/m_message.cpp14
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp61
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp12
-rw-r--r--plugins/Scriver/src/chat/main.cpp2
-rw-r--r--plugins/Scriver/src/chat/window.cpp11
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp11
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp11
-rw-r--r--protocols/AimOscar/src/chat.cpp46
-rw-r--r--protocols/FacebookRM/src/chat.cpp62
-rw-r--r--protocols/FacebookRM/src/proto.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp30
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp35
-rw-r--r--protocols/IRCG/src/clist.cpp4
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp101
-rw-r--r--protocols/IRCG/src/input.cpp29
-rw-r--r--protocols/IRCG/src/irclib.cpp14
-rw-r--r--protocols/IRCG/src/irclib.h2
-rw-r--r--protocols/IRCG/src/ircproto.cpp18
-rw-r--r--protocols/IRCG/src/services.cpp40
-rw-r--r--protocols/IRCG/src/stdafx.h326
-rw-r--r--protocols/IRCG/src/tools.cpp28
-rw-r--r--protocols/IRCG/src/windows.cpp4
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp37
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp24
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/MRA/src/MraChat.cpp27
-rw-r--r--protocols/MRA/src/Mra_functions.cpp2
-rw-r--r--protocols/MSN/src/msn_chat.cpp46
-rw-r--r--protocols/MSN/src/msn_commands.cpp14
-rw-r--r--protocols/MSN/src/msn_misc.cpp10
-rw-r--r--protocols/MSN/src/msn_proto.cpp3
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp50
-rw-r--r--protocols/MinecraftDynmap/src/proto.cpp6
-rw-r--r--protocols/Omegle/src/chat.cpp53
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Sametime/src/conference.cpp84
-rw-r--r--protocols/Sametime/src/sametime.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp68
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp7
-rw-r--r--protocols/Tox/src/tox_chatrooms.cpp10
-rw-r--r--protocols/Twitter/src/chat.cpp35
-rw-r--r--protocols/Twitter/src/proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp52
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/WhatsApp/src/chat.cpp47
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
-rw-r--r--protocols/Yahoo/src/chat.cpp37
-rw-r--r--src/core/stdchat/src/main.cpp2
-rw-r--r--src/core/stdchat/src/services.cpp4
-rw-r--r--src/core/stdchat/src/window.cpp11
-rw-r--r--src/mir_app/src/chat_manager.cpp11
-rw-r--r--src/mir_app/src/chat_svc.cpp249
-rw-r--r--src/mir_app/src/chat_tools.cpp9
-rw-r--r--src/mir_app/src/mir_app.def8
-rw-r--r--src/mir_app/src/mir_app64.def8
66 files changed, 821 insertions, 1146 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib
index 3cd1a5674e..86cc9f3453 100644
--- a/bin10/lib/mir_app.lib
+++ b/bin10/lib/mir_app.lib
Binary files differ
diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib
index 9b7b5e465b..f610c28d22 100644
--- a/bin10/lib/mir_app64.lib
+++ b/bin10/lib/mir_app64.lib
Binary files differ
diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib
index 3cd1a5674e..86cc9f3453 100644
--- a/bin12/lib/mir_app.lib
+++ b/bin12/lib/mir_app.lib
Binary files differ
diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib
index 9b7b5e465b..f610c28d22 100644
--- a/bin12/lib/mir_app64.lib
+++ b/bin12/lib/mir_app64.lib
Binary files differ
diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib
index 3cd1a5674e..86cc9f3453 100644
--- a/bin14/lib/mir_app.lib
+++ b/bin14/lib/mir_app.lib
Binary files differ
diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib
index 9b7b5e465b..f610c28d22 100644
--- a/bin14/lib/mir_app64.lib
+++ b/bin14/lib/mir_app64.lib
Binary files differ
diff --git a/include/m_chat.h b/include/m_chat.h
index 8eb96aeda8..54fc11805c 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -137,7 +137,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GC_FONTSIZE 0x0200 // enable font size selection
// 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
@@ -145,16 +144,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// GCREGISTER struct
struct GCREGISTER
{
- 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
- LPCTSTR ptszDispName; // This is the protocol's real name as it will be displayed to the user
- 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];
+ const char *pszModule; // This MUST be the protocol name as registered with Miranda IM
+ const wchar_t *ptszDispName; // This is the protocol's real name as it will be displayed to the user
+ unsigned dwFlags; // Use GC_* flags above to indicate features supported
+ 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];
};
EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
@@ -178,20 +176,18 @@ EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
// 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.
// GCSESSION structure
struct GCSESSION
{
- 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)
- LPCTSTR ptszName; // The name of the session as it will be displayed to the user
- LPCTSTR ptszID; // The unique identifier for the session.
- LPCTSTR ptszStatusbarText; // Optional text to set in the statusbar of the chat room window, or NULL.
- DWORD dwFlags;
- INT_PTR dwItemData; // Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event
+ const char *pszModule; // The name of the protocol owning the session (the same as pszModule when you register)
+ const wchar_t *ptszName; // The name of the session as it will be displayed to the user
+ const wchar_t *ptszID; // The unique identifier for the session.
+ const wchar_t *ptszStatusbarText; // Optional text to set in the statusbar of the chat room window, or NULL.
+ int iType; // Use one of the GCW_* flags above to set the type of session
+ DWORD dwFlags;
+ void *pItemData; // Set user defined data for this session. Retrieve it by using the Chat_GetUserInfo() call
};
EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *);
@@ -354,78 +350,18 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *);
// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
#define GC_EVENT_REMOVESTATUS 0x0800
-// GC_EVENT_CHUID - not shown in the log (Change the unique identifier of a contact)
-// pszID(in GCDEST) - Should be NULL as a unique id's are global.
-// pszUID - The current unique identifier
-// pszText - The new unique identifier. Color codes are not valid
-#define GC_EVENT_CHUID 0x1000
-
-// GC_EVENT_CHANGESESSIONAME - not shown in the log (Change the display name of a session)
-// pszText - The new name. Color codes are not valid
-#define GC_EVENT_CHANGESESSIONAME 0x1001
-
// GC_EVENT_ADDGROUP - not shown in the log (Add a possible status mode to the nicklist, ex IRC uses "Op", "Voice", "Normal" etc )
// NOTE. When adding several statuses, start with the highest status
// pszStatus - The new group name
// dwItemData - Optional HICON handle to a 10x10 icon. Set to NULL to use the built in icons.
#define GC_EVENT_ADDGROUP 0x1002
-// GC_EVENT_SETITEMDATA & GC_EVENT_SETITEMDATA - not shown in the log (Get/Set the user defined data of a session)
-// dwItemData - The itemdata to set or get
-#define GC_EVENT_SETITEMDATA 0x1003
-#define GC_EVENT_GETITEMDATA 0x1004
-
-// GC_EVENT_SETSBTEXT - not shown in the log (Set the text of the statusbar for a chat room window)
-// pszText - Statusbar text. Color codes are not valid
-#define GC_EVENT_SETSBTEXT 0x1006
-
-// GC_EVENT_ACK - not shown in the log (Acknowledge a outgoing message, when GC_ACKMSG is set
-#define GC_EVENT_ACK 0x1007
-
-// GC_EVENT_SENDMESSAGE - not shown in the log ("Fake" a message from a chat room as if the user had typed it). Used by IRC to broadcast /AME and /AMSG messages
-// pszText - The text
-#define GC_EVENT_SENDMESSAGE 0x1008
-
-// GC_EVENT_SETSTATUSEX - not shown in the log (Space or tab delimited list of pszUID's to indicate as away).
-// Used by IRC to mark users as away in the nicklist. If UIDs can contain spaces, use tabs
-// pszText - Space or tab delimited list of pszUID's
-
-#define GC_SSE_ONLYLISTED 0x0001 // processes only listed contacts, resets all contacts otherwise
-#define GC_SSE_ONLINE 0x0002 // displays a contact online, otherwise away
-#define GC_SSE_TABDELIMITED 0x0004 // use tabs as delimiters
-#define GC_SSE_OFFLINE 0x0008 // displays a contact offline, otherwise away
-
-#define GC_EVENT_SETSTATUSEX 0x1009
-
// GC_EVENT_SETCONTACTSTATUS - sets status icon for contact
// pszUID - Unique identifier of the one who receives a new status
// dwItemData - (DWORD)ID_STATUS_* or zero to remove status icon
#define GC_EVENT_SETCONTACTSTATUS 0x100A
-// GC_EVENT_CONTROL - not shown in the log (Control window associated to a session and the session itself)
-// NOTE 1: No members of GCEVENT are used, send one of the below flags in wParam instead,
-// Ex CallService(GC_EVENT_CONTROL, SESSION_INITDONE, (LPARAM)&gce);
-// NOTE 2: The first four control events are the only ones you should use most likely!
-// The ones below them are used by IRC to join channels hidden or maximized and show the server window from the system menu.
-// The SESSION_VISIBLE, SESSION_HIDDEN, SESSION_MAXIMIZE and SESSION_MINIMIZE events CAN replace SESSION_INITDONE but I urge you not to
-// do that as it will override any settings the user has made in the Chat options
-// NOTE 3: If pszID (of GCDEST) = NULL then this message will be broadcasted to all sessions, which can be usefule for terminating
-// all sessions when the protocol was disconnected
-#define SESSION_INITDONE 1 // send this when the session is fully set up (all users have ben added to the nicklist)
-#define SESSION_TERMINATE 7 // send to terminate a session and close the window associated with it
-#define SESSION_OFFLINE 8 // send to set the session as "online" (hContact is set to Online etc)
-#define SESSION_ONLINE 9 // send to set the session as "offline" (hContact is set to Offline etc)
-
-#define WINDOW_VISIBLE 2 // make the room window visible
-#define WINDOW_HIDDEN 3 // close the room window. Session is not terminated.
-#define WINDOW_MAXIMIZE 4 // make the room window maximized
-#define WINDOW_MINIMIZE 5 // make the room window minimized
-#define WINDOW_CLEARLOG 6 // clear the log of the room window
-
-#define GC_EVENT_CONTROL 0x1005
-
// Error messages
-#define GC_EVENT_WRONGVER 1 // You appear to be using the wrong version of this API.
#define GC_EVENT_ERROR 2 // An internal error occurred.
// The GCDEST structure. It is passed to Chat inside GCEVENT.
@@ -439,12 +375,10 @@ struct GCDEST
// The GCEVENT structure
#define GCEF_ADDTOLOG 0x0001
-#define GCEF_REMOVECONTACT 0x0002
#define GCEF_NOTNOTIFY 0x0004
struct GCEVENT
{
- int cbSize; // set to sizeof(GCEVENT);
GCDEST *pDest; // pointer to a GCDEST structure which specifies the session to receive the event
LPCTSTR ptszText; //
LPCTSTR ptszNick; //
@@ -459,10 +393,46 @@ struct GCEVENT
DWORD time; // Timestamp of the event
};
-EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT*);
+EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT*);
+
+EXTERN_C MIR_APP_DLL(void*) Chat_GetUserInfo(const char *szModule, const wchar_t *wszId);
+EXTERN_C MIR_APP_DLL(int) Chat_SetUserInfo(const char *szModule, const wchar_t *wszId, void *pItemData);
+
+EXTERN_C MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wszId, const wchar_t *wszNewName);
+EXTERN_C MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszId, const wchar_t *wszOldId, const wchar_t *wszNewId);
+EXTERN_C MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId, const wchar_t *wszText);
+EXTERN_C MIR_APP_DLL(int) Chat_SetStatusbarText(const char *szModule, const wchar_t *wszId, const wchar_t *wszText);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+#define GC_SSE_ONLYLISTED 0x0001 // processes only listed contacts, resets all contacts otherwise
+#define GC_SSE_ONLINE 0x0002 // displays a contact online, otherwise away
+#define GC_SSE_TABDELIMITED 0x0004 // use tabs as delimiters
+#define GC_SSE_OFFLINE 0x0008 // displays a contact offline, otherwise away
+
+EXTERN_C MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *wszId, int flags, const wchar_t *wszText);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+#define SESSION_INITDONE 1 // send this when the session is fully set up (all users have ben added to the nicklist)
+#define SESSION_TERMINATE 7 // send to terminate a session and close the window associated with it
+#define SESSION_OFFLINE 8 // send to set the session as "online" (hContact is set to Online etc)
+#define SESSION_ONLINE 9 // send to set the session as "offline" (hContact is set to Offline etc)
+
+#define WINDOW_VISIBLE 2 // make the room window visible
+#define WINDOW_HIDDEN 3 // close the room window. Session is not terminated.
+#define WINDOW_MAXIMIZE 4 // make the room window maximized
+#define WINDOW_MINIMIZE 5 // make the room window minimized
+#define WINDOW_CLEARLOG 6 // clear the log of the room window
+
+// if wszId == NULL, this message is broadcasted to all windows of specified szModule
+EXTERN_C MIR_APP_DLL(int) Chat_Control(const char *szModule, const wchar_t *wszId, int command);
+EXTERN_C MIR_APP_DLL(int) Chat_Terminate(const char *szModule, const wchar_t *wszId, bool bRemoveContact = false);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// This hook is fired when MS_GC_EVENT is called, with the same wParam and lParam as above.
// It allows external plugins to intercept chat events and display then in other ways
+
#define ME_GC_HOOK_EVENT "GChat/HookEvent"
/*
@@ -493,7 +463,7 @@ struct GC_INFO
LPCSTR pszModule; // the module name as registered in MS_GC_REGISTER
LPCTSTR pszID; // unique ID of the session
LPTSTR pszName; // display name of the session
- INT_PTR dwItemData; // user specified data.
+ void* pItemData; // user specified data.
int iCount; // count of users in the nicklist
LPSTR pszUsers; // space separated string containing the UID's of the users in the user list.
// NOTE. Use Mirandas mmi_free() on the returned string.
@@ -585,25 +555,6 @@ typedef struct {
#define ME_GC_BUILDMENU "GChat/BuildMenu"
-/*
- * Example of how to add 2 items to the popup menu for the userlist *
-
- GCMENUITEMS *gcmi= (GCMENUITEMS*) lParam;
- if (gcmi->Type == MENU_ON_NICKLIST)
- {
- static struct gc_item Item[] = {
- {Translate("User &details"), 1, MENU_ITEM, FALSE},
- {Translate("&Op"), 2, MENU_POPUPITEM, FALSE},
- };
-
- gcmi->nItems = sizeof(Item)/sizeof(Item[0]);
- gcmi->Item = &Item[0];
- gcmi->Item[gcmi->nItems-1].bDisabled = bFlag;
-
- return 0;
- }
-*/
-
//////////////////////////////////////////////////////////////////////////
// Get Chat ToolTip Text for buddy
// wParam = (WPARAM)(wchar_t*) roomID parentdat->ptszID
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 82002a8bad..0bae166750 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -50,10 +50,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GC_SHOWFILTERMENU (WM_USER+113)
#define GC_SETWINDOWPOS (WM_USER+114)
#define GC_SAVEWNDPOS (WM_USER+115)
+#define GC_CONTROL_MSG (WM_USER+116)
#define GC_REDRAWWINDOW (WM_USER+118)
#define GC_SHOWCOLORCHOOSER (WM_USER+119)
#define GC_ADDLOG (WM_USER+120)
-#define GC_ACKMESSAGE (WM_USER+121)
#define GC_UPDATENICKLIST (WM_USER+125)
#define GC_TABCHANGE (WM_USER+127)
#define GC_ADDTAB (WM_USER+128)
@@ -208,7 +208,7 @@ struct GCSessionInfoBase
WORD wStatus;
WORD wState;
WORD wCommandsNum;
- DWORD dwItemData;
+ void *pItemData;
DWORD dwFlags;
MCONTACT hContact;
HWND hwndStatus;
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp
index d615b33ea0..0589cddc35 100644
--- a/plugins/Dropbox/src/dropbox_utils.cpp
+++ b/plugins/Dropbox/src/dropbox_utils.cpp
@@ -106,14 +106,7 @@ void CDropbox::SendToContact(MCONTACT hContact, const wchar_t *data)
const char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == TRUE) {
ptrW tszChatRoom(db_get_wsa(hContact, szProto, "ChatRoomID"));
- GCDEST gcd = { szProto, tszChatRoom, GC_EVENT_SENDMESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.bIsMe = TRUE;
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = mir_wstrdup(data);
- gce.time = time(NULL);
- Chat_Event(WINDOW_VISIBLE, &gce);
- mir_free((void*)gce.ptszText);
+ Chat_SendUserMessage(szProto, tszChatRoom, data);
return;
}
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp
index cc0de69657..d08fad864b 100644
--- a/plugins/MirLua/src/m_message.cpp
+++ b/plugins/MirLua/src/m_message.cpp
@@ -34,18 +34,10 @@ static int message_Send(lua_State *L)
const char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == TRUE)
{
- ptrW tszChatRoom(db_get_wsa(hContact, szProto, "ChatRoomID"));
- GCDEST gcd = { szProto, tszChatRoom, GC_EVENT_SENDMESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.bIsMe = TRUE;
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = mir_utf8decodeW(message);
- gce.time = time(NULL);
-
- res = Chat_Event(WINDOW_VISIBLE, &gce);
+ ptrW wszChatRoom(db_get_wsa(hContact, szProto, "ChatRoomID"));
+ ptrW wszMessage(mir_utf8decodeW(message));
+ res = Chat_SendUserMessage(szProto, wszChatRoom, wszMessage);
lua_pushinteger(L, res);
-
- mir_free((void*)gce.ptszText);
}
else if ((res = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message)) != ACKRESULT_FAILED)
{
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index f7030c03a8..b6755f5dca 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -757,44 +757,31 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag
CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(strProto);
if (pIRCCon && db_get_b(hContact, szProto, "ChatRoom", 0) != 0) {
- DBVARIANT dbv;
- if (db_get_ws(hContact, szProto, "Nick", &dbv))
+ ptrW wszNick(db_get_wsa(hContact, szProto, "Nick"));
+ if (wszNick == NULL)
return NULL;
- GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE };
- gcd.ptszID = dbv.ptszVal;
-
- tstring strID = tstring(gcd.ptszID) + L" - " + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str()));
- gcd.ptszID = (LPTSTR)strID.c_str();
-
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszStatus = L"";
- gce.ptszText = (LPTSTR)strAscii.c_str();
- gce.time = time(NULL);
- gce.bIsMe = true;
- Chat_Event(NULL, &gce);
-
- db_free(&dbv);
+ tstring strID = tstring(wszNick) + L" - " + tstring(_A2T(toNarrowString(pIRCCon->strNetwork).c_str()));
+ Chat_SendUserMessage(szProto, strID.c_str(), strAscii.c_str());
return 0;
}
- else {
- SMessageJob *pJob = new SMessageJob();
- pJob->dwTimestamp = GetTickCount();
- pJob->hContact = hContact;
- char* szMsgUtf = mir_utf8encodeW(strMessage.c_str());
+ SMessageJob *pJob = new SMessageJob();
+ pJob->dwTimestamp = GetTickCount();
+ pJob->hContact = hContact;
- pJob->iBufferSize = (int)mir_strlen(szMsgUtf) + 1;
- pJob->pcBuffer = (char *)malloc(pJob->iBufferSize);
- pJob->dwFlags = 0;
+ char* szMsgUtf = mir_utf8encodeW(strMessage.c_str());
- memcpy(pJob->pcBuffer, szMsgUtf, pJob->iBufferSize);
- mir_free(szMsgUtf);
+ pJob->iBufferSize = (int)mir_strlen(szMsgUtf) + 1;
+ pJob->pcBuffer = (char *)malloc(pJob->iBufferSize);
+ pJob->dwFlags = 0;
- pJob->hEvent = (MEVENT)ProtoChainSend(pJob->hContact, PSS_MESSAGE, 0, (LPARAM)pJob->pcBuffer);
- CAppletManager::GetInstance()->AddMessageJob(pJob);
- return pJob->hEvent;
- }
+ memcpy(pJob->pcBuffer, szMsgUtf, pJob->iBufferSize);
+ mir_free(szMsgUtf);
+
+ pJob->hEvent = (MEVENT)ProtoChainSend(pJob->hContact, PSS_MESSAGE, 0, (LPARAM)pJob->pcBuffer);
+ CAppletManager::GetInstance()->AddMessageJob(pJob);
+ return pJob->hEvent;
}
//************************************************************************
@@ -1126,13 +1113,13 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam)
}
// fetch the network name
- if (gcd->iType == GC_EVENT_CHANGESESSIONAME) {
- if (gcd->ptszID && !mir_wstrcmpi(gcd->ptszID, L"Network log")) {
- pIRCCon->strNetwork = toTstring(gce->ptszText);
- TRACE(L"\t Found network identifier: %s\n", pIRCCon->strNetwork.c_str());
- return 0;
- }
- }
+ // if (gcd->iType == GC_EVENT_CHANGESESSIONAME) {
+ // if (gcd->ptszID && !mir_wstrcmpi(gcd->ptszID, L"Network log")) {
+ // pIRCCon->strNetwork = toTstring(gce->ptszText);
+ // TRACE(L"\t Found network identifier: %s\n", pIRCCon->strNetwork.c_str());
+ // return 0;
+ // }
+ // }
CEvent Event;
if (gce->bIsMe)
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 6b6a8bd599..c5e08928b4 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -144,12 +144,10 @@ void PasteIt(MCONTACT hContact, int mode)
// in chat room.
// Next step is to get all protocol sessions and find
// one with correct hContact
- GC_INFO gci = { 0 };
- GCDEST gcd = { szProto, NULL, GC_EVENT_SENDMESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
int cnt = pci->SM_GetCount(szProto);
for (int i = 0; i < cnt; i++)
{
+ GC_INFO gci = {};
gci.iItem = i;
gci.pszModule = szProto;
gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID;
@@ -159,13 +157,7 @@ void PasteIt(MCONTACT hContact, int mode)
// In this place session was finded, gci.pszID contains
// session ID, but it is in unicode or ascii format,
// depends on protocol wersion
- gcd.ptszID = gci.pszID;
- gce.bIsMe = TRUE;
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP);
- gce.time = time(NULL);
- Chat_Event(0, &gce);
- mir_free((void*)gce.ptszText);
+ Chat_SendUserMessage(szProto, gci.pszID, _A2T(pasteToWeb->szFileLink));
break;
}
}
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp
index cff8723cf0..06b0235d2b 100644
--- a/plugins/Scriver/src/chat/main.cpp
+++ b/plugins/Scriver/src/chat/main.cpp
@@ -61,7 +61,7 @@ static void OnDblClickSession(SESSION_INFO *si)
static void OnRemoveSession(SESSION_INFO *si)
{
if (si->hWnd)
- SendMessage(si->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0);
+ SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
}
static void OnRenameSession(SESSION_INFO *si)
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp
index 263d504ced..461cb94a2c 100644
--- a/plugins/Scriver/src/chat/window.cpp
+++ b/plugins/Scriver/src/chat/window.cpp
@@ -1266,7 +1266,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
}
else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
}
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ else SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
case GC_REDRAWLOG2:
@@ -1285,7 +1285,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
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_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
case DM_UPDATETABCONTROL:
@@ -1343,11 +1343,6 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
}
break;
- case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
- SetDlgItemText(hwndDlg, IDC_CHAT_MESSAGE, L"");
- return TRUE;
-
case WM_CTLCOLORLISTBOX:
SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
return (INT_PTR)pci->hListBkgBrush;
@@ -1440,7 +1435,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
SendMessage(hwndDlg, DM_UPDATETITLEBAR, 0, 0);
break;
- case GC_EVENT_CONTROL + WM_USER + 500:
+ case GC_CONTROL_MSG:
switch (wParam) {
case SESSION_OFFLINE:
SendMessage(hwndDlg, DM_UPDATESTATUSBAR, 0, 0);
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index d80b7a016b..618ceca12c 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -231,15 +231,8 @@ void CSend::svcSendMsgExit(const char* szMessage)
gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID;
Chat_GetInfo(&gci);
if (gci.hContact == m_hContact) {
- GCDEST gcd = { m_pszProto, gci.pszID, GC_EVENT_SENDMESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.bIsMe = TRUE;
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszText = tmp;
- gce.time = time(NULL);
-
- //* returns 0 on success or error code on failure
- res = 200 + (int)Chat_Event(0, &gce);
+ Chat_SendUserMessage(m_pszProto, gci.pszID, tmp);
+ res = 200;
break;
}
}
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index e3005afb9f..e55c8d3082 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -61,7 +61,7 @@ static void OnDblClickSession(SESSION_INFO *si)
static void OnRemoveSession(SESSION_INFO *si)
{
if (si->hWnd)
- SendMessage(si->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0);
+ SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
}
static void OnRenameSession(SESSION_INFO *si)
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 289763089e..d44c0bb5b6 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -2058,7 +2058,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE);
}
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ else SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
case GC_REDRAWLOG2:
@@ -2089,14 +2089,9 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
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_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
- case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETREADONLY, FALSE, 0);
- SetDlgItemText(hwndDlg, IDC_CHAT_MESSAGE, L"");
- return TRUE;
-
case DM_TYPING:
// Typing support for GCW_PRIVMESS sessions
if (si->iType == GCW_PRIVMESS) {
@@ -2247,7 +2242,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
break;
- case GC_EVENT_CONTROL + WM_USER + 500:
+ case GC_CONTROL_MSG:
switch (wParam) {
case SESSION_OFFLINE:
SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index 2fcd8ee38f..c88354a8db 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -22,7 +22,7 @@ static const COLORREF crCols[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
void CAimProto::chat_register(void)
{
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.nColors = 16;
gcr.pColors = (COLORREF*)crCols;
@@ -34,11 +34,11 @@ void CAimProto::chat_register(void)
HookProtoEvent(ME_GC_BUILDMENU, &CAimProto::OnGCMenuHook);
}
-void CAimProto::chat_start(const char* id, unsigned short exchange)
+void CAimProto::chat_start(const char *id, unsigned short exchange)
{
wchar_t *idt = mir_a2u(id);
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = idt;
@@ -46,18 +46,17 @@ void CAimProto::chat_start(const char* id, unsigned short exchange)
Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = TranslateT("Me");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
gcd.iType = GC_EVENT_ADDGROUP;
gce.ptszStatus = TranslateT("Others");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
- Chat_Event(WINDOW_VISIBLE, &gce);
+ Chat_Control(m_szModuleName, idt, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, idt, SESSION_ONLINE);
+ Chat_Control(m_szModuleName, idt, WINDOW_VISIBLE);
setWord(find_chat_contact(id), "Exchange", exchange);
@@ -66,15 +65,14 @@ void CAimProto::chat_start(const char* id, unsigned short exchange)
void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_t* msg)
{
- wchar_t *idt = mir_a2u(id);
- wchar_t *snt = mir_a2u(sn);
+ ptrW idt(mir_a2u(id));
+ ptrW snt(mir_a2u(sn));
MCONTACT hContact = contact_from_sn(sn);
- wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(
- WPARAM(hContact), 0) : snt;
+ wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0) : snt;
GCDEST gcd = { m_szModuleName, idt, evt };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.pDest = &gcd;
gce.ptszNick = nick;
@@ -83,26 +81,16 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_
gce.ptszStatus = gce.bIsMe ? TranslateT("Me") : TranslateT("Others");
gce.ptszText = msg;
gce.time = time(NULL);
- Chat_Event(0, &gce);
-
- mir_free(snt);
- mir_free(idt);
+ Chat_Event(&gce);
}
void CAimProto::chat_leave(const char* id)
{
- wchar_t *idt = mir_a2u(id);
-
- GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.pDest = &gcd;
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
-
- mir_free(idt);
+ ptrW idt(mir_a2u(id));
+ Chat_Control(m_szModuleName, idt, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, idt);
}
-
int CAimProto::OnGCEvent(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*)lParam;
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index b487f4a2e1..ce9e7a4512 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -36,7 +36,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
ptrW tchat_id(mir_a2u(chat_id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszText = ttext;
gce.time = timestamp ? timestamp : ::time(NULL);
if (id != NULL)
@@ -48,7 +48,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
}
gce.ptszNick = tnick;
gce.ptszUID = tid;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
facy.erase_reader(ChatIDToHContact(chat_id));
}
@@ -57,11 +57,7 @@ void FacebookProto::RenameChat(const char *chat_id, const char *name)
{
ptrW tchat_id(mir_a2u(chat_id));
ptrW tname(mir_a2u_cp(name, CP_UTF8));
-
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszText = tname;
- Chat_Event(0, &gce);
+ Chat_ChangeSessionName(m_szModuleName, tchat_id, tname);
}
int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam)
@@ -174,7 +170,7 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa
ptrW tid(mir_a2u(user.user_id.c_str()));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.pDest = &gcd;
gce.dwFlags = addToLog ? GCEF_ADDTOLOG : 0;
gce.ptszNick = tnick;
@@ -199,7 +195,7 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa
}
}
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const char *name)
@@ -213,14 +209,14 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const
ptrW tid(mir_a2u(id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_PART };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
gce.time = ::time(NULL);
gce.bIsMe = false;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
/** Caller must free result */
@@ -249,7 +245,7 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname)
ptrW tid(mir_a2u(id));
// Create the group chat session
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_PRIVMESS;
gcw.ptszID = tid;
gcw.pszModule = m_szModuleName;
@@ -258,26 +254,22 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname)
// Send setting events
GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
// Create a user statuses
gce.ptszStatus = TranslateT("Myself");
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = TranslateT("Friend");
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = TranslateT("User");
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = TranslateT("Former");
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
// Finish initialization
- gcd.iType = GC_EVENT_CONTROL;
- gce.time = ::time(NULL);
- gce.pDest = &gcd;
-
bool hideChats = getBool(FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS);
- Chat_Event((hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, tid, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE));
+ Chat_Control(m_szModuleName, tid, SESSION_ONLINE);
}
INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM)
@@ -340,14 +332,8 @@ INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM)
{
ptrW idT(wParam ? getWStringA(wParam, "ChatRoomID") : NULL);
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
- gcd.ptszID = idT;
-
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, idT, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, idT);
if (!wParam) {
facy.clear_chatrooms();
@@ -433,7 +419,7 @@ void FacebookProto::PrepareNotificationsChatRoom() {
mir_snwprintf(nameT, L"%s: %s", m_tszUserName, TranslateT("Notifications"));
// Create the group chat session
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_PRIVMESS;
gcw.ptszID = _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM);
gcw.pszModule = m_szModuleName;
@@ -441,12 +427,8 @@ void FacebookProto::PrepareNotificationsChatRoom() {
Chat_NewSession(&gcw);
// Send setting events
- GCDEST gcd = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
- Chat_Event(WINDOW_HIDDEN, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, gcw.ptszID, WINDOW_HIDDEN);
+ Chat_Control(m_szModuleName, gcw.ptszID, SESSION_ONLINE);
}
}
@@ -464,7 +446,7 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
ptrW messageT(mir_a2u_cp(message.c_str(), CP_UTF8));
GCDEST gcd = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszText = messageT;
gce.time = notification->time ? notification->time : ::time(NULL);
gce.bIsMe = false;
@@ -472,5 +454,5 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
gce.ptszNick = TranslateT("Notifications");
gce.ptszUID = idT;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
} \ No newline at end of file
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 38a0c958b1..f277745e98 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -482,7 +482,7 @@ int FacebookProto::OnModulesLoaded(WPARAM, LPARAM)
HookProtoEvent(ME_MSG_PRECREATEEVENT, &FacebookProto::OnPreCreateEvent);
// Register group chat
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.dwFlags = 0; //GC_ACKMSG;
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
@@ -749,8 +749,8 @@ INT_PTR FacebookProto::VisitNotifications(WPARAM, LPARAM)
if (useChatRoom) {
GCDEST gcd = { m_szModuleName, _T(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(WINDOW_VISIBLE, &gce);
+ GCEVENT gce = { &gcd };
+ Chat_Control(WINDOW_VISIBLE);
}
else {*/
OpenUrl(FACEBOOK_URL_NOTIFICATIONS);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 724b242aa1..421cfef1a7 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -829,7 +829,7 @@ retry:
UIN2IDT(e->event.msg.sender, id);
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
time_t t = time(NULL);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
@@ -838,7 +838,7 @@ retry:
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(messageT);
}
}
@@ -893,7 +893,7 @@ retry:
UIN2IDT(getDword(GG_KEY_UIN, 0), id);
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message);
gce.ptszText = messageT;
@@ -908,7 +908,7 @@ retry:
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"mainthread() (%x): Sent conference message to room %s.", this, chat);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(messageT);
mir_free(nickT);
}
@@ -1272,25 +1272,20 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM)
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
// Terminate conference if contact is deleted
- DBVARIANT dbv;
- if ( isChatRoom(hContact) && !getWString(hContact, "ChatRoomID", &dbv) && gc_enabled)
+ ptrW wszRoomId(getWStringA(hContact, "ChatRoomID"));
+ if (isChatRoom(hContact) && wszRoomId != NULL && gc_enabled)
{
- GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- GGGC *chat = gc_lookup(dbv.ptszVal);
-
- debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, dbv.pszVal);
+ GGGC *chat = gc_lookup(wszRoomId);
+ debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, wszRoomId);
if (chat)
{
// Destroy chat entry
free(chat->recipients);
list_remove(&chats, chat, 1);
// Terminate chat window / shouldn't cascade entry is deleted
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, wszRoomId, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, wszRoomId);
}
-
- db_free(&dbv);
return 0;
}
@@ -1353,13 +1348,10 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
static int cascade = 0;
if (!cascade && dbv.ptszVal)
{
- GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CHANGESESSIONAME };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszText = ptszVal;
debugLogA("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal);
// Mark cascading
/* FIXME */ cascade = 1;
- Chat_Event(0, &gce);
+ Chat_ChangeSessionName(m_szModuleName, dbv.ptszVal, ptszVal);
/* FIXME */ cascade = 0;
}
db_free(&dbv);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 892fcaad0a..b26c271602 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -33,7 +33,7 @@ int GGPROTO::gc_init()
char service[64];
// Register Gadu-Gadu proto
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
@@ -150,7 +150,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = id;
gce.ptszText = gch->ptszText;
wchar_t* nickT;
@@ -170,7 +170,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->pDest->ptszID, gch->ptszText);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(nickT);
T2Utf pszText_utf8(gch->ptszText);
@@ -211,7 +211,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
uin_t uin;
DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, 0, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
debugLogA("gc_getchat(): Count %d.", recipients_count);
if (!recipients) return NULL;
@@ -311,12 +311,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
mir_snwprintf(status, TranslateT("This is my own conference."));
}
- GCSESSION gcwindow = { sizeof(gcwindow) };
+ GCSESSION gcwindow = {};
gcwindow.iType = GCW_CHATROOM;
gcwindow.pszModule = m_szModuleName;
gcwindow.ptszName = sender ? senderName : TranslateT("Conference");
gcwindow.ptszID = chat->id;
- gcwindow.dwItemData = (UINT_PTR)chat;
+ gcwindow.pItemData = chat;
gcwindow.ptszStatusbarText = status;
// Here we put nice new hash sign
@@ -340,7 +340,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
// Add normal group
gce.ptszStatus = TranslateT("Participants");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
gcd.iType = GC_EVENT_JOIN;
// Add myself
@@ -358,7 +358,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
gce.ptszNick = nickT;
gce.bIsMe = 1;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(nickT);
debugLogW(L"gc_getchat(): Myself %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus);
}
@@ -383,11 +383,11 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
gce.bIsMe = 0;
gce.dwFlags = 0;
debugLogW(L"gc_getchat(): Added %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+
+ Chat_Control(m_szModuleName, chat->id, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, chat->id, SESSION_ONLINE);
debugLogW(L"gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
@@ -479,11 +479,8 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
if (count > i) i = count;
chat = gg->gc_getchat(0, participants, count);
if (chat)
- {
- GCDEST gcd = { gg->m_szModuleName, chat, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(WINDOW_VISIBLE, &gce);
- }
+ Chat_Control(gg->m_szModuleName, chat, WINDOW_VISIBLE);
+
free(participants);
}
}
@@ -632,13 +629,13 @@ int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick)
UIN2IDT(uin, id);
GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_NICK };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.pDest = &gcd;
gce.ptszUID = id;
gce.ptszText = ptszNick;
debugLogW(L"gc_changenick(): Found room %s with uin %d, sending nick change %s.", chat->id, uin, id);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
break;
}
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index a0406973c6..3095d7096a 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -40,7 +40,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas
hContact = CList_AddContact(&user, false, false);
setByte(hContact, "DCC", 1);
- DCCINFO* pdci = new DCCINFO;
+ DCCINFO *pdci = new DCCINFO;
pdci->sHostmask = hostmask;
pdci->hContact = hContact;
pdci->dwAdr = (DWORD)adr;
@@ -50,7 +50,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas
pdci->sContactName = name;
if (m_DCCChatAccept == 3 || m_DCCChatAccept == 2 && bFlag) {
- CDccSession* dcc = new CDccSession(this, pdci);
+ CDccSession *dcc = new CDccSession(this, pdci);
CDccSession* olddcc = FindDCCSession(hContact);
if (olddcc)
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index b291319818..2d619b8c71 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -235,7 +235,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, wchar_t* msg)
return 1;
}
-void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
+void __cdecl CIrcProto::ResolveIPThread(void *di)
{
Thread_SetName("IRC: ResolveIPThread");
IPRESOLVE* ipr = (IPRESOLVE *)di;
@@ -373,11 +373,8 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg)
DoEvent(GC_EVENT_QUIT, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 0 ? pmsg->parameters[0].c_str() : NULL, NULL, host.c_str(), NULL, true, false);
struct CONTACT user = { (LPTSTR)pmsg->prefix.sNick.c_str(), (LPTSTR)pmsg->prefix.sUser.c_str(), (LPTSTR)pmsg->prefix.sHost.c_str(), false, false, false };
CList_SetOffline(&user);
- if (pmsg->prefix.sNick == m_info.sNick) {
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
- }
+ if (pmsg->prefix.sNick == m_info.sNick)
+ Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
}
else ShowMessage(pmsg);
@@ -391,9 +388,7 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg)
DoEvent(GC_EVENT_PART, pmsg->parameters[0].c_str(), pmsg->prefix.sNick.c_str(), pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : NULL, NULL, host.c_str(), NULL, true, false);
if (pmsg->prefix.sNick == m_info.sNick) {
CMStringW S = MakeWndID(pmsg->parameters[0].c_str());
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, S, SESSION_OFFLINE);
}
}
else ShowMessage(pmsg);
@@ -410,12 +405,10 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg)
if (pmsg->parameters[1] == m_info.sNick) {
CMStringW S = MakeWndID(pmsg->parameters[0].c_str());
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, S, SESSION_OFFLINE);
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 *)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0].c_str());
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", pmsg->parameters[0].c_str(), wi->pszPassword);
else
@@ -499,7 +492,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg)
if ((int)pmsg->parameters.getCount() > iParametercount) {
if (!mir_wstrcmp(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*)Chat_GetUserInfo(m_szModuleName, pmsg->parameters[0].c_str());
switch (*p1) {
case 'v': cModeBit = 0; break;
case 'h': cModeBit = 1; break;
@@ -514,7 +507,7 @@ bool CIrcProto::OnIrc_MODE(const CIrcMessage* pmsg)
else
wi->OwnMode &= ~(1 << cModeBit);
- DoEvent(GC_EVENT_SETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, (DWORD_PTR)wi, false, false, 0);
+ Chat_SetUserInfo(m_szModuleName, pmsg->parameters[0].c_str(), wi);
}
DoEvent(bAdd ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS, pmsg->parameters[0].c_str(), pmsg->parameters[iParametercount].c_str(), pmsg->prefix.sNick.c_str(), sStatus.c_str(), NULL, NULL, m_oldStyleModes ? false : true, false);
iParametercount++;
@@ -581,7 +574,7 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg)
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_NICK, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, host.c_str(), NULL, true, bIsMe);
- DoEvent(GC_EVENT_CHUID, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, NULL, NULL, true, false);
+ Chat_ChangeUserId(m_szModuleName, NULL, pmsg->prefix.sNick, pmsg->parameters[0]);
struct CONTACT user = { (wchar_t*)pmsg->prefix.sNick.c_str(), (wchar_t*)pmsg->prefix.sUser.c_str(), (wchar_t*)pmsg->prefix.sHost.c_str(), false, false, false };
MCONTACT hContact = CList_FindContact(&user);
@@ -1086,7 +1079,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// remote requested that the file should be resumed
if (type == L"resume") {
- CDccSession* dcc;
+ CDccSession *dcc;
if (sToken.IsEmpty())
dcc = FindDCCSendByPort(iPort);
else
@@ -1101,7 +1094,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// remote accepted your request for a file resume
if (type == L"accept") {
- CDccSession* dcc;
+ CDccSession *dcc;
if (sToken.IsEmpty())
dcc = FindDCCRecvByPortAndName(iPort, pmsg->prefix.sNick.c_str());
else
@@ -1128,7 +1121,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// a reverse filetransfer. The plugin should connect to that computer
// and start sedning the file (if the token is valid). Compare to DCC RECV
if (!sToken.IsEmpty() && iPort) {
- CDccSession* dcc = FindPassiveDCCSend(_wtoi(sToken.c_str()));
+ CDccSession *dcc = FindPassiveDCCSend(_wtoi(sToken.c_str()));
if (dcc) {
dcc->SetupPassive(dwAdr, iPort);
dcc->Connect();
@@ -1273,31 +1266,31 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
CMStringW sID = MakeWndID(sChanName);
BYTE btOwnMode = 0;
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.ptszID = sID.c_str();
gcw.pszModule = m_szModuleName;
gcw.ptszName = sChanName;
if (!Chat_NewSession(&gcw)) {
DBVARIANT dbv;
- GCDEST gcd = { m_szModuleName, sID.c_str(), GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
PostIrcMessage(L"/MODE %s", sChanName);
// register the statuses
+ GCDEST gcd = { m_szModuleName, sID.c_str(), GC_EVENT_ADDGROUP };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = L"Owner";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Admin";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Op";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Halfop";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Voice";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Normal";
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
{
int k = 0;
CMStringW sTemp = GetWord(sNamesList.c_str(), k);
@@ -1333,7 +1326,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
}
gce.bIsMe = bIsMe;
gce.time = bIsMe ? time(0) : 0;
- CallChatEvent(0, &gce);
+ Chat_Event(&gce);
DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp.c_str(), NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
// fix for networks like freshirc where they allow more than one prefix
if (PrefixToStatus(sTemp2[0]) != L"Normal") {
@@ -1353,7 +1346,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 *)Chat_GetUserInfo(m_szModuleName, sChanName);
if (!wi)
wi = new CHANNELINFO;
wi->OwnMode = btOwnMode;
@@ -1362,7 +1355,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
wi->pszPassword = 0;
wi->pszTopic = 0;
wi->codepage = getCodepage();
- DoEvent(GC_EVENT_SETITEMDATA, sChanName, NULL, NULL, NULL, NULL, (DWORD_PTR)wi, false, false, 0);
+ Chat_SetUserInfo(m_szModuleName, sChanName, wi);
if (!sTopic.IsEmpty() && !mir_wstrcmpi(GetWord(sTopic.c_str(), 0).c_str(), sChanName)) {
DoEvent(GC_EVENT_TOPIC, sChanName, sTopicName.IsEmpty() ? NULL : sTopicName.c_str(), GetWordAddress(sTopic.c_str(), 1), NULL, sTopicTime.IsEmpty() ? NULL : sTopicTime.c_str(), NULL, true, false);
@@ -1370,21 +1363,8 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
sTopic = L"";
sTopicName = L"";
sTopicTime = L"";
- } }
-
- gcd.ptszID = (wchar_t*)sID.c_str();
- gcd.iType = GC_EVENT_CONTROL;
- gce.cbSize = sizeof(GCEVENT);
- gce.dwFlags = 0;
- gce.bIsMe = false;
- gce.dwItemData = false;
- gce.ptszNick = NULL;
- gce.ptszStatus = NULL;
- gce.ptszText = NULL;
- gce.ptszUID = NULL;
- gce.ptszUserInfo = NULL;
- gce.time = time(0);
- gce.pDest = &gcd;
+ }
+ }
if (!getWString("JTemp", &dbv)) {
CMStringW command = L"a";
@@ -1407,17 +1387,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
save += GetWordAddress(dbv.ptszVal, k);
switch (command[0]) {
case 'M':
- CallChatEvent(WINDOW_HIDDEN, &gce);
+ Chat_Control(m_szModuleName, sID, WINDOW_HIDDEN);
break;
case 'X':
- CallChatEvent(WINDOW_MAXIMIZE, &gce);
+ Chat_Control(m_szModuleName, sID, WINDOW_MAXIMIZE);
break;
default:
- CallChatEvent(SESSION_INITDONE, &gce);
+ Chat_Control(m_szModuleName, sID, SESSION_INITDONE);
break;
}
}
- else CallChatEvent(SESSION_INITDONE, &gce);
+ else Chat_Control(m_szModuleName, sID, SESSION_INITDONE);
if (save.IsEmpty())
db_unset(NULL, m_szModuleName, "JTemp");
@@ -1425,11 +1405,9 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
setWString("JTemp", save.c_str());
db_free(&dbv);
}
- else CallChatEvent(SESSION_INITDONE, &gce);
+ else Chat_Control(m_szModuleName, sID, SESSION_INITDONE);
- gcd.iType = GC_EVENT_CONTROL;
- gce.pDest = &gcd;
- CallChatEvent(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, sID, SESSION_ONLINE);
}
}
}
@@ -1929,7 +1907,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg)
User = GetWord(m_whoReply.c_str(), 0);
}
- DoEvent(GC_EVENT_SETSTATUSEX, pmsg->parameters[1].c_str(), NULL, S.IsEmpty() ? NULL : S.c_str(), NULL, NULL, GC_SSE_TABDELIMITED, FALSE, FALSE);
+ Chat_SetStatusEx(m_szModuleName, pmsg->parameters[1], GC_SSE_TABDELIMITED, S.IsEmpty() ? NULL : S.c_str());
return true;
}
@@ -2281,9 +2259,7 @@ void CIrcProto::OnIrcDisconnected()
sDisconn += TranslateT("*Disconnected*");
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, sDisconn.c_str(), NULL, NULL, NULL, true, false);
- GCDEST gcd = { m_szModuleName, 0, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, NULL, SESSION_OFFLINE);
if (!Miranda_Terminated())
CList_SetAllOffline(m_disconnectDCCChats);
@@ -2351,7 +2327,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*)
gci.iItem = i;
gci.pszModule = m_szModuleName;
if (!Chat_GetInfo(&gci) && gci.iType == GCW_CHATROOM) {
- CHANNELINFO *wi = (CHANNELINFO*)gci.dwItemData;
+ CHANNELINFO *wi = (CHANNELINFO*)gci.pItemData;
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", gci.pszName, wi->pszPassword);
else
@@ -2361,11 +2337,8 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*)
}
DoEvent(GC_EVENT_ADDGROUP, SERVERWINDOW, NULL, NULL, L"Normal", NULL, NULL, FALSE, TRUE);
- {
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_ONLINE, &gce);
- }
+
+ Chat_Control(m_szModuleName, SERVERWINDOW, SESSION_ONLINE);
CallFunctionAsync(sttMainThrdOnConnect, this);
nickflag = false;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 6cc5de8669..cf66f3273b 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -218,11 +218,9 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
CMStringW therest = GetWordAddress(text, 4);
if (command == L"/servershow" || command == L"/serverhide") {
- if (m_useServer) {
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN, &gce);
- }
+ if (m_useServer)
+ Chat_Control(m_szModuleName, SERVERWINDOW, command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN);
+
return true;
}
@@ -250,9 +248,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
else
S = MakeWndID(window);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(WINDOW_CLEARLOG, &gce);
+ Chat_Control(m_szModuleName, S, WINDOW_CLEARLOG);
return true;
}
@@ -466,7 +462,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
PostIrcMessage(L"/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 *)Chat_GetUserInfo(m_szModuleName, window);
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", window, wi->pszPassword);
else
@@ -474,10 +470,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
return true;
}
- CMStringW S = MakeWndID(window);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, MakeWndID(window));
PostIrcMessage(L"/JOIN %s", GetWordAddress(text, 1));
return true;
@@ -518,7 +511,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
CMStringW S = L"/ME " + DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
+ Chat_SendUserMessage(m_szModuleName, NULL, S);
return true;
}
@@ -528,7 +521,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
CMStringW S = DoIdentifiers(GetWordAddress(text.c_str(), 1), window);
S.Replace(L"%", L"%%");
- DoEvent(GC_EVENT_SENDMESSAGE, NULL, NULL, S.c_str(), NULL, NULL, NULL, FALSE, FALSE);
+ Chat_SendUserMessage(m_szModuleName, NULL, S);
return true;
}
@@ -683,7 +676,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
dci->iType = DCC_CHAT;
dci->bSender = true;
- CDccSession* dcc = new CDccSession(this, dci);
+ CDccSession *dcc = new CDccSession(this, dci);
CDccSession* olddcc = FindDCCSession(ccNew);
if (olddcc)
olddcc->Disconnect();
@@ -844,7 +837,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha
if (Message.IsEmpty())
return 0;
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, windowname, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, windowname);
int cp = (wi) ? wi->codepage : getCodepage();
// process the message
@@ -899,7 +892,7 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha
if (hContact) {
if (flag && bDCC) {
- CDccSession* dcc = FindDCCSession(hContact);
+ CDccSession *dcc = FindDCCSession(hContact);
if (dcc) {
FormatMsg(DoThis);
CMStringW mess = GetWordAddress(DoThis.c_str(), 2);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index d734c12ee4..36c9f09f40 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -443,7 +443,7 @@ void __cdecl CIrcProto::ThreadProc(void*)
m_info.Reset();
}
-void CIrcProto::AddDCCSession(MCONTACT, CDccSession* dcc)
+void CIrcProto::AddDCCSession(MCONTACT, CDccSession *dcc)
{
mir_cslock lck(m_dcc);
@@ -454,7 +454,7 @@ void CIrcProto::AddDCCSession(MCONTACT, CDccSession* dcc)
m_dcc_chats.insert(dcc);
}
-void CIrcProto::AddDCCSession(DCCINFO*, CDccSession* dcc)
+void CIrcProto::AddDCCSession(DCCINFO*, CDccSession *dcc)
{
mir_cslock lck(m_dcc);
m_dcc_xfers.insert(dcc);
@@ -471,7 +471,7 @@ void CIrcProto::RemoveDCCSession(MCONTACT hContact)
}
}
-void CIrcProto::RemoveDCCSession(DCCINFO* pdci)
+void CIrcProto::RemoveDCCSession(DCCINFO *pdci)
{
mir_cslock lck(m_dcc);
@@ -494,7 +494,7 @@ CDccSession* CIrcProto::FindDCCSession(MCONTACT hContact)
return 0;
}
-CDccSession* CIrcProto::FindDCCSession(DCCINFO* pdci)
+CDccSession* CIrcProto::FindDCCSession(DCCINFO *pdci)
{
mir_cslock lck(m_dcc);
@@ -718,7 +718,7 @@ unsigned long ConvertIPToInteger(char* IP)
////////////////////////////////////////////////////////////////////
// initialize basic stuff needed for the dcc objects, also start a timer for checking the status of connections (timeouts)
-CDccSession::CDccSession(CIrcProto* _pro, DCCINFO* pdci) :
+CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) :
m_proto(_pro),
NewFileName(0),
dwWhatNeedsDoing(0),
@@ -767,7 +767,7 @@ CDccSession::~CDccSession() // destroy all that needs destroying
}
if (di->iType == DCC_CHAT) {
- CDccSession* dcc = m_proto->FindDCCSession(di->hContact);
+ CDccSession *dcc = m_proto->FindDCCSession(di->hContact);
if (dcc && this == dcc) {
m_proto->RemoveDCCSession(di->hContact); // objects automatically remove themselves from the list of objects
m_proto->setWord(di->hContact, "Status", ID_STATUS_OFFLINE);
@@ -1389,7 +1389,7 @@ VOID CALLBACK DCCTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
// helper function for incoming dcc connections.
void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1)
{
- CDccSession* dcc = (CDccSession*)p1;
+ CDccSession *dcc = (CDccSession*)p1;
dcc->IncomingConnection(hConnection, dwRemoteIP);
}
diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h
index 4e46810551..4c0395e3f6 100644
--- a/protocols/IRCG/src/irclib.h
+++ b/protocols/IRCG/src/irclib.h
@@ -145,7 +145,7 @@ protected:
public:
- CDccSession(CIrcProto*, DCCINFO* pdci); // constructor
+ CDccSession(CIrcProto*, DCCINFO *pdci); // constructor
~CDccSession(); // destructor, ÷òî õàðàêòåðíî
time_t tLastPercentageUpdate; // time of last update of the filetransfer dialog
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index c625469aec..f80950ae5f 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -193,7 +193,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- GCREGISTER gcr = { sizeof(GCREGISTER) };
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_CHANMGR | GC_BOLD | GC_ITALICS | GC_UNDERLINE | GC_COLOR | GC_BKGCOLOR;
gcr.nColors = 16;
gcr.pColors = colors;
@@ -204,19 +204,17 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
- GCSESSION gcw = { sizeof(GCSESSION) };
+ GCSESSION gcw = {};
gcw.iType = GCW_SERVER;
gcw.ptszID = SERVERWINDOW;
gcw.pszModule = m_szModuleName;
gcw.ptszName = NEWWSTR_ALLOCA((wchar_t*)_A2T(m_network));
Chat_NewSession(&gcw);
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
if (m_useServer && !m_hideServerWindow)
- CallChatEvent(WINDOW_VISIBLE, &gce);
+ Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
else
- CallChatEvent(WINDOW_HIDDEN, &gce);
+ Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_HIDDEN);
wchar_t szTemp[MAX_PATH];
mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
@@ -357,7 +355,7 @@ HANDLE __cdecl CIrcProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t* s
di->sPath = szPath;
di->sFileAndPath = di->sPath + di->sFile;
- CDccSession* dcc = new CDccSession(this, di);
+ CDccSession *dcc = new CDccSession(this, di);
AddDCCSession(di, dcc);
dcc->Connect();
return di;
@@ -370,7 +368,7 @@ int __cdecl CIrcProto::FileCancel(MCONTACT, HANDLE hTransfer)
{
DCCINFO* di = (DCCINFO*)hTransfer;
- CDccSession* dcc = FindDCCSession(di);
+ CDccSession *dcc = FindDCCSession(di);
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, (long)FILERESUME_CANCEL);
SetEvent(dcc->hEvent);
@@ -398,7 +396,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const wchar_t**
long i = (long)*action;
- CDccSession* dcc = FindDCCSession(di);
+ CDccSession *dcc = FindDCCSession(di);
if (dcc) {
InterlockedExchange(&dcc->dwWhatNeedsDoing, i);
if (*action == FILERESUME_RENAME) {
@@ -573,7 +571,7 @@ HANDLE __cdecl CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t**
dci->dwSize = size;
// create new dcc object
- CDccSession* dcc = new CDccSession(this, dci);
+ CDccSession *dcc = new CDccSession(this, dci);
// keep track of all objects created
AddDCCSession(dci, dcc);
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 5c208d2ec5..226eeb971e 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -177,7 +177,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam)
CLISTEVENT* pcle = (CLISTEVENT*)lParam;
if (getByte(pcle->hContact, "DCC", 0) != 0) {
- DCCINFO* pdci = (DCCINFO*)pcle->lParam;
+ DCCINFO *pdci = (DCCINFO*)pcle->lParam;
CMessageBoxDlg* dlg = new CMessageBoxDlg(this, pdci);
dlg->Show();
HWND hWnd = dlg->GetHwnd();
@@ -201,21 +201,19 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM)
if (!getWString(hContact, "Nick", &dbv)) {
int type = getByte(hContact, "ChatRoom", 0);
if (type != 0) {
- CMStringW S = L"";
+ CMStringW S;
if (type == GCW_CHATROOM)
S = MakeWndID(dbv.ptszVal);
if (type == GCW_SERVER)
S = SERVERWINDOW;
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- int i = CallChatEvent(SESSION_TERMINATE, &gce);
+ int i = Chat_Terminate(m_szModuleName, S, false);
if (i && type == GCW_CHATROOM)
PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
}
else {
BYTE bDCC = getByte((MCONTACT)wp, "DCC", 0);
if (bDCC) {
- CDccSession* dcc = FindDCCSession((MCONTACT)wp);
+ CDccSession *dcc = FindDCCSession((MCONTACT)wp);
if (dcc)
dcc->Disconnect();
}
@@ -249,11 +247,7 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM)
if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) {
PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
-
- CMStringW S = MakeWndID(dbv.ptszVal);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, MakeWndID(dbv.ptszVal));
}
db_free(&dbv);
}
@@ -290,7 +284,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM)
INT_PTR __cdecl CIrcProto::OnMenuDisconnect(WPARAM wp, LPARAM)
{
- CDccSession* dcc = FindDCCSession((MCONTACT)wp);
+ CDccSession *dcc = FindDCCSession((MCONTACT)wp);
if (dcc)
dcc->Disconnect();
return 0;
@@ -367,9 +361,7 @@ INT_PTR __cdecl CIrcProto::OnShowListMenuCommand(WPARAM, LPARAM)
INT_PTR __cdecl CIrcProto::OnShowServerMenuCommand(WPARAM, LPARAM)
{
- GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(WINDOW_VISIBLE, &gce);
+ Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
return 0;
}
@@ -531,13 +523,9 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
case 3:
PostIrcMessage(L"/PART %s %s", p1, m_userInfo);
- {
- S = MakeWndID(p1);
- GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
- }
+ Chat_Terminate(m_szModuleName, MakeWndID(p1));
break;
+
case 4: // show server window
PostIrcMessageWnd(p1, NULL, L"/SERVERSHOW");
break;
@@ -856,14 +844,14 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
ulAdr = ConvertIPToInteger(m_mySpecifiedHostIP);
else
ulAdr = ConvertIPToInteger(m_IPFromServer ? m_myHost : m_myLocalHost);
- gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; //DCC submenu
+ gcmi->Item[23].bDisabled = ulAdr == 0 ? TRUE : FALSE; // DCC submenu
wchar_t stzChanName[100];
const wchar_t* temp = wcschr(gcmi->pszID, ' ');
size_t len = min(((temp == NULL) ? mir_wstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
mir_wstrncpy(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 *)Chat_GetUserInfo(m_szModuleName, stzChanName);
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;
@@ -1002,7 +990,7 @@ void __cdecl CIrcProto::ConnectServerThread(void*)
if (m_mySpecifiedHost[0])
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(m_mySpecifiedHost, IP_MANUAL));
- DoEvent(GC_EVENT_CHANGESESSIONAME, SERVERWINDOW, NULL, m_info.sNetwork.c_str(), NULL, NULL, NULL, FALSE, TRUE);
+ Chat_ChangeSessionName(m_szModuleName, SERVERWINDOW, m_info.sNetwork);
}
else {
Temp = m_iDesiredStatus;
@@ -1066,9 +1054,7 @@ void CIrcProto::DisconnectFromServer(void)
if (m_perform && IsConnected())
DoPerform("Event: Disconnect");
- GCDEST gcd = { m_szModuleName, 0, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, NULL);
ForkThread(&CIrcProto::DisconnectServerThread, 0);
}
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index e3190007ca..e28616db4e 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -97,23 +97,26 @@ struct CIrcProto;
// special service for tweaking performance, implemented in chat.dll
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
typedef int (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
-typedef struct {
+typedef struct
+{
GETEVENTFUNC pfnAddEvent;
}
- GCPTRS;
+GCPTRS;
#define IP_AUTO 1
#define IP_MANUAL 2
struct IPRESOLVE // Contains info about the channels
{
- IPRESOLVE( const char* _addr, int _type ) :
- sAddr( _addr ),
- iType( _type )
- {}
+ IPRESOLVE(const char* _addr, int _type) :
+ sAddr(_addr),
+ iType(_type)
+ {
+ }
~IPRESOLVE()
- {}
+ {
+ }
CMStringA sAddr;
int iType;
@@ -144,13 +147,15 @@ struct SERVER_INFO // Contains info about different servers
struct PERFORM_INFO // Contains 'm_perform buffer' for different networks
{
- PERFORM_INFO( const char* szSetting, const wchar_t* value ) :
- mSetting( szSetting ),
- mText( value )
- {}
+ PERFORM_INFO(const char* szSetting, const wchar_t* value) :
+ mSetting(szSetting),
+ mText(value)
+ {
+ }
~PERFORM_INFO()
- {}
+ {
+ }
CMStringA mSetting;
CMStringW mText;
@@ -186,14 +191,15 @@ using namespace irc;
/////////////////////////////////////////////////////////////////////////////////////////
-typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage* pmsg);
+typedef bool (CIrcProto::*PfnIrcMessageHandler)(const CIrcMessage *pmsg);
struct CIrcHandler
{
- CIrcHandler( const wchar_t* _name, PfnIrcMessageHandler _handler ) :
- m_name( _name ),
- m_handler( _handler )
- {}
+ CIrcHandler(const wchar_t* _name, PfnIrcMessageHandler _handler) :
+ m_name(_name),
+ m_handler(_handler)
+ {
+ }
const wchar_t* m_name;
PfnIrcMessageHandler m_handler;
@@ -201,22 +207,22 @@ struct CIrcHandler
struct CIrcProto : public PROTO<CIrcProto>
{
- CIrcProto(const char*, const wchar_t*);
- ~CIrcProto();
+ CIrcProto(const char*, const wchar_t*);
+ ~CIrcProto();
- // Protocol interface
+ // Protocol interface
- virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr );
+ virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
virtual int __cdecl Authorize(MEVENT hDbEvent);
virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t* szReason);
virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath);
- virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer );
+ virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szReason);
- virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const wchar_t **szFilename);
+ virtual int __cdecl FileResume(HANDLE hTransfer, int *action, const wchar_t **szFilename);
- virtual DWORD_PTR __cdecl GetCaps( int type, MCONTACT hContact = NULL);
+ virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
virtual HANDLE __cdecl SearchBasic(const wchar_t* id);
@@ -240,10 +246,10 @@ struct CIrcProto : public PROTO<CIrcProto>
INT_PTR __cdecl OnJoinMenuCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM);
INT_PTR __cdecl OnMenuChanSettings(WPARAM, LPARAM);
- INT_PTR __cdecl OnMenuDisconnect( WPARAM , LPARAM );
+ INT_PTR __cdecl OnMenuDisconnect(WPARAM, LPARAM);
INT_PTR __cdecl OnMenuIgnore(WPARAM, LPARAM);
INT_PTR __cdecl OnMenuWhois(WPARAM, LPARAM);
- INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM );
+ INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnShowListMenuCommand(WPARAM, LPARAM);
INT_PTR __cdecl OnShowServerMenuCommand(WPARAM, LPARAM);
@@ -262,25 +268,25 @@ struct CIrcProto : public PROTO<CIrcProto>
// Data
char m_serverName[100];
- char m_password [500];
- wchar_t m_identSystem[10];
+ char m_password[500];
+ wchar_t m_identSystem[10];
char m_network[30];
char m_portStart[10];
char m_portEnd[10];
int m_iSSL;
- wchar_t m_identPort[10];
- wchar_t m_nick[30], m_pNick[30];
- wchar_t m_alternativeNick[30];
- wchar_t m_name[200];
- wchar_t m_userID[200];
- wchar_t m_quitMessage[400];
- wchar_t m_userInfo[500];
+ wchar_t m_identPort[10];
+ wchar_t m_nick[30], m_pNick[30];
+ wchar_t m_alternativeNick[30];
+ wchar_t m_name[200];
+ wchar_t m_userID[200];
+ wchar_t m_quitMessage[400];
+ wchar_t m_userInfo[500];
char m_myHost[50];
char m_mySpecifiedHost[500];
char m_mySpecifiedHostIP[50];
char m_myLocalHost[50];
WORD m_myLocalPort;
- wchar_t* m_alias;
+ wchar_t *m_alias;
int m_serverComboSelection;
int m_quickComboSelection;
int m_onlineNotificationTime;
@@ -345,28 +351,26 @@ struct CIrcProto : public PROTO<CIrcProto>
bool bPerformDone;
- CJoinDlg* m_joinDlg;
- CListDlg* m_listDlg;
- CManagerDlg* m_managerDlg;
- CNickDlg* m_nickDlg;
- CWhoisDlg* m_whoisDlg;
- CQuickDlg* m_quickDlg;
- CIgnorePrefsDlg* m_ignoreDlg;
+ CJoinDlg *m_joinDlg;
+ CListDlg *m_listDlg;
+ CNickDlg *m_nickDlg;
+ CWhoisDlg *m_whoisDlg;
+ CQuickDlg *m_quickDlg;
+ CManagerDlg *m_managerDlg;
+ CIgnorePrefsDlg *m_ignoreDlg;
int m_noOfChannels, m_manualWhoisCount;
CMStringA sChannelModes, sUserModes;
CMStringW sChannelPrefixes, sUserModePrefixes, WhoisAwayReply;
- //clist.cpp
+ // clist.cpp
MCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline);
bool CList_SetAllOffline(BYTE ChatsToo);
MCONTACT CList_SetOffline(CONTACT *user);
-
- bool CList_AddEvent(CONTACT *user, HICON Icon, HANDLE event, const char *tooltip, int type );
MCONTACT CList_FindContact(CONTACT *user);
BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port);
- //commandmonitor.cpp
+ // commandmonitor.cpp
UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
int AddOutgoingMessageToDB(MCONTACT hContact, wchar_t *msg);
@@ -374,18 +378,18 @@ struct CIrcProto : public PROTO<CIrcProto>
int DoPerform(const char *event);
void __cdecl ResolveIPThread(void *di);
- bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network) ;
+ bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network);
int IsIgnored(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type);
int IsIgnored(CMStringW user, char type);
- bool RemoveIgnore(const wchar_t *mask) ;
+ bool RemoveIgnore(const wchar_t *mask);
- //input.cpp
- CMStringW DoAlias( const wchar_t *text, wchar_t *window);
- BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact);
+ // input.cpp
+ CMStringW DoAlias(const wchar_t *text, wchar_t *window);
+ BOOL DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hContact);
CMStringW DoIdentifiers(CMStringW text, const wchar_t *window);
- void FormatMsg(CMStringW &text);
- bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
- bool PostIrcMessage(const wchar_t *fmt, ...);
+ void FormatMsg(CMStringW &text);
+ bool PostIrcMessageWnd(wchar_t *pszWindow, MCONTACT hContact, const wchar_t *szBuf);
+ bool PostIrcMessage(const wchar_t *fmt, ...);
// irclib.cpp
UINT_PTR DCCTimer;
@@ -404,12 +408,12 @@ struct CIrcProto : public PROTO<CIrcProto>
OBJLIST<CIrcIgnoreItem> m_ignoreItems;
- int m_channelNumber;
+ int m_channelNumber;
CMStringW m_whoReply;
CMStringW sNamesList;
CMStringW sTopic;
CMStringW sTopicName;
- CMStringW sTopicTime;
+ CMStringW sTopicTime;
CMStringW m_namesToWho;
CMStringW m_channelsToWho;
CMStringW m_namesToUserhost;
@@ -417,18 +421,18 @@ struct CIrcProto : public PROTO<CIrcProto>
void InitPrefs(void);
void InitIgnore(void);
- void ReadSettings( TDbSetting* sets, int count );
- void RewriteIgnoreSettings( void );
- void WriteSettings( TDbSetting* sets, int count );
+ void ReadSettings(TDbSetting* sets, int count);
+ void RewriteIgnoreSettings(void);
+ void WriteSettings(TDbSetting* sets, int count);
- //output
- BOOL ShowMessage (const CIrcMessage* pmsg);
+ // output
+ BOOL ShowMessage(const CIrcMessage *pmsg);
- //scripting.cpp
- INT_PTR __cdecl Scripting_InsertRawIn(WPARAM wParam,LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertRawOut(WPARAM wParam,LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertGuiIn(WPARAM wParam,LPARAM lParam);
- INT_PTR __cdecl Scripting_InsertGuiOut(WPARAM wParam,LPARAM lParam);
+ // scripting.cpp
+ INT_PTR __cdecl Scripting_InsertRawIn(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl Scripting_InsertRawOut(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl Scripting_InsertGuiIn(WPARAM wParam, LPARAM lParam);
+ INT_PTR __cdecl Scripting_InsertGuiOut(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl Scripting_GetIrcData(WPARAM wparam, LPARAM lparam);
// services.cpp
@@ -436,59 +440,55 @@ struct CIrcProto : public PROTO<CIrcProto>
void DisconnectFromServer(void);
void InitMainMenus(void);
- void __cdecl ConnectServerThread( void* );
- void __cdecl DisconnectServerThread( void* );
-
- //tools.cpp
- void AddToJTemp(wchar_t op, CMStringW& sCommand);
- bool AddWindowItemData(CMStringW window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic);
- INT_PTR CallChatEvent(WPARAM wParam, GCEVENT *);
- INT_PTR DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick, const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
- void FindLocalIP(HANDLE con);
- bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
- bool IsChannel(const char* sName);
- bool IsChannel(const wchar_t* sName);
- void KillChatTimer(UINT_PTR &nIDEvent);
+ void __cdecl ConnectServerThread(void*);
+ void __cdecl DisconnectServerThread(void*);
+
+ // tools.cpp
+ void AddToJTemp(wchar_t op, CMStringW& sCommand);
+ bool AddWindowItemData(CMStringW window, const wchar_t *pszLimit, const wchar_t *pszMode, const wchar_t *pszPassword, const wchar_t *pszTopic);
+ INT_PTR DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick, const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp = 1);
+ void FindLocalIP(HANDLE con);
+ bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
+ bool IsChannel(const char* sName);
+ bool IsChannel(const wchar_t* sName);
+ void KillChatTimer(UINT_PTR &nIDEvent);
CMStringW MakeWndID(const wchar_t* sWindow);
CMStringW ModeToStatus(int sMode);
CMStringW PrefixToStatus(int cPrefix);
- int SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi);
- void SetChatTimer(UINT_PTR &nIDEvent,UINT uElapse, TIMERPROC lpTimerFunc);
+ int SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi);
+ void SetChatTimer(UINT_PTR &nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
- void ClearUserhostReasons(int type);
- void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...);
+ void ClearUserhostReasons(int type);
+ void DoUserhostWithReason(int type, CMStringW reason, bool bSendCommand, CMStringW userhostparams, ...);
CMStringW GetNextUserhostReason(int type);
CMStringW PeekAtReasons(int type);
- // userinfo.cpp
- void __cdecl AckUserInfoSearch( void* hContact );
-
////////////////////////////////////////////////////////////////////////////////////////
// former CIrcSession class
- void AddDCCSession(MCONTACT hContact, CDccSession* dcc);
- void AddDCCSession(DCCINFO* pdci, CDccSession* dcc);
+ void AddDCCSession(MCONTACT hContact, CDccSession *dcc);
+ void AddDCCSession(DCCINFO *pdci, CDccSession *dcc);
void RemoveDCCSession(MCONTACT hContact);
- void RemoveDCCSession(DCCINFO* pdci);
+ void RemoveDCCSession(DCCINFO *pdci);
CDccSession* FindDCCSession(MCONTACT hContact);
- CDccSession* FindDCCSession(DCCINFO* pdci);
+ CDccSession* FindDCCSession(DCCINFO *pdci);
CDccSession* FindDCCSendByPort(int iPort);
- CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t* szName);
+ CDccSession* FindDCCRecvByPortAndName(int iPort, const wchar_t *szName);
CDccSession* FindPassiveDCCSend(int iToken);
CDccSession* FindPassiveDCCRecv(CMStringW sName, CMStringW sToken);
void DisconnectAllDCCSessions(bool Shutdown);
void CheckDCCTimeout(void);
- bool Connect(const CIrcSessionInfo& info);
+ bool Connect(const CIrcSessionInfo &info);
void Disconnect(void);
void KillIdent(void);
int NLSend(const wchar_t* fmt, ...);
int NLSend(const char* fmt, ...);
int NLSend(const unsigned char* buf, int cbBuf);
- int NLSendNoScript( const unsigned char* buf, int cbBuf);
+ int NLSendNoScript(const unsigned char* buf, int cbBuf);
int NLReceive(unsigned char* buf, int cbBuf);
void InsertIncomingEvent(wchar_t* pszRaw);
@@ -496,11 +496,11 @@ struct CIrcProto : public PROTO<CIrcProto>
// send-to-stream operators
int getCodepage() const;
- __inline void setCodepage( int aPage ) { codepage = aPage; }
+ __inline void setCodepage(int aPage) { codepage = aPage; }
CIrcSessionInfo m_info;
-protected :
+protected:
int codepage;
HANDLE con;
HANDLE hBindPort;
@@ -508,74 +508,74 @@ protected :
LIST<CDccSession> m_dcc_chats;
LIST<CDccSession> m_dcc_xfers;
-private :
+private:
mir_cs m_dcc; // protect the dcc objects
- void createMessageFromPchar( const char* p );
- void Notify(const CIrcMessage* pmsg);
- void __cdecl ThreadProc( void *pparam );
+ void createMessageFromPchar(const char* p);
+ void Notify(const CIrcMessage *pmsg);
+ void __cdecl ThreadProc(void *pparam);
////////////////////////////////////////////////////////////////////////////////////////
// former CIrcMonitor class
- bool OnIrc_PING(const CIrcMessage* pmsg);
- bool OnIrc_WELCOME(const CIrcMessage* pmsg);
- bool OnIrc_YOURHOST(const CIrcMessage* pmsg);
- bool OnIrc_NICK(const CIrcMessage* pmsg);
- bool OnIrc_PRIVMSG(const CIrcMessage* pmsg);
- bool OnIrc_JOIN(const CIrcMessage* pmsg);
- bool OnIrc_QUIT(const CIrcMessage* pmsg);
- bool OnIrc_PART(const CIrcMessage* pmsg);
- bool OnIrc_KICK(const CIrcMessage* pmsg);
- bool OnIrc_MODE(const CIrcMessage* pmsg);
- bool OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg);
- bool OnIrc_MODEQUERY(const CIrcMessage* pmsg);
- bool OnIrc_NAMES(const CIrcMessage* pmsg);
- bool OnIrc_ENDNAMES(const CIrcMessage* pmsg);
- bool OnIrc_INITIALTOPIC(const CIrcMessage* pmsg);
- bool OnIrc_INITIALTOPICNAME(const CIrcMessage* pmsg);
- bool OnIrc_TOPIC(const CIrcMessage* pmsg);
- bool OnIrc_TRYAGAIN(const CIrcMessage* pmsg);
- bool OnIrc_NOTICE(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_NAME(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_CHANNELS(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_SERVER(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_AWAY(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_END(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_AUTH(const CIrcMessage* pmsg);
- bool OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg);
- bool OnIrc_NICK_ERR(const CIrcMessage* pmsg);
- bool OnIrc_ENDMOTD(const CIrcMessage* pmsg);
- bool OnIrc_LISTSTART(const CIrcMessage* pmsg);
- bool OnIrc_LIST(const CIrcMessage* pmsg);
- bool OnIrc_LISTEND(const CIrcMessage* pmsg);
- bool OnIrc_BANLIST(const CIrcMessage* pmsg);
- bool OnIrc_BANLISTEND(const CIrcMessage* pmsg);
- bool OnIrc_SUPPORT(const CIrcMessage* pmsg);
- bool OnIrc_BACKFROMAWAY(const CIrcMessage* pmsg);
- bool OnIrc_SETAWAY(const CIrcMessage* pmsg);
- bool OnIrc_JOINERROR(const CIrcMessage* pmsg);
- bool OnIrc_UNKNOWN(const CIrcMessage* pmsg);
- bool OnIrc_ERROR(const CIrcMessage* pmsg);
- bool OnIrc_NOOFCHANNELS(const CIrcMessage* pmsg);
- bool OnIrc_PINGPONG(const CIrcMessage* pmsg);
- bool OnIrc_INVITE(const CIrcMessage* pmsg);
- bool OnIrc_WHO_END(const CIrcMessage* pmsg);
- bool OnIrc_WHO_REPLY(const CIrcMessage* pmsg);
- bool OnIrc_WHOTOOLONG(const CIrcMessage* pmsg);
-
- bool IsCTCP(const CIrcMessage* pmsg);
-
- void OnIrcDefault(const CIrcMessage* pmsg);
+ bool OnIrc_PING(const CIrcMessage *pmsg);
+ bool OnIrc_WELCOME(const CIrcMessage *pmsg);
+ bool OnIrc_YOURHOST(const CIrcMessage *pmsg);
+ bool OnIrc_NICK(const CIrcMessage *pmsg);
+ bool OnIrc_PRIVMSG(const CIrcMessage *pmsg);
+ bool OnIrc_JOIN(const CIrcMessage *pmsg);
+ bool OnIrc_QUIT(const CIrcMessage *pmsg);
+ bool OnIrc_PART(const CIrcMessage *pmsg);
+ bool OnIrc_KICK(const CIrcMessage *pmsg);
+ bool OnIrc_MODE(const CIrcMessage *pmsg);
+ bool OnIrc_USERHOST_REPLY(const CIrcMessage *pmsg);
+ bool OnIrc_MODEQUERY(const CIrcMessage *pmsg);
+ bool OnIrc_NAMES(const CIrcMessage *pmsg);
+ bool OnIrc_ENDNAMES(const CIrcMessage *pmsg);
+ bool OnIrc_INITIALTOPIC(const CIrcMessage *pmsg);
+ bool OnIrc_INITIALTOPICNAME(const CIrcMessage *pmsg);
+ bool OnIrc_TOPIC(const CIrcMessage *pmsg);
+ bool OnIrc_TRYAGAIN(const CIrcMessage *pmsg);
+ bool OnIrc_NOTICE(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_NAME(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_CHANNELS(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_SERVER(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_AWAY(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_IDLE(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_END(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_OTHER(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_AUTH(const CIrcMessage *pmsg);
+ bool OnIrc_WHOIS_NO_USER(const CIrcMessage *pmsg);
+ bool OnIrc_NICK_ERR(const CIrcMessage *pmsg);
+ bool OnIrc_ENDMOTD(const CIrcMessage *pmsg);
+ bool OnIrc_LISTSTART(const CIrcMessage *pmsg);
+ bool OnIrc_LIST(const CIrcMessage *pmsg);
+ bool OnIrc_LISTEND(const CIrcMessage *pmsg);
+ bool OnIrc_BANLIST(const CIrcMessage *pmsg);
+ bool OnIrc_BANLISTEND(const CIrcMessage *pmsg);
+ bool OnIrc_SUPPORT(const CIrcMessage *pmsg);
+ bool OnIrc_BACKFROMAWAY(const CIrcMessage *pmsg);
+ bool OnIrc_SETAWAY(const CIrcMessage *pmsg);
+ bool OnIrc_JOINERROR(const CIrcMessage *pmsg);
+ bool OnIrc_UNKNOWN(const CIrcMessage *pmsg);
+ bool OnIrc_ERROR(const CIrcMessage *pmsg);
+ bool OnIrc_NOOFCHANNELS(const CIrcMessage *pmsg);
+ bool OnIrc_PINGPONG(const CIrcMessage *pmsg);
+ bool OnIrc_INVITE(const CIrcMessage *pmsg);
+ bool OnIrc_WHO_END(const CIrcMessage *pmsg);
+ bool OnIrc_WHO_REPLY(const CIrcMessage *pmsg);
+ bool OnIrc_WHOTOOLONG(const CIrcMessage *pmsg);
+
+ bool IsCTCP(const CIrcMessage *pmsg);
+
+ void OnIrcDefault(const CIrcMessage *pmsg);
void OnIrcDisconnected();
static OBJLIST<CIrcHandler> m_handlers;
PfnIrcMessageHandler FindMethod(const wchar_t* lpszName);
- void OnIrcMessage(const CIrcMessage* pmsg);
+ void OnIrcMessage(const CIrcMessage *pmsg);
CMStringW sNick4Perform;
};
@@ -594,16 +594,14 @@ extern LIST<CIrcProto> g_Instances;
extern OBJLIST<SERVER_INFO> g_servers;
-void UpgradeCheck(void);
-
-CIrcProto* GetTimerOwner( UINT_PTR eventId );
+CIrcProto* GetTimerOwner(UINT_PTR eventId);
-VOID CALLBACK IdentTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK TimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK KeepAliveTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK OnlineNotifTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK OnlineNotifTimerProc3( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
-VOID CALLBACK DCCTimerProc( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime );
+VOID CALLBACK IdentTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK KeepAliveTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK OnlineNotifTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK OnlineNotifTimerProc3(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+VOID CALLBACK DCCTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
// options.cpp
@@ -622,9 +620,9 @@ int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
char* __stdcall IrcLoadFile(wchar_t * szPath);
CMStringW __stdcall GetWord(const wchar_t* text, int index);
const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
-void __stdcall RemoveLinebreaks( CMStringW& Message );
-wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2) ;
-wchar_t* __stdcall DoColorCodes (const wchar_t* text, bool bStrip, bool bReplacePercent);
+void __stdcall RemoveLinebreaks(CMStringW& Message);
+wchar_t* __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2);
+wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent);
CMStringA __stdcall GetWord(const char* text, int index);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index c3a1c1e1a1..4b5159450f 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -376,28 +376,19 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP
return szTemp;
}
-INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, GCEVENT *lParam)
-{
- return Chat_Event(wParam, lParam);
-}
-
INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick,
const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo,
DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
GCDEST gcd = { m_szModuleName, NULL, iEvent };
CMStringW sID;
- CMStringW sText = L"";
+ CMStringW sText;
if (iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho)
return false;
- if (pszText) {
- if (iEvent != GC_EVENT_SENDMESSAGE)
- sText = DoColorCodes(pszText, FALSE, TRUE);
- else
- sText = pszText;
- }
+ if (pszText)
+ sText = DoColorCodes(pszText, FALSE, TRUE);
if (pszWindow) {
if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
@@ -408,7 +399,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
}
else gcd.ptszID = NULL;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = pszStatus;
gce.dwFlags = (bAddToLog) ? GCEF_ADDTOLOG : 0;
gce.ptszNick = pszNick;
@@ -427,7 +418,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
else
gce.time = timestamp;
gce.bIsMe = bIsMe;
- return CallChatEvent(0, &gce);
+ return Chat_Event(&gce);
}
CMStringW CIrcProto::ModeToStatus(int sMode)
@@ -542,7 +533,8 @@ int CIrcProto::SetChannelSBText(CMStringW sWindow, CHANNELINFO * wi)
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);
+ Chat_SetStatusbarText(m_szModuleName, sWindow, sTemp);
+ return 0;
}
CMStringW CIrcProto::MakeWndID(const wchar_t* sWindow)
@@ -552,11 +544,11 @@ CMStringW CIrcProto::MakeWndID(const wchar_t* sWindow)
return CMStringW(buf);
}
-bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO* wis)
+bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO *wis)
{
CHANNELINFO *wi;
if (!wis)
- wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ wi = (CHANNELINFO*)Chat_GetUserInfo(m_szModuleName, window);
else
wi = wis;
if (wi) {
@@ -572,7 +564,7 @@ bool CIrcProto::FreeWindowItemData(CMStringW window, CHANNELINFO* wis)
bool CIrcProto::AddWindowItemData(CMStringW window, const wchar_t* pszLimit, const wchar_t* pszMode, const wchar_t* pszPassword, const wchar_t* pszTopic)
{
- CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, window.c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO *)Chat_GetUserInfo(m_szModuleName, window);
if (wi) {
if (pszLimit) {
wi->pszLimit = (wchar_t*)realloc(wi->pszLimit, sizeof(wchar_t)*(mir_wstrlen(pszLimit) + 1));
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 40c30af560..8c19b06bd8 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -1079,7 +1079,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
{
wchar_t window[256];
GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
- CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
+ CHANNELINFO *wi = (CHANNELINFO*)Chat_GetUserInfo(m_proto->m_szModuleName, window);
if (wi) {
wchar_t toadd[10]; *toadd = '\0';
wchar_t toremove[10]; *toremove = '\0';
@@ -1274,7 +1274,7 @@ void CManagerDlg::InitManager(int mode, const wchar_t* window)
{
SetDlgItemText(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 *)Chat_GetUserInfo(m_proto->m_szModuleName, window);
if (wi) {
if (m_proto->IsConnected()) {
wchar_t temp[1000];
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 32e353d586..61dff34c3d 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -128,7 +128,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
ptrW szNick(JabberNickFromJID(item->jid));
- GCSESSION gcw = { sizeof(GCSESSION) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = szNick;
@@ -168,15 +168,14 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
item->bChatActive = true;
GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateW(sttStatuses[i]);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event((item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, item->jid, (item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE);
+ Chat_Control(m_szModuleName, item->jid, SESSION_ONLINE);
return 0;
}
@@ -243,13 +242,13 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
buf.Replace(L"%", L"%%");
GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszNick = user->m_tszResourceName;
gce.ptszUID = user->m_tszResourceName;
gce.ptszText = buf;
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(0);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
}
@@ -270,7 +269,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
myNick = JabberNickFromJID(m_szJabberJID);
GCDEST gcd = { m_szModuleName, item->jid };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszNick = nick;
gce.ptszUID = resource;
if (jid != NULL)
@@ -308,21 +307,19 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
}
}
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
if (statusToSet != 0) {
- gce.ptszText = nick;
+ int flags = GC_SSE_ONLYLISTED;
if (statusToSet == ID_STATUS_AWAY || statusToSet == ID_STATUS_NA || statusToSet == ID_STATUS_DND)
- gce.dwItemData = 3;
- else
- gce.dwItemData = 1;
- gcd.iType = GC_EVENT_SETSTATUSEX;
- Chat_Event(0, &gce);
+ flags += GC_SSE_ONLINE;
+ Chat_SetStatusEx(m_szModuleName, item->jid, flags, nick);
+ gce.ptszText = nick;
gce.ptszUID = resource;
gce.dwItemData = statusToSet;
gcd.iType = GC_EVENT_SETCONTACTSTATUS;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
}
@@ -342,11 +339,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason)
GcLogUpdateMemberStatus(item, myNick, myNick, NULL, GC_EVENT_KICK, reason);
}
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszUID = item->jid;
- gce.ptszText = XmlGetText(reason);
- Chat_Event((code == 200) ? SESSION_TERMINATE : SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, item->jid, (code == 200) ? SESSION_TERMINATE : SESSION_OFFLINE);
db_unset(item->hContact, "CList", "Hidden");
item->bChatActive = false;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 6e6306ab66..a690f4f8ff 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -795,20 +795,17 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *
setWString(hContact, "MyNick", newNick);
}
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_CHUID };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszNick = oldNick;
- gce.ptszText = newNick;
+ Chat_ChangeUserId(m_szModuleName, item->jid, oldNick, newNick);
+
+ GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_NICK };
+ GCEVENT gce = { &gcd };
if (jid != NULL)
gce.ptszUserInfo = jid;
gce.time = time(0);
- Chat_Event(0, &gce);
-
- gcd.iType = GC_EVENT_NICK;
gce.ptszNick = oldNick;
gce.ptszUID = newNick;
gce.ptszText = newNick;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void CJabberProto::GroupchatProcessPresence(HXML node)
@@ -1110,7 +1107,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
tszText.Replace(L"%", L"%%");
tszText += imgLink;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = resource;
gce.ptszNick = nick;
gce.time = msgTime;
@@ -1123,15 +1120,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
if (m_options.GcLogChatHistory && isHistory)
gce.dwFlags |= GCEF_NOTNOTIFY;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
item->bChatActive = 2;
- if (gcd.iType == GC_EVENT_TOPIC) {
- gce.dwFlags &= ~GCEF_ADDTOLOG;
- gcd.iType = GC_EVENT_SETSBTEXT;
- Chat_Event(0, &gce);
- }
+ if (gcd.iType == GC_EVENT_TOPIC)
+ Chat_SetStatusbarText(m_szModuleName, item->jid, tszText);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 597c513f64..bbf2407010 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -440,7 +440,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
else db_unset(hContact, "CList", "MyHandle");
if (isChatRoom(hContact)) {
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszID = jid;
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index b97423b7dc..bd9ad50656 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -217,7 +217,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
InitInfoFrame();
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.nColors = 16;
gcr.pColors = &crCols[0];
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index 7deb944d20..e09a76c374 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -13,7 +13,7 @@ void CMraProto::MraChatDllError()
bool CMraProto::MraChatRegister()
{
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.iMaxText = MRA_MAXLENOFMESSAGE;
gcr.nColors = 0;
gcr.ptszDispName = m_tszUserName;
@@ -31,24 +31,23 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact)
CMStringW wszEMail;
mraGetStringW(hContact, "e-mail", wszEMail);
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = pcli->pfnGetContactDisplayName(hContact, 0);
gcw.ptszID = wszEMail;
gcw.ptszStatusbarText = L"status bar";
- gcw.dwItemData = (DWORD)hContact;
+ gcw.pItemData = (void*)hContact;
if (!Chat_NewSession(&gcw)) {
GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
for (int i = 0; i < _countof(lpwszStatuses); i++) {
gce.ptszStatus = TranslateW(lpwszStatuses[i]);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, wszEMail, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, wszEMail, SESSION_ONLINE);
DWORD opcode = MULTICHAT_GET_MEMBERS;
CMStringA szEmail;
@@ -65,15 +64,11 @@ void CMraProto::MraChatSessionDestroy(MCONTACT hContact)
if (!bChatExists || hContact == NULL)
return;
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
-
CMStringW wszEMail;
mraGetStringW(hContact, "e-mail", wszEMail);
- gcd.ptszID = (LPWSTR)wszEMail.c_str();
- Chat_Event(SESSION_TERMINATE, &gce);
- Chat_Event(WINDOW_CLEARLOG, &gce);
+ Chat_Terminate(m_szModuleName, wszEMail);
+ Chat_Control(m_szModuleName, wszEMail, WINDOW_CLEARLOG);
}
INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, int iType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime)
@@ -89,7 +84,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession,
gcd.ptszID = (LPWSTR)wszID.c_str();
}
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = dwFlags;
gce.ptszUID = wszUID;
gce.ptszStatus = lpwszStatus;
@@ -116,7 +111,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession,
gce.ptszNick = wszUID;
}
- return Chat_Event(0, &gce);
+ return Chat_Event(&gce);
}
INT_PTR CMraProto::MraChatSessionInvite(MCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime)
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index f7e8a33f39..34c002235d 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -526,7 +526,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe
if (IsEMailChatAgent(szEmail)) {
CMStringW wszEMail = szEmail;
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = wszEMail;
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 386ea11a5f..86a0967aaf 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -58,7 +58,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
else mir_snwprintf(szName, L"%s %s%d",
m_tszUserName, TranslateT("Chat #"), m_chatID);
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = szName;
@@ -66,16 +66,15 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
for (int j = 0; j < _countof(m_ptszRoles); j++) {
gce.ptszStatus = m_ptszRoles[j];
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
- Chat_Event(WINDOW_VISIBLE, &gce);
+ Chat_Control(m_szModuleName, info->mChatID, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, info->mChatID, SESSION_ONLINE);
+ Chat_Control(m_szModuleName, info->mChatID, WINDOW_VISIBLE);
mir_free((wchar_t*)gce.ptszUID);
return 0;
@@ -99,11 +98,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli)
MSN_ChatInit(info, pszID, ezxml_txt(ezxml_get(xmli, "properties", 0, "topic", -1)));
MSN_StartStopTyping(info, false);
}
- else {
- GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(SESSION_ONLINE, &gce);
- }
+ else Chat_Control(m_szModuleName, info->mChatID, SESSION_ONLINE);
const char *pszCreator = ezxml_txt(ezxml_get(xmli, "properties", 0, "creator", -1));
@@ -145,11 +140,8 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli)
void CMsnProto::MSN_KillChatSession(const wchar_t* id)
{
- GCDEST gcd = { m_szModuleName, id, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_REMOVECONTACT;
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, id, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, id, true);
}
void CMsnProto::MSN_Kickuser(GCHOOK *gch)
@@ -183,21 +175,21 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
if (!mir_strcmp(xmli->name, "topicupdate")) {
ezxml_t initiator = ezxml_child(xmli, "initiator");
GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_TOPIC};
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
gce.ptszUID = initiator ? mir_a2u(initiator->txt) : NULL;
MCONTACT hContInitiator = MSN_HContactFromEmail(initiator ? initiator->txt : NULL);
gce.ptszNick = GetContactNameT(hContInitiator);
gce.ptszText = mir_a2u(ezxml_txt(ezxml_child(xmli, "value")));
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free((wchar_t*)gce.ptszUID);
mir_free((wchar_t*)gce.ptszText);
}
else if (ezxml_t target = ezxml_child(xmli, "target")) {
MCONTACT hContInitiator = NULL;
GCDEST gcd = { m_szModuleName, mChatID, 0};
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
if (!mir_strcmp(xmli->name, "deletemember")) {
@@ -247,12 +239,10 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
gce.ptszUID = mir_a2u(pszTarget);
MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget);
gce.ptszNick = GetContactNameT(hContTarget);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free((wchar_t*)gce.ptszUID);
if ((gcd.iType == GC_EVENT_PART || gcd.iType == GC_EVENT_KICK) && gce.bIsMe) {
- GCDEST gcd2 = { m_szModuleName, mChatID, GC_EVENT_CONTROL };
- GCEVENT gce2 = { sizeof(gce2), &gcd2 };
- Chat_Event(SESSION_OFFLINE, &gce2);
+ Chat_Control(m_szModuleName, mChatID, SESSION_OFFLINE);
break;
}
target = ezxml_next(target);
@@ -285,7 +275,7 @@ void CMsnProto::MSN_GCRefreshThreadsInfo(void)
void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody)
{
GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = mir_a2u(email);
gce.ptszNick = GetContactNameT(hContact);
@@ -296,7 +286,7 @@ void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *emai
gce.ptszText = EscapeChatTags(p);
mir_free(p);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free((void*)gce.ptszUID);
mir_free((void*)gce.ptszText);
}
@@ -509,14 +499,14 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
int bError = getWString("Nick", &dbv);
GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? L"" : dbv.ptszVal;
gce.ptszUID = mir_a2u(MyOptions.szEmail);
gce.time = time(NULL);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free((void*)gce.ptszUID);
if (!bError)
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 3c29b41bd6..4ddfca2196 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -1882,13 +1882,13 @@ LBL_InvalidCommand:
// modified for chat
{
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_QUIT };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
gce.ptszUID = mir_a2u(data.userEmail);
gce.time = time(NULL);
gce.bIsMe = FALSE;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free((void*)gce.ptszUID);
}
@@ -1902,14 +1902,14 @@ LBL_InvalidCommand:
if (info->mChatID[0] && personleft == 1) {
if (!mir_strcmp(data.isIdle, "1")) {
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_INFORMATION };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.bIsMe = FALSE;
gce.time = time(NULL);
gce.ptszText = TranslateT("This conversation has been inactive, participants will be removed.");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
gce.ptszText = TranslateT("To resume the conversation, please quit this session and start a new chat session.");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
else {
if (!g_bTerminated && MessageBox(NULL,
@@ -2138,14 +2138,14 @@ LBL_InvalidCommand:
if (chatCreated) {
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = GetContactNameT(hContact);
gce.ptszUID = mir_a2u(data.userEmail);
gce.ptszStatus = TranslateT("Others");
gce.time = time(NULL);
gce.bIsMe = FALSE;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free((void*)gce.ptszUID);
}
else MSN_ChatStart(info);
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index ad4ac92d1a..e610b9c87a 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -396,13 +396,9 @@ void CMsnProto::MSN_GoOffline(void)
hContact = db_find_next(hContact, m_szModuleName))
{
if (isChatRoom(hContact) != 0) {
- DBVARIANT dbv;
- if (getWString(hContact, "ChatRoomID", &dbv) == 0) {
- GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(SESSION_OFFLINE, &gce);
- db_free(&dbv);
- }
+ ptrW wszRoom(getWStringA(hContact, "ChatRoomID"));
+ if (wszRoom != NULL)
+ Chat_Control(m_szModuleName, wszRoom, SESSION_OFFLINE);
}
else {
if (ID_STATUS_OFFLINE != getWord(hContact, "Status", ID_STATUS_OFFLINE)) {
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index 86b68155bc..c9e104c7c7 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -201,8 +201,7 @@ CMsnProto::~CMsnProto()
int CMsnProto::OnModulesLoaded(WPARAM, LPARAM)
{
- GCREGISTER gcr = { 0 };
- gcr.cbSize = sizeof(GCREGISTER);
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.iMaxText = 0;
gcr.nColors = 16;
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index c4e4fd0b87..a2aa6f0e6b 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -31,7 +31,7 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con
ptrW tname(mir_a2u_cp(name, CP_UTF8));
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = timestamp;
gce.ptszText = tmessage;
@@ -47,7 +47,7 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam)
@@ -91,7 +91,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name)
ptrW tname(mir_a2u_cp(name, CP_UTF8));
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
@@ -103,7 +103,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name)
else
gce.ptszStatus = L"Normal";
- Chat_Event(0,&gce);
+ Chat_Event(&gce);
}
void MinecraftDynmapProto::DeleteChatContact(const char *name)
@@ -111,14 +111,14 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name)
ptrW tname(mir_a2u_cp(name, CP_UTF8));
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
gce.time = DWORD(time(0));
gce.bIsMe = (m_nick == name);
- Chat_Event(0,&gce);
+ Chat_Event(&gce);
}
INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress)
@@ -126,7 +126,7 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress)
ptrW tszTitle(mir_a2u_cp(m_title.c_str(), CP_UTF8));
// Create the group chat session
- GCSESSION gcw = {sizeof(gcw)};
+ GCSESSION gcw = {};
gcw.iType = GCW_PRIVMESS;
gcw.ptszID = m_tszUserName;
gcw.ptszName = tszTitle;
@@ -138,13 +138,13 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress)
// Create a group
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = L"Admin";
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Normal";
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
// Note: Initialization will finish up in SetChatStatus, called separately
if (!suppress)
@@ -158,31 +158,22 @@ void MinecraftDynmapProto::SetTopic(const char *topic)
ptrW ttopic(mir_a2u_cp(topic, CP_UTF8));
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = ::time(NULL);
gce.ptszText = ttopic;
- Chat_Event(0, &gce);
+ Chat_Event( &gce);
}
INT_PTR MinecraftDynmapProto::OnLeaveChat(WPARAM,LPARAM)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE,&gce);
-
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, m_tszUserName);
return 0;
}
void MinecraftDynmapProto::SetChatStatus(int status)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
if (status == ID_STATUS_ONLINE)
{
// Load actual name from database
@@ -196,20 +187,15 @@ void MinecraftDynmapProto::SetChatStatus(int status)
// Add self contact
AddChatContact(m_nick.c_str());
- Chat_Event(SESSION_INITDONE,&gce);
- Chat_Event(SESSION_ONLINE, &gce);
- }
- else
- {
- Chat_Event(SESSION_OFFLINE,&gce);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_ONLINE);
}
+ else Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
}
void MinecraftDynmapProto::ClearChat()
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(WINDOW_CLEARLOG, &gce);
+ Chat_Control(m_szModuleName, m_tszUserName, WINDOW_CLEARLOG);
}
// TODO: Could this be done better?
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp
index 9fb913869b..48c3cdfa80 100644
--- a/protocols/MinecraftDynmap/src/proto.cpp
+++ b/protocols/MinecraftDynmap/src/proto.cpp
@@ -160,15 +160,11 @@ INT_PTR MinecraftDynmapProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM)
{
// Register group chat
- GCREGISTER gcr = {sizeof(gcr)};
- gcr.dwFlags = 0;
+ GCREGISTER gcr = {};
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = MINECRAFTDYNMAP_MESSAGE_LIMIT;
- gcr.nColors = 0;
- gcr.pColors = NULL;
Chat_Register(&gcr);
-
return 0;
}
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index e823ffa676..fb6bed05a2 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -28,7 +28,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a
utils::text::treplace_all(&smessage, L"%", L"%%");
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = ::time(NULL);
gce.ptszText = smessage.c_str();
@@ -44,7 +44,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
@@ -222,14 +222,14 @@ void OmegleProto::SendChatMessage(std::string text)
/*void OmegleProto::SendChatEvent(int type)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
-GCEVENT gce = { sizeof(gce), &gcd };
+GCEVENT gce = { &gcd };
Chat_Event(WINDOW_CLEARLOG,&gce);
}*/
void OmegleProto::AddChatContact(const wchar_t *name)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
@@ -245,13 +245,13 @@ void OmegleProto::AddChatContact(const wchar_t *name)
else
gce.ptszStatus = L"Normal";
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void OmegleProto::DeleteChatContact(const wchar_t *name)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
@@ -261,13 +261,13 @@ void OmegleProto::DeleteChatContact(const wchar_t *name)
else
gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
{
// Create the group chat session
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_PRIVMESS;
gcw.ptszID = m_tszUserName;
gcw.ptszName = m_tszUserName;
@@ -279,13 +279,13 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
// Create a group
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = L"Admin";
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = L"Normal";
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
SetTopic();
@@ -299,7 +299,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
void OmegleProto::SetTopic(const wchar_t *topic)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = ::time(NULL);
if (topic == NULL)
@@ -307,27 +307,18 @@ void OmegleProto::SetTopic(const wchar_t *topic)
else
gce.ptszText = topic;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
INT_PTR OmegleProto::OnLeaveChat(WPARAM, LPARAM)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
-
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, m_tszUserName);
return 0;
}
void OmegleProto::SetChatStatus(int status)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
if (status == ID_STATUS_ONLINE)
{
// Load actual name from database
@@ -340,23 +331,19 @@ void OmegleProto::SetChatStatus(int status)
// Add self contact
AddChatContact(facy.nick_);
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_ONLINE);
}
else
{
- Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
}
}
void OmegleProto::ClearChat()
{
- if (getByte(OMEGLE_KEY_NO_CLEAR, 0))
- return;
-
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(WINDOW_CLEARLOG, &gce);
+ if (!getByte(OMEGLE_KEY_NO_CLEAR, 0))
+ Chat_Control(m_szModuleName, m_tszUserName, WINDOW_CLEARLOG);
}
// TODO: Could this be done better?
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 838e1c559e..7e76eeee51 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -165,7 +165,7 @@ INT_PTR OmegleProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
int OmegleProto::OnModulesLoaded(WPARAM, LPARAM)
{
// Register group chat
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.dwFlags = 0; //GC_TYPNOTIF; //GC_ACKMSG;
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp
index 976408d699..66444363b8 100644
--- a/protocols/Sametime/src/conference.cpp
+++ b/protocols/Sametime/src/conference.cpp
@@ -103,36 +103,35 @@ void CSametimeProto::ClearInviteQueue()
@param conf the conference just joined
@param members mwLoginInfo list of existing conference members
*/
-void mwServiceConf_conf_opened(mwConference* conf, GList* members)
-{
+void mwServiceConf_conf_opened(mwConference* conf, GList* members)
+{
CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLogW(L"mwServiceConf_conf_opened() start");
- wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
- wchar_t* tszConfTitle = mir_utf8decodeW(mwConference_getTitle(conf));
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
// create new chat session
- GCSESSION gcs = { sizeof(gcs) };
- gcs.dwFlags = 0;
- gcs.iType = GCW_CHATROOM;
- gcs.pszModule = proto->m_szModuleName;
- gcs.ptszID = tszConfId;
- gcs.ptszName = tszConfTitle;
- gcs.dwItemData = 0;
-
- Chat_NewSession(&gcs);
- mir_free(tszConfTitle);
+ {
+ ptrW tszConfTitle(mir_utf8decodeW(mwConference_getTitle(conf)));
+
+ GCSESSION gcs = {};
+ gcs.iType = GCW_CHATROOM;
+ gcs.pszModule = proto->m_szModuleName;
+ gcs.ptszID = tszConfId;
+ gcs.ptszName = tszConfTitle;
+ Chat_NewSession(&gcs);
+ }
//add a group
GCDEST gcd = { proto->m_szModuleName, 0 };
gcd.iType = GC_EVENT_ADDGROUP;
gcd.ptszID = tszConfId;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszStatus = TranslateT("Normal");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
// add users
gcd.iType = GC_EVENT_JOIN;
@@ -147,23 +146,18 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members)
gce.ptszUID = tszUserId;
gce.bIsMe = (strcmp(((mwLoginInfo*)user->data)->login_id, proto->my_login_info->login_id) == 0);
- Chat_Event(0, &gce);
+ Chat_Event( &gce);
mir_free(tszUserName);
mir_free(tszUserId);
}
// finalize setup (show window)
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
-
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(proto->m_szModuleName, tszConfId, SESSION_INITDONE);
+ Chat_Control(proto->m_szModuleName, tszConfId, SESSION_ONLINE);
if (conf == proto->my_conference)
proto->ClearInviteQueue();
-
- mir_free(tszConfId);
}
/** triggered when a conference is closed. This is typically when
@@ -173,18 +167,9 @@ void mwServiceConf_conf_closed(mwConference* conf, guint32 reason)
CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLogW(L"mwServiceConf_conf_closed() start");
- wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
-
- GCDEST gcd = { proto->m_szModuleName };
- gcd.ptszID = tszConfId;
- gcd.iType = GC_EVENT_CONTROL;
-
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
-
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
- mir_free(tszConfId);
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ Chat_Control(proto->m_szModuleName, tszConfId, SESSION_OFFLINE);
+ Chat_Terminate(proto->m_szModuleName, tszConfId);
}
/** triggered when someone joins the conference */
@@ -217,14 +202,14 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user)
gcd.ptszID = tszConfId;
gcd.iType = GC_EVENT_JOIN;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
gce.time = (DWORD)time(0);
- Chat_Event(0, &gce);
+ Chat_Event( &gce);
mir_free(tszUserName);
mir_free(tszUserId);
@@ -246,13 +231,13 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user)
gcd.ptszID = tszConfId;
gcd.iType = GC_EVENT_PART;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
gce.time = (DWORD)time(0);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
/** triggered when someone says something */
@@ -267,7 +252,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh
gcd.ptszID = tszConfId;
gcd.iType = GC_EVENT_MESSAGE;
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
wchar_t* textT = mir_utf8decodeW(what);
@@ -278,7 +263,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh
gce.ptszUID = tszUserId;
gce.time = (DWORD)time(0);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(textT);
mir_free(tszUserName);
@@ -316,19 +301,10 @@ void CSametimeProto::TerminateConference(char* name)
GList *conferences, *conf;
conferences = conf = mwServiceConference_getConferences(service_conference);
- for (;conf;conf = conf->next) {
- if (strcmp(name, mwConference_getName((mwConference*)conf->data)) == 0) {
-
- wchar_t* idt = mir_utf8decodeW(name);
- GCDEST gcd = {m_szModuleName, idt, GC_EVENT_CONTROL};
+ for (;conf;conf = conf->next)
+ if (strcmp(name, mwConference_getName((mwConference*)conf->data)) == 0)
+ Chat_Terminate(m_szModuleName, ptrW(mir_utf8decodeW(name)));
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- Chat_Event(SESSION_TERMINATE, &gce);
-
- mir_free(idt);
- }
- }
g_list_free(conferences);
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index e4cfbe6949..0a2e9631ff 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -198,7 +198,7 @@ int CSametimeProto::OnIdleChanged(WPARAM, LPARAM lParam)
int CSametimeProto::OnModulesLoaded(WPARAM, LPARAM)
{
// register with chat module
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = MAX_MESSAGE_SIZE;
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 107dc2bbcd..782b1501a3 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void CSkypeProto::InitGroupChatModule()
{
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.iMaxText = 0;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
@@ -35,7 +35,7 @@ void CSkypeProto::InitGroupChatModule()
void CSkypeProto::CloseAllChatChatSessions()
{
GC_INFO gci = { 0 };
- gci.Flags = GCF_BYINDEX | GCF_ID | GCF_DATA;
+ gci.Flags = GCF_BYINDEX | GCF_ID;
gci.pszModule = m_szModuleName;
int count = pci->SM_GetCount(m_szModuleName);
@@ -44,10 +44,8 @@ void CSkypeProto::CloseAllChatChatSessions()
gci.iItem = i;
if (!Chat_GetInfo(&gci))
{
- GCDEST gcd = { m_szModuleName, gci.pszID, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, gci.pszID, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, gci.pszID);
}
}
}
@@ -61,7 +59,7 @@ MCONTACT CSkypeProto::FindChatRoom(const char *chatname)
void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
{
// Create the group chat session
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.ptszID = tid;
gcw.pszModule = m_szModuleName;
@@ -70,23 +68,19 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
// Send setting events
GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
// Create a user statuses
gce.ptszStatus = TranslateT("Admin");
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
gce.ptszStatus = TranslateT("User");
- Chat_Event(NULL, &gce);
+ Chat_Event(&gce);
// Finish initialization
- gcd.iType = GC_EVENT_CONTROL;
- gce.time = time(NULL);
- gce.pDest = &gcd;
-
bool hideChats = getBool("HideChats", 1);
- Chat_Event((hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, tid, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE));
+ Chat_Control(m_szModuleName, tid, SESSION_ONLINE);
}
void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response)
@@ -239,7 +233,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
break; // New nick is same, do nothing
GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_NICK };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszNick = tnick_old;
gce.bIsMe = IsMe(user_id);
@@ -247,7 +241,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
gce.ptszText = tnick_new;
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
if (!reset)
db_set_ws(hChatContact, "UsersNicks", _T2A(gch->ptszUID), tnick_new);
@@ -278,18 +272,12 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM)
{
if (!IsOnline())
return 1;
+
if (hContact && IDYES == MessageBox(NULL, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION))
{
ptrW idT(getWStringA(hContact, "ChatRoomID"));
-
- GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
- gcd.ptszID = idT;
-
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.time = ::time(NULL);
-
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, idT, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, idT);
SendRequest(new KickUserRequest(_T2A(idT), li.szSkypename, li));
@@ -410,7 +398,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
CMStringA id = ParseUrl(xId, "8:");
GCDEST gcd = { m_szModuleName, _A2T(szConversationName), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
ptrW tszId(mir_a2u(id));
ptrW tszRole(mir_a2u(xRole));
ptrW tszInitiator(mir_a2u(initiator));
@@ -422,7 +410,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
gce.time = time(NULL);
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateT("Admin");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
}
}
@@ -460,7 +448,7 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM
void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
{
GCDEST gcd = { m_szModuleName, chat_id, isAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ GCEVENT gce = { &gcd };
ptrW tnick(GetChatContactNick(_T2A(chat_id), _T2A(from), _T2A(from)));
@@ -484,7 +472,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from,
if (isLoading) gce.dwFlags = GCEF_NOTNOTIFY;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
@@ -520,11 +508,7 @@ void CSkypeProto::RenameChat(const char *chat_id, const char *name)
{
ptrW tchat_id(mir_a2u(chat_id));
ptrW tname(mir_utf8decodeW(name));
-
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszText = tname;
- Chat_Event(0, &gce);
+ Chat_ChangeSessionName(m_szModuleName, tchat_id, tname);
}
void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const char *initiator)
@@ -534,11 +518,11 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const
ptrW ttopic(mir_utf8decodeW(topic));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = tname;
gce.ptszNick = tname;
gce.ptszText = ttopic;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
bool CSkypeProto::IsChatContact(const wchar_t *chat_id, const char *id)
@@ -601,7 +585,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const
ptrW tid(mir_a2u(id));
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.pDest = &gcd;
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
@@ -610,7 +594,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateW(role);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, const char *name, bool isKick, const char *initiator)
@@ -623,7 +607,7 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con
ptrW tid(mir_a2u(id));
GCDEST gcd = { m_szModuleName, tchat_id, isKick ? GC_EVENT_KICK : GC_EVENT_PART };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
if (isKick)
{
gce.ptszUID = tid;
@@ -640,7 +624,7 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con
gce.bIsMe = IsMe(id);
}
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM)
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index 73a0d91c09..30e7124a16 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -47,11 +47,8 @@ void CSkypeProto::SetAllContactsStatus(WORD status)
void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
{
ptrW tszChatID(getWStringA(hContact, "ChatRoomID"));
- if (tszChatID == NULL)
- return;
- GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event((iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, &gce);
+ if (tszChatID != NULL)
+ Chat_Control(m_szModuleName, tszChatID, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE);
}
MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent)
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp
index 2cf2641db8..146a225419 100644
--- a/protocols/Tox/src/tox_chatrooms.cpp
+++ b/protocols/Tox/src/tox_chatrooms.cpp
@@ -136,7 +136,7 @@ INT_PTR CToxProto::OnCreateChatRoom(WPARAM, LPARAM)
void CToxProto::InitGroupChatModule()
{
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.iMaxText = 0;
gcr.ptszDispName = this->m_tszUserName;
gcr.pszModule = this->m_szModuleName;
@@ -152,7 +152,7 @@ void CToxProto::InitGroupChatModule()
void CToxProto::CloseAllChatChatSessions()
{
GC_INFO gci = { 0 };
- gci.Flags = GCF_BYINDEX | GCF_ID | GCF_DATA;
+ gci.Flags = GCF_BYINDEX | GCF_ID;
gci.pszModule = m_szModuleName;
int count = pci->SM_GetCount(m_szModuleName);
@@ -161,10 +161,8 @@ void CToxProto::CloseAllChatChatSessions()
gci.iItem = i;
if (!Chat_GetInfo(&gci))
{
- GCDEST gcd = { m_szModuleName, gci.pszID, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, gci.pszID, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, gci.pszID);
}
}
}
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp
index 61575672ca..fc4274835a 100644
--- a/protocols/Twitter/src/chat.cpp
+++ b/protocols/Twitter/src/chat.cpp
@@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void TwitterProto::UpdateChat(const twitter_user &update)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.pDest = &gcd;
gce.bIsMe = (update.username == twit_.get_username());
gce.dwFlags = GCEF_ADDTOLOG;
@@ -49,7 +49,7 @@ void TwitterProto::UpdateChat(const twitter_user &update)
else
gce.ptszNick = mir_a2u(update.username.c_str());
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(const_cast<wchar_t*>(gce.ptszNick));
mir_free(const_cast<wchar_t*>(gce.ptszUID));
@@ -91,12 +91,12 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)
void TwitterProto::AddChatContact(const char *name, const char *nick)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = DWORD(time(0));
gce.ptszNick = mir_a2u(nick ? nick : name);
gce.ptszUID = mir_a2u(name);
gce.ptszStatus = L"Normal";
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(const_cast<wchar_t*>(gce.ptszNick));
mir_free(const_cast<wchar_t*>(gce.ptszUID));
@@ -105,11 +105,11 @@ void TwitterProto::AddChatContact(const char *name, const char *nick)
void TwitterProto::DeleteChatContact(const char *name)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.time = DWORD(time(0));
gce.ptszNick = mir_a2u(name);
gce.ptszUID = gce.ptszNick;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(const_cast<wchar_t*>(gce.ptszNick));
}
@@ -117,7 +117,7 @@ void TwitterProto::DeleteChatContact(const char *name)
INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
{
// ***** Create the group chat session
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = m_tszUserName;
@@ -129,9 +129,9 @@ INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
// ***** Create a group
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = L"Normal";
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
// ***** Hook events
HookProtoEvent(ME_GC_EVENT, &TwitterProto::OnChatOutgoing);
@@ -148,19 +148,13 @@ INT_PTR TwitterProto::OnLeaveChat(WPARAM, LPARAM)
{
in_chat_ = false;
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
-
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, m_tszUserName);
return 0;
}
void TwitterProto::SetChatStatus(int status)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
-
if (status == ID_STATUS_ONLINE) {
// Add all friends to contact list
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -183,9 +177,8 @@ void TwitterProto::SetChatStatus(int status)
// For some reason, I have to send an INITDONE message, even if I'm not actually
// initializing the room...
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, m_tszUserName, SESSION_ONLINE);
}
- else
- Chat_Event(SESSION_OFFLINE, &gce);
+ else Chat_Control(m_szModuleName, m_tszUserName, SESSION_OFFLINE);
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index b2f43800db..cadee6121f 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -337,7 +337,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
twit_.set_handle(this, m_hNetlibUser);
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = 159;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index f109c81108..f09904cba2 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -60,14 +60,14 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
sid.Format(L"%S_%d", m_szModuleName, id);
c->m_wszId = mir_wstrdup(sid);
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = wszTitle;
gcw.ptszID = sid;
Chat_NewSession(&gcw);
- GC_INFO gci = { 0 };
+ GC_INFO gci = {};
gci.pszModule = m_szModuleName;
gci.pszID = sid;
gci.Flags = GCF_BYID | GCF_HCONTACT;
@@ -78,10 +78,10 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
m_chats.insert(c);
GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
for (int i = _countof(sttStatuses)-1; i >= 0; i--) {
gce.ptszStatus = TranslateW(sttStatuses[i]);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
setDword(gci.hContact, "vk_chat_id", id);
@@ -96,10 +96,10 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
m_chats.remove(c);
return NULL;
}
- gcd.iType = GC_EVENT_CONTROL;
+
gce.ptszStatus = 0;
- Chat_Event((m_vkOptions.bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, sid, (m_vkOptions.bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE);
+ Chat_Control(m_szModuleName, sid, SESSION_ONLINE);
RetrieveChatInfo(c);
return c;
@@ -201,13 +201,13 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
if (bNew) {
GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ GCEVENT gce = { &gcd };
gce.bIsMe = uid == m_myUserId;
gce.ptszUID = wszId;
gce.ptszNick = wszNick;
gce.ptszStatus = TranslateW(sttStatuses[uid == cc->m_admin_id]);
gce.dwItemData = (INT_PTR)cu;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
}
@@ -220,12 +220,12 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
_itow(cu.m_uid, wszId, 10);
GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_PART };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = wszId;
- gce.dwFlags = GCEF_REMOVECONTACT | GCEF_NOTNOTIFY;
+ gce.dwFlags = GCEF_NOTNOTIFY;
gce.time = time(NULL);
gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId));
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
cc->m_users.remove(i);
}
@@ -285,10 +285,7 @@ void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCWSTR wszTopic)
cc->m_wszTopic = mir_wstrdup(wszTopic);
setWString(cc->m_hContact, "Nick", wszTopic);
- GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_CHANGESESSIONAME };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
- gce.ptszText = wszTopic;
- Chat_Event(0, &gce);
+ Chat_ChangeSessionName(m_szModuleName, cc->m_wszId, wszTopic);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -435,14 +432,14 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR
_itow(uid, wszId, 10);
GCDEST gcd = { m_szModuleName, cc->m_wszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ GCEVENT gce = { &gcd };
gce.bIsMe = (uid == m_myUserId);
gce.ptszUID = wszId;
gce.time = msgTime;
gce.dwFlags = (bIsHistory) ? GCEF_NOTNOTIFY : GCEF_ADDTOLOG;
gce.ptszNick = cu->m_wszNick ? mir_wstrdup(cu->m_wszNick) : mir_wstrdup(hContact ? ptrW(db_get_wsa(hContact, m_szModuleName, "Nick")) : TranslateT("Unknown"));
gce.ptszText = IsEmpty((wchar_t *)pwszBody) ? mir_wstrdup(L"...") : mir_wstrdup(pwszBody);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
StopChatContactTyping(cc->m_chatid, uid);
}
@@ -466,12 +463,8 @@ void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus)
return;
CVkChatInfo *cc = GetChatById(wszChatID);
- if (cc == NULL)
- return;
-
- GCDEST gcd = { m_szModuleName, wszChatID, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event((iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, &gce);
+ if (cc != NULL)
+ Chat_Control(m_szModuleName, wszChatID, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -670,11 +663,8 @@ void CVkProto::LeaveChat(int chat_id, bool close_window, bool delete_chat)
if (cc == NULL)
return;
- GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_QUIT };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
- Chat_Event(0, &gce);
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(close_window? SESSION_TERMINATE:SESSION_OFFLINE, &gce);
+ Chat_Control(m_szModuleName, cc->m_wszId, close_window ? SESSION_TERMINATE : SESSION_OFFLINE);
+
if (delete_chat)
db_delete_contact(cc->m_hContact);
else
@@ -801,7 +791,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
break;
GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_NICK };
- GCEVENT gce = { sizeof(GCEVENT), &gcd };
+ GCEVENT gce = { &gcd };
wchar_t wszId[20];
_itow(cu->m_uid, wszId, 10);
@@ -812,7 +802,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
gce.ptszText = mir_wstrdup(wszNewNick);
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
cu->m_wszNick = mir_wstrdup(wszNewNick);
setWString(cc->m_hContact, CMStringA(FORMAT, "nick%d", cu->m_uid), wszNewNick);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 01b698aafa..e45cbede37 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -105,7 +105,7 @@ CVkProto::~CVkProto()
int CVkProto::OnModulesLoaded(WPARAM, LPARAM)
{
// Chats
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
gcr.nColors = _countof(sttColors);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index 11d809ed6e..0987c6ea52 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -302,7 +302,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n
setString(hOldContact, "ChatRoomID", jid.c_str());
}
- GCSESSION gcw = { sizeof(GCSESSION) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = ptszNick;
@@ -312,15 +312,14 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n
pInfo->hContact = (hOldContact != NULL) ? hOldContact : ContactIDToHContact(jid);
GCDEST gcd = { m_szModuleName, ptszJid, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateW(sttStatuses[i]);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? SESSION_INITDONE : WINDOW_HIDDEN, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Control(m_szModuleName, ptszJid, getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? SESSION_INITDONE : WINDOW_HIDDEN);
+ Chat_Control(m_szModuleName, ptszJid, SESSION_ONLINE);
if (m_pConnection)
m_pConnection->sendGetParticipants(jid);
@@ -359,11 +358,7 @@ void WhatsAppProto::onGroupInfo(const std::string &jid, const std::string &owner
pInfo->bActive = true;
time_subject = 0;
}
- else {
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(SESSION_ONLINE, &gce);
- }
+ else Chat_Control(m_szModuleName, pInfo->tszJid, SESSION_ONLINE);
if (!subject.empty()) {
pInfo->tszOwner = str2t(owner);
@@ -399,14 +394,14 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg)
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = pMsg.timestamp;
gce.ptszText = tszText;
gce.bIsMe = m_szJid == pMsg.remote_resource;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
if (isOnline())
m_pConnection->sendMessageReceived(pMsg);
@@ -428,13 +423,13 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG + ((ts == 0) ? GCEF_NOTNOTIFY : 0);
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = ts;
gce.ptszText = tszText;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
setWString(pInfo->hContact, WHATSAPP_KEY_NICK, tszText);
}
@@ -450,12 +445,12 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = ts;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string &ujid, int ts)
@@ -469,12 +464,12 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_PART };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = ts;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
void WhatsAppProto::onLeaveGroup(const std::string &gjid)
@@ -483,11 +478,7 @@ void WhatsAppProto::onLeaveGroup(const std::string &gjid)
if (pInfo == NULL)
return;
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_CONTROL };
-
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszUID = pInfo->tszJid;
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Terminate(m_szModuleName, pInfo->tszJid);
db_delete_contact(pInfo->hContact);
m_chats.erase((char*)_T2A(pInfo->tszJid));
@@ -510,11 +501,11 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszNick = nick;
gce.ptszUID = utils::removeA(ujid);
gce.ptszStatus = (bIsOwner) ? L"Owners" : L"Members";
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
}
@@ -543,14 +534,14 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg)
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = time(NULL);
gce.ptszText = p->second.c_str();
gce.bIsMe = m_szJid == msg.remote_resource;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
pInfo->m_unsentMsgs.erase(p);
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index cda1b921e6..1045d73536 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -74,7 +74,7 @@ int WhatsAppProto::OnEvent(PROTOEVENTTYPE evType, WPARAM, LPARAM)
case EV_PROTO_ONLOAD:
// Register group chat
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp
index f229a942c1..07955a94ee 100644
--- a/protocols/Yahoo/src/chat.cpp
+++ b/protocols/Yahoo/src/chat.cpp
@@ -136,7 +136,7 @@ static const COLORREF crCols[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
void CYahooProto::ChatRegister(void)
{
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.nColors = 16;
gcr.pColors = (COLORREF*)crCols;
@@ -150,9 +150,9 @@ void CYahooProto::ChatRegister(void)
void CYahooProto::ChatStart(const char* room)
{
- wchar_t* idt = mir_a2u(room);
+ ptrW idt(mir_a2u(room));
- GCSESSION gcw = { sizeof(gcw) };
+ GCSESSION gcw = {};
gcw.iType = GCW_CHATROOM;
gcw.pszModule = m_szModuleName;
gcw.ptszName = idt;
@@ -160,33 +160,24 @@ void CYahooProto::ChatStart(const char* room)
Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszStatus = TranslateT("Me");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
gcd.iType = GC_EVENT_ADDGROUP;
gce.ptszStatus = TranslateT("Others");
- Chat_Event(0, &gce);
-
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
- Chat_Event(WINDOW_VISIBLE, &gce);
+ Chat_Event(&gce);
- mir_free(idt);
+ Chat_Control(m_szModuleName, idt, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, idt, SESSION_ONLINE);
+ Chat_Control(m_szModuleName, idt, WINDOW_VISIBLE);
}
void CYahooProto::ChatLeave(const char* room)
{
- wchar_t* idt = mir_a2u(room);
-
- GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_REMOVECONTACT;
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
-
- mir_free(idt);
+ ptrW idt(mir_a2u(room));
+ Chat_Control(m_szModuleName, idt, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, idt, true);
}
void CYahooProto::ChatLeaveAll(void)
@@ -204,7 +195,7 @@ void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const wc
wchar_t* nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(WPARAM(hContact), 0) : snt;
GCDEST gcd = { m_szModuleName, idt, evt };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = nick;
gce.ptszUID = snt;
@@ -212,7 +203,7 @@ void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const wc
gce.ptszStatus = gce.bIsMe ? TranslateT("Me") : TranslateT("Others");
gce.ptszText = msg;
gce.time = time(NULL);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(snt);
mir_free(idt);
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index 69b0ba9fc2..d12604f44e 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -124,7 +124,7 @@ static void OnRemoveSession(SESSION_INFO *si)
{
if (!g_Settings.bTabsEnable) {
if (si->hWnd)
- SendMessage(si->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0);
+ SendMessage(si->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
}
else if (g_TabSession.hWnd)
SendMessage(g_TabSession.hWnd, GC_REMOVETAB, 1, (LPARAM)si);
diff --git a/src/core/stdchat/src/services.cpp b/src/core/stdchat/src/services.cpp
index 91b72f4b3d..f534c4a56c 100644
--- a/src/core/stdchat/src/services.cpp
+++ b/src/core/stdchat/src/services.cpp
@@ -69,7 +69,7 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
pci->SetActiveSession(si->ptszID, si->pszModule);
if (!IsWindowVisible(g_TabSession.hWnd) || wp == WINDOW_HIDDEN)
- SendMessage(g_TabSession.hWnd, GC_EVENT_CONTROL + WM_USER + 500, wp, 0);
+ SendMessage(g_TabSession.hWnd, GC_CONTROL_MSG, wp, 0);
else {
if (IsIconic(g_TabSession.hWnd))
ShowWindow(g_TabSession.hWnd, SW_NORMAL);
@@ -96,7 +96,7 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground)
SetWindowLongPtr(si->hWnd, GWL_EXSTYLE, GetWindowLongPtr(si->hWnd, GWL_EXSTYLE) | WS_EX_APPWINDOW);
if (!IsWindowVisible(si->hWnd) || wp == WINDOW_HIDDEN)
- SendMessage(si->hWnd, GC_EVENT_CONTROL + WM_USER + 500, wp, 0);
+ SendMessage(si->hWnd, GC_CONTROL_MSG, wp, 0);
else {
if (IsIconic(si->hWnd))
ShowWindow(si->hWnd, SW_NORMAL);
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 642dd5b2ea..cd6be436d8 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -1459,7 +1459,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else Log_StreamInEvent(hwndDlg, si->pLogEnd, si, TRUE, FALSE);
}
- else SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ else SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
case GC_REDRAWLOG2:
@@ -1478,7 +1478,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (si->pLogEnd)
Log_StreamInEvent(hwndDlg, si->pLog, si, FALSE, FALSE);
else
- SendMessage(hwndDlg, GC_EVENT_CONTROL + WM_USER + 500, WINDOW_CLEARLOG, 0);
+ SendMessage(hwndDlg, GC_CONTROL_MSG, WINDOW_CLEARLOG, 0);
break;
case GC_SWITCHNEXTTAB:
@@ -1795,11 +1795,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
break;
- case GC_ACKMESSAGE:
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, FALSE, 0);
- SetDlgItemText(hwndDlg, IDC_MESSAGE, L"");
- return TRUE;
-
case WM_CTLCOLORLISTBOX:
SetBkColor((HDC)wParam, g_Settings.crUserListBGColor);
return (INT_PTR)pci->hListBkgBrush;
@@ -1886,7 +1881,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
break;
- case GC_EVENT_CONTROL + WM_USER + 500:
+ case GC_CONTROL_MSG:
switch (wParam) {
case SESSION_OFFLINE:
SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 79659bd7ef..635478ce8f 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -123,11 +123,11 @@ static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL re
while (pTemp != NULL) {
// match
if ((!pszID && pTemp->iType != GCW_SERVER || !mir_wstrcmpi(pTemp->ptszID, pszID)) && !mir_strcmpi(pTemp->pszModule, pszModule)) {
- DWORD dw = pTemp->dwItemData;
+ void *pItemData = pTemp->pItemData;
if (chatApi.OnRemoveSession)
chatApi.OnRemoveSession(pTemp);
- DoEventHook(pTemp->ptszID, pTemp->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)pTemp->dwItemData);
+ DoEventHook(pTemp->ptszID, pTemp->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)pTemp->pItemData);
if (pLast == NULL)
chatApi.wndList = pTemp->next;
@@ -142,7 +142,8 @@ static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL re
SM_FreeSession(pTemp);
if (pszID)
- return (int)dw;
+ return (int)pItemData;
+
if (pLast)
pTemp = pLast->next;
else
@@ -546,8 +547,8 @@ static BOOL SM_RemoveAll(void)
SESSION_INFO *pLast = chatApi.wndList->next;
if (chatApi.wndList->hWnd)
- SendMessage(chatApi.wndList->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0);
- DoEventHook(chatApi.wndList->ptszID, chatApi.wndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)chatApi.wndList->dwItemData);
+ SendMessage(chatApi.wndList->hWnd, GC_CONTROL_MSG, SESSION_TERMINATE, 0);
+ DoEventHook(chatApi.wndList->ptszID, chatApi.wndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)chatApi.wndList->pItemData);
SM_FreeSession(chatApi.wndList);
chatApi.wndList = pLast;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index c5acd9abb6..2320292da5 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -137,7 +137,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *gci)
if (si == NULL)
return 1;
- if (gci->Flags & GCF_DATA) gci->dwItemData = si->dwItemData;
+ if (gci->Flags & GCF_DATA) gci->pItemData = si->pItemData;
if (gci->Flags & GCF_HCONTACT) gci->hContact = si->hContact;
if (gci->Flags & GCF_TYPE) gci->iType = si->iType;
if (gci->Flags & GCF_COUNT) gci->iCount = si->nUsersInNicklist;
@@ -155,9 +155,6 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
if (gcr == NULL)
return GC_REGISTER_ERROR;
- if (gcr->cbSize != sizeof(GCREGISTER))
- return GC_REGISTER_WRONGVER;
-
mir_cslock lck(csChat);
MODULEINFO *mi = chatApi.MM_AddModule(gcr->pszModule);
if (mi == NULL)
@@ -195,9 +192,6 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw)
if (gcw == NULL)
return GC_NEWSESSION_ERROR;
- if (gcw->cbSize != sizeof(GCSESSION))
- return GC_NEWSESSION_WRONGVER;
-
mir_cslock lck(csChat);
MODULEINFO *mi = chatApi.MM_FindModule(gcw->pszModule);
if (mi == NULL)
@@ -223,7 +217,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw)
if ((si = chatApi.SM_AddSession(gcw->ptszID, gcw->pszModule)) == NULL)
return GC_NEWSESSION_ERROR;
- si->dwItemData = gcw->dwItemData;
+ si->pItemData = gcw->pItemData;
if (gcw->iType != GCW_SERVER)
si->wStatus = ID_STATUS_ONLINE;
si->iType = gcw->iType;
@@ -264,7 +258,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// handles chat event
+// chat control
struct ShowChatParam
{
@@ -294,109 +288,71 @@ static void SetInitDone(SESSION_INFO *si)
p->hIcon = HICON(si->iStatusCount - (INT_PTR)p->hIcon - 1);
}
-static int DoControl(GCEVENT *gce, WPARAM wp)
+MIR_APP_DLL(int) Chat_Control(const char *szModule, const wchar_t *wszId, int iCommand)
{
SESSION_INFO *si;
- if (gce->pDest->iType == GC_EVENT_CONTROL) {
- switch (wp) {
- case WINDOW_HIDDEN:
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- SetInitDone(si);
- chatApi.SetActiveSession(si->ptszID, si->pszModule);
- if (si->hWnd)
- CallFunctionAsync(stubShowRoom, new ShowChatParam(si, wp, FALSE));
- }
- return 0;
-
- case WINDOW_MINIMIZE:
- case WINDOW_MAXIMIZE:
- case WINDOW_VISIBLE:
- case SESSION_INITDONE:
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- SetInitDone(si);
- if (wp != SESSION_INITDONE || db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) == 0)
- CallFunctionAsync(stubShowRoom, new ShowChatParam(si, wp, TRUE));
- return 0;
- }
- break;
-
- case SESSION_OFFLINE:
- chatApi.SM_SetOffline(gce->pDest->ptszID, gce->pDest->pszModule);
- // fall through
-
- case SESSION_ONLINE:
- chatApi.SM_SetStatus(gce->pDest->ptszID, gce->pDest->pszModule, wp == SESSION_ONLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
- break;
-
- case WINDOW_CLEARLOG:
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
- if (chatApi.OnClearLog)
- chatApi.OnClearLog(si);
- si->iEventCount = 0;
- si->LastTime = 0;
- }
- break;
+ mir_cslock lck(csChat);
+ switch (iCommand) {
+ case WINDOW_HIDDEN:
+ if (si = chatApi.SM_FindSession(wszId, szModule)) {
+ SetInitDone(si);
+ chatApi.SetActiveSession(si->ptszID, si->pszModule);
+ if (si->hWnd)
+ CallFunctionAsync(stubShowRoom, new ShowChatParam(si, iCommand, FALSE));
+ }
+ return 0;
- case SESSION_TERMINATE:
- return chatApi.SM_RemoveSession(gce->pDest->ptszID, gce->pDest->pszModule, (gce->dwFlags & GCEF_REMOVECONTACT) != 0);
+ case WINDOW_MINIMIZE:
+ case WINDOW_MAXIMIZE:
+ case WINDOW_VISIBLE:
+ case SESSION_INITDONE:
+ if (si = chatApi.SM_FindSession(wszId, szModule)) {
+ SetInitDone(si);
+ if (iCommand != SESSION_INITDONE || db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) == 0)
+ CallFunctionAsync(stubShowRoom, new ShowChatParam(si, iCommand, TRUE));
+ return 0;
}
- chatApi.SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_EVENT_CONTROL + WM_USER + 500, wp, 0);
- }
+ break;
- else if (gce->pDest->iType == GC_EVENT_CHUID && gce->ptszText) {
- chatApi.SM_ChangeUID(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszNick, gce->ptszText);
- }
+ case SESSION_OFFLINE:
+ chatApi.SM_SetOffline(wszId, szModule);
+ // fall through
- else if (gce->pDest->iType == GC_EVENT_CHANGESESSIONAME && gce->ptszText) {
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- replaceStrW(si->ptszName, gce->ptszText);
- if (si->hWnd)
- SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
- if (chatApi.OnRenameSession)
- chatApi.OnRenameSession(si);
- }
- }
+ case SESSION_ONLINE:
+ chatApi.SM_SetStatus(wszId, szModule, iCommand == SESSION_ONLINE ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE);
+ break;
- else if (gce->pDest->iType == GC_EVENT_SETITEMDATA) {
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule))
- si->dwItemData = gce->dwItemData;
- }
+ case SESSION_TERMINATE:
+ return chatApi.SM_RemoveSession(wszId, szModule, false);
- else if (gce->pDest->iType == GC_EVENT_GETITEMDATA) {
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- gce->dwItemData = si->dwItemData;
- return si->dwItemData;
+ case WINDOW_CLEARLOG:
+ if (si = chatApi.SM_FindSession(wszId, szModule)) {
+ chatApi.LM_RemoveAll(&si->pLog, &si->pLogEnd);
+ if (chatApi.OnClearLog)
+ chatApi.OnClearLog(si);
+ si->iEventCount = 0;
+ si->LastTime = 0;
}
- return 0;
- }
- else if (gce->pDest->iType == GC_EVENT_SETSBTEXT) {
- if (si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
- replaceStrW(si->ptszStatusbarText, gce->ptszText);
- if (si->ptszStatusbarText)
- db_set_ws(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
- else
- db_set_s(si->hContact, si->pszModule, "StatusBar", "");
-
- if (chatApi.OnSetStatusBar)
- chatApi.OnSetStatusBar(si);
- }
- }
- else if (gce->pDest->iType == GC_EVENT_ACK) {
- chatApi.SM_SendMessage(gce->pDest->ptszID, gce->pDest->pszModule, GC_ACKMESSAGE, 0, 0);
- }
- else if (gce->pDest->iType == GC_EVENT_SENDMESSAGE && gce->ptszText) {
- chatApi.SM_SendUserMessage(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText);
- }
- else if (gce->pDest->iType == GC_EVENT_SETSTATUSEX) {
- chatApi.SM_SetStatusEx(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszText, gce->dwItemData);
+ break;
+
+ default:
+ return GC_EVENT_ERROR;
}
- else return 1;
+ chatApi.SM_SendMessage(wszId, szModule, GC_CONTROL_MSG, iCommand, 0);
return 0;
}
+MIR_APP_DLL(int) Chat_Terminate(const char *szModule, const wchar_t *wszId, bool bRemoveContact)
+{
+ mir_cslock lck(csChat);
+ return chatApi.SM_RemoveSession(wszId, szModule, bRemoveContact);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// handles chat event
+
static void AddUser(GCEVENT *gce)
{
SESSION_INFO *si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
@@ -416,7 +372,7 @@ static void AddUser(GCEVENT *gce)
chatApi.OnNewUser(si, ui);
}
-EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT *gce)
+EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
{
BOOL bIsHighlighted = FALSE;
BOOL bRemoveFlag = FALSE;
@@ -428,9 +384,6 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT *gce)
if (gcd == NULL)
return GC_EVENT_ERROR;
- if (gce->cbSize != sizeof(GCEVENT))
- return GC_EVENT_WRONGVER;
-
if (!IsEventSupported(gcd->iType))
return GC_EVENT_ERROR;
@@ -449,17 +402,6 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT *gce)
}
return 0;
- case GC_EVENT_CHUID:
- case GC_EVENT_CHANGESESSIONAME:
- case GC_EVENT_SETITEMDATA:
- case GC_EVENT_GETITEMDATA:
- case GC_EVENT_CONTROL:
- case GC_EVENT_SETSBTEXT:
- case GC_EVENT_ACK:
- case GC_EVENT_SENDMESSAGE:
- case GC_EVENT_SETSTATUSEX:
- return DoControl(gce, sessionEvent);
-
case GC_EVENT_SETCONTACTSTATUS:
return chatApi.SM_SetContactStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
@@ -565,6 +507,86 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT *gce)
return GC_EVENT_ERROR;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+// chat control functions
+
+MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wszId, const wchar_t *wszNewName)
+{
+ if (wszNewName == NULL)
+ return GC_EVENT_ERROR;
+
+ mir_cslock lck(csChat);
+ if (SESSION_INFO *si = chatApi.SM_FindSession(wszId, szModule)) {
+ replaceStrW(si->ptszName, wszNewName);
+ if (si->hWnd)
+ SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0);
+ if (chatApi.OnRenameSession)
+ chatApi.OnRenameSession(si);
+ }
+ return 0;
+}
+
+MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszId, const wchar_t *wszOldId, const wchar_t *wszNewId)
+{
+ if (wszNewId == NULL)
+ return GC_EVENT_ERROR;
+
+ mir_cslock lck(csChat);
+ return !chatApi.SM_ChangeUID(wszId, szModule, wszOldId, wszNewId);
+}
+
+MIR_APP_DLL(void*) Chat_GetUserInfo(const char *szModule, const wchar_t *wszId)
+{
+ mir_cslock lck(csChat);
+ if (SESSION_INFO *si = chatApi.SM_FindSession(wszId, szModule))
+ return si->pItemData;
+ return NULL;
+}
+
+MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId, const wchar_t *wszText)
+{
+ if (wszText == NULL)
+ return GC_EVENT_ERROR;
+
+ mir_cslock lck(csChat);
+ return !chatApi.SM_SendUserMessage(wszId, szModule, wszText);
+}
+
+MIR_APP_DLL(int) Chat_SetStatusbarText(const char *szModule, const wchar_t *wszId, const wchar_t *wszText)
+{
+ mir_cslock lck(csChat);
+ if (SESSION_INFO *si = chatApi.SM_FindSession(wszId, szModule)) {
+ replaceStrW(si->ptszStatusbarText, wszText);
+ if (si->ptszStatusbarText)
+ db_set_ws(si->hContact, si->pszModule, "StatusBar", si->ptszStatusbarText);
+ else
+ db_set_s(si->hContact, si->pszModule, "StatusBar", "");
+
+ if (chatApi.OnSetStatusBar)
+ chatApi.OnSetStatusBar(si);
+ }
+ return 0;
+}
+
+MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *wszId, int flags, const wchar_t *wszText)
+{
+ mir_cslock lck(csChat);
+ return !chatApi.SM_SetStatusEx(wszId, szModule, wszText, flags);
+}
+
+MIR_APP_DLL(int) Chat_SetUserInfo(const char *szModule, const wchar_t *wszId, void *pItemData)
+{
+ mir_cslock lck(csChat);
+ if (SESSION_INFO *si = chatApi.SM_FindSession(wszId, szModule)) {
+ si->pItemData = pItemData;
+ return 0;
+ }
+ return GC_EVENT_ERROR;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// module initialization
+
static int ModulesLoaded(WPARAM, LPARAM)
{
LoadChatIcons();
@@ -595,9 +617,6 @@ static int ModulesLoaded(WPARAM, LPARAM)
return 0;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// Service creation
-
static bool bInited = false;
int LoadChatModule(void)
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 0ac5311f81..eb262e1eed 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -658,16 +658,7 @@ BOOL IsEventSupported(int eventType)
case GC_EVENT_ACTION:
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
- case GC_EVENT_CHUID:
- case GC_EVENT_CHANGESESSIONAME:
case GC_EVENT_ADDGROUP:
- case GC_EVENT_SETITEMDATA:
- case GC_EVENT_GETITEMDATA:
- case GC_EVENT_SETSBTEXT:
- case GC_EVENT_ACK:
- case GC_EVENT_SENDMESSAGE:
- case GC_EVENT_SETSTATUSEX:
- case GC_EVENT_CONTROL:
case GC_EVENT_SETCONTACTSTATUS:
return TRUE;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index dd066e34da..a72414500f 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -300,3 +300,11 @@ Chat_Event @300
Chat_GetInfo @301
Chat_NewSession @302
Chat_Register @303
+Chat_GetUserInfo @304
+Chat_SetUserInfo @305
+Chat_ChangeUserId @306
+Chat_ChangeSessionName @307
+Chat_SetStatusbarText @308
+Chat_SendUserMessage @309
+Chat_SetStatusEx @310
+Chat_Terminate @311
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index de2bdb2cbe..e3d58e4aa3 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -300,3 +300,11 @@ Chat_Event @300
Chat_GetInfo @301
Chat_NewSession @302
Chat_Register @303
+Chat_GetUserInfo @304
+Chat_SetUserInfo @305
+Chat_ChangeUserId @306
+Chat_ChangeSessionName @307
+Chat_SetStatusbarText @308
+Chat_SendUserMessage @309
+Chat_SetStatusEx @310
+Chat_Terminate @311