int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; CLISTMENUITEM mi; char *szProto; BOOL callAvailable = FALSE; BOOL hangupAvailable = FALSE; UNREFERENCED_PARAMETER(lParam); if (!(szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0))) return 0; if (!HasVoiceService()) { // Clear hold-Item in case it exists mi=HoldCallItem(); mi.flags|=CMIM_ALL; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi); } if (!strcmp(szProto, SKYPE_PROTONAME)) { if (!HasVoiceService()) { if (!DBGetContactSetting((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "OnHold", 0)) mi=ResumeCallItem(); else mi=HoldCallItem(); mi.flags=CMIM_ALL; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi); callAvailable = FALSE; hangupAvailable = TRUE; DBFreeVariant(&dbv); } else { callAvailable = TRUE; hangupAvailable = FALSE; } if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)!=0) { callAvailable = FALSE; hangupAvailable = FALSE; } mi = CallItem(); mi.flags |= CMIM_ALL | (!callAvailable?CMIF_HIDDEN:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallItem,(LPARAM)&mi); mi = HupItem(); mi.flags |= CMIM_ALL | (!hangupAvailable?CMIF_HIDDEN:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuCallHangup,(LPARAM)&mi); } // Clear SkypeOut menu in case it exists mi=SkypeOutCallItem(); mi.flags|=CMIM_ALL; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem,(LPARAM)&mi); // File sending and groupchat-creation works starting with protocol version 5 if (protocol>=5) { mi=FileTransferItem(); if (DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0) mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuFileTransferItem,(LPARAM)&mi); } if (protocol>=5 || bIsImoproxy) { mi=ChatInitItem(); if (DBGetContactSettingByte(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) && DBGetContactSettingByte((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0) mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuChatInitItem,(LPARAM)&mi); } } else if (bSkypeOut) { if (!DBGetContactSetting((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { mi=SkypeOutHupItem(); DBFreeVariant(&dbv); } else { mi=SkypeOutCallItem(); if(!DBGetContactSetting((HANDLE)wParam,"UserInfo","MyPhone0",&dbv)) { DBFreeVariant(&dbv); mi.flags=0; } } mi.flags|=CMIM_ALL; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuSkypeOutCallItem,(LPARAM)&mi); } return 0; }
int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM) { MCONTACT hContact = (MCONTACT) wParam; char *szProto = GetContactProto(hContact); if (!szProto) return 0; // Clear hold-Item in case it exists CLISTMENUITEM mi = HoldCallItem(); mi.flags |= CMIM_ALL; Menu_ModifyItem(hMenuHoldCallItem, &mi); DBVARIANT dbv; BOOL callAvailable = FALSE; BOOL hangupAvailable = FALSE; if (!strcmp(szProto, SKYPE_PROTONAME)) { if (!db_get(hContact, SKYPE_PROTONAME, "CallId", &dbv)) { if (db_get_b(hContact, SKYPE_PROTONAME, "OnHold", 0)) mi = ResumeCallItem(); else mi = HoldCallItem(); mi.flags = CMIM_ALL; Menu_ModifyItem(hMenuHoldCallItem, &mi); callAvailable = FALSE; hangupAvailable = TRUE; db_free(&dbv); } else { callAvailable = TRUE; hangupAvailable = FALSE; } if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) != 0) { callAvailable = FALSE; hangupAvailable = FALSE; } mi = CallItem(); mi.flags |= CMIM_ALL | (!callAvailable ? CMIF_HIDDEN : 0); Menu_ModifyItem(hMenuCallItem, &mi); mi = HupItem(); mi.flags |= CMIM_ALL | (!hangupAvailable ? CMIF_HIDDEN : 0); Menu_ModifyItem(hMenuCallHangup, &mi); // Clear SkypeOut menu in case it exists mi = SkypeOutCallItem(); mi.flags |= CMIM_ALL; Menu_ModifyItem(hMenuSkypeOutCallItem, &mi); // File sending and groupchat-creation works starting with protocol version 5 if (protocol >= 5) { mi = FileTransferItem(); if (db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0) mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS; Menu_ModifyItem(hMenuFileTransferItem, &mi); } if (protocol >= 5 || bIsImoproxy) { mi = ChatInitItem(); if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0) mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS; Menu_ModifyItem(hMenuChatInitItem, &mi); mi = BlockContactItem(); mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS | CMIM_NAME; if (db_get_b(hContact, SKYPE_PROTONAME, "IsBlocked", 0) == 1) mi.ptszName = LPGENT("Unblock contact"); Menu_ModifyItem(hMenuBlockContactItem, &mi); } } else if (bSkypeOut) { if (!db_get(hContact, SKYPE_PROTONAME, "CallId", &dbv)) { mi = SkypeOutHupItem(); db_free(&dbv); } else { mi = SkypeOutCallItem(); if (!db_get(hContact, "UserInfo", "MyPhone0", &dbv)) { db_free(&dbv); mi.flags = 0; } } mi.flags |= CMIM_ALL; Menu_ModifyItem(hMenuSkypeOutCallItem, &mi); } return 0; }