diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-22 00:55:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-22 00:57:16 +0300 |
commit | d28931ebdfc4ff561d05ab000aee4cbb5ac24d62 (patch) | |
tree | e5cfd83eb231df123a3d744106a4e9b521fba409 /protocols | |
parent | 921f870dd0feec3230a8634abbd85c556e9f3d22 (diff) |
OnEvent(EV_PROTO_ONCONTACTDELETED) => PROTO_INTERFACE::OnContactDeleted
Diffstat (limited to 'protocols')
35 files changed, 110 insertions, 204 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 003079a283..ec9faa0690 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -92,6 +92,49 @@ CDiscordProto::~CDiscordProto() ::CloseHandle(m_evRequestsQueue); } +///////////////////////////////////////////////////////////////////////////////////////// + +void CDiscordProto::OnModulesLoaded() +{ + // Fill users list + for (auto &hContact : AccContacts()) { + CDiscordUser *pNew = new CDiscordUser(getId(hContact, DB_KEY_ID)); + pNew->hContact = hContact; + pNew->channelId = getId(hContact, DB_KEY_CHANNELID); + pNew->lastMsg.id = getId(hContact, DB_KEY_LASTMSGID); + pNew->wszUsername = ptrW(getWStringA(hContact, DB_KEY_NICK)); + pNew->iDiscriminator = getDword(hContact, DB_KEY_DISCR); + arUsers.insert(pNew); + } + + GCREGISTER gcr = {}; + gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR; + gcr.ptszDispName = m_tszUserName; + gcr.pszModule = m_szModuleName; + Chat_Register(&gcr); + + // Clist + Clist_GroupCreate(0, m_wszDefaultGroup); + + HookProtoEvent(ME_GC_EVENT, &CDiscordProto::GroupchatEventHook); + HookProtoEvent(ME_GC_BUILDMENU, &CDiscordProto::GroupchatMenuHook); + + InitMenus(); +} + +void CDiscordProto::OnShutdown() +{ + debugLogA("CDiscordProto::OnPreShutdown"); + + m_bTerminated = true; + SetEvent(m_evRequestsQueue); + + if (m_hGatewayConnection) + Netlib_Shutdown(m_hGatewayConnection); +} + +///////////////////////////////////////////////////////////////////////////////////////// + INT_PTR CDiscordProto::GetCaps(int type, MCONTACT) { switch (type) { @@ -422,19 +465,17 @@ int CDiscordProto::OnDbEventRead(WPARAM, LPARAM hDbEvent) ///////////////////////////////////////////////////////////////////////////////////////// -int CDiscordProto::OnDeleteContact(MCONTACT hContact) +void CDiscordProto::OnContactDeleted(MCONTACT hContact) { CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID)); if (pUser == nullptr || !m_bOnline) - return 0; + return; if (pUser->channelId) Push(new AsyncHttpRequest(this, REQUEST_DELETE, CMStringA(FORMAT, "/channels/%lld", pUser->channelId), nullptr)); if (pUser->id) RemoveFriend(pUser->id); - - return 0; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -546,56 +587,3 @@ HANDLE CDiscordProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, ForkThread(&CDiscordProto::SendFileThread, param); return param; } - -///////////////////////////////////////////////////////////////////////////////////////// - -void CDiscordProto::OnModulesLoaded() -{ - // Fill users list - for (auto &hContact : AccContacts()) { - CDiscordUser *pNew = new CDiscordUser(getId(hContact, DB_KEY_ID)); - pNew->hContact = hContact; - pNew->channelId = getId(hContact, DB_KEY_CHANNELID); - pNew->lastMsg.id = getId(hContact, DB_KEY_LASTMSGID); - pNew->wszUsername = ptrW(getWStringA(hContact, DB_KEY_NICK)); - pNew->iDiscriminator = getDword(hContact, DB_KEY_DISCR); - arUsers.insert(pNew); - } - - GCREGISTER gcr = {}; - gcr.dwFlags = GC_TYPNOTIF | GC_CHANMGR; - gcr.ptszDispName = m_tszUserName; - gcr.pszModule = m_szModuleName; - Chat_Register(&gcr); - - // Clist - Clist_GroupCreate(0, m_wszDefaultGroup); - - HookProtoEvent(ME_GC_EVENT, &CDiscordProto::GroupchatEventHook); - HookProtoEvent(ME_GC_BUILDMENU, &CDiscordProto::GroupchatMenuHook); - - InitMenus(); -} - -void CDiscordProto::OnShutdown() -{ - debugLogA("CDiscordProto::OnPreShutdown"); - - m_bTerminated = true; - SetEvent(m_evRequestsQueue); - - if (m_hGatewayConnection) - Netlib_Shutdown(m_hGatewayConnection); -} - -///////////////////////////////////////////////////////////////////////////////////////// - -int CDiscordProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM) -{ - switch (event) { - case EV_PROTO_ONCONTACTDELETED: - return OnDeleteContact((MCONTACT)wParam); - } - - return 1; -} diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 0b095d70da..8723c072d5 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -257,7 +257,9 @@ public: CDiscordProto(const char*,const wchar_t*); ~CDiscordProto(); + ////////////////////////////////////////////////////////////////////////////////////// // PROTO_INTERFACE + INT_PTR GetCaps(int, MCONTACT = 0) override; HWND CreateExtendedSearchUI(HWND owner) override; @@ -279,12 +281,14 @@ public: int UserIsTyping(MCONTACT hContact, int type) override; int SetStatus(int iNewStatus) override; - int OnEvent(PROTOEVENTTYPE, WPARAM, LPARAM) override; + void OnContactDeleted(MCONTACT) override; void OnModulesLoaded() override; void OnShutdown() override; + ////////////////////////////////////////////////////////////////////////////////////// // Services + INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM); @@ -292,11 +296,15 @@ public: INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM); INT_PTR __cdecl SetMyAvatar(WPARAM, LPARAM); + ////////////////////////////////////////////////////////////////////////////////////// // Events + int __cdecl OnOptionsInit(WPARAM, LPARAM); int __cdecl OnDbEventRead(WPARAM, LPARAM); + ////////////////////////////////////////////////////////////////////////////////////// // dispatch commands + void OnCommandChannelCreated(const JSONNode&); void OnCommandChannelDeleted(const JSONNode&); void OnCommandChannelUpdated(const JSONNode&); @@ -321,8 +329,6 @@ public: void OnLoggedIn(); void OnLoggedOut(); - int OnDeleteContact(MCONTACT hContact); - void OnReceiveCreateChannel(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnReceiveFile(NETLIBHTTPREQUEST*, AsyncHttpRequest*); void OnReceiveGateway(NETLIBHTTPREQUEST*, AsyncHttpRequest*); @@ -339,7 +345,9 @@ public: bool RetrieveAvatar(MCONTACT hContact); void OnReceiveAvatar(NETLIBHTTPREQUEST*, AsyncHttpRequest*); + ////////////////////////////////////////////////////////////////////////////////////// // Misc + void SetServerStatus(int iStatus); void RemoveFriend(SnowFlake id); diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 7ebd189b9d..e3b1bd553a 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -553,7 +553,7 @@ HANDLE FacebookProto::GetAwayMsg(MCONTACT) return nullptr; // Status messages are disabled } -int FacebookProto::OnContactDeleted(WPARAM hContact, LPARAM) +void FacebookProto::OnContactDeleted(MCONTACT hContact) { // Remove this contact from caches ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); @@ -572,7 +572,6 @@ int FacebookProto::OnContactDeleted(WPARAM hContact, LPARAM) // Cancel friendship (with confirmation) CancelFriendship(hContact, 1); - return 0; } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 1e859eaba1..e280fbc737 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -390,9 +390,6 @@ INT_PTR FacebookProto::GetNotificationsCount(WPARAM, LPARAM) int FacebookProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) { switch (event) { - case EV_PROTO_ONCONTACTDELETED: - return OnContactDeleted(wParam, lParam); - case EV_PROTO_ONMENU: InitMenu(); break; diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index de18548415..f4a35b48c0 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -127,6 +127,8 @@ public: int UserIsTyping(MCONTACT hContact, int type) override; int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override; + + void OnContactDeleted(MCONTACT) override; void OnModulesLoaded() override; void OnShutdown() override; @@ -170,7 +172,6 @@ public: int __cdecl OnOptionsInit(WPARAM, LPARAM); int __cdecl OnToolbarInit(WPARAM, LPARAM); int __cdecl OnBuildStatusMenu(WPARAM,LPARAM); - int __cdecl OnContactDeleted(WPARAM,LPARAM); int __cdecl OnPrebuildContactMenu(WPARAM,LPARAM); int __cdecl OnIdleChanged(WPARAM,LPARAM); int __cdecl OnGCEvent(WPARAM,LPARAM); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index cd3d98c6c2..ca86944985 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1241,7 +1241,8 @@ void GaduProto::broadcastnewstatus(int newStatus) ////////////////////////////////////////////////////////////
// When contact is deleted
-int GaduProto::contactdeleted(WPARAM hContact, LPARAM)
+
+void GaduProto::OnContactDeleted(MCONTACT hContact)
{
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
@@ -1260,7 +1261,7 @@ int GaduProto::contactdeleted(WPARAM hContact, LPARAM) Chat_Control(m_szModuleName, wszRoomId, SESSION_OFFLINE);
Chat_Terminate(m_szModuleName, wszRoomId);
}
- return 0;
+ return;
}
if (uin && isonline())
@@ -1269,8 +1270,6 @@ int GaduProto::contactdeleted(WPARAM hContact, LPARAM) gg_remove_notify_ex(m_sess, uin, GG_USER_NORMAL);
gg_LeaveCriticalSection(&sess_mutex, "contactdeleted", 25, 1, "sess_mutex", 1);
}
-
- return 0;
}
////////////////////////////////////////////////////////////
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 3851e4ce7a..c78ca2ea95 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -737,9 +737,6 @@ int GaduProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) case EV_PROTO_ONMENU:
menus_init();
break;
-
- case EV_PROTO_ONCONTACTDELETED:
- return contactdeleted(wParam, lParam);
}
return TRUE;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 8445e52499..3d2dd02d07 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -57,6 +57,7 @@ struct GaduProto : public PROTO<GaduProto> int UserIsTyping(MCONTACT hContact, int type) override;
int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
@@ -112,7 +113,6 @@ struct GaduProto : public PROTO<GaduProto> void broadcastnewstatus(int newStatus);
void cleanuplastplugin(DWORD version);
- int contactdeleted(WPARAM wParam, LPARAM lParam);
void notifyall();
void changecontactstatus(uin_t uin, int status, const wchar_t *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version);
wchar_t *getstatusmsg(int status);
diff --git a/protocols/Gadu-Gadu/src/libgadu/dcc7.cpp b/protocols/Gadu-Gadu/src/libgadu/dcc7.cpp index b9f6ef2faa..eb50fec1b5 100644 --- a/protocols/Gadu-Gadu/src/libgadu/dcc7.cpp +++ b/protocols/Gadu-Gadu/src/libgadu/dcc7.cpp @@ -1643,8 +1643,6 @@ struct gg_event *gg_dcc7_watch_fd(struct gg_dcc7 *dcc) return e; } } - - return e; } /** diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 6152e22e88..309e65374d 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -818,9 +818,6 @@ int CIrcProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) case EV_PROTO_ONMENU:
InitMainMenus();
break;
-
- case EV_PROTO_ONCONTACTDELETED:
- return OnContactDeleted(wParam, lParam);
}
return 1;
}
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index 6948098cd2..9797574c0a 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -70,6 +70,8 @@ struct CIrcProto : public PROTO<CIrcProto> int SetAwayMsg(int m_iStatus, const wchar_t *msg) override; int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override; + + void OnContactDeleted(MCONTACT) override; void OnModulesLoaded() override; void OnShutdown() override; @@ -91,7 +93,6 @@ struct CIrcProto : public PROTO<CIrcProto> INT_PTR __cdecl OnShowServerMenuCommand(WPARAM, LPARAM); // Events - int __cdecl OnContactDeleted(WPARAM, LPARAM); int __cdecl OnInitOptionsPages(WPARAM, LPARAM); int __cdecl OnInitUserInfo(WPARAM, LPARAM); int __cdecl OnMenuPreBuild(WPARAM, LPARAM); diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 0c798257f9..8b4413ce9d 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -172,11 +172,10 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) return 0;
}
-int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM)
+void CIrcProto::OnContactDeleted(MCONTACT hContact)
{
- MCONTACT hContact = (MCONTACT)wp;
if (!hContact)
- return 0;
+ return;
DBVARIANT dbv;
if (!getWString(hContact, "Nick", &dbv)) {
@@ -192,9 +191,9 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) PostIrcMessage(L"/PART %s %s", dbv.ptszVal, m_userInfo);
}
else {
- BYTE bDCC = getByte((MCONTACT)wp, "DCC", 0);
+ BYTE bDCC = getByte(hContact, "DCC", 0);
if (bDCC) {
- CDccSession *dcc = FindDCCSession((MCONTACT)wp);
+ CDccSession *dcc = FindDCCSession(hContact);
if (dcc)
dcc->Disconnect();
}
@@ -202,7 +201,6 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) db_free(&dbv);
}
- return 0;
}
INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM)
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index a2379109f8..89222ebf96 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -1821,9 +1821,6 @@ int CIcqProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) mir_snprintf(szDbSetting, "%sGroups", m_szModuleName);
db_delete_module(0, szDbSetting);
break;
-
- case EV_PROTO_ONCONTACTDELETED:
- return ServListDbContactDeleted(wParam, lParam);
}
return 1;
}
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 4f4ff59415..e653ef9a3b 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -94,6 +94,7 @@ struct CIcqProto : public PROTO<CIcqProto> int UserIsTyping(MCONTACT hContact, int type) override;
int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
@@ -664,7 +665,6 @@ struct CIcqProto : public PROTO<CIcqProto> DWORD icq_addServerPrivacyItem(MCONTACT hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType);
int __cdecl ServListDbSettingChanged(WPARAM wParam, LPARAM lParam);
- int __cdecl ServListDbContactDeleted(WPARAM wParam, LPARAM lParam);
int __cdecl ServListCListGroupChange(WPARAM wParam, LPARAM lParam);
//----| stdpackets.cpp |----------------------------------------------------------
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index b3c613d017..1720be39bb 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -2259,7 +2259,7 @@ int CIcqProto::ServListDbSettingChanged(WPARAM hContact, LPARAM lParam) }
-int CIcqProto::ServListDbContactDeleted(WPARAM hContact, LPARAM)
+void CIcqProto::OnContactDeleted(MCONTACT hContact)
{
DeleteFromContactsCache(hContact);
@@ -2268,13 +2268,13 @@ int CIcqProto::ServListDbContactDeleted(WPARAM hContact, LPARAM) setWord(hContact, "SrvRecordCount", 0);
if (!icqOnline() || !m_bSsiEnabled)
- return 0;
+ return;
// we need all server contacts on local buddy list
DWORD dwUIN;
uid_str szUID;
if (getContactUid(hContact, &dwUIN, &szUID))
- return 0;
+ return;
WORD wContactID = getWord(hContact, DBSETTING_SERVLIST_ID, 0);
WORD wGroupID = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0);
@@ -2301,8 +2301,6 @@ int CIcqProto::ServListDbContactDeleted(WPARAM hContact, LPARAM) if (wIgnoreID) // delete ignore record
icq_removeServerPrivacyItem(hContact, dwUIN, szUID, wIgnoreID, SSI_ITEM_IGNORE);
}
-
- return 0;
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index ea3d7ab58d..3316875e72 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -31,14 +31,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
// OnContactDeleted - processes a contact deletion
-int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM)
+void CJabberProto::OnContactDeleted(MCONTACT hContact)
{
if (!m_bJabberOnline) // should never happen
- return 0;
+ return;
ptrW jid(getWStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"));
if (jid == nullptr)
- return 0;
+ return;
if (ListGetItemPtr(LIST_ROSTER, jid)) {
if (!wcschr(jid, '@')) {
@@ -55,7 +55,6 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) ListRemove(LIST_ROSTER, jid);
}
- return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 801cb5bd0f..9a29ec47be 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1330,9 +1330,6 @@ int CJabberProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam case EV_PROTO_ONMENU:
MenuInit();
break;
-
- case EV_PROTO_ONCONTACTDELETED:
- return OnContactDeleted(wParam, lParam);
}
return 1;
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 4f08e9219a..f63750259d 100755 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -111,6 +111,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface int UserIsTyping(MCONTACT hContact, int type) override;
int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
@@ -120,7 +121,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface //====| Events |======================================================================
void __cdecl OnAddContactForever(MCONTACT hContact);
- int __cdecl OnContactDeleted(WPARAM, LPARAM);
int __cdecl OnDbSettingChanged(WPARAM, LPARAM);
int __cdecl OnIdleChanged(WPARAM, LPARAM);
int __cdecl OnLangChanged(WPARAM, LPARAM);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 7da11cc3ec..3b088aaf66 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -966,9 +966,6 @@ int CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) mir_snprintf(szDbsettings, "%s_HTTPS", m_szModuleName);
db_delete_module(0, szDbsettings);
break;
-
- case EV_PROTO_ONCONTACTDELETED:
- return OnContactDeleted(wParam, lParam);
}
return 1;
}
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 9e11b50b49..f64f2da3c7 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -66,10 +66,13 @@ struct CMsnProto : public PROTO<CMsnProto> int UserIsTyping(MCONTACT hContact, int type) override;
int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
//====| Services |====================================================================
+
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl GetAvatarInfo(WPARAM wParam, LPARAM lParam);
@@ -87,7 +90,7 @@ struct CMsnProto : public PROTO<CMsnProto> INT_PTR __cdecl OnLeaveChat(WPARAM wParam, LPARAM lParam);
//====| Events |======================================================================
- int __cdecl OnContactDeleted(WPARAM wParam, LPARAM lParam);
+
int __cdecl OnIdleChanged(WPARAM wParam, LPARAM lParam);
int __cdecl OnGroupChange(WPARAM wParam, LPARAM lParam);
int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 657aa54881..70ec17fc56 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -245,10 +245,10 @@ INT_PTR CMsnProto::SendNudge(WPARAM hContact, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// MsnContactDeleted - called when a contact is deleted from list
-int CMsnProto::OnContactDeleted(WPARAM hContact, LPARAM)
+void CMsnProto::OnContactDeleted(MCONTACT hContact)
{
if (!msnLoggedIn) //should never happen for MSN contacts
- return 0;
+ return;
if (isChatRoom(hContact)) {
DBVARIANT dbv;
@@ -278,8 +278,6 @@ int CMsnProto::OnContactDeleted(WPARAM hContact, LPARAM) MSN_AddUser(hContact, szEmail, 0, LIST_LL | LIST_REMOVE);
}
}
-
- return 0;
}
diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index 0ea1bb8f9c..4fe03a0547 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -128,18 +128,6 @@ int MinecraftDynmapProto::SetStatus(int new_status) } ////////////////////////////////////////////////////////////////////////////// - -int MinecraftDynmapProto::OnEvent(PROTOEVENTTYPE event,WPARAM wParam,LPARAM lParam) -{ - switch(event) { - case EV_PROTO_ONCONTACTDELETED: - return OnContactDeleted(wParam, lParam); - } - - return 1; -} - -////////////////////////////////////////////////////////////////////////////// // EVENTS INT_PTR MinecraftDynmapProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) @@ -162,10 +150,9 @@ void MinecraftDynmapProto::OnShutdown() SetStatus(ID_STATUS_OFFLINE); } -int MinecraftDynmapProto::OnContactDeleted(WPARAM, LPARAM) +void MinecraftDynmapProto::OnContactDeleted(MCONTACT) { OnLeaveChat(NULL, NULL); - return 0; } ////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h index 71c59a6fc9..9979e62ed8 100644 --- a/protocols/MinecraftDynmap/src/proto.h +++ b/protocols/MinecraftDynmap/src/proto.h @@ -44,16 +44,13 @@ public: INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override; int SetStatus(int iNewStatus) override; - int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override; + void OnContactDeleted(MCONTACT) override; void OnModulesLoaded() override; void OnShutdown() override; // Services INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); - // Events - int __cdecl OnContactDeleted(WPARAM,LPARAM); - // Chat handling int __cdecl OnChatEvent(WPARAM,LPARAM); INT_PTR __cdecl OnJoinChat(WPARAM,LPARAM); diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 80831a9293..37c127f940 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -131,18 +131,6 @@ int OmegleProto::SetStatus(int new_status) }
//////////////////////////////////////////////////////////////////////////////
-
-int OmegleProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
-{
- switch (event) {
- case EV_PROTO_ONCONTACTDELETED:
- return OnContactDeleted(wParam, lParam);
- }
-
- return 1;
-}
-
-//////////////////////////////////////////////////////////////////////////////
// EVENTS
INT_PTR OmegleProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
@@ -184,10 +172,9 @@ int OmegleProto::OnOptionsInit(WPARAM wParam, LPARAM) return 0;
}
-int OmegleProto::OnContactDeleted(WPARAM, LPARAM)
+void OmegleProto::OnContactDeleted(MCONTACT)
{
OnLeaveChat(NULL, NULL);
- return 0;
}
int OmegleProto::UserIsTyping(MCONTACT hContact, int type)
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 90a114da31..dd81adcaad 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -51,7 +51,7 @@ public: int UserIsTyping(MCONTACT hContact, int type) override;
- int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam);
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
@@ -60,7 +60,6 @@ public: // Events
int __cdecl OnOptionsInit(WPARAM, LPARAM);
- int __cdecl OnContactDeleted(WPARAM, LPARAM);
// Chat handling
int __cdecl OnChatEvent(WPARAM, LPARAM);
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index b9c7513840..d345821194 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -282,13 +282,11 @@ INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM) return 0;
}
-int CSkypeProto::OnContactDeleted(MCONTACT hContact, LPARAM)
+void CSkypeProto::OnContactDeleted(MCONTACT hContact)
{
- if (!IsOnline()) return 1;
-
- if (hContact && !isChatRoom(hContact))
- PushRequest(new DeleteContactRequest(li, Contacts[hContact]));
- return 0;
+ if (IsOnline())
+ if (hContact && !isChatRoom(hContact))
+ PushRequest(new DeleteContactRequest(li, Contacts[hContact]));
}
INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM)
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index e1a702e565..cd5baa7bc0 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -301,9 +301,6 @@ int CSkypeProto::UserIsTyping(MCONTACT hContact, int type) int CSkypeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) { switch (iEventType) { - case EV_PROTO_ONCONTACTDELETED: - return OnContactDeleted(wParam, lParam); - case EV_PROTO_ONMENU: return OnInitStatusMenu(); } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 7162695ea3..b9c9d96f4a 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -55,6 +55,7 @@ public: int SetAwayMsg(int m_iStatus, const wchar_t *msg) override;
int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
@@ -288,8 +289,6 @@ private: void LoadContactsInfo(const NETLIBHTTPREQUEST *response);
void LoadContactList(const NETLIBHTTPREQUEST *response);
- int __cdecl OnContactDeleted(MCONTACT, LPARAM);
-
void OnBlockContact(const NETLIBHTTPREQUEST *response, void *p);
void OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p);
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index ec77254b02..191169160b 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -341,23 +341,14 @@ HANDLE CSteamProto::GetAwayMsg(MCONTACT hContact) return (HANDLE)1; } -int CSteamProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM) +void CSteamProto::OnContactDeleted(MCONTACT hContact) { - switch (eventType) { - case EV_PROTO_ONCONTACTDELETED: - if (IsOnline()) { - MCONTACT hContact = (MCONTACT)wParam; - // remove only authorized contacts - if (!getByte(hContact, "Auth", 0)) { - ptrA token(getStringA("TokenSecret")); - ptrA sessionId(getStringA("SessionID")); - ptrA steamId(getStringA("SteamID")); - char *who = getStringA(hContact, "SteamID"); - PushRequest(new RemoveFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendRemoved, (void*)who); - } - } - return 0; + // remove only authorized contacts + if (!getByte(hContact, "Auth", 0)) { + ptrA token(getStringA("TokenSecret")); + ptrA sessionId(getStringA("SessionID")); + ptrA steamId(getStringA("SteamID")); + char *who = getStringA(hContact, "SteamID"); + PushRequest(new RemoveFriendRequest(token, sessionId, steamId, who), &CSteamProto::OnFriendRemoved, (void*)who); } - - return 1; }
\ No newline at end of file diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index ef971cb2e9..4298d45737 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -74,7 +74,7 @@ public: int UserIsTyping(MCONTACT hContact, int type) override;
- int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
// menus
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 6c93559463..f6e72d7b47 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -199,22 +199,20 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM) return 0;
}
-int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM)
+void CToxProto::OnContactDeleted(MCONTACT hContact)
{
if (!IsOnline())
- return 0;
+ return;
if (!isChatRoom(hContact)) {
int32_t friendNumber = GetToxFriendNumber(hContact);
TOX_ERR_FRIEND_DELETE error;
if (!tox_friend_delete(m_toxThread->Tox(), friendNumber, &error)) {
debugLogA(__FUNCTION__": failed to delete friend (%d)", error);
- return error;
+ return;
}
SaveToxProfile(m_toxThread->Tox());
}
-
- return 0;
}
void CToxProto::OnFriendRequest(Tox*, const uint8_t *pubKey, const uint8_t *message, size_t /* length */, void *arg)
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 6e95610f26..004211284f 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -230,9 +230,6 @@ int CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) case EV_PROTO_ONRENAME:
return OnAccountRenamed(wParam, lParam);
- case EV_PROTO_ONCONTACTDELETED:
- return OnContactDeleted(wParam, lParam);
-
case EV_PROTO_ONMENU:
return OnInitStatusMenu();
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index acf1cc0898..b89ce4118d 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -47,6 +47,7 @@ public: int UserIsTyping(MCONTACT hContact, int type) override;
int OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
// icons
@@ -166,8 +167,6 @@ private: INT_PTR __cdecl OnRequestAuth(WPARAM hContact, LPARAM lParam);
INT_PTR __cdecl OnGrantAuth(WPARAM hContact, LPARAM);
- int __cdecl OnContactDeleted(MCONTACT, LPARAM);
-
static void OnFriendRequest(Tox *tox, const uint8_t *pubKey, const uint8_t *message, size_t length, void *arg);
static void OnFriendNameChange(Tox *tox, uint32_t friendNumber, const uint8_t *name, size_t length, void *arg);
static void OnStatusMessageChanged(Tox *tox, uint32_t friendNumber, const uint8_t *message, size_t length, void *arg);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index eaf507aabd..e8325d3d41 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -518,18 +518,6 @@ INT_PTR CVkProto::GetCaps(int type, MCONTACT) //////////////////////////////////////////////////////////////////////////////
-int CVkProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
-{
- switch (event) {
- case EV_PROTO_ONCONTACTDELETED:
- return OnContactDeleted(wParam, lParam);
- }
-
- return 1;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
MCONTACT CVkProto::AddToList(int, PROTOSEARCHRESULT *psr)
{
debugLogA("CVkProto::AddToList");
@@ -657,17 +645,17 @@ int CVkProto::GetInfo(MCONTACT hContact, int) return 0;
}
-int CVkProto::OnContactDeleted(WPARAM hContact, LPARAM)
+void CVkProto::OnContactDeleted(MCONTACT hContact)
{
ptrW pwszNick(db_get_wsa(hContact, m_szModuleName, "Nick"));
debugLogW(L"CVkProto::OnContactDeleted %s", pwszNick);
if (db_get_b(hContact, "CList", "NotOnList") || getBool(hContact, "SilentDelete") || isChatRoom((MCONTACT)hContact))
- return 0;
+ return;
LONG userID = getDword(hContact, "ID", VK_INVALID_USER);
if (userID == VK_INVALID_USER || userID == VK_FEED_USER)
- return 0;
+ return;
CONTACTDELETE_FORM_PARAMS *param = new CONTACTDELETE_FORM_PARAMS(pwszNick, true, !getBool(hContact, "Auth", true), true);
CVkContactDeleteForm dlg(this, param);
@@ -675,7 +663,7 @@ int CVkProto::OnContactDeleted(WPARAM hContact, LPARAM) debugLogW(L"CVkProto::OnContactDeleted %s DeleteDialog=%d DeleteFromFriendlist=%d", pwszNick, param->bDeleteDialog, param->bDeleteFromFriendlist);
if (!(param->bDeleteDialog || param->bDeleteFromFriendlist))
- return 0;
+ return;
CMStringA code(FORMAT, "var userID=\"%d\";", userID);
if (param->bDeleteDialog)
@@ -688,6 +676,4 @@ int CVkProto::OnContactDeleted(WPARAM hContact, LPARAM) Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveSmth)
<< CHAR_PARAM("code", code.c_str()));
-
- return 0;
}
\ No newline at end of file diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 50e5924afe..f1fd68ba43 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -66,14 +66,13 @@ struct CVkProto : public PROTO<CVkProto> int SetStatus(int iNewStatus) override;
int UserIsTyping(MCONTACT hContact, int type) override;
- int OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) override;
+ void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
//==== Events ========================================================================
int __cdecl OnOptionsInit(WPARAM, LPARAM);
- int __cdecl OnContactDeleted(WPARAM, LPARAM);
void OnOAuthAuthorize(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
void OnReceiveAvatar(NETLIBHTTPREQUEST*, AsyncHttpRequest*);
|