summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/icq_menu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-28 16:34:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-28 16:34:30 +0300
commit81ce57622c3166830b23eae534dacc6b008c659d (patch)
tree6d6ac74667f733a20b94fa27cc01c2f45688c533 /protocols/IcqOscarJ/src/icq_menu.cpp
parentc2bb7727483b9b5620e8cc0ce6adae35ee78d0a4 (diff)
common protocol instance management code went into template
Diffstat (limited to 'protocols/IcqOscarJ/src/icq_menu.cpp')
-rw-r--r--protocols/IcqOscarJ/src/icq_menu.cpp28
1 files changed, 4 insertions, 24 deletions
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp
index 97fa93ab52..827f3e9c09 100644
--- a/protocols/IcqOscarJ/src/icq_menu.cpp
+++ b/protocols/IcqOscarJ/src/icq_menu.cpp
@@ -30,41 +30,21 @@
HGENMENU g_hContactMenuItems[3];
HANDLE g_hContactMenuSvc[3];
-static int sttCompareProtocols(const CIcqProto *p1, const CIcqProto *p2)
-{
- return mir_strcmp(p1->m_szModuleName, p2->m_szModuleName);
-}
-
-LIST<CIcqProto> g_Instances(1, sttCompareProtocols);
-
-static CIcqProto* IcqGetInstanceByHContact(MCONTACT hContact)
-{
- char* szProto = GetContactProto(hContact);
- if (szProto == nullptr)
- return nullptr;
-
- for (auto &it : g_Instances)
- if (!mir_strcmp(szProto, it->m_szModuleName))
- return it;
-
- return nullptr;
-}
-
static INT_PTR IcqMenuHandleAddServContact(WPARAM wParam, LPARAM lParam)
{
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
+ CIcqProto* ppro = CMPlugin::getInstance(wParam);
return (ppro) ? ppro->AddServerContact(wParam, lParam) : 0;
}
static INT_PTR IcqMenuHandleXStatusDetails(WPARAM wParam, LPARAM lParam)
{
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
+ CIcqProto* ppro = CMPlugin::getInstance(wParam);
return (ppro) ? ppro->ShowXStatusDetails(wParam, lParam) : 0;
}
static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam)
{
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
+ CIcqProto* ppro = CMPlugin::getInstance(wParam);
return (ppro) ? ppro->OpenWebProfile(wParam, lParam) : 0;
}
@@ -74,7 +54,7 @@ static int IcqPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE);
Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE);
- CIcqProto* ppro = IcqGetInstanceByHContact(wParam);
+ CIcqProto* ppro = CMPlugin::getInstance(wParam);
return (ppro) ? ppro->OnPreBuildContactMenu(wParam, lParam) : 0;
}