From 0c41e6c4566fdb2d99b8a6ca1fb48859fd4a0e34 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Sep 2016 19:43:24 +0000 Subject: - 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 --- protocols/AimOscar/src/chat.cpp | 20 ++++++------- protocols/FacebookRM/src/chat.cpp | 36 +++++++++++----------- protocols/FacebookRM/src/proto.cpp | 4 +-- protocols/Gadu-Gadu/src/core.cpp | 10 +++---- protocols/Gadu-Gadu/src/groupchat.cpp | 44 +++++++++++++-------------- protocols/IRCG/src/commandmonitor.cpp | 48 +++++++++++++++--------------- protocols/IRCG/src/input.cpp | 8 ++--- protocols/IRCG/src/ircproto.cpp | 8 ++--- protocols/IRCG/src/main.cpp | 2 ++ protocols/IRCG/src/scripting.cpp | 8 ++--- protocols/IRCG/src/services.cpp | 12 ++++---- protocols/IRCG/src/stdafx.h | 11 +++---- protocols/IRCG/src/tools.cpp | 6 ++-- protocols/JabberG/src/jabber.cpp | 12 ++++---- protocols/JabberG/src/jabber_chat.cpp | 18 +++++------ protocols/JabberG/src/jabber_groupchat.cpp | 8 ++--- protocols/JabberG/src/jabber_iqid.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 2 +- protocols/MRA/src/MraChat.cpp | 19 +++++------- protocols/MRA/src/Mra_functions.cpp | 2 +- protocols/MSN/src/msn_chat.cpp | 26 ++++++++-------- protocols/MSN/src/msn_commands.cpp | 10 +++---- protocols/MSN/src/msn_misc.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/MinecraftDynmap/src/chat.cpp | 28 ++++++++--------- protocols/MinecraftDynmap/src/proto.cpp | 2 +- protocols/Omegle/src/chat.cpp | 30 +++++++++---------- protocols/Omegle/src/proto.cpp | 2 +- protocols/Sametime/src/conference.cpp | 22 +++++++------- protocols/Sametime/src/sametime.cpp | 2 +- protocols/SkypeWeb/src/main.cpp | 2 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 38 +++++++++++------------ protocols/SkypeWeb/src/skype_contacts.cpp | 2 +- protocols/Tox/src/stdafx.h | 2 +- protocols/Tox/src/tox.cpp | 4 ++- protocols/Tox/src/tox_chatrooms.cpp | 10 +++---- protocols/Twitter/src/chat.cpp | 20 ++++++------- protocols/Twitter/src/proto.cpp | 2 +- protocols/VKontakte/src/vk_chats.cpp | 26 ++++++++-------- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/WhatsApp/src/chat.cpp | 24 +++++++-------- protocols/WhatsApp/src/proto.cpp | 2 +- protocols/Yahoo/src/chat.cpp | 20 ++++++------- 43 files changed, 278 insertions(+), 282 deletions(-) (limited to 'protocols') 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(&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(&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(&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(&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(&gce)); + Chat_Event(NULL, &gce); gce.ptszStatus = TranslateT("Friend"); - CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast(&gce)); + Chat_Event(NULL, &gce); gce.ptszStatus = TranslateT("User"); - CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast(&gce)); + Chat_Event(NULL, &gce); gce.ptszStatus = TranslateT("Former"); - CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast(&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(&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(&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(&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 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 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 //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(&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(&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(&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(&gce)); + Chat_Event(NULL, &gce); gce.ptszStatus = L"Normal"; - CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast(&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(&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(&gce)); - CallServiceSync(MS_GC_EVENT,SESSION_TERMINATE,reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT,SESSION_ONLINE, reinterpret_cast(&gce)); + Chat_Event(SESSION_INITDONE,&gce); + Chat_Event(SESSION_ONLINE, &gce); } else { - CallServiceSync(MS_GC_EVENT,SESSION_OFFLINE,reinterpret_cast(&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(&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(&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(&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(&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(&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(&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(&gce)); + Chat_Event(NULL, &gce); gce.ptszStatus = L"Normal"; - CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast(&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(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast(&gce)); + Chat_Event(SESSION_INITDONE, &gce); + Chat_Event(SESSION_ONLINE, &gce); } else { - CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast(&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(&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(&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(&gce)); + Chat_Event(NULL, &gce); gce.ptszStatus = TranslateT("User"); - CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast(&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(&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(&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(&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(&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 #include #include -#include +#include #include #include #include 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(&gce)); + Chat_Event(0, &gce); mir_free(const_cast(gce.ptszNick)); mir_free(const_cast(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(&gce)); + Chat_Event(0, &gce); mir_free(const_cast(gce.ptszNick)); mir_free(const_cast(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(&gce)); + Chat_Event(0, &gce); mir_free(const_cast(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(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast(&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(&gce)); - CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast(&gce)); + Chat_Event(SESSION_INITDONE, &gce); + Chat_Event(SESSION_ONLINE, &gce); } else - CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast(&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(&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); -- cgit v1.2.3