diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-07 13:02:12 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-07 13:02:12 +0300 |
commit | 13474cea9a306a3bc8ffd24545836b919463c056 (patch) | |
tree | e1e31fd79368afa89529eb3ac594fa19840cea81 /plugins/BuddyPounce | |
parent | 3ac6eea5b042cf04e28060c47369e999fbdf3ad5 (diff) |
fixes #1536 (Steam and BuddyPounce menu items appear for all contacts)
Diffstat (limited to 'plugins/BuddyPounce')
-rw-r--r-- | plugins/BuddyPounce/src/main.cpp | 35 | ||||
-rw-r--r-- | plugins/BuddyPounce/src/version.h | 2 |
2 files changed, 19 insertions, 18 deletions
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index 53e56be61a..90b28e8e42 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -3,6 +3,8 @@ CMPlugin g_plugin;
MWindowList hWindowList;
+static HGENMENU g_hMenuItem;
+
/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfoEx = {
@@ -23,19 +25,6 @@ CMPlugin::CMPlugin() : {}
/////////////////////////////////////////////////////////////////////////////////////////
-// MainInit
-
-int MainInit(WPARAM, LPARAM)
-{
- CMenuItem mi(&g_plugin);
- SET_UID(mi, 0x719c1596, 0xb0fd, 0x4c74, 0xb7, 0xe4, 0xeb, 0x22, 0xf4, 0x99, 0xd7, 0x68);
- mi.position = 10;
- mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_POUNCE));
- mi.name.a = LPGEN("&Buddy Pounce");
- mi.pszService = "BuddyPounce/MenuCommand";
- Menu_AddContactMenuItem(&mi);
- return 0;
-}
int MsgAck(WPARAM, LPARAM lParam)
{
@@ -74,6 +63,12 @@ int MsgAck(WPARAM, LPARAM lParam) return 0;
}
+int PrebuildContactMenu(WPARAM hContact, LPARAM)
+{
+ Menu_ShowItem(g_hMenuItem, (CallProtoService(GetContactProto(hContact), PS_GETCAPS, PFLAGNUM_1) & PF1_IM) != 0);
+ return 0;
+}
+
int BuddyPounceOptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
@@ -194,8 +189,7 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) MCONTACT hContact = wParam;
wchar_t* message = (wchar_t*)lParam;
DBVARIANT dbv;
- if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv))
- {
+ if (!db_get_ws(hContact, MODULENAME, "PounceMsg", &dbv)) {
wchar_t* newPounce = (wchar_t*)mir_alloc(mir_wstrlen(dbv.pwszVal) + mir_wstrlen(message) + 1);
if (!newPounce) return 1;
mir_wstrcpy(newPounce, dbv.pwszVal);
@@ -213,12 +207,19 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) int CMPlugin::Load()
{
- HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, UserOnlineSettingChanged);
HookEvent(ME_OPT_INITIALISE, BuddyPounceOptInit);
HookEvent(ME_PROTO_ACK, MsgAck);
- CreateServiceFunction("BuddyPounce/MenuCommand", BuddyPounceMenuCommand);
+ CMenuItem mi(&g_plugin);
+ SET_UID(mi, 0x719c1596, 0xb0fd, 0x4c74, 0xb7, 0xe4, 0xeb, 0x22, 0xf4, 0x99, 0xd7, 0x68);
+ mi.position = 10;
+ mi.hIcolibItem = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_POUNCE));
+ mi.name.a = LPGEN("&Buddy Pounce");
+ mi.pszService = "BuddyPounce/MenuCommand";
+ g_hMenuItem = Menu_AddContactMenuItem(&mi);
+ CreateServiceFunction(mi.pszService, BuddyPounceMenuCommand);
hWindowList = WindowList_Create();
diff --git a/plugins/BuddyPounce/src/version.h b/plugins/BuddyPounce/src/version.h index a6bd8c6de4..49843db69b 100644 --- a/plugins/BuddyPounce/src/version.h +++ b/plugins/BuddyPounce/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 3 #define __RELEASE_NUM 2 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include <stdver.h> |