summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-25 12:06:17 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-25 12:06:17 +0300
commit30387a749280e955af923d4a06c325651fe964ac (patch)
tree024947cb7729eb7427b2e7b5f2dc6446c40569dd /protocols/VKontakte
parent8f6f88cb88c460eaf0ca96b0db7cbda3ab010075 (diff)
fixes #2080 (protocol menu is lost during dynamic account creation)
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp60
-rw-r--r--protocols/VKontakte/src/vk_proto.h1
2 files changed, 33 insertions, 28 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index d1198e1a5d..1a69ec8000 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -115,34 +115,10 @@ void CVkProto::OnModulesLoaded()
/////////////////////////////////////////////////////////////////////////////////////////
// Menu support
-void CVkProto::InitMenus()
+void CVkProto::OnBuildProtoMenu()
{
- HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CVkProto::OnPreBuildContactMenu);
-
- //Contact Menu Services
- CreateProtoService(PS_GETSERVERHISTORYLAST1DAY, &CVkProto::SvcGetServerHistoryLastNDay<1>);
- CreateProtoService(PS_GETSERVERHISTORYLAST3DAY, &CVkProto::SvcGetServerHistoryLastNDay<3>);
- CreateProtoService(PS_GETSERVERHISTORYLAST7DAY, &CVkProto::SvcGetServerHistoryLastNDay<7>);
- CreateProtoService(PS_GETSERVERHISTORYLAST30DAY, &CVkProto::SvcGetServerHistoryLastNDay<30>);
- CreateProtoService(PS_GETSERVERHISTORYLAST90DAY, &CVkProto::SvcGetServerHistoryLastNDay<90>);
- CreateProtoService(PS_GETALLSERVERHISTORYFORCONTACT, &CVkProto::SvcGetAllServerHistoryForContact);
- CreateProtoService(PS_GETALLSERVERHISTORY, &CVkProto::SvcGetAllServerHistory);
- CreateProtoService(PS_VISITPROFILE, &CVkProto::SvcVisitProfile);
- CreateProtoService(PS_CREATECHAT, &CVkProto::SvcCreateChat);
- CreateProtoService(PS_ADDASFRIEND, &CVkProto::SvcAddAsFriend);
- CreateProtoService(PS_DELETEFRIEND, &CVkProto::SvcDeleteFriend);
- CreateProtoService(PS_BANUSER, &CVkProto::SvcBanUser);
- CreateProtoService(PS_REPORTABUSE, &CVkProto::SvcReportAbuse);
- CreateProtoService(PS_DESTROYKICKCHAT, &CVkProto::SvcDestroyKickChat);
- CreateProtoService(PS_OPENBROADCAST, &CVkProto::SvcOpenBroadcast);
- CreateProtoService(PS_LOADVKNEWS, &CVkProto::SvcLoadVKNews);
- CreateProtoService(PS_WIPENONFRIENDS, &CVkProto::SvcWipeNonFriendContacts);
- CreateProtoService(PS_SETSTATUSMSG, &CVkProto::SvcSetStatusMsg);
- CreateProtoService(PS_WALLPOST, &CVkProto::SvcWallPost);
- CreateProtoService(PS_MARKMESSAGESASREAD, &CVkProto::SvcMarkMessagesAsRead);
-
- for (int i = 0; i < PMI_COUNT; i++)
- m_hProtoMenuItems[i] = nullptr;
+ for (auto &it : m_hProtoMenuItems)
+ it = nullptr;
CMenuItem mi(&g_plugin);
mi.root = Menu_GetProtocolRoot(this);
@@ -210,9 +186,37 @@ void CVkProto::InitMenus()
SET_UID(mi, 0x9550515e, 0x2a45, 0x4913, 0x95, 0x1a, 0x1e, 0xfa, 0x7, 0xc6, 0x2d, 0x60);
m_hProtoMenuItems[PMI_VISITPROFILE] = Menu_AddProtoMenuItem(&mi, m_szModuleName);
}
+}
+
+void CVkProto::InitMenus()
+{
+ HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CVkProto::OnPreBuildContactMenu);
+
+ //Contact Menu Services
+ CreateProtoService(PS_GETSERVERHISTORYLAST1DAY, &CVkProto::SvcGetServerHistoryLastNDay<1>);
+ CreateProtoService(PS_GETSERVERHISTORYLAST3DAY, &CVkProto::SvcGetServerHistoryLastNDay<3>);
+ CreateProtoService(PS_GETSERVERHISTORYLAST7DAY, &CVkProto::SvcGetServerHistoryLastNDay<7>);
+ CreateProtoService(PS_GETSERVERHISTORYLAST30DAY, &CVkProto::SvcGetServerHistoryLastNDay<30>);
+ CreateProtoService(PS_GETSERVERHISTORYLAST90DAY, &CVkProto::SvcGetServerHistoryLastNDay<90>);
+ CreateProtoService(PS_GETALLSERVERHISTORYFORCONTACT, &CVkProto::SvcGetAllServerHistoryForContact);
+ CreateProtoService(PS_GETALLSERVERHISTORY, &CVkProto::SvcGetAllServerHistory);
+ CreateProtoService(PS_VISITPROFILE, &CVkProto::SvcVisitProfile);
+ CreateProtoService(PS_CREATECHAT, &CVkProto::SvcCreateChat);
+ CreateProtoService(PS_ADDASFRIEND, &CVkProto::SvcAddAsFriend);
+ CreateProtoService(PS_DELETEFRIEND, &CVkProto::SvcDeleteFriend);
+ CreateProtoService(PS_BANUSER, &CVkProto::SvcBanUser);
+ CreateProtoService(PS_REPORTABUSE, &CVkProto::SvcReportAbuse);
+ CreateProtoService(PS_DESTROYKICKCHAT, &CVkProto::SvcDestroyKickChat);
+ CreateProtoService(PS_OPENBROADCAST, &CVkProto::SvcOpenBroadcast);
+ CreateProtoService(PS_LOADVKNEWS, &CVkProto::SvcLoadVKNews);
+ CreateProtoService(PS_WIPENONFRIENDS, &CVkProto::SvcWipeNonFriendContacts);
+ CreateProtoService(PS_SETSTATUSMSG, &CVkProto::SvcSetStatusMsg);
+ CreateProtoService(PS_WALLPOST, &CVkProto::SvcWallPost);
+ CreateProtoService(PS_MARKMESSAGESASREAD, &CVkProto::SvcMarkMessagesAsRead);
+
// Contact Menu Items
- mi.root = nullptr;
+ CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
mi.pszService = PS_VISITPROFILE;
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 984dc46808..3e5e888c79 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -66,6 +66,7 @@ struct CVkProto : public PROTO<CVkProto>
int SetStatus(int iNewStatus) override;
int UserIsTyping(MCONTACT hContact, int type) override;
+ void OnBuildProtoMenu() override;
void OnContactDeleted(MCONTACT) override;
void OnModulesLoaded() override;
void OnShutdown() override;