From 74d73e1537585bfc4c33892b9ec47dc523af1ce4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 19 Feb 2020 20:28:04 +0300 Subject: if a protocol handles an event, it shall return 1, not 0 --- protocols/Discord/src/groupchat.cpp | 2 +- protocols/Facebook/src/groupchats.cpp | 4 +- protocols/Gadu-Gadu/src/groupchat.cpp | 4 +- protocols/ICQ-WIM/src/groupchats.cpp | 4 +- protocols/IRCG/src/services.cpp | 498 ++++++++++++++--------------- protocols/JabberG/src/jabber_chat.cpp | 4 +- protocols/JabberG/src/jabber_proto.cpp | 1 - protocols/MSN/src/msn_chat.cpp | 4 +- protocols/Omegle/src/chat.cpp | 3 +- protocols/Sametime/src/conference.cpp | 7 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 10 +- protocols/Twitter/src/chat.cpp | 12 +- protocols/VKontakte/src/vk_chats.cpp | 4 +- 13 files changed, 275 insertions(+), 282 deletions(-) (limited to 'protocols') diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index 8b68a6a20b..ee00b1054e 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -201,5 +201,5 @@ int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam) break; } - return 0; + return 1; } diff --git a/protocols/Facebook/src/groupchats.cpp b/protocols/Facebook/src/groupchats.cpp index 2596aaf2cf..b5844ec3c1 100644 --- a/protocols/Facebook/src/groupchats.cpp +++ b/protocols/Facebook/src/groupchats.cpp @@ -158,7 +158,7 @@ int FacebookProto::GroupchatEventHook(WPARAM, LPARAM lParam) SESSION_INFO *si = g_chatApi.SM_FindSession(gch->si->ptszID, gch->si->pszModule); if (si == nullptr) - return 0; + return 1; switch (gch->iType) { case GC_USER_MESSAGE: @@ -190,7 +190,7 @@ int FacebookProto::GroupchatEventHook(WPARAM, LPARAM lParam) break; } - return 0; + return 1; } void FacebookProto::Chat_ProcessLogMenu(SESSION_INFO *si, GCHOOK *gch) diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 7d09dfc691..51ce62d926 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -184,9 +184,9 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam) if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, nullptr))) CallService(MS_MSG_SENDMESSAGE, hContact, 0); } - debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->iType, chat, uin, gch->ptszText); - return 0; + debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->iType, chat, uin, gch->ptszText); + return 1; } typedef struct _gg_gc_echat diff --git a/protocols/ICQ-WIM/src/groupchats.cpp b/protocols/ICQ-WIM/src/groupchats.cpp index 9226a30db5..7f29b16f7a 100644 --- a/protocols/ICQ-WIM/src/groupchats.cpp +++ b/protocols/ICQ-WIM/src/groupchats.cpp @@ -211,7 +211,7 @@ int CIcqProto::GroupchatEventHook(WPARAM, LPARAM lParam) SESSION_INFO *si = g_chatApi.SM_FindSession(gch->si->ptszID, gch->si->pszModule); if (si == nullptr) - return 0; + return 1; switch (gch->iType) { case GC_USER_MESSAGE: @@ -235,7 +235,7 @@ int CIcqProto::GroupchatEventHook(WPARAM, LPARAM lParam) break; } - return 0; + return 1; } void CIcqProto::Chat_ProcessLogMenu(SESSION_INFO *si, int iChoice) diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 04a1ea6936..917842b0e7 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -455,265 +455,263 @@ static void DoChatFormatting(CMStringW &wszText) int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam) { + // handle the hook GCHOOK *gch = (GCHOOK*)lParam; - CMStringW S = L""; + if (mir_strcmpi(gch->si->pszModule, m_szModuleName)) + return 0; + CMStringW S = L""; mir_cslock lock(m_csGcHook); - // handle the hook - if (gch) { - if (!mir_strcmpi(gch->si->pszModule, m_szModuleName)) { - wchar_t *p1 = mir_wstrdup(gch->si->ptszID); - wchar_t *p2 = wcsstr(p1, L" - "); - if (p2) - *p2 = 0; - - switch (gch->iType) { - case GC_SESSION_TERMINATE: - FreeWindowItemData(p1, (CHANNELINFO*)gch->dwData); - break; - - case GC_USER_MESSAGE: - if (gch && gch->ptszText && *gch->ptszText) { - CMStringW wszText(gch->ptszText); - DoChatFormatting(wszText); - PostIrcMessageWnd(p1, NULL, wszText); - } - break; - - case GC_USER_CHANMGR: - PostIrcMessageWnd(p1, NULL, L"/CHANNELMANAGER"); - break; - - case GC_USER_PRIVMESS: - PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/QUERY %s", gch->ptszUID)); - break; - - case GC_USER_LOGMENU: - switch (gch->dwData) { - case 1: - OnChangeNickMenuCommand(NULL, NULL); - break; - case 2: - PostIrcMessageWnd(p1, NULL, L"/CHANNELMANAGER"); - break; - - case 3: - PostIrcMessage(L"/PART %s %s", p1, m_userInfo); - Chat_Terminate(m_szModuleName, MakeWndID(p1)); - break; - - case 4: // show server window - PostIrcMessageWnd(p1, NULL, L"/SERVERSHOW"); - break; - /* case 5: // nickserv register nick - PostIrcMessage( L"/nickserv REGISTER %%question=\"%s\",\"%s\"", - TranslateT("Please enter your authentication code"), TranslateT("Authenticate nick")); - break; - */ - case 6: // nickserv Identify - PostIrcMessage(L"/nickserv AUTH %%question=\"%s\",\"%s\"", - TranslateT("Please enter your authentication code"), TranslateT("Authenticate nick")); - break; - case 7: // nickserv drop nick - if (MessageBox(nullptr, TranslateT("Are you sure you want to unregister your current nick?"), TranslateT("Delete nick"), - MB_ICONERROR + MB_YESNO + MB_DEFBUTTON2) == IDYES) - PostIrcMessage(L"/nickserv DROP"); - break; - case 8: // nickserv Identify - { - CQuestionDlg* dlg = new CQuestionDlg(this); - dlg->Show(); - HWND question_hWnd = dlg->GetHwnd(); - HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT); - SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick")); - SetDlgItemText(question_hWnd, IDC_TEXT, TranslateT("Please enter your password")); - SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, L"/nickserv IDENTIFY %question=\"%s\",\"%s\""); - SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE, - (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD); - SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)'*', 0); - SetFocus(hEditCtrl); - dlg->Activate(); - } - break; - case 9: // nickserv remind password - { - DBVARIANT dbv; - if (!getWString("Nick", &dbv)) { - PostIrcMessage(L"/nickserv SENDPASS %s", dbv.pwszVal); - db_free(&dbv); - } - } - break; - case 10: // nickserv set new password - PostIrcMessage(L"/nickserv SET PASSWORD %%question=\"%s\",\"%s\"", - TranslateT("Please enter your new password"), TranslateT("Set new password")); - break; - case 11: // nickserv set language - PostIrcMessage(L"/nickserv SET LANGUAGE %%question=\"%s\",\"%s\"", - TranslateT("Please enter desired language ID (numeric value, depends on server)"), TranslateT("Change language of NickServ messages")); - break; - case 12: // nickserv set homepage - PostIrcMessage(L"/nickserv SET URL %%question=\"%s\",\"%s\"", - TranslateT("Please enter URL that will be linked to your nick"), TranslateT("Set URL, linked to nick")); - break; - case 13: // nickserv set email - PostIrcMessage(L"/nickserv SET EMAIL %%question=\"%s\",\"%s\"", - TranslateT("Please enter your e-mail, that will be linked to your nick"), TranslateT("Set e-mail, linked to nick")); - break; - case 14: // nickserv set info - PostIrcMessage(L"/nickserv SET INFO %%question=\"%s\",\"%s\"", - TranslateT("Please enter some information about your nick"), TranslateT("Set information for nick")); - break; - case 15: // nickserv kill unauth off - PostIrcMessage(L"/nickserv SET KILL OFF"); - break; - case 16: // nickserv kill unauth on - PostIrcMessage(L"/nickserv SET KILL ON"); - break; - case 17: // nickserv kill unauth quick - PostIrcMessage(L"/nickserv SET KILL QUICK"); - break; - case 18: // nickserv hide nick from /LIST - PostIrcMessage(L"/nickserv SET PRIVATE ON"); - break; - case 19: // nickserv show nick to /LIST - PostIrcMessage(L"/nickserv SET PRIVATE OFF"); - break; - case 20: // nickserv Hide e-mail from info - PostIrcMessage(L"/nickserv SET HIDE EMAIL ON"); - break; - case 21: // nickserv Show e-mail in info - PostIrcMessage(L"/nickserv SET HIDE EMAIL OFF"); - break; - case 22: // nickserv Set security for nick - PostIrcMessage(L"/nickserv SET SECURE ON"); - break; - case 23: // nickserv Remove security for nick - PostIrcMessage(L"/nickserv SET SECURE OFF"); - break; - case 24: // nickserv Link nick to current - PostIrcMessage(L"/nickserv LINK %%question=\"%s\",\"%s\"", - TranslateT("Please enter nick you want to link to your current nick"), TranslateT("Link another nick to current nick")); - break; - case 25: // nickserv Unlink nick from current - PostIrcMessage(L"/nickserv LINK %%question=\"%s\",\"%s\"", - TranslateT("Please enter nick you want to unlink from your current nick"), TranslateT("Unlink another nick from current nick")); - break; - case 26: // nickserv Set main nick - PostIrcMessage(L"/nickserv LINK %%question=\"%s\",\"%s\"", - TranslateT("Please enter nick you want to set as your main nick"), TranslateT("Set main nick")); - break; - case 27: // nickserv list all linked nicks - PostIrcMessage(L"/nickserv LISTLINKS"); - break; - case 28: // nickserv list all channels owned - PostIrcMessage(L"/nickserv LISTCHANS"); - break; - } - break; - - case GC_USER_NICKLISTMENU: - switch (gch->dwData) { - case 1: - PostIrcMessage(L"/MODE %s +o %s", p1, gch->ptszUID); - break; - case 2: - PostIrcMessage(L"/MODE %s -o %s", p1, gch->ptszUID); - break; - case 3: - PostIrcMessage(L"/MODE %s +v %s", p1, gch->ptszUID); - break; - case 4: - PostIrcMessage(L"/MODE %s -v %s", p1, gch->ptszUID); - break; - case 5: - PostIrcMessage(L"/KICK %s %s", p1, gch->ptszUID); - break; - case 6: - PostIrcMessage(L"/KICK %s %s %%question=\"%s\",\"%s\",\"%s\"", - p1, gch->ptszUID, TranslateT("Please enter the reason"), TranslateT("Kick"), ""); - break; - case 7: - DoUserhostWithReason(1, L"B" + (CMStringW)p1, true, L"%s", gch->ptszUID); - break; - case 8: - DoUserhostWithReason(1, L"K" + (CMStringW)p1, true, L"%s", gch->ptszUID); - break; - case 9: - DoUserhostWithReason(1, L"L" + (CMStringW)p1, true, L"%s", gch->ptszUID); - break; - case 10: - PostIrcMessage(L"/WHOIS %s %s", gch->ptszUID, gch->ptszUID); - break; - // case 11: - // DoUserhostWithReason(1, "I", true, "%s", gch->ptszUID ); - // break; - // case 12: - // DoUserhostWithReason(1, "J", true, "%s", gch->ptszUID ); - // break; - case 13: - PostIrcMessage(L"/DCC CHAT %s", gch->ptszUID); - break; - case 14: - PostIrcMessage(L"/DCC SEND %s", gch->ptszUID); - break; - case 15: - DoUserhostWithReason(1, L"I", true, L"%s", gch->ptszUID); - break; - case 16: - PostIrcMessage(L"/MODE %s +h %s", p1, gch->ptszUID); - break; - case 17: - PostIrcMessage(L"/MODE %s -h %s", p1, gch->ptszUID); - break; - case 18: - PostIrcMessage(L"/MODE %s +q %s", p1, gch->ptszUID); - break; - case 19: - PostIrcMessage(L"/MODE %s -q %s", p1, gch->ptszUID); - break; - case 20: - PostIrcMessage(L"/MODE %s +a %s", p1, gch->ptszUID); - break; - case 21: - PostIrcMessage(L"/MODE %s -a %s", p1, gch->ptszUID); - break; - case 22: - PostIrcMessage(L"/NOTICE %s %%question=\"%s\",\"%s\"", - gch->ptszUID, TranslateT("Please enter the notice text"), TranslateT("Send notice")); - break; - case 23: - PostIrcMessage(L"/INVITE %s %%question=\"%s\",\"%s\"", - gch->ptszUID, TranslateT("Please enter the channel name to invite to"), TranslateT("Invite to channel")); - break; - case 30: - { - PROTOSEARCHRESULT psr = {}; - psr.cbSize = sizeof(psr); - psr.flags = PSR_UNICODE; - psr.id.w = gch->ptszUID; - psr.nick.w = gch->ptszUID; - Contact_AddBySearch(m_szModuleName, &psr); - } - break; - case 31: //slap - PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/slap %s", gch->ptszUID)); - break; - case 32: //nickserv info - PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv INFO %s ALL", gch->ptszUID)); - break; - case 33: //nickserv ghost - PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv GHOST %s", gch->ptszUID)); - break; + wchar_t *p1 = mir_wstrdup(gch->si->ptszID); + wchar_t *p2 = wcsstr(p1, L" - "); + if (p2) + *p2 = 0; + + switch (gch->iType) { + case GC_SESSION_TERMINATE: + FreeWindowItemData(p1, (CHANNELINFO*)gch->dwData); + break; + + case GC_USER_MESSAGE: + if (gch && gch->ptszText && *gch->ptszText) { + CMStringW wszText(gch->ptszText); + DoChatFormatting(wszText); + PostIrcMessageWnd(p1, NULL, wszText); + } + break; + + case GC_USER_CHANMGR: + PostIrcMessageWnd(p1, NULL, L"/CHANNELMANAGER"); + break; + + case GC_USER_PRIVMESS: + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/QUERY %s", gch->ptszUID)); + break; + + case GC_USER_LOGMENU: + switch (gch->dwData) { + case 1: + OnChangeNickMenuCommand(NULL, NULL); + break; + case 2: + PostIrcMessageWnd(p1, NULL, L"/CHANNELMANAGER"); + break; + + case 3: + PostIrcMessage(L"/PART %s %s", p1, m_userInfo); + Chat_Terminate(m_szModuleName, MakeWndID(p1)); + break; + + case 4: // show server window + PostIrcMessageWnd(p1, NULL, L"/SERVERSHOW"); + break; + /* case 5: // nickserv register nick + PostIrcMessage( L"/nickserv REGISTER %%question=\"%s\",\"%s\"", + TranslateT("Please enter your authentication code"), TranslateT("Authenticate nick")); + break; + */ + case 6: // nickserv Identify + PostIrcMessage(L"/nickserv AUTH %%question=\"%s\",\"%s\"", + TranslateT("Please enter your authentication code"), TranslateT("Authenticate nick")); + break; + case 7: // nickserv drop nick + if (MessageBox(nullptr, TranslateT("Are you sure you want to unregister your current nick?"), TranslateT("Delete nick"), + MB_ICONERROR + MB_YESNO + MB_DEFBUTTON2) == IDYES) + PostIrcMessage(L"/nickserv DROP"); + break; + case 8: // nickserv Identify + { + CQuestionDlg* dlg = new CQuestionDlg(this); + dlg->Show(); + HWND question_hWnd = dlg->GetHwnd(); + HWND hEditCtrl = GetDlgItem(question_hWnd, IDC_EDIT); + SetDlgItemText(question_hWnd, IDC_CAPTION, TranslateT("Identify nick")); + SetDlgItemText(question_hWnd, IDC_TEXT, TranslateT("Please enter your password")); + SetDlgItemText(question_hWnd, IDC_HIDDENEDIT, L"/nickserv IDENTIFY %question=\"%s\",\"%s\""); + SetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE, + (LONG)GetWindowLongPtr(GetDlgItem(question_hWnd, IDC_EDIT), GWL_STYLE) | ES_PASSWORD); + SendMessage(hEditCtrl, EM_SETPASSWORDCHAR, (WPARAM)'*', 0); + SetFocus(hEditCtrl); + dlg->Activate(); + } + break; + case 9: // nickserv remind password + { + DBVARIANT dbv; + if (!getWString("Nick", &dbv)) { + PostIrcMessage(L"/nickserv SENDPASS %s", dbv.pwszVal); + db_free(&dbv); } - break; } - mir_free(p1); + break; + case 10: // nickserv set new password + PostIrcMessage(L"/nickserv SET PASSWORD %%question=\"%s\",\"%s\"", + TranslateT("Please enter your new password"), TranslateT("Set new password")); + break; + case 11: // nickserv set language + PostIrcMessage(L"/nickserv SET LANGUAGE %%question=\"%s\",\"%s\"", + TranslateT("Please enter desired language ID (numeric value, depends on server)"), TranslateT("Change language of NickServ messages")); + break; + case 12: // nickserv set homepage + PostIrcMessage(L"/nickserv SET URL %%question=\"%s\",\"%s\"", + TranslateT("Please enter URL that will be linked to your nick"), TranslateT("Set URL, linked to nick")); + break; + case 13: // nickserv set email + PostIrcMessage(L"/nickserv SET EMAIL %%question=\"%s\",\"%s\"", + TranslateT("Please enter your e-mail, that will be linked to your nick"), TranslateT("Set e-mail, linked to nick")); + break; + case 14: // nickserv set info + PostIrcMessage(L"/nickserv SET INFO %%question=\"%s\",\"%s\"", + TranslateT("Please enter some information about your nick"), TranslateT("Set information for nick")); + break; + case 15: // nickserv kill unauth off + PostIrcMessage(L"/nickserv SET KILL OFF"); + break; + case 16: // nickserv kill unauth on + PostIrcMessage(L"/nickserv SET KILL ON"); + break; + case 17: // nickserv kill unauth quick + PostIrcMessage(L"/nickserv SET KILL QUICK"); + break; + case 18: // nickserv hide nick from /LIST + PostIrcMessage(L"/nickserv SET PRIVATE ON"); + break; + case 19: // nickserv show nick to /LIST + PostIrcMessage(L"/nickserv SET PRIVATE OFF"); + break; + case 20: // nickserv Hide e-mail from info + PostIrcMessage(L"/nickserv SET HIDE EMAIL ON"); + break; + case 21: // nickserv Show e-mail in info + PostIrcMessage(L"/nickserv SET HIDE EMAIL OFF"); + break; + case 22: // nickserv Set security for nick + PostIrcMessage(L"/nickserv SET SECURE ON"); + break; + case 23: // nickserv Remove security for nick + PostIrcMessage(L"/nickserv SET SECURE OFF"); + break; + case 24: // nickserv Link nick to current + PostIrcMessage(L"/nickserv LINK %%question=\"%s\",\"%s\"", + TranslateT("Please enter nick you want to link to your current nick"), TranslateT("Link another nick to current nick")); + break; + case 25: // nickserv Unlink nick from current + PostIrcMessage(L"/nickserv LINK %%question=\"%s\",\"%s\"", + TranslateT("Please enter nick you want to unlink from your current nick"), TranslateT("Unlink another nick from current nick")); + break; + case 26: // nickserv Set main nick + PostIrcMessage(L"/nickserv LINK %%question=\"%s\",\"%s\"", + TranslateT("Please enter nick you want to set as your main nick"), TranslateT("Set main nick")); + break; + case 27: // nickserv list all linked nicks + PostIrcMessage(L"/nickserv LISTLINKS"); + break; + case 28: // nickserv list all channels owned + PostIrcMessage(L"/nickserv LISTCHANS"); + break; + } + break; + + case GC_USER_NICKLISTMENU: + switch (gch->dwData) { + case 1: + PostIrcMessage(L"/MODE %s +o %s", p1, gch->ptszUID); + break; + case 2: + PostIrcMessage(L"/MODE %s -o %s", p1, gch->ptszUID); + break; + case 3: + PostIrcMessage(L"/MODE %s +v %s", p1, gch->ptszUID); + break; + case 4: + PostIrcMessage(L"/MODE %s -v %s", p1, gch->ptszUID); + break; + case 5: + PostIrcMessage(L"/KICK %s %s", p1, gch->ptszUID); + break; + case 6: + PostIrcMessage(L"/KICK %s %s %%question=\"%s\",\"%s\",\"%s\"", + p1, gch->ptszUID, TranslateT("Please enter the reason"), TranslateT("Kick"), ""); + break; + case 7: + DoUserhostWithReason(1, L"B" + (CMStringW)p1, true, L"%s", gch->ptszUID); + break; + case 8: + DoUserhostWithReason(1, L"K" + (CMStringW)p1, true, L"%s", gch->ptszUID); + break; + case 9: + DoUserhostWithReason(1, L"L" + (CMStringW)p1, true, L"%s", gch->ptszUID); + break; + case 10: + PostIrcMessage(L"/WHOIS %s %s", gch->ptszUID, gch->ptszUID); + break; + // case 11: + // DoUserhostWithReason(1, "I", true, "%s", gch->ptszUID ); + // break; + // case 12: + // DoUserhostWithReason(1, "J", true, "%s", gch->ptszUID ); + // break; + case 13: + PostIrcMessage(L"/DCC CHAT %s", gch->ptszUID); + break; + case 14: + PostIrcMessage(L"/DCC SEND %s", gch->ptszUID); + break; + case 15: + DoUserhostWithReason(1, L"I", true, L"%s", gch->ptszUID); + break; + case 16: + PostIrcMessage(L"/MODE %s +h %s", p1, gch->ptszUID); + break; + case 17: + PostIrcMessage(L"/MODE %s -h %s", p1, gch->ptszUID); + break; + case 18: + PostIrcMessage(L"/MODE %s +q %s", p1, gch->ptszUID); + break; + case 19: + PostIrcMessage(L"/MODE %s -q %s", p1, gch->ptszUID); + break; + case 20: + PostIrcMessage(L"/MODE %s +a %s", p1, gch->ptszUID); + break; + case 21: + PostIrcMessage(L"/MODE %s -a %s", p1, gch->ptszUID); + break; + case 22: + PostIrcMessage(L"/NOTICE %s %%question=\"%s\",\"%s\"", + gch->ptszUID, TranslateT("Please enter the notice text"), TranslateT("Send notice")); + break; + case 23: + PostIrcMessage(L"/INVITE %s %%question=\"%s\",\"%s\"", + gch->ptszUID, TranslateT("Please enter the channel name to invite to"), TranslateT("Invite to channel")); + break; + case 30: + { + PROTOSEARCHRESULT psr = {}; + psr.cbSize = sizeof(psr); + psr.flags = PSR_UNICODE; + psr.id.w = gch->ptszUID; + psr.nick.w = gch->ptszUID; + Contact_AddBySearch(m_szModuleName, &psr); + } + break; + case 31: //slap + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/slap %s", gch->ptszUID)); + break; + case 32: //nickserv info + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv INFO %s ALL", gch->ptszUID)); + break; + case 33: //nickserv ghost + PostIrcMessageWnd(p1, NULL, CMStringW(FORMAT, L"/nickserv GHOST %s", gch->ptszUID)); + break; } + break; } + mir_free(p1); - return 0; + return 1; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index e3512d3321..1b07311a7e 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1368,7 +1368,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) T2Utf roomJid(gch->si->ptszID); JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, roomJid); if (item == nullptr) - return 0; + return 1; switch (gch->iType) { case GC_USER_MESSAGE: @@ -1408,7 +1408,7 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam) break; } - return 0; + return 1; } ///////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 9129f46ba8..5e67a49b61 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -219,7 +219,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_tszSelectedLang = mir_strdup("en"); } - CJabberProto::~CJabberProto() { ConsoleUninit(); diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index bb6c4c3e99..e38fbac244 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -455,7 +455,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) { GCHOOK *gch = (GCHOOK*)lParam; if (!gch) - return 1; + return 0; if (_stricmp(gch->si->pszModule, m_szModuleName)) return 0; @@ -549,7 +549,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) break; } - return 0; + return 1; } int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 7f13e74967..6d96e70d93 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -71,7 +71,6 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) { GCHOOK *hook = reinterpret_cast(lParam); - if (mir_strcmp(hook->si->pszModule, m_szModuleName)) return 0; @@ -182,7 +181,7 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam) break; } - return 0; + return 1; } void OmegleProto::SendChatMessage(std::string text) diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index ee0a6a35b9..6ff9a1bf89 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -280,8 +280,8 @@ void CSametimeProto::TerminateConference(char* name) int CSametimeProto::GcEventHook(WPARAM, LPARAM lParam) { GCHOOK* gch = (GCHOOK*)lParam; - - if (strcmp(gch->si->pszModule, m_szModuleName) != 0) return 0; + if (strcmp(gch->si->pszModule, m_szModuleName) != 0) + return 0; GList *conferences = mwServiceConference_getConferences(service_conference); for (GList *conf = conferences;conf;conf = conf->next) { @@ -313,8 +313,7 @@ int CSametimeProto::GcEventHook(WPARAM, LPARAM lParam) { } g_list_free(conferences); - - return 0; + return 1; } int CSametimeProto::ChatDeleted(MCONTACT hContact) { diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 990d1d6cee..cdab9bc6cd 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -87,7 +87,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) { GCHOOK *gch = (GCHOOK*)lParam; if (!gch) - return 1; + return 0; if (mir_strcmp(gch->si->pszModule, m_szModuleName) != 0) return 0; @@ -129,10 +129,8 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) if (hContact != NULL) SendRequest(new InviteUserToChatRequest(chat_id, Contacts[hContact], "User", this)); - { - mir_cslock lck(m_InviteDialogsLock); - m_InviteDialogs.remove(&dlg); - } + mir_cslock lck(m_InviteDialogsLock); + m_InviteDialogs.remove(&dlg); } break; @@ -200,7 +198,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) } break; } - return 0; + return 1; } INT_PTR CSkypeProto::OnJoinChatRoom(WPARAM hContact, LPARAM) diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 733e4aacee..3ede02bae6 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -62,14 +62,14 @@ int CTwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam) break; case GC_USER_PRIVMESS: - { - ptrA text(mir_u2a(hook->ptszUID)); - CallService(MS_MSG_SENDMESSAGE, WPARAM(UsernameToHContact(text)), 0); - } - break; + { + ptrA text(mir_u2a(hook->ptszUID)); + CallService(MS_MSG_SENDMESSAGE, UsernameToHContact(text), 0); + } + break; } - return 0; + return 1; } // TODO: remove nick? diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index a5904b7b46..bc39f6cc40 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -455,7 +455,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) CVkChatInfo *cc = GetChatById(gch->si->ptszID); if (cc == nullptr) - return 0; + return 1; switch (gch->iType) { case GC_USER_MESSAGE: @@ -489,7 +489,7 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam) NickMenuHook(cc, gch); break; } - return 0; + return 1; } void CVkProto::OnSendChatMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) -- cgit v1.2.3