static int ServiceParseLink(WPARAM wParam, LPARAM lParam) { char *arg = (char*)lParam; UNREFERENCED_PARAMETER(wParam); if (arg == NULL) return 1; /* sanity check */ /* send message: gg:UID */ /* skip leading prefix */ arg = strchr(arg, ':'); if (arg == NULL) return 1; /* parse failed */ for (++arg; *arg == '/'; ++arg); /* send a message to a contact */ { MCONTACT hContact; if (ServiceExists(MS_MSG_SENDMESSAGE)) { hContact = gg_getcontact(atoi(arg), TRUE, FALSE, arg); if (hContact != NULL) CallService(MS_MSG_SENDMESSAGE, hContact, 0); } } return 0; }
static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) { char *arg = (char*)lParam; list_t l = g_Instances; GGPROTO *gg = NULL; uin_t uin; CLISTMENUITEM mi = {0}; int items = 0; if (list_count(l) == 0) return 0; if (arg == NULL) return 1; arg = strchr(arg, ':'); if (arg == NULL) return 1; for (++arg; *arg == '/'; ++arg); uin = atoi(arg); if (!uin) return 1; for (mi.cbSize = sizeof(mi); l; l = l->next) { GGPROTO *gginst = l->data; mi.flags = CMIM_FLAGS; if (gginst->proto.m_iStatus > ID_STATUS_OFFLINE) { ++items; gg = l->data; mi.flags |= CMIM_ICON; mi.hIcon = LoadSkinnedProtoIcon(GG_PROTO, gg->proto.m_iStatus); } else { mi.flags |= CMIF_HIDDEN; mi.hIcon = NULL; } CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)gginst->hInstanceMenuItem, (LPARAM)&mi); if (mi.hIcon) CallService(MS_SKIN2_RELEASEICON, (WPARAM)mi.hIcon, 0); } if (items > 1) { ListParam param = {0}; HMENU hMenu = CreatePopupMenu(); POINT pt; int cmd = 0; param.MenuObjectHandle = hInstanceMenu; CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)¶m); GetCursorPos(&pt); cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL); DestroyMenu(hMenu); if (cmd) CallService(MO_PROCESSCOMMANDBYMENUIDENT, cmd, (LPARAM)&gg); } if (gg == NULL) return 0; if (ServiceExists(MS_MSG_SENDMESSAGE)) { HANDLE hContact = gg_getcontact(gg, uin, 1, 0, NULL); if (hContact != NULL) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); } return 0; }