summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-16 19:43:24 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-16 19:43:24 +0000
commit0c41e6c4566fdb2d99b8a6ca1fb48859fd4a0e34 (patch)
tree700937499ee66952d1ca5b92928fc9ec3b034447
parent7a7a6637021d78ad995f3e21e9743fae69bd2562 (diff)
- chats services replaces with functions;
- chat calls switched from CallServiceSync to direct calls everywhere git-svn-id: http://svn.miranda-ng.org/main/trunk@17305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_app.libbin78654 -> 79712 bytes
-rw-r--r--bin10/lib/mir_app64.libbin75580 -> 76542 bytes
-rw-r--r--bin12/lib/mir_app.libbin78654 -> 79712 bytes
-rw-r--r--bin12/lib/mir_app64.libbin75580 -> 76542 bytes
-rw-r--r--bin14/lib/mir_app.libbin78654 -> 79712 bytes
-rw-r--r--bin14/lib/mir_app64.libbin75580 -> 76542 bytes
-rw-r--r--include/delphi/m_api.pas1
-rw-r--r--include/delphi/m_chat.inc644
-rw-r--r--include/m_chat.h48
-rw-r--r--include/m_chat_int.h5
-rw-r--r--plugins/Actman/iac_inout.pas4
-rw-r--r--plugins/Dropbox/src/dropbox_utils.cpp2
-rw-r--r--plugins/MirLua/src/m_message.cpp2
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp2
-rw-r--r--plugins/PasteIt/src/Options.cpp2
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp8
-rw-r--r--plugins/PasteIt/src/stdafx.h2
-rw-r--r--plugins/Scriver/src/chat/main.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp6
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/stdafx.h2
-rw-r--r--plugins/TabSRMM/src/chat/main.cpp2
-rw-r--r--plugins/Utils.pas/mircontacts.pas45
-rw-r--r--plugins/XSoundNotify/src/xsn_main.cpp3
-rw-r--r--protocols/AimOscar/src/chat.cpp20
-rw-r--r--protocols/FacebookRM/src/chat.cpp36
-rw-r--r--protocols/FacebookRM/src/proto.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp44
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp48
-rw-r--r--protocols/IRCG/src/input.cpp8
-rw-r--r--protocols/IRCG/src/ircproto.cpp8
-rw-r--r--protocols/IRCG/src/main.cpp2
-rw-r--r--protocols/IRCG/src/scripting.cpp8
-rw-r--r--protocols/IRCG/src/services.cpp12
-rw-r--r--protocols/IRCG/src/stdafx.h11
-rw-r--r--protocols/IRCG/src/tools.cpp6
-rw-r--r--protocols/JabberG/src/jabber.cpp12
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp18
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp8
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp2
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/MRA/src/MraChat.cpp19
-rw-r--r--protocols/MRA/src/Mra_functions.cpp2
-rw-r--r--protocols/MSN/src/msn_chat.cpp26
-rw-r--r--protocols/MSN/src/msn_commands.cpp10
-rw-r--r--protocols/MSN/src/msn_misc.cpp2
-rw-r--r--protocols/MSN/src/msn_proto.cpp2
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp28
-rw-r--r--protocols/MinecraftDynmap/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/chat.cpp30
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Sametime/src/conference.cpp22
-rw-r--r--protocols/Sametime/src/sametime.cpp2
-rw-r--r--protocols/SkypeWeb/src/main.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp38
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp2
-rw-r--r--protocols/Tox/src/stdafx.h2
-rw-r--r--protocols/Tox/src/tox.cpp4
-rw-r--r--protocols/Tox/src/tox_chatrooms.cpp10
-rw-r--r--protocols/Twitter/src/chat.cpp20
-rw-r--r--protocols/Twitter/src/proto.cpp2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp26
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp2
-rw-r--r--protocols/WhatsApp/src/chat.cpp24
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
-rw-r--r--protocols/Yahoo/src/chat.cpp20
-rw-r--r--src/core/stdchat/src/main.cpp2
-rw-r--r--src/mir_app/src/chat.h12
-rw-r--r--src/mir_app/src/chat_clist.cpp11
-rw-r--r--src/mir_app/src/chat_manager.cpp15
-rw-r--r--src/mir_app/src/chat_svc.cpp59
-rw-r--r--src/mir_app/src/mir_app.def5
-rw-r--r--src/mir_app/src/mir_app64.def5
74 files changed, 349 insertions, 1102 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib
index bf16b8891a..3cd1a5674e 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 5a7ff9981b..9b7b5e465b 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 bf16b8891a..3cd1a5674e 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 5a7ff9981b..9b7b5e465b 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 bf16b8891a..3cd1a5674e 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 5a7ff9981b..9b7b5e465b 100644
--- a/bin14/lib/mir_app64.lib
+++ b/bin14/lib/mir_app64.lib
Binary files differ
diff --git a/include/delphi/m_api.pas b/include/delphi/m_api.pas
index c20865c82c..1621e49438 100644
--- a/include/delphi/m_api.pas
+++ b/include/delphi/m_api.pas
@@ -194,7 +194,6 @@ var
{$include m_awaymsg.inc}
{$include m_button.inc}
{$include m_button_int.inc}
- {$include m_chat.inc}
{$include m_clc.inc}
{$include m_clistint.inc}
{$include m_cluiframes.inc}
diff --git a/include/delphi/m_chat.inc b/include/delphi/m_chat.inc
deleted file mode 100644
index 5ba790fe65..0000000000
--- a/include/delphi/m_chat.inc
+++ /dev/null
@@ -1,644 +0,0 @@
-{
-Chat module plugin for Miranda IM
-
-Copyright (C) 2003 Jörgen Persson
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-}
-
-{$IFNDEF M_CHAT}
-{$DEFINE M_CHAT}
-(*
- This plugin provides event driven chat rooms for protocols that wish to use it.
- It is built for IRC, which I also develop and is naturally biased towards IRC,
- but it should work very well with other protocols too. I will try to explain as
- careful as possible in this document how to use chat.dll
-
- -- General guidelines --
-
- There is ONE rule a protocol MUST follow to use this:
-
- 1. Do NOT touch hContacts that has a byte "ChatRoom" set to ANYTHING other than 0! (Could be 1, 2, 3, ...)
- This is because chat.dll adds contacts to the clist using the protocol name
- supplied by the protocol. But this will naturally not work well if the
- protocol also tampers with the contacts. The value of the byte indicates which type of
- window/contact it is (see the GCW_* flags below). There is two exceptions to this rule:
-
- * You should continue to handle the right click menu items of these
- contacts as usual, by hooking the menu prebuild hook etc. Chat.dll can not
- handle this in an efficient manner!
-
- * You should also handle when the user deletes the contact/room from the
- contact list, as the protocol will then most likely have to send some message
- to the server that the user has left the room.
-
- NOTE. Chat keeps its own copies of strings passed.
-
-
- * * Example of implementing this rule * *:
- * * This is a code snippet that is common in protocols * *:
-
-
-
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact)
- {
- szProto = (AnsiChar * ) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto != NULL && !lstrcmpi(szProto, PROTONAME))
- {
- ... do something with the hContact here;
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
-
- * * You should do this instead * *:
-
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
- while (hContact)
- {
- szProto = (AnsiChar * ) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (szProto != NULL && !lstrcmpi(szProto, PROTONAME))
- {
- if (DBGetContactSettingByte(hContact, PROTONAME, "ChatRoom", 0) == 0)
- {
- ... do something with the hContact here;
- }
- }
- hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
- }
-
-
- There is not more to it than that! To recapitulate: do NOT touch contacts where the
- byte "ChatRoom" is set to anything other than 0,
-*)
-{
- OK, enough of the precautions, HOW DO YOU USE CHAT? In short you need to do FOUR things:
-
- 1. REGISTER your protocol with Chat
- Only registered protocols can use Chat
-
- 2. CREATE SESSIONS when your protocol are joining a group chat room. (One per room joined)
- These sessions will be put on the contact-list and are managed totally by chat.
- This is the reason you must obey to the "precautions" I mentioned above.
- Do not tamper directly with Chat's hContacts. Use Services provided by Chat instead.
-
- 3. SEND EVENTS to the sessions created in #3.
- These events reflect users joining/leaving/speaking etc.
-
- 4. DESTROY SESSIONS when the user leaves the room (ie the session is not needed anymore).
-
- These four points are implemented in three services: MS_GC_REGISTER, MS_GC_NEWSESSION
- and MS_GC_EVENT.
-}
-
-
-//------------------------- SERVICES ------------------------
-{
- Step 1. -- REGISTER with Chat --
-
- The first thing that a protocol need to do is register with Chat. This is best done
- when ALL modules has loaded (ME_SYSTEM_MODULESLOADED). The registration is
- needed to make sure that the protocol obey rule 1 mentioned above, but also to
- set protocol specific preferences.
-
- * Use MS_GC_REGISTER like this: CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr;
-
- * returns 0 on success or error code on failure.
-}
-
-const
-// Flags
- GC_BOLD = $0001; //enable the 'bold' button
- GC_ITALICS = $0002; //enable the 'italics' button
- GC_UNDERLINE = $0004; //enable the 'underline' button
- GC_COLOR = $0008; //enable the 'foreground color' button
- GC_BKGCOLOR = $0010; //enable the 'background color' button
- GC_ACKMSG = $0020; //the protocol must acknowlege messages sent
- GC_TYPNOTIF = $0040; //enable typing notifications.
- GC_CHANMGR = $0080; //enable the 'channel settings' button
- GC_SINGLEFORMAT = $0100; //the protocol supports only 1 formatting per message
- GC_FONTSIZE = $0200; //enable font size selection
-
-// Error messages
- GC_REGISTER_WRONGVER = 1; //You appear to be using the wrong version of this API. Registration failed.
- GC_REGISTER_ERROR = 2; //An internal error occurred. Registration failed.
- GC_REGISTER_NOUNICODE = 3; //MS_GC_REGISTER returns this error if the Unicode version of chat
- //is not installed and GC_UNICODE is set. Registration failed
-
-// GCREGISTER struct
-type
- TGCREGISTER = record
- cbSize :int; //Set to sizeof(GCREGISTER);
- dwFlags :dword; //Use GC_* flags above to indicate features supported
- pszModule :PAnsiChar; //This MUST be the protocol name as registered with Miranda IM
- pszModuleDispName:TChar; //This is the protocol's real name as it will be displayed to the user
- iMaxText :int; //Max message length the protocol supports. Will limit the typing area input. 0 = no limit
- nColors :int; //Number of colors in the colorchooser menu for the color buttons. Max = 100
- pColors :^TCOLORREF;//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];
- end;
-
-const
- MS_GC_REGISTER:PAnsiChar = 'GChat/Register';
-
-{
- Step 2. -- CREATE a new SESSION --
-
- Create a new session (chat room) and set various settings related to it.
- The chat room will not be shown to the user until the 'set up' phase is
- completed and SESSION_INITDONE is sent. See the MS_GC_EVENT for that.
-
- * Use MS_GC_NEWSESSION like this: CallService(MS_GC_NEWSESSION, 0, (LPARAM)(GCSESSION *) &gcr;
-
- * returns 0 on success or error code on failure
-}
-
-
-// Session type
- GCW_CHATROOM = 1; // the session is a dedicated multi user chat room. ex "IRC channels".
- // A hContact will be added for the session
- GCW_SERVER = 2; // the session is used as a network console. ex "IRC server window"
- // A hContact will be added for the session, but it will default to being
- // hidden (on the CList)
- GCW_PRIVMESS = 3; // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional
- // support for adding more users etc. ex "MSN session".
-
-// Error messages
- GC_NEWSESSION_WRONGVER = 1; //You appear to be using the wrong version of this API.
- GC_NEWSESSION_ERROR = 2; //An internal error occurred.
-
-// GCSESSION structure
-type
- TGCSESSION = record
- cbSize :int; //Set to sizeof(GCSESSION);
- iType :int; //Use one of the GCW_* flags above to set the type of session
- pszModule :PAnsiChar; //The name of the protocol owning the session (the same as pszModule when you register)
- szName :TCHAR; //The name of the session as it will be displayed to the user
- szID :TCHAR; //The unique identifier for the session.
- szStatusbarText:TCHAR; //Optional text to set in the statusbar of the chat room window, or NULL.
- dwFlags :dword;
- dwItemData :int_ptr; //Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event
- end;
-
-const
- MS_GC_NEWSESSION:PAnsiChar = 'GChat/NewChat';
-
-{
- Step 3 -- SEND an EVENT --
-
- Events is what drives Chat! After having created the session in Step 2
- it is time to make it work for real. Follow these guidelines:
-
- 1. Start off by telling Chat what possible statuses a user can have (in the nicklist)
- by sending GC_EVENT_ADDGROUP as many times as needed. Also supply an icon
- to go with this status. Ex "Voice status" on IRC
-
- 2.Then send "JOIN" events (GC_EVENT_JOIN) to populate the user list.
- You will need to send one event per user that should be added. As long as
- SESSION_INITDONE has not been sent these events will not show up in the log.
-
- 3.When you are done with filling the user list it is a good time to end
- the set up phase and make the window visible by calling GC_EVENT_CONTROL event
- with wParam = SESSION_INITDONE.
-
- 4.You will also want to send a GC_EVENT_CONTROL with wParam = SESSION_ONLINE to
- make the statusbar and the CList item go to "online" status
-
- You have now set up the session and made it active. A CList hContact has been added
- to the contact list and a chat room window is associated to the session. Send EVENTS to
- Chat users speaking, users joining and so on. See below for full
- list of what events are possible.
-
- IMPORTANT: For sending events you'll use the GCEVENT and GCDEST structures. A GCDEST
- structure pointer is passed inside GCEVENT and it tells Chat what event type it is
- and what session it is related to. The GCDEST structure and its members are ALWAYS
- used (but the members can be NULL in some occasions). Depending on what type of event
- you are sending, the members of GCEVENT have different usage. Each event and how to
- use the members are discussed below. The "bAddToLog" and "time" members are always valid
- and always mean the same. bAddToLog = TRUE means that the event is added to the disk log
- (at least when this makes sense). This can be used by Jabber for instance, when
- it needs to add channel history to the window, but without logging to disk.
- The "time" member is the timestamp of the event.(Tip. use the function time(NULL)
- to set the current time)
-
- NOTE. It is possible to send formatted text (bold, italics, underlined, foreground color
- and background color) to Chat by using the following identifiers in the text (pszText):
-
- %cXX - set the foreground color ( XX is the zero based decimal index of the color registered in MS_GC_REGISTER.. Always use two digits )
- %C - reset foreground color to default
- %fXX - set the background color ( XX is the zero based decimal index of the color registered in MS_GC_REGISTER.. Always use two digits )
- %F - reset the background color to default
- %b - enable bold
- %B - disable bold
- %u - enable underlined
- %U - disable underlined
- %i - enable italics
- %I - disable italics
- %r - reset all to default
- %% - escape the formatting. Translates to %
-
- IMPORTANT. If you have specified GC_COLOR or GC_BKGCOLOR when you registered you can expect to
- get these identifiers in the text you receive from Chat as well. Make sure % is ALWAYS
- translated to %% in text you send to Chat to avoid accidental formatting.
- NOTE. You will not get %cRRRGGGBBB back, instead you will get the index of the colour as
- registered with GC_REGISTER. Eg %c3 (the fourth colour of your index)
-
- * Use MS_GC_EVENT like this: CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce;
-
- * returns 0 on success or error code on failure
-}
-
-// * List of possible events to send to Chat. Unlisted members are not valid *
-// * for the event. Listed members are mandatory unless otherwise specified *
-
-
-// GC_EVENT_JOIN - "<pszNick> has joined" (A user is joining the session)
-// pszNick - Display name
-// pszUID - Unique identifier of the user
-// pszStatus - Which status does the user have. Should be a status previously
-// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
-// bIsMe - Set to TRUE if it is the Miranda user
-// Chat needs to know which user in the userlist that is "self"
-// It cannot highlight a message containing the "own" nick without this info
-// NOTE. if time == NULL, then the event will not be shown in the message log
- GC_EVENT_JOIN = $0001;
-
-// GC_EVENT_PART - "<pszNick> has left: <pszText>" (A user left the session)
-// pszNick - Display name
-// pszUID - Unique identifier
-// pszText - Optional part message, can be NULL
- GC_EVENT_PART = $0002;
-
-// GC_EVENT_QUIT - "<pszNick> disconnected: pszText" (A user disconnected from the network)
-// pszID(in GCDEST) - Should be NULL as a disconnect event is global.
-// pszNick - Display name
-// pszUID - Unique identifier
-// pszText - Optional disconnect message, can be NULL
- GC_EVENT_QUIT = $0004;
-
-// GC_EVENT_KICK - "<pszStatus> kicked <pszNick>: <pszText>" (A user is kicking another user from the room)
-// pszNick - Display name of the one being being kicked
-// pszUID - Unique identifier of the one being kicked
-// pszStatus - Name of user who is doing the kicking
-// pszText - Optional kick message, can be NULL
- GC_EVENT_KICK = $0008;
-
-// GC_EVENT_NICK - "<pszNick> is now known as <pszText>" (A user changed his name)
-// NOTE, see GC_EVENT_CHUID also
-// pszID(in GCDEST) - Should be NULL as a nick change event is global.
-// pszNick - Old display name
-// pszUID - Unique identifier
-// pszText - New display name of the user. Color codes are not valid
- GC_EVENT_NICK = $0010;
-
-// GC_EVENT_NOTICE - "Notice from <pszNick>: <pszText>" (An IRC type notice)
-// pszID(in GCDEST) - Should be NULL to send to the active window
-// pszNick - Display name
-// pszUID - Unique identifier
-// pszText - Notice text
- GC_EVENT_NOTICE = $0020;
-
-// GC_EVENT_MESSAGE - "<pszNick>: <pszText> (A user is speaking)
-// pszNick - Display name
-// pszUID - Unique identifier
-// bIsMe - Set to TRUE if it is the Miranda user
-// pszText - Message text.
- GC_EVENT_MESSAGE = $0040;
-
-// GC_EVENT_TOPIC - "Topic is <pszText> (Set by: <pszNick>" (The room topic was changed/set)
-// pszNick - Optional display name of who set the topic, can be NULL
-// pszUID - Optional unique identifier of who set the topic, can be NULL
-// pszText - Topic text
- GC_EVENT_TOPIC = $0080;
-
-// GC_EVENT_INFORMATION (Informational text) Ex a server response to a /WHO command in IRC
-// pszID(in GCDEST) - NULL to send to the active window
-// pszText - Information text
- GC_EVENT_INFORMATION = $0100;
-
-// GC_EVENT_ACTION - "<pszNick> <pszText>" (An IRC Style action event)
-// pszNick - Display name
-// pszUID - Unique identifier
-// bIsMe - Set to TRUE if it is the Miranda user
-// pszText - Message text.
- GC_EVENT_ACTION = $0200;
-
-// GC_EVENT_ADDSTATUS - "<pszText> enables '<pszStatus>' for <pszNick>" (A status change has occured for a user)
-// NOTE. Status changes are cumulative. The user will show in the nicklist with the highest status received.
-// Ex, IRC users can have "Op" and "Voice" statuses simultaneously but s/he will be displayed as "Op"
-// pszNick - Display name of the one who receives a new status
-// pszUID - Unique identifier of the one who receives a new status
-// pszText - The display name of the one who is setting the status. Color codes are not valid
-// pszStatus - The status. Should be a status previously
-// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
- GC_EVENT_ADDSTATUS = $0400;
-
-// GC_EVENT_REMOVESTATUS - "<pszText> disables '<pszStatus>' for <pszNick>" (A status change has occured for a user)
-// NOTE. Status changes are cumulative. The user will show in the nicklist with the highest status received.
-// Ex, IRC users can have "Op" and "Voice" statuses simultaneously but s/he will be displayed as "Op"
-// pszNick - Display name of the one who got a status mode disabled
-// pszUID - Unique identifier of the one who got a status mode disabled
-// pszText - The display name of the one disabling the status. Color codes are not valid
-// pszStatus - The status. Should be a status previously
-// registered with GC_EVENT_ADDGROUP. Ex "Voice" in IRC
- GC_EVENT_REMOVESTATUS = $0800;
-
-// 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
- GC_EVENT_CHUID = $1000;
-
-// GC_EVENT_CHANGESESSIONAME - not shown in the log (Change the display name of a session)
-// pszText - The new name. Color codes are not valid
- GC_EVENT_CHANGESESSIONAME = $1001;
-
-// 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.
- GC_EVENT_ADDGROUP = $1002;
-
-// 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
- GC_EVENT_SETITEMDATA = $1003;
- GC_EVENT_GETITEMDATA = $1004;
-
-// 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
- GC_EVENT_SETSBTEXT = $1006;
-
-// GC_EVENT_ACK - not shown in the log (Acknowledge a outgoing message, when GC_ACKMSG is set
- GC_EVENT_ACK = $1007;
-
-// 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
- GC_EVENT_SENDMESSAGE = $1008;
-
-// 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
-
- GC_SSE_ONLYLISTED = $0001; // processes only listed contacts, resets all contacts otherwise
- GC_SSE_ONLINE = $0002; // displays a contact online, otherwise away
- GC_SSE_TABDELIMITED = $0004; // use tabs as delimiters
- GC_SSE_OFFLINE = $0008; // displays a contact offline, otherwise away
-
- GC_EVENT_SETSTATUSEX = $1009;
-
-
-// GC_EVENT_SETCONTACTSTATUS - sets status icon for contact
-// pszUID - Unique identifier of the one who receives a new status
-// pszStatus - (dword)ID_STATUS_* or zero to remove status icon
- GC_EVENT_SETCONTACTSTATUS = $100A;
-
-// 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
- SESSION_INITDONE = 1; //send this when the session is fully set up (all users have ben added to the nicklist)
- SESSION_TERMINATE = 7; //send to terminate a session and close the window associated with it
- SESSION_OFFLINE = 8; //send to set the session as "online" (hContact is set to Online etc)
- SESSION_ONLINE = 9; //send to set the session as "offline" (hContact is set to Offline etc)
-//------------
- WINDOW_VISIBLE = 2; //make the room window visible
- WINDOW_HIDDEN = 3; //close the room window. Session is not terminated.
- WINDOW_MAXIMIZE = 4; //make the room window maximized
- WINDOW_MINIMIZE = 5; //make the room window minimized
- WINDOW_CLEARLOG = 6; //clear the log of the room window
-
- GC_EVENT_CONTROL = $1005;
-
-// Error messages
- GC_EVENT_WRONGVER = 1; //You appear to be using the wrong version of this API.
- GC_EVENT_ERROR = 2; //An internal error occurred.
-
-// The GCDEST structure. It is passed to Chat inside GCEVENT.
-type
- PGCDEST = ^TGCDEST;
- TGCDEST = record
- pszModule:PAnsiChar; //Name of the protocol (same as you registered with)
- szID :TCHAR; //Unique identifier of the session, or NULL to broadcast to all sessions as specified above
- iType :int; //Use GC_EVENT_* as defined above. Only one event per service call.
- end;
-
-// The GCEVENT structure
-type
- TGCEVENT = record
- cbSize :int; // Set to sizeof(GCEVENT);
- pDest :PGCDEST; // pointer to a GCDEST structure which specifies the session to receive the event
- szText :TCHAR; // usage depends on type of event, max 2048 characters
- szNick :TCHAR; // usage depends on type of event
- szUID :TCHAR; // usage depends on type of event, Do NOT use spaces for unique user identifiers.
- szStatus :TCHAR; // usage depends on type of event
- szUserInfo:TCHAR; // Additional user information that is displayed after the nickname.
- // IRC use it to display a hostmask for JOIN, PART (and more) events.
- bIsMe :bool; // Is this event from the Miranda user?
- dwFlags :dword; // event flags: GCEF_ADDTOLOG, GC_UNICODE
-
- // FALSE any other time than when initializing the window (before sending SESSION_INITDONE)
- dwItemData:int_ptr; // User specified data.
- time :dword; // Timestamp of the event
- end;
-
-const
- MS_GC_EVENT:PAnsiChar = 'GChat/NewEvent';
-
-// 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
- ME_GC_HOOK_EVENT:PAnsiChar = 'GChat/HookEvent';
-
-
- GCEF_ADDTOLOG = $0001;
- GCEF_REMOVECONTACT = $0002;
-// Added in Miranda NG 0.94.4+
- GCEF_NOTNOTIFY = $0004;
-
-// OK! That was about everything that you need to know about for operating Chat in a basic way.
-// There are however some more things you will need to know about. Some you may use and some you may not need,
-
-{
- -- GETTING info about a SESSION or session data --
-
- Use this service to get information on different aspects of the sessions that are registered with Chat.
-
- * Use MS_GC_GETINFO like this: CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)(AnsiChar *) pszModule);
-
- * returns -1 on failure and the sessioncount on success
-}
- MS_GC_GETSESSIONCOUNT:PAnsiChar = 'GChat/GetCount';
-
-{
- -- GETTING info about a SESSION or session data --
-
- Use this service to get information on different aspects of the sessions that are registered with Chat.
-
- * Use MS_GC_GETINFO like this: CallService(MS_GC_GETINFO, 0, (LPARAM)(GC_INFO *) &gci;
-
- * returns 0 on success or error code on failure
-}
-
-// Flags
- GCF_BYINDEX = $0001; // iItem is valid and should contain the index of the session to get
- GCF_BYID = $0002; // pszID is valid and should contain the ID of the session to get. This is the default if no
- GCF_HCONTACT = $0004; // hContact is valid
- GCF_DATA = $0008; // wItemData is valid
- GCF_ID = $0010; // pszID is valid.
- GCF_NAME = $0020; // pszName is valid
- GCF_ITYPE = $0040; // iType is valid
- GCF_COUNT = $0080; // iCount is valid
- GCF_USERS = $0100; // pszUsers is valid
-
-// The GC_INFO structure
-type
- TGC_INFO = record
- Flags :dword; // use a combination of the above flags
- iItem :int; // session type (GCW_*)
- iType :int; // session type (GCW_*)
- pszModule :PAnsiChar; // the module name as registered in MS_GC_REGISTER
- pszID :TCHAR; // unique ID of the session
- pszName :TCHAR; // display name of the session
- dwItemData:int_ptr; // user specified data.
- iCount :int; // count of users in the nicklist
- pszUsers :PAnsiChar; // space separated string containing the UID's of the users in the user list.
- // NOTE. Use Mirandas mmi_free() on the returned string.
- hContact :TMCONTACT; // hContact for the session (can be NULL)
- end;
-
-const
- MS_GC_GETINFO:PAnsiChar = 'GChat/GetInfo';
-
-//------------------------- HOOKS ------------------------
-{
- -- user interaction --
- Hook this to receive notifications about when user take actions in a chat room window.
- Check for the below flags to find out what type of user interaction it is. See the
- to find out which members of GCHOOK that are valid.
-
- * wParam=0
- * lParam=(LPARAM)(GCEVENT *)pgch
-
- * Returning nonzero from your hook will stop other hooks from being called.
-}
- GC_USER_MESSAGE = 1; // user sent a message, with \n delimiting lines, pszText contains the text.
- GC_USER_CHANMGR = 2; // user clicked the settings button in a chat room
- GC_USER_LOGMENU = 3; // user has selected a message log menu item, dwData is valid. See ME_GC_BUILDMENU
- GC_USER_NICKLISTMENU = 4; // user has selected a userlist menu item, valid members: dwData. See ME_GC_BUILDMENU
- GC_USER_TYPNOTIFY = 5; // NOT IMPLEMENTED YET! user is typing
- GC_USER_PRIVMESS = 6; // user requests to send a private message to a user. pszUID is valid
- GC_SESSION_TERMINATE = 7; // the session is about to be terminated, the "user defined data" is passed in dwData, which can be good free'ing any allocated memory.
- GC_USER_LEAVE = 8; // user requests to leave the session
- GC_USER_CLOSEWND = 9; // user closed the window (this is usually not an indication that the protocol
- // should take action, but MSN may want to terminate the session here)
-
- ME_GC_EVENT:PAnsiChar = 'GChat/OutgoingEvent';
-
-type
- TGCHOOK = record
- pDest :PGCDEST; // pointer to a GCDEST structure which specifies from which session the hook was triggered
- szText:TCHAR; // usage depends on type of event
- szUID :TCHAR; // unique identifier, usage depends on type of event
- dwData:int_ptr; // user defined data, usage depends on type of event}
- end;
-
-{
- -- Build the pop up menus --
- The user wants to show a right click (popup) menu and your protocol should tell what
- items should be added to the menu. You should create a static array of struct gc_item's.
- When you get this notification you should set "nItems" to the number of gc_item's
- you want to show on the user's popup menu and then set the "Item" member to point to that array.
-
- * wParam=0
- * lParam=(LPARAM)(GCMENUITEM *)gcmi
-
- Returning nonzero from your hook will stop other hooks from being called.
-}
-const
-// type of item to add to the popup menu
- MENU_NEWPOPUP = 1; // add submenu
- MENU_POPUPITEM = 2; // add item to current submenu
- MENU_POPUPSEPARATOR = 3; // add separator to current submenu
- MENU_SEPARATOR = 4; // add separator to menu
- MENU_ITEM = 5; // add item
- MENU_POPUPCHECK = 6; // add checked item to current submenu
- MENU_CHECK = 7; // add checked item
- MENU_POPUPHMENU = 8; // add custom submenu to current submenu, use dwID to specify HMENU
- MENU_HMENU = 9; // add custom submenu, use dwID to specify HMENU
-
-// type of menu that is being requested
- MENU_ON_LOG = 1; // pop up menu on the message log
- MENU_ON_NICKLIST = 2; // pop up menu on the user list
-
-// contains info on a menuitem to be added
-type
- pgc_item = ^tgc_item;
- tgc_item = record
- szDesc :TCHAR; // Textual description of the menu item to add
- dwID :dword; // when/if the user selects this menu item this
- // value will be returned via the above hook, GC_USER_LOGMENU
- // or GC_USER_NICKLISTMENU. Must not be 0 and must be unique.
- uType :int; // What kind of menu item is it? Use MENU_* flags above
- bDisabled:bool; // should the menu item be shown as disabled
- end;
-
-type
- TGCMENUITEMS = record
- pszModule:PAnsiChar; // Contains the protocol name, do NOT change.
- pszID :TCHAR; // The unique identifier of the session that triggered the hook, do NOT change.
- pszUID :TCHAR; // Contains the unique identifier if Type = MENU_ON_NICKLIST. do NOT change.
- _Type :int; // Type of menu. MENU_ON_* flags used. do NOT change.
- nItems :int; // Set this to the number of menu items you want to add
- Item :pgc_item; // pointer to the first in the array of gc_item's
- end;
-
-const
- ME_GC_BUILDMENU:PAnsiChar = '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)(TCHAR*) roomID parentdat->ptszID
- lParam = (WPARAM)(TCHAR*) userID ui1->pszUID
- result (int)(TCHAR*)mir_tstrdup("tooltip text")
- returns pointer to text of tooltip and starts owns it
-}
- MS_GC_PROTO_GETTOOLTIPTEXT = '/GetChatToolTipText';
-
-{$ENDIF}
diff --git a/include/m_chat.h b/include/m_chat.h
index c7a26dbbd1..8eb96aeda8 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -121,9 +121,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
needed to make sure that the protocol obey rule 1 mentioned above, but also to
set protocol specific preferences.
- * Use MS_GC_REGISTER like this: CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr;
-
- * returns 0 on success or error code on failure.
+ returns 0 on success or error code on failure.
*/
// Flags
@@ -159,7 +157,7 @@ struct GCREGISTER
// pColors = &crCols[0];
};
-#define MS_GC_REGISTER "GChat/Register"
+EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*);
/*
Step 2. -- CREATE a new SESSION --
@@ -168,12 +166,9 @@ struct GCREGISTER
The chat room will not be shown to the user until the 'set up' phase is
completed and SESSION_INITDONE is sent. See the MS_GC_EVENT for that.
- * Use MS_GC_NEWSESSION like this: CallService(MS_GC_NEWSESSION, 0, (LPARAM)(GCSESSION *) &gcr;
-
- * returns 0 on success or error code on failure
+ returns 0 on success or error code on failure
*/
-
// Session type
#define GCW_CHATROOM 1 // the session is a dedicated multi user chat room. ex "IRC channels".
// A hContact will be added for the session
@@ -199,7 +194,7 @@ struct GCSESSION
INT_PTR dwItemData; // Set user defined data for this session. Retrieve it by using the GC_EVENT_GETITEMDATA event
};
-#define MS_GC_NEWSESSION "GChat/NewChat"
+EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *);
/*
Step 3 -- SEND an EVENT --
@@ -261,10 +256,7 @@ struct GCSESSION
NOTE. You will not get %cRRRGGGBBB back, instead you will get the index of the colour as
registered with GC_REGISTER. Eg %c3 (the fourth colour of your index)
- * Use MS_GC_EVENT like this: CallService(MS_GC_EVENT, 0, (LPARAM)(GCEVENT *) &gce;
-
- * returns 0 on success or error code on failure
-
+ returns 0 on success or error code on failure
*/
// * List of possible events to send to Chat. Unlisted members are not valid *
@@ -445,6 +437,11 @@ 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);
@@ -456,37 +453,18 @@ struct GCEVENT
LPCTSTR ptszUserInfo; //
BOOL bIsMe; // Is this event from the Miranda user?
- DWORD dwFlags; // event flags: GCEF_ADDTOLOG, GCEF_NOTNOTIFY
+ DWORD dwFlags; // event flags: GCEF_*
INT_PTR dwItemData; // User specified data.
DWORD time; // Timestamp of the event
};
-#define MS_GC_EVENT "GChat/NewEvent"
+EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT*);
// 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"
-#define GCEF_ADDTOLOG 0x0001
-#define GCEF_REMOVECONTACT 0x0002
-// Added in Miranda NG 0.94.4+
-#define GCEF_NOTNOTIFY 0x0004
-
-// OK! That was about everything that you need to know about for operating Chat in a basic way.
-// There are however some more things you will need to know about. Some you may use and some you may not need,
-
-/*
- -- GETTING info about a SESSION or session data --
-
- Use this service to get information on different aspects of the sessions that are registered with Chat.
-
- * Use MS_GC_GETINFO like this: CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)(char *) pszModule);
- * returns -1 on failure and the sessioncount on success
-*/
-
-#define MS_GC_GETSESSIONCOUNT "GChat/GetCount"
-
/*
-- GETTING info about a SESSION or session data --
Use this service to get information on different aspects of the sessions that are registered with Chat.
@@ -522,7 +500,7 @@ struct GC_INFO
MCONTACT hContact; // hContact for the session (can be NULL)
};
-#define MS_GC_GETINFO "GChat/GetInfo"
+EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO*);
//------------------------- HOOKS ------------------------
/*
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 30cc1e1115..82002a8bad 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -442,9 +442,6 @@ struct CHAT_MANAGER
extern CHAT_MANAGER *pci;
extern int hLangpack;
-__forceinline void mir_getCI(CHAT_MANAGER_INITDATA *pData)
-{
- pci = (CHAT_MANAGER*)CallService("GChat/GetInterface", hLangpack, (LPARAM)pData);
-}
+EXTERN_C MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pData = NULL, int = hLangpack);
#endif // M_CHAT_INT_H__
diff --git a/plugins/Actman/iac_inout.pas b/plugins/Actman/iac_inout.pas
index e83e62ad8f..b8effc62ae 100644
--- a/plugins/Actman/iac_inout.pas
+++ b/plugins/Actman/iac_inout.pas
@@ -289,9 +289,7 @@ begin
dbei.flags :=DBEF_SENT or DBEF_UTF;
db_event_add(hContact, @dbei);
mFreeMem(blob);
- end
- else
- SendToChat(hContact,last);
+ end;
end
else
begin
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp
index c8ef7f06c8..d615b33ea0 100644
--- a/plugins/Dropbox/src/dropbox_utils.cpp
+++ b/plugins/Dropbox/src/dropbox_utils.cpp
@@ -112,7 +112,7 @@ void CDropbox::SendToContact(MCONTACT hContact, const wchar_t *data)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszText = mir_wstrdup(data);
gce.time = time(NULL);
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ Chat_Event(WINDOW_VISIBLE, &gce);
mir_free((void*)gce.ptszText);
return;
}
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp
index eb99205312..cc0de69657 100644
--- a/plugins/MirLua/src/m_message.cpp
+++ b/plugins/MirLua/src/m_message.cpp
@@ -42,7 +42,7 @@ static int message_Send(lua_State *L)
gce.ptszText = mir_utf8decodeW(message);
gce.time = time(NULL);
- res = CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ res = Chat_Event(WINDOW_VISIBLE, &gce);
lua_pushinteger(L, res);
mir_free((void*)gce.ptszText);
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp
index 48d2c843c6..f7030c03a8 100644
--- a/plugins/MirandaG15/src/CAppletManager.cpp
+++ b/plugins/MirandaG15/src/CAppletManager.cpp
@@ -772,7 +772,7 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag
gce.ptszText = (LPTSTR)strAscii.c_str();
gce.time = time(NULL);
gce.bIsMe = true;
- CallService(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(NULL, &gce);
db_free(&dbv);
return 0;
diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp
index 60cec76e47..8d80a15948 100644
--- a/plugins/PasteIt/src/Options.cpp
+++ b/plugins/PasteIt/src/Options.cpp
@@ -409,7 +409,7 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam
}
case WM_CLOSE:
{
- OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ OptsPagesData *optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
delete optsPagesData;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
break;
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp
index 6ebee5236d..6b6a8bd599 100644
--- a/plugins/PasteIt/src/PasteIt.cpp
+++ b/plugins/PasteIt/src/PasteIt.cpp
@@ -54,6 +54,7 @@ PLUGININFOEX pluginInfo = {
static IconItem icon = { LPGEN("Paste It"), "PasteIt_main", IDI_MENU };
int hLangpack = 0;
+CHAT_MANAGER *pci;
BOOL APIENTRY DllMain(HMODULE hModule, DWORD, LPVOID)
{
@@ -146,13 +147,13 @@ void PasteIt(MCONTACT hContact, int mode)
GC_INFO gci = { 0 };
GCDEST gcd = { szProto, NULL, GC_EVENT_SENDMESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
- int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto);
+ int cnt = pci->SM_GetCount(szProto);
for (int i = 0; i < cnt; i++)
{
gci.iItem = i;
gci.pszModule = szProto;
gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID;
- CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
if (gci.hContact == hContact)
{
// In this place session was finded, gci.pszID contains
@@ -163,7 +164,7 @@ void PasteIt(MCONTACT hContact, int mode)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszText = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP);
gce.time = time(NULL);
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free((void*)gce.ptszText);
break;
}
@@ -399,6 +400,7 @@ int ModulesLoaded(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
+ pci = Chat_GetInterface();
Icon_Register(hInst, LPGEN("Paste It"), &icon, 1);
diff --git a/plugins/PasteIt/src/stdafx.h b/plugins/PasteIt/src/stdafx.h
index 959524e03e..a637e884d0 100644
--- a/plugins/PasteIt/src/stdafx.h
+++ b/plugins/PasteIt/src/stdafx.h
@@ -27,7 +27,7 @@
#include <m_protosvc.h>
#include <m_options.h>
#include <m_utils.h>
-#include <m_chat.h>
+#include <m_chat_int.h>
#include <m_msg_buttonsbar.h>
diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp
index a223f9898d..cff8723cf0 100644
--- a/plugins/Scriver/src/chat/main.cpp
+++ b/plugins/Scriver/src/chat/main.cpp
@@ -155,7 +155,7 @@ static void OnLoadSettings()
int Chat_Load()
{
CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Messaging") L"/" LPGENW("Group chats"), FONTMODE_SKIP };
- mir_getCI(&data);
+ pci = Chat_GetInterface(&data);
saveCI = *pci;
pci->OnCreateModule = OnCreateModule;
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index 61e4be2080..d80b7a016b 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -222,14 +222,14 @@ void CSend::svcSendMsgExit(const char* szMessage)
}
GC_INFO gci = { 0 };
int res = GC_RESULT_NOSESSION;
- int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_pszProto);
+ int cnt = pci->SM_GetCount(m_pszProto);
//loop on all gc session to get the right (save) ptszID for the chatroom from m_hContact
gci.pszModule = m_pszProto;
for (int i = 0; i < cnt; i++) {
gci.iItem = i;
gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID;
- CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
if (gci.hContact == m_hContact) {
GCDEST gcd = { m_pszProto, gci.pszID, GC_EVENT_SENDMESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -239,7 +239,7 @@ void CSend::svcSendMsgExit(const char* szMessage)
gce.time = time(NULL);
//* returns 0 on success or error code on failure
- res = 200 + (int)CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
+ res = 200 + (int)Chat_Event(0, &gce);
break;
}
}
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index 6866930af5..7026c4c832 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Main.h"
// Prototypes ///////////////////////////////////////////////////////////////////////////
+CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
HINSTANCE g_hSendSS;
MGLOBAL g_myGlobals;
@@ -258,6 +259,7 @@ ATOM g_clsTargetHighlighter = 0;
DLL_EXPORT int Load(void)
{
mir_getLP(&pluginInfo);
+ pci = Chat_GetInterface();
pcli = Clist_GetInterface();
INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h
index 5a079657bf..a96f88f4d1 100644
--- a/plugins/SendScreenshotPlus/src/stdafx.h
+++ b/plugins/SendScreenshotPlus/src/stdafx.h
@@ -53,7 +53,7 @@ using namespace std;
#include <msapi/vssym32.h>
#include <newpluginapi.h>
#include <m_button.h>
-#include <m_chat.h>
+#include <m_chat_int.h>
#include <m_clist.h>
#include <m_contacts.h>
#include <m_database.h>
diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp
index d1f8cb16e0..e3005afb9f 100644
--- a/plugins/TabSRMM/src/chat/main.cpp
+++ b/plugins/TabSRMM/src/chat/main.cpp
@@ -265,7 +265,7 @@ int Chat_Load()
CheckUpdate();
CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Message Sessions") L"/" LPGENW("Group chats"), FONTMODE_ALTER };
- mir_getCI(&data);
+ pci = Chat_GetInterface(&data);
saveCI = *pci;
pci->OnCreateModule = OnCreateModule;
pci->OnNewUser = OnNewUser;
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas
index d9e2e2bf7e..7e5337c8c8 100644
--- a/plugins/Utils.pas/mircontacts.pas
+++ b/plugins/Utils.pas/mircontacts.pas
@@ -45,7 +45,6 @@ function WndToContact(wnd:HWND):TMCONTACT; overload;
function WndToContact:TMCONTACT; overload;
procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boolean=true);
-procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar);
//----- List of contacts (combobox) -----
@@ -486,50 +485,6 @@ CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0);
end;
end;
-procedure SendChatText(pszID:pointer;pszModule:PAnsiChar;pszText:pointer);
-var
- gcd:TGCDEST;
- gce:TGCEVENT;
-begin
- gcd.pszModule:=pszModule;
- gcd.iType :=GC_EVENT_SENDMESSAGE;
- gcd.szID.w :=pszID;
-
- FillChar(gce,SizeOf(TGCEVENT),0);
- gce.cbSize :=SizeOf(TGCEVENT);
- gce.pDest :=@gcd;
- gce.bIsMe :=true;
- gce.szText.w:=pszText;
- gce.dwFlags :=GCEF_ADDTOLOG;
- gce.time :=GetCurrentTimeStamp;
-
- CallServiceSync(MS_GC_EVENT,0,lparam(@gce));
-end;
-
-procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar);
-var
- gci:TGC_INFO;
- pszModule:PAnsiChar;
- i,cnt:integer;
-begin
- pszModule:=GetContactProto(hContact);
- cnt:=CallService(MS_GC_GETSESSIONCOUNT,0,lparam(pszModule));
- i:=0;
- gci.pszModule:=pszModule;
- while i<cnt do
- begin
- gci.iItem:=i;
- gci.Flags:=GCF_BYINDEX+GCF_HCONTACT+GCF_ID;
- CallService(MS_GC_GETINFO,0,lparam(@gci));
- if gci.hContact=hContact then
- begin
- SendChatText(gci.pszID.w,pszModule,pszText);
- break;
- end;
- inc(i);
- end;
-end;
-
//----- List of contacts -----
const
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp
index b55359a816..25ba83707b 100644
--- a/plugins/XSoundNotify/src/xsn_main.cpp
+++ b/plugins/XSoundNotify/src/xsn_main.cpp
@@ -175,8 +175,6 @@ static int OnPlaySound(WPARAM, LPARAM)
static int OnLoadInit(WPARAM, LPARAM)
{
- mir_getCI(NULL);
-
CMenuItem mi;
SET_UID(mi, 0x5d72ca1f, 0xc52, 0x436d, 0x81, 0x47, 0x29, 0xf6, 0xc3, 0x28, 0xb5, 0xd1);
mi.position = -0x7FFFFFFF;
@@ -210,6 +208,7 @@ static int OnPreShutdown(WPARAM, LPARAM)
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfo);
+ pci = Chat_GetInterface();
pcli = Clist_GetInterface();
CreateServiceFunction("XSoundNotify/ContactMenuCommand", ShowDialog);
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index 40a59adea1..2fcd8ee38f 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -28,7 +28,7 @@ void CAimProto::chat_register(void)
gcr.pColors = (COLORREF*)crCols;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CAimProto::OnGCEvent);
HookProtoEvent(ME_GC_BUILDMENU, &CAimProto::OnGCMenuHook);
@@ -43,21 +43,21 @@ void CAimProto::chat_start(const char* id, unsigned short exchange)
gcw.pszModule = m_szModuleName;
gcw.ptszName = idt;
gcw.ptszID = idt;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = TranslateT("Me");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_ADDGROUP;
gce.ptszStatus = TranslateT("Others");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Event(WINDOW_VISIBLE, &gce);
setWord(find_chat_contact(id), "Exchange", exchange);
@@ -83,7 +83,7 @@ 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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(snt);
mir_free(idt);
@@ -96,8 +96,8 @@ void CAimProto::chat_leave(const char* id)
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
gce.pDest = &gcd;
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
mir_free(idt);
}
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index a41fed1c54..b487f4a2e1 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -48,7 +48,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
}
gce.ptszNick = tnick;
gce.ptszUID = tid;
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
facy.erase_reader(ChatIDToHContact(chat_id));
}
@@ -61,7 +61,7 @@ void FacebookProto::RenameChat(const char *chat_id, const char *name)
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszText = tname;
- CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam)
@@ -199,7 +199,7 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa
}
}
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const char *name)
@@ -220,7 +220,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const
gce.time = ::time(NULL);
gce.bIsMe = false;
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
/** Caller must free result */
@@ -232,7 +232,7 @@ char *FacebookProto::GetChatUsers(const char *chat_id)
gci.Flags = GCF_USERS;
gci.pszModule = m_szModuleName;
gci.pszID = ptszChatID;
- CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
// mir_free(gci.pszUsers);
return gci.pszUsers;
@@ -254,7 +254,7 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname)
gcw.ptszID = tid;
gcw.pszModule = m_szModuleName;
gcw.ptszName = tname;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
// Send setting events
GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP };
@@ -262,13 +262,13 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname)
// Create a user statuses
gce.ptszStatus = TranslateT("Myself");
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
gce.ptszStatus = TranslateT("Friend");
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
gce.ptszStatus = TranslateT("User");
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
gce.ptszStatus = TranslateT("Former");
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
// Finish initialization
gcd.iType = GC_EVENT_CONTROL;
@@ -276,8 +276,8 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname)
gce.pDest = &gcd;
bool hideChats = getBool(FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS);
- CallServiceSync(MS_GC_EVENT, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event((hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM)
@@ -346,8 +346,8 @@ INT_PTR FacebookProto::OnLeaveChat(WPARAM wParam, LPARAM)
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
if (!wParam) {
facy.clear_chatrooms();
@@ -438,15 +438,15 @@ void FacebookProto::PrepareNotificationsChatRoom() {
gcw.ptszID = _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM);
gcw.pszModule = m_szModuleName;
gcw.ptszName = nameT;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ 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);
- CallServiceSync(MS_GC_EVENT, WINDOW_HIDDEN, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(WINDOW_HIDDEN, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
}
@@ -472,5 +472,5 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
gce.ptszNick = TranslateT("Notifications");
gce.ptszUID = idT;
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
} \ No newline at end of file
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index aac1821f0e..38a0c958b1 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -489,7 +489,7 @@ int FacebookProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.iMaxText = FACEBOOK_MESSAGE_LIMIT;
gcr.nColors = 0;
gcr.pColors = NULL;
- CallService(MS_GC_REGISTER, 0, reinterpret_cast<LPARAM>(&gcr));
+ Chat_Register(&gcr);
return 0;
}
@@ -750,7 +750,7 @@ INT_PTR FacebookProto::VisitNotifications(WPARAM, LPARAM)
if (useChatRoom) {
GCDEST gcd = { m_szModuleName, _T(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(WINDOW_VISIBLE, &gce);
}
else {*/
OpenUrl(FACEBOOK_URL_NOTIFICATIONS);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index ffce72b6b5..724b242aa1 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(messageT);
mir_free(nickT);
}
@@ -1286,8 +1286,8 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM)
free(chat->recipients);
list_remove(&chats, chat, 1);
// Terminate chat window / shouldn't cascade entry is deleted
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
}
db_free(&dbv);
@@ -1359,7 +1359,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
debugLogA("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal);
// Mark cascading
/* FIXME */ cascade = 1;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
/* FIXME */ cascade = 0;
}
db_free(&dbv);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 65db400791..892fcaad0a 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -30,24 +30,20 @@
//
int GGPROTO::gc_init()
{
- if (ServiceExists(MS_GC_REGISTER)) {
- char service[64];
+ char service[64];
- // Register Gadu-Gadu proto
- GCREGISTER gcr = { sizeof(gcr) };
- gcr.ptszDispName = m_tszUserName;
- gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ // Register Gadu-Gadu proto
+ GCREGISTER gcr = { sizeof(gcr) };
+ gcr.ptszDispName = m_tszUserName;
+ gcr.pszModule = m_szModuleName;
+ Chat_Register(&gcr);
- HookProtoEvent(ME_GC_EVENT, &GGPROTO::gc_event);
-
- gc_enabled = TRUE;
- // create & hook event
- mir_snprintf(service, GG_GC_GETCHAT, m_szModuleName);
- debugLogA("gc_init(): Registered with groupchat plugin.");
- }
- else debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
+ HookProtoEvent(ME_GC_EVENT, &GGPROTO::gc_event);
+ gc_enabled = TRUE;
+ // create & hook event
+ mir_snprintf(service, GG_GC_GETCHAT, m_szModuleName);
+ debugLogA("gc_init(): Registered with groupchat plugin.");
return 1;
}
@@ -174,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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(nickT);
T2Utf pszText_utf8(gch->ptszText);
@@ -329,7 +325,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
gcwindow.ptszName = name;
// Create new room
- if (CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM) &gcwindow)) {
+ if (Chat_NewSession( &gcwindow)) {
debugLogW(L"gc_getchat(): Cannot create new chat window %s.", chat->id);
free(name);
free(chat);
@@ -344,7 +340,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
// Add normal group
gce.ptszStatus = TranslateT("Participants");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_JOIN;
// Add myself
@@ -362,7 +358,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
gce.ptszNick = nickT;
gce.bIsMe = 1;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(nickT);
debugLogW(L"gc_getchat(): Myself %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus);
}
@@ -387,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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
debugLogW(L"gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
@@ -486,7 +482,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
{
GCDEST gcd = { gg->m_szModuleName, chat, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ Chat_Event(WINDOW_VISIBLE, &gce);
}
free(participants);
}
@@ -642,7 +638,7 @@ int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick)
gce.ptszText = ptszNick;
debugLogW(L"gc_changenick(): Found room %s with uin %d, sending nick change %s.", chat->id, uin, id);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
break;
}
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 6b369de31f..b291319818 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -96,13 +96,13 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD)
CMStringW name = GetWord(ppro->m_channelsToWho.c_str(), 0);
if (name.IsEmpty()) {
ppro->m_channelsToWho = L"";
- int count = (int)CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)ppro->m_szModuleName);
+ int count = pci->SM_GetCount(ppro->m_szModuleName);
for (int i = 0; i < count; i++) {
GC_INFO gci = { 0 };
gci.Flags = GCF_BYINDEX | GCF_NAME | GCF_TYPE | GCF_COUNT;
gci.iItem = i;
gci.pszModule = ppro->m_szModuleName;
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM)
+ if (!Chat_GetInfo(&gci) && gci.iType == GCW_CHATROOM)
if (gci.iCount <= ppro->m_onlineNotificationLimit)
ppro->m_channelsToWho += CMStringW(gci.pszName) + L" ";
}
@@ -376,7 +376,7 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage* pmsg)
if (pmsg->prefix.sNick == m_info.sNick) {
GCDEST gcd = { m_szModuleName, NULL, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, (LPARAM)&gce);
+ CallChatEvent(SESSION_OFFLINE, &gce);
}
}
else ShowMessage(pmsg);
@@ -393,7 +393,7 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage* pmsg)
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, (LPARAM)&gce);
+ CallChatEvent(SESSION_OFFLINE, &gce);
}
}
else ShowMessage(pmsg);
@@ -412,7 +412,7 @@ bool CIrcProto::OnIrc_KICK(const CIrcMessage* pmsg)
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, (LPARAM)&gce);
+ CallChatEvent(SESSION_OFFLINE, &gce);
if (m_rejoinIfKicked) {
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, pmsg->parameters[0].c_str(), NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
@@ -626,7 +626,7 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg)
str.Delete(0, 1);
CMStringW Wnd = MakeWndID(str.c_str());
gci.pszID = Wnd.c_str();
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM)
+ if (!Chat_GetInfo(&gci) && gci.iType == GCW_CHATROOM)
S2 = GetWord(gci.pszID, 0);
else
S2 = L"";
@@ -1278,7 +1278,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
gcw.ptszID = sID.c_str();
gcw.pszModule = m_szModuleName;
gcw.ptszName = sChanName;
- if (!CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw)) {
+ if (!Chat_NewSession(&gcw)) {
DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, sID.c_str(), GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -1287,17 +1287,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
// register the statuses
gce.ptszStatus = L"Owner";
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &gce);
gce.ptszStatus = L"Admin";
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &gce);
gce.ptszStatus = L"Op";
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &gce);
gce.ptszStatus = L"Halfop";
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &gce);
gce.ptszStatus = L"Voice";
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &gce);
gce.ptszStatus = L"Normal";
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &gce);
{
int k = 0;
CMStringW sTemp = GetWord(sNamesList.c_str(), k);
@@ -1333,7 +1333,7 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
}
gce.bIsMe = bIsMe;
gce.time = bIsMe ? time(0) : 0;
- CallChatEvent(0, (LPARAM)&gce);
+ CallChatEvent(0, &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") {
@@ -1407,17 +1407,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
save += GetWordAddress(dbv.ptszVal, k);
switch (command[0]) {
case 'M':
- CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
+ CallChatEvent(WINDOW_HIDDEN, &gce);
break;
case 'X':
- CallChatEvent(WINDOW_MAXIMIZE, (LPARAM)&gce);
+ CallChatEvent(WINDOW_MAXIMIZE, &gce);
break;
default:
- CallChatEvent(SESSION_INITDONE, (LPARAM)&gce);
+ CallChatEvent(SESSION_INITDONE, &gce);
break;
}
}
- else CallChatEvent(SESSION_INITDONE, (LPARAM)&gce);
+ else CallChatEvent(SESSION_INITDONE, &gce);
if (save.IsEmpty())
db_unset(NULL, m_szModuleName, "JTemp");
@@ -1425,11 +1425,11 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
setWString("JTemp", save.c_str());
db_free(&dbv);
}
- else CallChatEvent(SESSION_INITDONE, (LPARAM)&gce);
+ else CallChatEvent(SESSION_INITDONE, &gce);
gcd.iType = GC_EVENT_CONTROL;
gce.pDest = &gcd;
- CallChatEvent(SESSION_ONLINE, (LPARAM)&gce);
+ CallChatEvent(SESSION_ONLINE, &gce);
}
}
}
@@ -2283,7 +2283,7 @@ void CIrcProto::OnIrcDisconnected()
GCDEST gcd = { m_szModuleName, 0, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_OFFLINE, (LPARAM)&gce);
+ CallChatEvent(SESSION_OFFLINE, &gce);
if (!Miranda_Terminated())
CList_SetAllOffline(m_disconnectDCCChats);
@@ -2344,13 +2344,13 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*)
}
if (m_rejoinChannels) {
- int count = CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_szModuleName);
+ int count = pci->SM_GetCount(m_szModuleName);
for (int i = 0; i < count; i++) {
GC_INFO gci = { 0 };
gci.Flags = GCF_BYINDEX | GCF_DATA | GCF_NAME | GCF_TYPE;
gci.iItem = i;
gci.pszModule = m_szModuleName;
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM) {
+ if (!Chat_GetInfo(&gci) && gci.iType == GCW_CHATROOM) {
CHANNELINFO *wi = (CHANNELINFO*)gci.dwItemData;
if (wi && wi->pszPassword)
PostIrcMessage(L"/JOIN %s %s", gci.pszName, wi->pszPassword);
@@ -2364,7 +2364,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*)
{
GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_ONLINE, (LPARAM)&gce);
+ CallChatEvent(SESSION_ONLINE, &gce);
}
CallFunctionAsync(sttMainThrdOnConnect, this);
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index cbe0852a7c..6cc5de8669 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -221,7 +221,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
if (m_useServer) {
GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN, (LPARAM)&gce);
+ CallChatEvent(command == L"/servershow" ? WINDOW_VISIBLE : WINDOW_HIDDEN, &gce);
}
return true;
}
@@ -252,7 +252,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(WINDOW_CLEARLOG, (LPARAM)&gce);
+ CallChatEvent(WINDOW_CLEARLOG, &gce);
return true;
}
@@ -368,7 +368,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
gci.Flags = GCF_BYID | GCF_NAME | GCF_COUNT;
gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
+ if (!Chat_GetInfo(&gci))
mir_snwprintf(szTemp, L"users: %u", gci.iCount);
DoEvent(GC_EVENT_INFORMATION, NULL, m_info.sNick.c_str(), szTemp, NULL, NULL, NULL, true, false);
@@ -477,7 +477,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
CMStringW S = MakeWndID(window);
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
+ CallChatEvent(SESSION_TERMINATE, &gce);
PostIrcMessage(L"/JOIN %s", GetWordAddress(text, 1));
return true;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index a7befd3419..c625469aec 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -199,7 +199,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.pColors = colors;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
@@ -209,14 +209,14 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
gcw.ptszID = SERVERWINDOW;
gcw.pszModule = m_szModuleName;
gcw.ptszName = NEWWSTR_ALLOCA((wchar_t*)_A2T(m_network));
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
if (m_useServer && !m_hideServerWindow)
- CallChatEvent(WINDOW_VISIBLE, (LPARAM)&gce);
+ CallChatEvent(WINDOW_VISIBLE, &gce);
else
- CallChatEvent(WINDOW_HIDDEN, (LPARAM)&gce);
+ CallChatEvent(WINDOW_HIDDEN, &gce);
wchar_t szTemp[MAX_PATH];
mir_snwprintf(szTemp, L"%%miranda_path%%\\Plugins\\%S_perform.ini", m_szModuleName);
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp
index b19e245e13..4629c9fa31 100644
--- a/protocols/IRCG/src/main.cpp
+++ b/protocols/IRCG/src/main.cpp
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "version.h"
+CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
HINSTANCE hInst = NULL;
@@ -90,6 +91,7 @@ static int ircProtoUninit(CIrcProto *ppro)
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfo);
+ pci = Chat_GetInterface();
pcli = Clist_GetInterface();
InitIcons();
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index a2586f1258..e4ef002172 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -147,7 +147,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
gci.Flags = GCF_BYID | GCF_COUNT;
gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
+ if (!Chat_GetInfo(&gci)) {
wchar_t szTemp[40];
mir_snwprintf(szTemp, L"%u", gci.iCount);
sOutput = szTemp;
@@ -159,12 +159,12 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
gci.Flags = GCF_BYID | GCF_USERS;
gci.pszModule = m_szModuleName;
gci.pszID = S.c_str();
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
+ if (!Chat_GetInfo(&gci))
return (INT_PTR)mir_strdup(gci.pszUsers);
}
else if (sRequest == "channellist") {
CMStringW S = L"";
- int n = CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_szModuleName);
+ int n = pci->SM_GetCount(m_szModuleName);
if (n >= 0) {
int j = 0;
while (j < n) {
@@ -172,7 +172,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam)
gci.Flags = GCF_BYINDEX | GCF_ID;
gci.pszModule = m_szModuleName;
gci.iItem = j;
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) {
+ if (!Chat_GetInfo(&gci)) {
if (mir_wstrcmpi(gci.pszID, SERVERWINDOW)) {
CMStringW S1 = gci.pszID;
int k = S1.Find(L" ");
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index e97a5abae5..5c208d2ec5 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -35,7 +35,7 @@ void CIrcProto::InitMainMenus(void)
if (m_iStatus != ID_STATUS_OFFLINE) mi.flags |= CMIF_GRAYED;
mi.name.a = LPGEN("&Join channel");
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN);//GetIconHandle(IDI_JOIN);
+ mi.hIcolibItem = Skin_GetIconHandle(SKINICON_CHAT_JOIN);
mi.pszService = IRC_JOINCHANNEL;
mi.position = 201002;
hMenuJoin = Menu_AddProtoMenuItem(&mi, m_szModuleName);
@@ -208,7 +208,7 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM)
S = SERVERWINDOW;
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- int i = CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
+ int i = CallChatEvent(SESSION_TERMINATE, &gce);
if (i && type == GCW_CHATROOM)
PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
}
@@ -253,7 +253,7 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM)
CMStringW S = MakeWndID(dbv.ptszVal);
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
+ CallChatEvent(SESSION_TERMINATE, &gce);
}
db_free(&dbv);
}
@@ -369,7 +369,7 @@ INT_PTR __cdecl CIrcProto::OnShowServerMenuCommand(WPARAM, LPARAM)
{
GCDEST gcd = { m_szModuleName, SERVERWINDOW, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(WINDOW_VISIBLE, (LPARAM)&gce);
+ CallChatEvent(WINDOW_VISIBLE, &gce);
return 0;
}
@@ -535,7 +535,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
S = MakeWndID(p1);
GCDEST gcd = { m_szModuleName, S.c_str(), GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
+ CallChatEvent(SESSION_TERMINATE, &gce);
}
break;
case 4: // show server window
@@ -1068,7 +1068,7 @@ void CIrcProto::DisconnectFromServer(void)
GCDEST gcd = { m_szModuleName, 0, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallChatEvent(SESSION_TERMINATE, (LPARAM)&gce);
+ CallChatEvent(SESSION_TERMINATE, &gce);
ForkThread(&CIrcProto::DisconnectServerThread, 0);
}
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index 4e8670af7f..e3190007ca 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -54,6 +54,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "m_skin.h"
#include "m_netlib.h"
#include "m_langpack.h"
+#include "m_chat_int.h"
#include "m_message.h"
#include "m_userinfo.h"
#include "m_addcontact.h"
@@ -61,7 +62,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "m_genmenu.h"
#include "m_file.h"
#include "m_ignore.h"
-#include "m_chat.h"
+#include "m_chat_int.h"
#include "m_icolib.h"
#include "m_string.h"
#include "win2k.h"
@@ -361,9 +362,9 @@ struct CIrcProto : public PROTO<CIrcProto>
bool CList_SetAllOffline(BYTE ChatsToo);
MCONTACT CList_SetOffline(CONTACT *user);
- bool CList_AddEvent(CONTACT *user, HICON Icon, HANDLE event, const char *tooltip, int type ) ;
+ 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) ;
+ BOOL CList_AddDCCChat(const CMStringW &name, const CMStringW &hostmask, unsigned long adr, int port);
//commandmonitor.cpp
UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3;
@@ -374,7 +375,7 @@ struct CIrcProto : public PROTO<CIrcProto>
void __cdecl ResolveIPThread(void *di);
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(const CMStringW &nick, const CMStringW &address, const CMStringW &host, char type);
int IsIgnored(CMStringW user, char type);
bool RemoveIgnore(const wchar_t *mask) ;
@@ -441,7 +442,7 @@ struct CIrcProto : public PROTO<CIrcProto>
//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, LPARAM lParam);
+ 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);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index eb3068d7de..c3a1c1e1a1 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -376,9 +376,9 @@ wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplaceP
return szTemp;
}
-INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, LPARAM lParam)
+INT_PTR CIrcProto::CallChatEvent(WPARAM wParam, GCEVENT *lParam)
{
- return CallServiceSync(MS_GC_EVENT, wParam, (LPARAM)lParam);
+ return Chat_Event(wParam, lParam);
}
INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t* pszNick,
@@ -427,7 +427,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
else
gce.time = timestamp;
gce.bIsMe = bIsMe;
- return CallChatEvent(0, (LPARAM)&gce);
+ return CallChatEvent(0, &gce);
}
CMStringW CIrcProto::ModeToStatus(int sMode)
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 025b0c4125..ff4ec8afe3 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -183,15 +183,13 @@ extern "C" int __declspec(dllexport) Load()
{
// set the memory, lists & utf8 managers
mir_getLP(&pluginInfo);
+ pci = Chat_GetInterface();
pcli = Clist_GetInterface();
- mir_getCI(NULL);
- {
- INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
- if (FIP == NULL || result != S_OK) {
- MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Jabber Protocol will be disabled."), L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
- return 1;
- }
+ INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP);
+ if (FIP == NULL || result != S_OK) {
+ MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Jabber Protocol will be disabled."), L"Error", MB_OK | MB_ICONERROR | MB_APPLMODAL, 0);
+ return 1;
}
WORD v[4];
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index a3c53cd3ce..32e353d586 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -133,7 +133,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
gcw.pszModule = m_szModuleName;
gcw.ptszName = szNick;
gcw.ptszID = item->jid;
- CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
GCSessionInfoBase *si = pci->SM_FindSession(item->jid, m_szModuleName);
if (si != NULL) {
@@ -171,12 +171,12 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item)
GCEVENT gce = { sizeof(gce), &gcd };
for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateW(sttStatuses[i]);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, (item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event((item->bAutoJoin && m_options.AutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
return 0;
}
@@ -249,7 +249,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
gce.ptszText = buf;
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(0);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
}
@@ -308,7 +308,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
}
}
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
if (statusToSet != 0) {
gce.ptszText = nick;
@@ -317,12 +317,12 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
else
gce.dwItemData = 1;
gcd.iType = GC_EVENT_SETSTATUSEX;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gce.ptszUID = resource;
gce.dwItemData = statusToSet;
gcd.iType = GC_EVENT_SETCONTACTSTATUS;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
}
@@ -346,7 +346,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason)
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = item->jid;
gce.ptszText = XmlGetText(reason);
- CallServiceSync(MS_GC_EVENT, (code == 200) ? SESSION_TERMINATE : SESSION_OFFLINE, (LPARAM)&gce);
+ Chat_Event((code == 200) ? SESSION_TERMINATE : SESSION_OFFLINE, &gce);
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 433414bb59..6e6306ab66 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -802,13 +802,13 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *
if (jid != NULL)
gce.ptszUserInfo = jid;
gce.time = time(0);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_NICK;
gce.ptszNick = oldNick;
gce.ptszUID = newNick;
gce.ptszText = newNick;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
void CJabberProto::GroupchatProcessPresence(HXML node)
@@ -1123,14 +1123,14 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
if (m_options.GcLogChatHistory && isHistory)
gce.dwFlags |= GCEF_NOTNOTIFY;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
item->bChatActive = 2;
if (gcd.iType == GC_EVENT_TOPIC) {
gce.dwFlags &= ~GCEF_ADDTOLOG;
gcd.iType = GC_EVENT_SETSBTEXT;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index d2c836869d..597c513f64 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -450,7 +450,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
if (p)
*p = 0;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
db_unset(hContact, "CList", "Hidden");
chatRooms.insert((HANDLE)hContact);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 6922e35a59..b97423b7dc 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -223,7 +223,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM)
gcr.pColors = &crCols[0];
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CJabberProto::JabberGcEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CJabberProto::JabberGcMenuHook);
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index 9033968d25..7deb944d20 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -13,15 +13,12 @@ void CMraProto::MraChatDllError()
bool CMraProto::MraChatRegister()
{
- if (!ServiceExists(MS_GC_REGISTER))
- return FALSE;
-
GCREGISTER gcr = { sizeof(gcr) };
gcr.iMaxText = MRA_MAXLENOFMESSAGE;
gcr.nColors = 0;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CMraProto::MraChatGcEventHook);
return TRUE;
@@ -41,17 +38,17 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact)
gcw.ptszID = wszEMail;
gcw.ptszStatusbarText = L"status bar";
gcw.dwItemData = (DWORD)hContact;
- if (!CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw)) {
+ if (!Chat_NewSession(&gcw)) {
GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
for (int i = 0; i < _countof(lpwszStatuses); i++) {
gce.ptszStatus = TranslateW(lpwszStatuses[i]);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
DWORD opcode = MULTICHAT_GET_MEMBERS;
CMStringA szEmail;
@@ -75,8 +72,8 @@ void CMraProto::MraChatSessionDestroy(MCONTACT hContact)
mraGetStringW(hContact, "e-mail", wszEMail);
gcd.ptszID = (LPWSTR)wszEMail.c_str();
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Event(WINDOW_CLEARLOG, &gce);
}
INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession, int iType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime)
@@ -119,7 +116,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession,
gce.ptszNick = wszUID;
}
- return CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ return Chat_Event(0, &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 ea2913deba..f7e8a33f39 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -532,7 +532,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe
gcw.ptszName = wszEMail;
gcw.ptszID = (LPWSTR)wszEMail.c_str();
- if (CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw) == 0) {
+ if (Chat_NewSession(&gcw) == 0) {
BOOL bChatAdded = FALSE;
for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
if (mraGetStringA(hContact, "ChatRoomID", szEMailLocal)) {
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index abdeac5334..386ea11a5f 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -63,19 +63,19 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
gcw.pszModule = m_szModuleName;
gcw.ptszName = szName;
gcw.ptszID = info->mChatID;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
for (int j = 0; j < _countof(m_ptszRoles); j++) {
gce.ptszStatus = m_ptszRoles[j];
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Event(WINDOW_VISIBLE, &gce);
mir_free((wchar_t*)gce.ptszUID);
return 0;
@@ -102,7 +102,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli)
else {
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
const char *pszCreator = ezxml_txt(ezxml_get(xmli, "properties", 0, "creator", -1));
@@ -148,8 +148,8 @@ 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;
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
}
void CMsnProto::MSN_Kickuser(GCHOOK *gch)
@@ -190,7 +190,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
MCONTACT hContInitiator = MSN_HContactFromEmail(initiator ? initiator->txt : NULL);
gce.ptszNick = GetContactNameT(hContInitiator);
gce.ptszText = mir_a2u(ezxml_txt(ezxml_child(xmli, "value")));
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free((wchar_t*)gce.ptszUID);
mir_free((wchar_t*)gce.ptszText);
}
@@ -247,12 +247,12 @@ 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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &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 };
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce2);
+ Chat_Event(SESSION_OFFLINE, &gce2);
break;
}
target = ezxml_next(target);
@@ -296,7 +296,7 @@ void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *emai
gce.ptszText = EscapeChatTags(p);
mir_free(p);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free((void*)gce.ptszUID);
mir_free((void*)gce.ptszText);
}
@@ -516,7 +516,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
gce.time = time(NULL);
gce.ptszText = gch->ptszText;
gce.bIsMe = TRUE;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &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 93ac87ce7c..3c29b41bd6 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -393,7 +393,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
gci.Flags = GCF_HCONTACT;
gci.pszModule = m_szModuleName;
gci.pszID = mChatID;
- CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
tContact = gci.hContact;
}
else tContact = MSN_HContactFromEmail(email, nick, true, true);
@@ -1888,7 +1888,7 @@ LBL_InvalidCommand:
gce.ptszUID = mir_a2u(data.userEmail);
gce.time = time(NULL);
gce.bIsMe = FALSE;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free((void*)gce.ptszUID);
}
@@ -1907,9 +1907,9 @@ LBL_InvalidCommand:
gce.bIsMe = FALSE;
gce.time = time(NULL);
gce.ptszText = TranslateT("This conversation has been inactive, participants will be removed.");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gce.ptszText = TranslateT("To resume the conversation, please quit this session and start a new chat session.");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
else {
if (!g_bTerminated && MessageBox(NULL,
@@ -2145,7 +2145,7 @@ LBL_InvalidCommand:
gce.ptszStatus = TranslateT("Others");
gce.time = time(NULL);
gce.bIsMe = FALSE;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &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 82808220e3..ad4ac92d1a 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -400,7 +400,7 @@ void CMsnProto::MSN_GoOffline(void)
if (getWString(hContact, "ChatRoomID", &dbv) == 0) {
GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
db_free(&dbv);
}
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index 745505288c..86b68155bc 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -209,7 +209,7 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.pColors = (COLORREF*)crCols;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CMsnProto::MSN_GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CMsnProto::MSN_GCMenuHook);
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index d41748bd84..c4e4fd0b87 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -47,7 +47,7 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
- CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam)
@@ -103,7 +103,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name)
else
gce.ptszStatus = L"Normal";
- CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0,&gce);
}
void MinecraftDynmapProto::DeleteChatContact(const char *name)
@@ -118,7 +118,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name)
gce.time = DWORD(time(0));
gce.bIsMe = (m_nick == name);
- CallServiceSync(MS_GC_EVENT,0,reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0,&gce);
}
INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress)
@@ -131,7 +131,7 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress)
gcw.ptszID = m_tszUserName;
gcw.ptszName = tszTitle;
gcw.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
if (m_iStatus == ID_STATUS_OFFLINE)
return 0;
@@ -141,10 +141,10 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress)
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = L"Admin";
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
gce.ptszStatus = L"Normal";
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
// Note: Initialization will finish up in SetChatStatus, called separately
if (!suppress)
@@ -162,7 +162,7 @@ void MinecraftDynmapProto::SetTopic(const char *topic)
gce.time = ::time(NULL);
gce.ptszText = ttopic;
- CallServiceSync(MS_GC_EVENT,0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
INT_PTR MinecraftDynmapProto::OnLeaveChat(WPARAM,LPARAM)
@@ -171,8 +171,8 @@ INT_PTR MinecraftDynmapProto::OnLeaveChat(WPARAM,LPARAM)
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT,SESSION_TERMINATE,reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE,&gce);
return 0;
}
@@ -196,12 +196,12 @@ void MinecraftDynmapProto::SetChatStatus(int status)
// Add self contact
AddChatContact(m_nick.c_str());
- CallServiceSync(MS_GC_EVENT,SESSION_INITDONE,reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT,SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_INITDONE,&gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
else
{
- CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE,reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE,&gce);
}
}
@@ -209,7 +209,7 @@ void MinecraftDynmapProto::ClearChat()
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(WINDOW_CLEARLOG, &gce);
}
// TODO: Could this be done better?
@@ -232,7 +232,7 @@ MCONTACT MinecraftDynmapProto::GetChatHandle()
gci.Flags = GCF_HCONTACT;
gci.pszModule = m_szModuleName;
gci.pszID = m_tszUserName;
- CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
return gci.hContact;
} \ No newline at end of file
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp
index 147d9924a0..9fb913869b 100644
--- a/protocols/MinecraftDynmap/src/proto.cpp
+++ b/protocols/MinecraftDynmap/src/proto.cpp
@@ -167,7 +167,7 @@ int MinecraftDynmapProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.iMaxText = MINECRAFTDYNMAP_MESSAGE_LIMIT;
gcr.nColors = 0;
gcr.pColors = NULL;
- CallService(MS_GC_REGISTER, 0, reinterpret_cast<LPARAM>(&gcr));
+ Chat_Register(&gcr);
return 0;
}
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 3cc30faaaf..e823ffa676 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -44,7 +44,7 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
@@ -223,7 +223,7 @@ void OmegleProto::SendChatMessage(std::string text)
{
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
-CallServiceSync(MS_GC_EVENT,WINDOW_CLEARLOG,reinterpret_cast<LPARAM>(&gce));
+Chat_Event(WINDOW_CLEARLOG,&gce);
}*/
void OmegleProto::AddChatContact(const wchar_t *name)
@@ -245,7 +245,7 @@ void OmegleProto::AddChatContact(const wchar_t *name)
else
gce.ptszStatus = L"Normal";
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
void OmegleProto::DeleteChatContact(const wchar_t *name)
@@ -261,7 +261,7 @@ void OmegleProto::DeleteChatContact(const wchar_t *name)
else
gce.bIsMe = mir_wstrcmp(name, this->facy.nick_);
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
@@ -272,7 +272,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
gcw.ptszID = m_tszUserName;
gcw.ptszName = m_tszUserName;
gcw.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
if (m_iStatus == ID_STATUS_OFFLINE)
return 0;
@@ -282,10 +282,10 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = L"Admin";
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
gce.ptszStatus = L"Normal";
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
SetTopic();
@@ -307,7 +307,7 @@ void OmegleProto::SetTopic(const wchar_t *topic)
else
gce.ptszText = topic;
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
INT_PTR OmegleProto::OnLeaveChat(WPARAM, LPARAM)
@@ -316,8 +316,8 @@ INT_PTR OmegleProto::OnLeaveChat(WPARAM, LPARAM)
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
return 0;
}
@@ -340,12 +340,12 @@ void OmegleProto::SetChatStatus(int status)
// Add self contact
AddChatContact(facy.nick_);
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
else
{
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
}
}
@@ -356,7 +356,7 @@ void OmegleProto::ClearChat()
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(WINDOW_CLEARLOG, &gce);
}
// TODO: Could this be done better?
@@ -379,7 +379,7 @@ MCONTACT OmegleProto::GetChatHandle()
gci.Flags = GCF_HCONTACT;
gci.pszModule = m_szModuleName;
gci.pszID = m_tszUserName;
- CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
return gci.hContact;
} \ No newline at end of file
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 91d79f0d5f..838e1c559e 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -172,7 +172,7 @@ int OmegleProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.iMaxText = OMEGLE_MESSAGE_LIMIT;
gcr.nColors = 0;
gcr.pColors = NULL;
- CallService(MS_GC_REGISTER, 0, reinterpret_cast<LPARAM>(&gcr));
+ Chat_Register(&gcr);
return 0;
}
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp
index 585e74108e..976408d699 100644
--- a/protocols/Sametime/src/conference.cpp
+++ b/protocols/Sametime/src/conference.cpp
@@ -120,7 +120,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members)
gcs.ptszName = tszConfTitle;
gcs.dwItemData = 0;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcs);
+ Chat_NewSession(&gcs);
mir_free(tszConfTitle);
//add a group
@@ -132,7 +132,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members)
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszStatus = TranslateT("Normal");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
// add users
gcd.iType = GC_EVENT_JOIN;
@@ -147,7 +147,7 @@ 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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM) &gce);
+ Chat_Event(0, &gce);
mir_free(tszUserName);
mir_free(tszUserId);
@@ -155,10 +155,10 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members)
// finalize setup (show window)
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_ONLINE, &gce);
if (conf == proto->my_conference)
proto->ClearInviteQueue();
@@ -182,8 +182,8 @@ void mwServiceConf_conf_closed(mwConference* conf, guint32 reason)
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
- CallService(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallService(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
mir_free(tszConfId);
}
@@ -224,7 +224,7 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user)
gce.ptszStatus = L"Normal";
gce.time = (DWORD)time(0);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM) &gce);
+ Chat_Event(0, &gce);
mir_free(tszUserName);
mir_free(tszUserId);
@@ -252,7 +252,7 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user)
gce.ptszUID = tszUserId;
gce.ptszStatus = L"Normal";
gce.time = (DWORD)time(0);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
/** triggered when someone says something */
@@ -278,7 +278,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh
gce.ptszUID = tszUserId;
gce.time = (DWORD)time(0);
- CallService(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(textT);
mir_free(tszUserName);
@@ -324,7 +324,7 @@ void CSametimeProto::TerminateConference(char* name)
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_ADDTOLOG;
- CallService(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
mir_free(idt);
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index bcac4f2532..e4cfbe6949 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -202,7 +202,7 @@ int CSametimeProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = MAX_MESSAGE_SIZE;
- CallService(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
return 0;
}
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
index 3e5f56b471..6c4965b96b 100644
--- a/protocols/SkypeWeb/src/main.cpp
+++ b/protocols/SkypeWeb/src/main.cpp
@@ -58,7 +58,7 @@ extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
pcli = Clist_GetInterface();
- mir_getCI(nullptr);
+ pci = Chat_GetInterface();
CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fii);
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(g_szMirVer), LPARAM(g_szMirVer));
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 3f1ce32b1d..107dc2bbcd 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -23,7 +23,7 @@ void CSkypeProto::InitGroupChatModule()
gcr.iMaxText = 0;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CSkypeProto::OnGroupChatEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CSkypeProto::OnGroupChatMenuHook);
@@ -42,12 +42,12 @@ void CSkypeProto::CloseAllChatChatSessions()
for (int i = 0; i < count; i++)
{
gci.iItem = i;
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
+ if (!Chat_GetInfo(&gci))
{
GCDEST gcd = { m_szModuleName, gci.pszID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
}
}
}
@@ -66,7 +66,7 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
gcw.ptszID = tid;
gcw.pszModule = m_szModuleName;
gcw.ptszName = tname;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
// Send setting events
GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP };
@@ -74,9 +74,9 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
// Create a user statuses
gce.ptszStatus = TranslateT("Admin");
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
gce.ptszStatus = TranslateT("User");
- CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(NULL, &gce);
// Finish initialization
gcd.iType = GC_EVENT_CONTROL;
@@ -85,8 +85,8 @@ void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
bool hideChats = getBool("HideChats", 1);
- CallServiceSync(MS_GC_EVENT, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event((hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response)
@@ -247,7 +247,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
gce.ptszText = tnick_new;
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
if (!reset)
db_set_ws(hChatContact, "UsersNicks", _T2A(gch->ptszUID), tnick_new);
@@ -288,8 +288,8 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM)
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
SendRequest(new KickUserRequest(_T2A(idT), li.szSkypename, li));
@@ -422,7 +422,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
gce.time = time(NULL);
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateT("Admin");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
}
}
@@ -484,7 +484,7 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from,
if (isLoading) gce.dwFlags = GCEF_NOTNOTIFY;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
@@ -524,7 +524,7 @@ void CSkypeProto::RenameChat(const char *chat_id, const char *name)
GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszText = tname;
- CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const char *initiator)
@@ -538,7 +538,7 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const
gce.ptszUID = tname;
gce.ptszNick = tname;
gce.ptszText = ttopic;
- CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
bool CSkypeProto::IsChatContact(const wchar_t *chat_id, const char *id)
@@ -553,7 +553,7 @@ char *CSkypeProto::GetChatUsers(const wchar_t *chat_id)
gci.Flags = GCF_USERS;
gci.pszModule = m_szModuleName;
gci.pszID = chat_id;
- CallService(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
return gci.pszUsers;
}
@@ -610,7 +610,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const
gce.bIsMe = IsMe(id);
gce.ptszStatus = TranslateW(role);
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, const char *name, bool isKick, const char *initiator)
@@ -640,7 +640,7 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con
gce.bIsMe = IsMe(id);
}
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
}
INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM)
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index acabbd7b7a..73a0d91c09 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -51,7 +51,7 @@ void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
return;
GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event((iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, &gce);
}
MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent)
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index 9f37777cc5..e4f9c6987b 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -34,7 +34,7 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0
#include <m_message.h>
#include <m_avatars.h>
#include <m_skin.h>
-#include <m_chat.h>
+#include <m_chat_int.h>
#include <m_genmenu.h>
#include <m_clc.h>
#include <m_clist.h>
diff --git a/protocols/Tox/src/tox.cpp b/protocols/Tox/src/tox.cpp
index 10c30c14ee..0ee2774aa4 100644
--- a/protocols/Tox/src/tox.cpp
+++ b/protocols/Tox/src/tox.cpp
@@ -1,7 +1,8 @@
#include "stdafx.h"
int hLangpack;
-CLIST_INTERFACE* pcli;
+CHAT_MANAGER *pci;
+CLIST_INTERFACE *pcli;
HINSTANCE g_hInstance;
HMODULE g_hToxLibrary = NULL;
@@ -40,6 +41,7 @@ extern "C" int __declspec(dllexport) Load(void)
if (g_hToxLibrary == NULL)
return 0;
+ pci = Chat_GetInterface();
pcli = Clist_GetInterface();
mir_getLP(&pluginInfo);
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp
index 82805ab96e..2cf2641db8 100644
--- a/protocols/Tox/src/tox_chatrooms.cpp
+++ b/protocols/Tox/src/tox_chatrooms.cpp
@@ -140,7 +140,7 @@ void CToxProto::InitGroupChatModule()
gcr.iMaxText = 0;
gcr.ptszDispName = this->m_tszUserName;
gcr.pszModule = this->m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CToxProto::OnGroupChatEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CToxProto::OnGroupChatMenuHook);
@@ -155,16 +155,16 @@ void CToxProto::CloseAllChatChatSessions()
gci.Flags = GCF_BYINDEX | GCF_ID | GCF_DATA;
gci.pszModule = m_szModuleName;
- int count = CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_szModuleName);
+ int count = pci->SM_GetCount(m_szModuleName);
for (int i = 0; i < count; i++)
{
gci.iItem = i;
- if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci))
+ if (!Chat_GetInfo(&gci))
{
GCDEST gcd = { m_szModuleName, gci.pszID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
}
}
}
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp
index 0daee31258..61575672ca 100644
--- a/protocols/Twitter/src/chat.cpp
+++ b/protocols/Twitter/src/chat.cpp
@@ -49,7 +49,7 @@ void TwitterProto::UpdateChat(const twitter_user &update)
else
gce.ptszNick = mir_a2u(update.username.c_str());
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
mir_free(const_cast<wchar_t*>(gce.ptszNick));
mir_free(const_cast<wchar_t*>(gce.ptszUID));
@@ -96,7 +96,7 @@ void TwitterProto::AddChatContact(const char *name, const char *nick)
gce.ptszNick = mir_a2u(nick ? nick : name);
gce.ptszUID = mir_a2u(name);
gce.ptszStatus = L"Normal";
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
mir_free(const_cast<wchar_t*>(gce.ptszNick));
mir_free(const_cast<wchar_t*>(gce.ptszUID));
@@ -109,7 +109,7 @@ void TwitterProto::DeleteChatContact(const char *name)
gce.time = DWORD(time(0));
gce.ptszNick = mir_a2u(name);
gce.ptszUID = gce.ptszNick;
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
mir_free(const_cast<wchar_t*>(gce.ptszNick));
}
@@ -122,7 +122,7 @@ INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
gcw.pszModule = m_szModuleName;
gcw.ptszName = m_tszUserName;
gcw.ptszID = m_tszUserName;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
if (m_iStatus != ID_STATUS_ONLINE)
return 0;
@@ -131,7 +131,7 @@ INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = L"Normal";
- CallServiceSync(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(0, &gce);
// ***** Hook events
HookProtoEvent(ME_GC_EVENT, &TwitterProto::OnChatOutgoing);
@@ -151,8 +151,8 @@ INT_PTR TwitterProto::OnLeaveChat(WPARAM, LPARAM)
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
return 0;
}
@@ -183,9 +183,9 @@ void TwitterProto::SetChatStatus(int status)
// For some reason, I have to send an INITDONE message, even if I'm not actually
// initializing the room...
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, reinterpret_cast<LPARAM>(&gce));
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
else
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
+ Chat_Event(SESSION_OFFLINE, &gce);
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index f44f1ce6b4..b2f43800db 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -341,7 +341,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.pszModule = m_szModuleName;
gcr.ptszDispName = m_tszUserName;
gcr.iMaxText = 159;
- CallService(MS_GC_REGISTER, 0, reinterpret_cast<LPARAM>(&gcr));
+ Chat_Register(&gcr);
DBEVENTTYPEDESCR evt = { sizeof(evt) };
evt.eventType = TWITTER_DB_EVENT_TYPE_TWEET;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index fa0a1d8b09..f109c81108 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -65,13 +65,13 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
gcw.pszModule = m_szModuleName;
gcw.ptszName = wszTitle;
gcw.ptszID = sid;
- CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
GC_INFO gci = { 0 };
gci.pszModule = m_szModuleName;
gci.pszID = sid;
gci.Flags = GCF_BYID | GCF_HCONTACT;
- CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci);
+ Chat_GetInfo(&gci);
c->m_hContact = gci.hContact;
setWString(gci.hContact, "Nick", wszTitle);
@@ -81,7 +81,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
GCEVENT gce = { sizeof(gce), &gcd };
for (int i = _countof(sttStatuses)-1; i >= 0; i--) {
gce.ptszStatus = TranslateW(sttStatuses[i]);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
setDword(gci.hContact, "vk_chat_id", id);
@@ -98,8 +98,8 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg)
}
gcd.iType = GC_EVENT_CONTROL;
gce.ptszStatus = 0;
- CallServiceSync(MS_GC_EVENT, (m_vkOptions.bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event((m_vkOptions.bHideChats) ? WINDOW_HIDDEN : SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
RetrieveChatInfo(c);
return c;
@@ -207,7 +207,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
gce.ptszNick = wszNick;
gce.ptszStatus = TranslateW(sttStatuses[uid == cc->m_admin_id]);
gce.dwItemData = (INT_PTR)cu;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
}
@@ -225,7 +225,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
gce.dwFlags = GCEF_REMOVECONTACT | GCEF_NOTNOTIFY;
gce.time = time(NULL);
gce.ptszNick = mir_wstrdup(CMStringW(FORMAT, L"%s (https://vk.com/id%s)", cu.m_wszNick, wszId));
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
cc->m_users.remove(i);
}
@@ -288,7 +288,7 @@ void CVkProto::SetChatTitle(CVkChatInfo *cc, LPCWSTR wszTopic)
GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_CHANGESESSIONAME };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
gce.ptszText = wszTopic;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -442,7 +442,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR
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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
StopChatContactTyping(cc->m_chatid, uid);
}
@@ -471,7 +471,7 @@ void CVkProto::SetChatStatus(MCONTACT hContact, int iStatus)
GCDEST gcd = { m_szModuleName, wszChatID, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event((iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, &gce);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -672,9 +672,9 @@ void CVkProto::LeaveChat(int chat_id, bool close_window, bool delete_chat)
GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_QUIT };
GCEVENT gce = { sizeof(GCEVENT), &gcd };
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, close_window? SESSION_TERMINATE:SESSION_OFFLINE, (LPARAM)&gce);
+ Chat_Event(close_window? SESSION_TERMINATE:SESSION_OFFLINE, &gce);
if (delete_chat)
db_delete_contact(cc->m_hContact);
else
@@ -812,7 +812,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
gce.ptszText = mir_wstrdup(wszNewNick);
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = time(NULL);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &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 b9e11dc2ca..01b698aafa 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -110,7 +110,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.pszModule = m_szModuleName;
gcr.nColors = _countof(sttColors);
gcr.pColors = sttColors;
- CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
+ Chat_Register(&gcr);
CreateProtoService(PS_LEAVECHAT, &CVkProto::OnLeaveChat);
CreateProtoService(PS_JOINCHAT, &CVkProto::OnJoinChat);
HookProtoEvent(ME_GC_EVENT, &CVkProto::OnChatEvent);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index bc2d6c9fb0..11d809ed6e 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -307,7 +307,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n
gcw.pszModule = m_szModuleName;
gcw.ptszName = ptszNick;
gcw.ptszID = ptszJid;
- CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
pInfo->hContact = (hOldContact != NULL) ? hOldContact : ContactIDToHContact(jid);
@@ -315,12 +315,12 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n
GCEVENT gce = { sizeof(gce), &gcd };
for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateW(sttStatuses[i]);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(getBool(WHATSAPP_KEY_AUTORUNCHATS, true) ? SESSION_INITDONE : WINDOW_HIDDEN, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
if (m_pConnection)
m_pConnection->sendGetParticipants(jid);
@@ -362,7 +362,7 @@ void WhatsAppProto::onGroupInfo(const std::string &jid, const std::string &owner
else {
GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_ONLINE, &gce);
}
if (!subject.empty()) {
@@ -406,7 +406,7 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg)
gce.time = pMsg.timestamp;
gce.ptszText = tszText;
gce.bIsMe = m_szJid == pMsg.remote_resource;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
if (isOnline())
m_pConnection->sendMessageReceived(pMsg);
@@ -434,7 +434,7 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string
gce.ptszNick = tszNick;
gce.time = ts;
gce.ptszText = tszText;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
setWString(pInfo->hContact, WHATSAPP_KEY_NICK, tszText);
}
@@ -455,7 +455,7 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = ts;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string &ujid, int ts)
@@ -474,7 +474,7 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
gce.time = ts;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
void WhatsAppProto::onLeaveGroup(const std::string &gjid)
@@ -487,7 +487,7 @@ void WhatsAppProto::onLeaveGroup(const std::string &gjid)
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = pInfo->tszJid;
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
db_delete_contact(pInfo->hContact);
m_chats.erase((char*)_T2A(pInfo->tszJid));
@@ -514,7 +514,7 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector
gce.ptszNick = nick;
gce.ptszUID = utils::removeA(ujid);
gce.ptszStatus = (bIsOwner) ? L"Owners" : L"Members";
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
}
@@ -550,7 +550,7 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg)
gce.time = time(NULL);
gce.ptszText = p->second.c_str();
gce.bIsMe = m_szJid == msg.remote_resource;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ Chat_Event(0, &gce);
pInfo->m_unsentMsgs.erase(p);
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index caeb7613af..cda1b921e6 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -78,7 +78,7 @@ int WhatsAppProto::OnEvent(PROTOEVENTTYPE evType, WPARAM, LPARAM)
gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &WhatsAppProto::onGroupChatEvent);
HookProtoEvent(ME_GC_BUILDMENU, &WhatsAppProto::OnChatMenu);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp
index 486286857d..f229a942c1 100644
--- a/protocols/Yahoo/src/chat.cpp
+++ b/protocols/Yahoo/src/chat.cpp
@@ -142,7 +142,7 @@ void CYahooProto::ChatRegister(void)
gcr.pColors = (COLORREF*)crCols;
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ Chat_Register(&gcr);
HookProtoEvent(ME_GC_EVENT, &CYahooProto::OnGCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CYahooProto::OnGCMenuHook);
@@ -157,21 +157,21 @@ void CYahooProto::ChatStart(const char* room)
gcw.pszModule = m_szModuleName;
gcw.ptszName = idt;
gcw.ptszID = idt;
- CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ Chat_NewSession(&gcw);
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszStatus = TranslateT("Me");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_ADDGROUP;
gce.ptszStatus = TranslateT("Others");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
+ Chat_Event(WINDOW_VISIBLE, &gce);
mir_free(idt);
}
@@ -183,8 +183,8 @@ void CYahooProto::ChatLeave(const char* room)
GCDEST gcd = { m_szModuleName, idt, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
gce.dwFlags = GCEF_REMOVECONTACT;
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
mir_free(idt);
}
@@ -212,7 +212,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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(snt);
mir_free(idt);
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp
index efb3aa504a..69b0ba9fc2 100644
--- a/src/core/stdchat/src/main.cpp
+++ b/src/core/stdchat/src/main.cpp
@@ -346,7 +346,7 @@ extern "C" __declspec(dllexport) int Load(void)
RegisterFonts();
CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Chat module"), FONTMODE_SKIP };
- mir_getCI(&data);
+ pci = Chat_GetInterface(&data);
saveCI = *pci;
pci->OnAddUser = OnAddUser;
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index e83904cde8..aff64769ff 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -27,19 +27,11 @@ struct MODULEINFO : public GCModuleInfoBase {};
struct SESSION_INFO : public GCSessionInfoBase {};
struct LOGSTREAMDATA : public GCLogStreamDataBase {};
-// special service for tweaking performance
-#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
-typedef INT_PTR(*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
-struct GCPTRS
-{
- GETEVENTFUNC pfnAddEvent;
-};
-
extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
extern GlobalLogSettingsBase *g_Settings;
extern int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
extern wchar_t *g_szFontGroup;
-extern mir_cs cs;
+extern mir_cs csChat;
extern char* pLogIconBmpBits[14];
@@ -61,11 +53,9 @@ BOOL SetAllOffline(BOOL bHide, const char *pszModule);
BOOL SetOffline(MCONTACT hContact, BOOL bHide);
int RoomDoubleclicked(WPARAM wParam,LPARAM lParam);
-INT_PTR EventDoubleclicked(WPARAM wParam,LPARAM lParam);
INT_PTR JoinChat(WPARAM wParam, LPARAM lParam);
INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam);
int PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
-INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam);
// colorchooser.c
void ColorChooser(SESSION_INFO *si, BOOL bFG, HWND hwndDlg, HWND hwndTarget, HWND hwndChooser);
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index d371083f5f..b6fdad1875 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -131,7 +131,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM)
return 1;
}
-INT_PTR EventDoubleclicked(WPARAM,LPARAM lParam)
+static INT_PTR EventDoubleclicked(WPARAM,LPARAM lParam)
{
return RoomDoubleclicked((WPARAM)((CLISTEVENT*)lParam)->hContact, 0);
}
@@ -193,11 +193,6 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM)
return 0;
}
-INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam)
-{
- return PrebuildContactMenu(wParam, lParam);
-}
-
BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t* fmt, ...)
{
wchar_t szBuf[4096];
@@ -217,6 +212,10 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t*
cle.hIcon = hIcon;
cle.pszService = "GChat/DblClickEvent" ;
cle.ptszTooltip = TranslateW(szBuf);
+
+ if (!ServiceExists(cle.pszService))
+ CreateServiceFunction(cle.pszService, &EventDoubleclicked);
+
if (type) {
if (!cli.pfnGetEvent(hContact, 0))
cli.pfnAddEvent(&cle);
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 3ec71e4886..79659bd7ef 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -1179,17 +1179,16 @@ static BOOL LM_RemoveAll(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd)
return TRUE;
}
-INT_PTR SvcGetChatManager(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _hLangpack)
{
- if (lParam == NULL)
- return (INT_PTR)&chatApi;
+ if (pInit == NULL)
+ return &chatApi;
// wipe out old junk
memset(PBYTE(&chatApi) + offsetof(CHAT_MANAGER, OnCreateModule), 0, sizeof(CHAT_MANAGER) - offsetof(CHAT_MANAGER, OnCreateModule));
- CHAT_MANAGER_INITDATA *pInit = (CHAT_MANAGER_INITDATA*)lParam;
if (g_cbSession) { // reallocate old sessions
- mir_cslock lck(cs);
+ mir_cslock lck(csChat);
SESSION_INFO *pPrev = NULL;
for (SESSION_INFO *p = chatApi.wndList; p; p = p->next) {
SESSION_INFO *p1 = (SESSION_INFO*)mir_realloc(p, pInit->cbSession);
@@ -1205,7 +1204,7 @@ INT_PTR SvcGetChatManager(WPARAM wParam, LPARAM lParam)
}
}
if (g_cbModuleInfo) { // reallocate old modules
- mir_cslock lck(cs);
+ mir_cslock lck(csChat);
MODULEINFO *pPrev = NULL;
for (MODULEINFO *p = m_ModList; p; p = p->next) {
MODULEINFO *p1 = (MODULEINFO*)mir_realloc(p, pInit->cbModuleInfo);
@@ -1225,7 +1224,7 @@ INT_PTR SvcGetChatManager(WPARAM wParam, LPARAM lParam)
g_cbSession = pInit->cbSession;
g_cbModuleInfo = pInit->cbModuleInfo;
g_iFontMode = pInit->iFontMode;
- g_iChatLang = (int)wParam;
+ g_iChatLang = _hLangpack;
chatApi.SetActiveSession = SetActiveSession;
chatApi.SetActiveSessionEx = SetActiveSessionEx;
@@ -1326,5 +1325,5 @@ INT_PTR SvcGetChatManager(WPARAM wParam, LPARAM lParam)
RegisterFonts();
OptionsInit();
- return (INT_PTR)&chatApi;
+ return &chatApi;
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 58fdbb1bb3..0e390c90e4 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -27,7 +27,7 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM);
#include "chat.h"
HGENMENU hJoinMenuItem, hLeaveMenuItem;
-mir_cs cs;
+mir_cs csChat;
static HANDLE
hServiceRegister = NULL,
@@ -119,22 +119,12 @@ static int SmileyOptionsChanged(WPARAM, LPARAM)
return 0;
}
-static INT_PTR Service_GetCount(WPARAM, LPARAM lParam)
+EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *gci)
{
- if (!lParam)
- return -1;
-
- mir_cslock lck(cs);
- return chatApi.SM_GetCount((char *)lParam);
-}
-
-static INT_PTR Service_GetInfo(WPARAM, LPARAM lParam)
-{
- GC_INFO *gci = (GC_INFO *)lParam;
if (!gci || !gci->pszModule)
return 1;
- mir_cslock lck(cs);
+ mir_cslock lck(csChat);
SESSION_INFO *si;
if (gci->Flags & GCF_BYINDEX)
@@ -154,16 +144,15 @@ static INT_PTR Service_GetInfo(WPARAM, LPARAM lParam)
return 0;
}
-static INT_PTR Service_Register(WPARAM, LPARAM lParam)
+MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
{
- GCREGISTER *gcr = (GCREGISTER *)lParam;
if (gcr == NULL)
return GC_REGISTER_ERROR;
if (gcr->cbSize != sizeof(GCREGISTER))
return GC_REGISTER_WRONGVER;
- mir_cslock lck(cs);
+ mir_cslock lck(csChat);
MODULEINFO *mi = chatApi.MM_AddModule(gcr->pszModule);
if (mi == NULL)
return GC_REGISTER_ERROR;
@@ -192,16 +181,15 @@ static INT_PTR Service_Register(WPARAM, LPARAM lParam)
return 0;
}
-static INT_PTR Service_NewChat(WPARAM, LPARAM lParam)
+EXTERN_C MIR_APP_DLL(int) Chat_NewSession(const GCSESSION *gcw)
{
- GCSESSION *gcw = (GCSESSION *)lParam;
if (gcw == NULL)
return GC_NEWSESSION_ERROR;
if (gcw->cbSize != sizeof(GCSESSION))
return GC_NEWSESSION_WRONGVER;
- mir_cslock lck(cs);
+ mir_cslock lck(csChat);
MODULEINFO *mi = chatApi.MM_FindModule(gcw->pszModule);
if (mi == NULL)
return GC_NEWSESSION_ERROR;
@@ -399,9 +387,8 @@ static void AddUser(GCEVENT *gce)
chatApi.OnNewUser(si, ui);
}
-static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
+EXTERN_C MIR_APP_DLL(int) Chat_Event(int sessionEvent, GCEVENT *gce)
{
- GCEVENT *gce = (GCEVENT*)lParam;
BOOL bIsHighlighted = FALSE;
BOOL bRemoveFlag = FALSE;
@@ -418,10 +405,10 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
if (!IsEventSupported(gcd->iType))
return GC_EVENT_ERROR;
- if (NotifyEventHooks(hHookEvent, wParam, lParam))
+ if (NotifyEventHooks(hHookEvent, 0, LPARAM(gce)))
return 1;
- mir_cslock lck(cs);
+ mir_cslock lck(csChat);
// Do different things according to type of event
switch (gcd->iType) {
@@ -442,7 +429,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
case GC_EVENT_ACK:
case GC_EVENT_SENDMESSAGE:
case GC_EVENT_SETSTATUSEX:
- return DoControl(gce, wParam);
+ return DoControl(gce, sessionEvent);
case GC_EVENT_SETCONTACTSTATUS:
return chatApi.SM_SetContactStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
@@ -549,15 +536,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
return GC_EVENT_ERROR;
}
-static INT_PTR Service_GetAddEventPtr(WPARAM, LPARAM lParam)
-{
- GCPTRS *gp = (GCPTRS *)lParam;
-
- mir_cslock lck(cs);
- gp->pfnAddEvent = Service_AddEvent;
- return 0;
-}
-
static int ModulesLoaded(WPARAM, LPARAM)
{
LoadChatIcons();
@@ -573,6 +551,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
mi.name.a = LPGEN("&Join chat");
mi.pszService = "GChat/JoinChat";
hJoinMenuItem = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, JoinChat);
SET_UID(mi, 0x72b7440b, 0xd2db, 0x4e22, 0xa6, 0xb1, 0x2, 0xd0, 0x96, 0xee, 0xad, 0x88);
mi.position = -2000090000;
@@ -581,6 +560,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
mi.name.a = LPGEN("&Leave chat");
mi.pszService = "GChat/LeaveChat";
hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, LeaveChat);
chatApi.SetAllOffline(TRUE, NULL);
return 0;
@@ -597,19 +577,6 @@ int LoadChatModule(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
- CreateServiceFunction(MS_GC_REGISTER, Service_Register);
- CreateServiceFunction(MS_GC_NEWSESSION, Service_NewChat);
- CreateServiceFunction(MS_GC_EVENT, Service_AddEvent);
- CreateServiceFunction(MS_GC_GETEVENTPTR, Service_GetAddEventPtr);
- CreateServiceFunction(MS_GC_GETINFO, Service_GetInfo);
- CreateServiceFunction(MS_GC_GETSESSIONCOUNT, Service_GetCount);
-
- CreateServiceFunction("GChat/DblClickEvent", EventDoubleclicked);
- CreateServiceFunction("GChat/PrebuildMenuEvent", PrebuildContactMenuSvc);
- CreateServiceFunction("GChat/JoinChat", JoinChat);
- CreateServiceFunction("GChat/LeaveChat", LeaveChat);
- CreateServiceFunction("GChat/GetInterface", SvcGetChatManager);
-
chatApi.hSendEvent = CreateHookableEvent(ME_GC_EVENT);
chatApi.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU);
hHookEvent = CreateHookableEvent(ME_GC_HOOK_EVENT);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 0d2942d84f..dd066e34da 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -295,3 +295,8 @@ DestroyDbInstance @295
FindDatabasePlugin @296
InitDbInstance @297
RegisterDatabasePlugin @298
+Chat_GetInterface @299
+Chat_Event @300
+Chat_GetInfo @301
+Chat_NewSession @302
+Chat_Register @303
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index e7ff36afca..de2bdb2cbe 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -295,3 +295,8 @@ DestroyDbInstance @295
FindDatabasePlugin @296
InitDbInstance @297
RegisterDatabasePlugin @298
+Chat_GetInterface @299
+Chat_Event @300
+Chat_GetInfo @301
+Chat_NewSession @302
+Chat_Register @303