summaryrefslogtreecommitdiff
path: root/src/modules/metacontacts
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-15 20:31:21 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-15 20:31:21 +0000
commit9561b4646d502c99174a2bc0bf40f3ad5bc39d93 (patch)
tree45ddd273ee99febd2fd5507984c16cee8bdd0ad1 /src/modules/metacontacts
parent94be27b5a7e0944650c6ca0855b7340cfc352a86 (diff)
MC srmm menu OnClick procedure
git-svn-id: http://svn.miranda-ng.org/main/trunk@8633 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/metacontacts')
-rw-r--r--src/modules/metacontacts/meta_services.cpp41
-rw-r--r--src/modules/metacontacts/meta_utils.cpp16
2 files changed, 42 insertions, 15 deletions
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index 7ee5556559..0ee2bf2f80 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -563,6 +563,46 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam)
return 0;
}
+// we assume that it could be called only for the metacontacts
+int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam)
+{
+ StatusIconClickData *sicd = (StatusIconClickData*)lParam;
+ if (lstrcmpA(sicd->szModule, META_PROTO))
+ return 0;
+
+ DBCachedContact *cc = CheckMeta(hMeta);
+ if (cc == NULL)
+ return 0;
+
+ HMENU hMenu = CreatePopupMenu();
+ int iDefault = Meta_GetContactNumber(cc, Meta_GetMostOnline(cc));
+ TCHAR tszItemName[200];
+
+ MENUITEMINFO mii = { sizeof(mii) };
+ mii.fMask = MIIM_ID | MIIM_STATE | MIIM_STRING;
+ mii.dwTypeData = tszItemName;
+ mii.cch = SIZEOF(tszItemName);
+ for (int i = 0; i < cc->nSubs; i++) {
+ char *szProto = GetContactProto(cc->pSubs[i]);
+ if (szProto == NULL) continue;
+
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ if (pa == NULL) continue;
+
+ mir_sntprintf(tszItemName, SIZEOF(tszItemName), _T("%s [%s]"),
+ cli.pfnGetContactDisplayName(cc->pSubs[i], 0), pa->tszAccountName);
+
+ mii.wID = i + 1;
+ mii.fState = (i == iDefault) ? MFS_CHECKED : MFS_ENABLED;
+ InsertMenuItem(hMenu, i, TRUE, &mii);
+ }
+
+ UINT res = TrackPopupMenu(hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_BOTTOMALIGN | TPM_LEFTALIGN, sicd->clickLocation.x, sicd->clickLocation.y, 0, cli.hwndContactTree, NULL);
+ if (res > 0)
+ db_mc_setDefault(cc->contactID, Meta_GetContactHandle(cc, res - 1));
+ return 0;
+}
+
int Meta_ClistDoubleClicked(WPARAM hMeta, LPARAM lParam)
{
DBCachedContact *cc = currDb->m_cache->GetCachedContact(hMeta);
@@ -606,6 +646,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam)
// hook srmm window close/open events
HookEvent(ME_MSG_WINDOWEVENT, Meta_MessageWindowEvent);
+ HookEvent(ME_MSG_ICONPRESSED, Meta_SrmmIconClicked);
// hook protocol nudge events to forward to subcontacts
int numberOfProtocols;
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index 8429fec83f..adac54c90f 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -530,20 +530,6 @@ int Meta_SwapContacts(DBCachedContact *cc, int n1, int n2)
/////////////////////////////////////////////////////////////////////////////////////////
-INT_PTR CALLBACK DlgProcNull(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- HWND prog = GetDlgItem(hwndDlg, IDC_PROG);
-
- TranslateDialogDefault(hwndDlg);
-
- SendMessage(prog, PBM_SETPOS, 0, 0);
- return TRUE;
- }
- return FALSE;
-}
-
void Meta_FixStatus(DBCachedContact *ccMeta)
{
WORD status = ID_STATUS_OFFLINE;
@@ -578,4 +564,4 @@ void Meta_UpdateSrmmIcon(DBCachedContact *ccMeta, int iStatus)
}
}
Srmm_ModifyIcon(ccMeta->contactID, &sid);
-} \ No newline at end of file
+}