static int ToolbarModulesLoaded(WPARAM, LPARAM) { TTBButton ttb = { 0 }; ttb.pszService = MS_CRASHDUMPER_STORETOCLIP; ttb.name = ttb.pszTooltipUp = LPGEN("Version Information To Clipboard"); ttb.hIconHandleUp = GetIconHandle(IDI_VITOCLIP); ttb.dwFlags = TTBBF_VISIBLE; TopToolbar_AddButton(&ttb); ttb.pszService = MS_CRASHDUMPER_STORETOFILE; ttb.name = ttb.pszTooltipUp = LPGEN("Version Information To File"); ttb.hIconHandleUp = GetIconHandle(IDI_VITOFILE); ttb.dwFlags = 0; TopToolbar_AddButton(&ttb); ttb.pszService = MS_CRASHDUMPER_VIEWINFO; ttb.name = ttb.pszTooltipUp = LPGEN("Show Version Information"); ttb.hIconHandleUp = GetIconHandle(IDI_VISHOW); TopToolbar_AddButton(&ttb); ttb.pszService = MS_CRASHDUMPER_UPLOAD; ttb.name = ttb.pszTooltipUp = LPGEN("Upload Version Information"); ttb.hIconHandleUp = GetIconHandle(IDI_VIUPLOAD); TopToolbar_AddButton(&ttb); return 0; }
void CSametimeProto::InitConferenceMenu() { debugLog(_T("CSametimeProto::InitConferenceMenu()")); CreateProtoService(MS_SAMETIME_MENULEAVECHAT, &CSametimeProto::onMenuLeaveChat); CreateProtoService(MS_SAMETIME_MENUCREATECHAT, &CSametimeProto::onMenuCreateChat); char service[128]; CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; mi.pszContactOwner = m_szModuleName; mi.ptszName = LPGENT("Leave conference"); mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENULEAVECHAT); mi.pszService = service; mi.icolibItem = GetIconHandle(IDI_ICON_LEAVE); hLeaveChatMenuItem = Menu_AddContactMenuItem(&mi); mi.ptszName = LPGENT("Start conference"); mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUCREATECHAT); mi.pszService = service; mi.icolibItem = GetIconHandle(IDI_ICON_INVITE); hCreateChatMenuItem = Menu_AddContactMenuItem(&mi); HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSametimeProto::PrebuildContactMenu); }
int LoadAwayMsgModule(void) { hWindowList = WindowList_Create(); hWindowList2 = WindowList_Create(); CMenuItem mi; mi.flags = CMIF_TCHAR; CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); mi.position = -2000005000; mi.name.t = LPGENT("Re&ad Away message"); mi.pszService = MS_AWAYMSG_SHOWAWAYMSG; hAwayMsgMenuItem = Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand); mi.position = -2000006000; mi.hIcolibItem = GetIconHandle(IDI_COPY); mi.name.t = LPGENT("Copy Away message"); mi.pszService = MS_SIMPLESTATUSMSG_COPYMSG; hCopyMsgMenuItem = Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand); mi.position = -2000007000; mi.hIcolibItem = GetIconHandle(IDI_GOTOURL); mi.name.t = LPGENT("&Go to URL in Away message"); mi.pszService = MS_SIMPLESTATUSMSG_GOTOURLMSG; hGoToURLMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu); return 0; }
void WhatsAppProto::InitContactMenus() { ::HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); CLISTMENUITEM mi = {sizeof(mi)}; mi.position = -2000006100; mi.icolibItem = GetIconHandle("leaveGroup"); mi.pszName = GetIconDescription("leaveGroup"); mi.pszService = "WhatsAppProto/LeaveGroup"; CreateServiceFunction(mi.pszService,GlobalService<&WhatsAppProto::OnLeaveGroup>); g_hContactMenuItems[CMI_LEAVE_GROUP] = Menu_AddContactMenuItem(&mi); mi.position = -2000006100; mi.icolibItem = GetIconHandle("leaveAndDeleteGroup"); mi.pszName = GetIconDescription("leaveAndDeleteGroup"); g_hContactMenuItems[CMI_REMOVE_GROUP] = Menu_AddContactMenuItem(&mi); mi.position = -2000006099; mi.icolibItem = GetIconHandle("changeGroupSubject"); mi.pszName = GetIconDescription("changeGroupSubject"); mi.pszService = "WhatsAppProto/ChangeGroupSubject"; CreateServiceFunction(mi.pszService,GlobalService<&WhatsAppProto::OnChangeGroupSubject>); g_hContactMenuItems[CMI_CHANGE_GROUP_SUBJECT] = Menu_AddContactMenuItem(&mi); }
void CAimProto::InitMainMenus(void) { CMenuItem mi; mi.root = Menu_GetProtocolRoot(this); mi.pszService = "/ManageAccount"; CreateProtoService(mi.pszService, &CAimProto::ManageAccount); mi.position = 201001; mi.hIcolibItem = GetIconHandle("aim"); mi.name.a = LPGEN("Manage Account"); hMainMenu[0] = Menu_AddProtoMenuItem(&mi, m_szModuleName); mi.pszService = "/InstantIdle"; CreateProtoService(mi.pszService, &CAimProto::InstantIdle); mi.position = 201002; mi.hIcolibItem = GetIconHandle("idle"); mi.name.a = LPGEN("Instant Idle"); hMainMenu[1] = Menu_AddProtoMenuItem(&mi, m_szModuleName); mi.pszService = "/JoinChatRoom"; CreateProtoService(mi.pszService, &CAimProto::JoinChatUI); mi.position = 201003; mi.hIcolibItem = GetIconHandle("aol"); mi.name.a = LPGEN( "Join Chat Room" ); hMainMenu[2] = Menu_AddProtoMenuItem(&mi, m_szModuleName); }
// interface void LoadNotifications() { POPUPNOTIFICATION notification = { 0 }; notification.cbSize = sizeof(notification); notification.actionCount = 0; notification.lpActions = 0; mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName)); notification.lchIcoLib = GetIconHandle(IDI_MB_WARN); notification.colorBack = RGB(210, 210, 150); notification.colorText = RGB(0, 0, 0); notification.iSeconds = 10; g_hntfWarning = RegisterNotification(¬ification); mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Notification", sizeof(notification.lpzName)); notification.lchIcoLib = GetIconHandle(IDI_MB_INFO); notification.colorBack = RGB(230, 230, 230); notification.colorText = RGB(0, 0, 0); notification.iSeconds = 7; g_hntfNotification = RegisterNotification(¬ification); mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName)); mir_strncpy(notification.lpzName, "Error", sizeof(notification.lpzName)); notification.lchIcoLib = GetIconHandle(IDI_MB_STOP); notification.colorBack = RGB(191, 0, 0); notification.colorText = RGB(255, 245, 225); notification.iSeconds = -1; g_hntfError = RegisterNotification(¬ification); }
int LoadAwayMsgModule(void) { hWindowList = WindowList_Create(); hWindowList2 = WindowList_Create(); CMenuItem mi; mi.flags = CMIF_TCHAR; SET_UID(mi, 0xd3282acc, 0x9ff1, 0x4ede, 0x8a, 0x1e, 0x36, 0x72, 0x3f, 0x44, 0x4f, 0x84); CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); mi.position = -2000005000; mi.name.t = LPGENT("Re&ad Away message"); mi.pszService = MS_AWAYMSG_SHOWAWAYMSG; hAwayMsgMenuItem = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x311124e9, 0xb477, 0x42ef, 0x84, 0xd2, 0xc, 0x6c, 0x50, 0x3f, 0x4a, 0x84); CreateServiceFunction(MS_SIMPLESTATUSMSG_COPYMSG, CopyAwayMsgCommand); mi.position = -2000006000; mi.hIcolibItem = GetIconHandle(IDI_COPY); mi.name.t = LPGENT("Copy Away message"); mi.pszService = MS_SIMPLESTATUSMSG_COPYMSG; hCopyMsgMenuItem = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0xe2c75070, 0x455d, 0x455f, 0xbf, 0x53, 0x86, 0x64, 0xbc, 0x14, 0xa1, 0xbe); CreateServiceFunction(MS_SIMPLESTATUSMSG_GOTOURLMSG, GoToURLMsgCommand); mi.position = -2000007000; mi.hIcolibItem = GetIconHandle(IDI_GOTOURL); mi.name.t = LPGENT("&Go to URL in Away message"); mi.pszService = MS_SIMPLESTATUSMSG_GOTOURLMSG; hGoToURLMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, AwayMsgPreBuildMenu); return 0; }
INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) { DBEVENTINFO* dbei = (DBEVENTINFO*)lParam; HICON icon = NULL; switch (dbei->eventType) { case SKYPE_DB_EVENT_TYPE_CALL_INFO: case SKYPE_DB_EVENT_TYPE_INCOMING_CALL: { icon = IcoLib_GetIconByHandle(GetIconHandle("inc_call")); break; } case SKYPE_DB_EVENT_TYPE_ACTION: { icon = IcoLib_GetIconByHandle(GetIconHandle("me_action")); break; } default: { icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); break; } } return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon)); }
//true - ok,false ignore INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM) { PCheckProcParam pcpp = ( PCheckProcParam )wParam; lpMirOTRMenuExecParam cmep=NULL; TMO_MenuItem mi; if ( pcpp == NULL ) return FALSE; cmep = ( lpMirOTRMenuExecParam )pcpp->MenuItemOwnerData; if ( cmep == NULL ) //this is rootsection...build it return TRUE; MCONTACT hContact = (MCONTACT)pcpp->wParam, hSub; if((hSub = db_mc_getMostOnline(hContact)) != 0) hContact = hSub; TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact)); mi.cbSize = sizeof(mi); if ( CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) { if ( mi.flags & CMIF_HIDDEN ) return FALSE; if ( mi.flags & CMIF_NOTPRIVATE && level==TRUST_PRIVATE ) return FALSE; if ( mi.flags & CMIF_NOTFINISHED && level==TRUST_FINISHED ) return FALSE; if ( mi.flags & CMIF_NOTUNVERIFIED && level==TRUST_UNVERIFIED ) return FALSE; if ( mi.flags & CMIF_NOTNOTPRIVATE && level==TRUST_NOT_PRIVATE ) return FALSE; if (pcpp->MenuItemHandle == hStatusInfoItem) { mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; switch (level) { case TRUST_PRIVATE: mi.hIcolibItem = GetIconHandle(ICON_PRIVATE); mi.ptszName = TranslateT(LANG_STATUS_PRIVATE); break; case TRUST_UNVERIFIED: mi.hIcolibItem = GetIconHandle(ICON_UNVERIFIED); mi.ptszName = TranslateT(LANG_STATUS_UNVERIFIED); break; case TRUST_FINISHED: mi.hIcolibItem = GetIconHandle(ICON_FINISHED); mi.ptszName = TranslateT(LANG_STATUS_FINISHED); break; default: mi.hIcolibItem = GetIconHandle(ICON_NOT_PRIVATE); mi.ptszName = TranslateT(LANG_STATUS_DISABLED); } CallService(MO_MODIFYMENUITEM, (WPARAM)hStatusInfoItem, (LPARAM)&mi); } else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) { if (db_get_b(hContact, MODULENAME, "HTMLConv", 0) ) mi.flags |= CMIM_FLAGS|CMIF_CHECKED; else mi.flags = CMIM_FLAGS|(mi.flags &~CMIF_CHECKED); CallService(MO_MODIFYMENUITEM, (WPARAM)hHTMLConvMenuItem, (LPARAM)&mi); } } return TRUE; }
void UpdateMenu() { CLISTMENUITEM mi = {sizeof(mi)}; mi.pszName = (Enabled == 1 ? DISABLE_SILENCE : ENABLE_SILENCE); mi.flags = CMIM_NAME | CMIM_ALL; mi.icolibItem = (Enabled == 1 ? GetIconHandle(DISABLE_SILENCE) : GetIconHandle(ENABLE_SILENCE)); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSSMenuToggleOnOff, (LPARAM)&mi); UpdateTTB(); }
void UpdateMenu(bool State) { if (!State) // to enable auto-update Menu_ModifyItem(hService2[0], LPGENT("Auto Update Enabled"), GetIconHandle("enabled")); else // to disable auto-update Menu_ModifyItem(hService2[0], LPGENT("Auto Update Disabled"), GetIconHandle("disabled")); CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : 0); db_set_b(NULL, MODULE, "AutoUpdate", !State); }
/** * Popup classes initialization */ void FacebookProto::InitPopups() { POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; ppc.PluginWindowProc = PopupDlgProc; ppc.lParam = APF_RETURN_HWND; TCHAR desc[256]; char name[256]; // Client mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Client notifications")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Client"); ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("facebook")); ppc.colorBack = RGB(191, 0, 0); // red ppc.colorText = RGB(255, 255, 255); // white ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Newsfeeds mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("News feeds")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Newsfeed"); ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("newsfeed")); ppc.colorBack = RGB(255, 255, 255); // white ppc.colorText = RGB(0, 0, 0); // black ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Notifications mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Notifications")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Notification"); ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("notification")); ppc.colorBack = RGB(59, 89, 152); // Facebook's blue ppc.colorText = RGB(255, 255, 255); // white ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); // Others mir_sntprintf(desc, SIZEOF(desc), _T("%s/%s"), m_tszUserName, TranslateT("Other events")); mir_snprintf(name, SIZEOF(name), "%s_%s", m_szModuleName, "Other"); ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_GetIconByHandle(GetIconHandle("facebook")); ppc.colorBack = RGB(255, 255, 255); // white ppc.colorText = RGB(0, 0, 0); // black ppc.iSeconds = 0; popupClasses.push_back(Popup_RegisterClass(&ppc)); }
INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM) { db_set_b(0, MODULE, "TempDisable", opt.TempDisabled = !opt.TempDisabled); if (opt.TempDisabled) Menu_ModifyItem(hEnableDisableMenu, LPGENW("Enable status notification"), GetIconHandle(ICO_NOTIFICATION_OFF)); else Menu_ModifyItem(hEnableDisableMenu, LPGENW("Disable status notification"), GetIconHandle(ICO_NOTIFICATION_ON)); CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton, opt.TempDisabled ? 0 : TTBST_PUSHED); return 0; }
INT_PTR Meta_OnOff(WPARAM, LPARAM) { bool bToggled = !db_mc_isEnabled(); db_set_b(0, META_PROTO, "Enabled", bToggled); if (bToggled) Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), GetIconHandle(I_MENUOFF)); else Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENU)); db_mc_enable(bToggled); Meta_HideMetaContacts(!bToggled); return 0; }
int OnToolbarLoaded(WPARAM wParam, LPARAM lParam) { TTBButton ttb = { sizeof(ttb) }; ttb.name = LPGEN("Enable/disable auto update"); ttb.pszService = MS_WEATHER_ENABLED; ttb.pszTooltipUp = LPGEN("Auto Update Enabled"); ttb.pszTooltipDn = LPGEN("Auto Update Disabled"); ttb.hIconHandleUp = GetIconHandle("main"); ttb.hIconHandleDn = GetIconHandle("disabled"); ttb.dwFlags = (db_get_b(NULL, WEATHERPROTONAME, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE; hTBButton = TopToolbar_AddButton(&ttb); return 0; }
int OnToolbarLoaded(WPARAM, LPARAM) { TTBButton ttb = { 0 }; ttb.name = LPGEN("Enable/disable auto update"); ttb.pszService = MS_NEWSAGGREGATOR_ENABLED; ttb.pszTooltipUp = LPGEN("Auto Update Enabled"); ttb.pszTooltipDn = LPGEN("Auto Update Disabled"); ttb.hIconHandleUp = GetIconHandle("enabled"); ttb.hIconHandleDn = GetIconHandle("disabled"); ttb.dwFlags = (db_get_b(NULL, MODULE, "AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE; hTBButton = TopToolbar_AddButton(&ttb); return 0; }
void CSkypeProto::InitMenus() { HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu); //hChooserMenu = Menu_AddObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose"); CMenuItem mi; mi.flags = CMIF_TCHAR; // Request authorization mi.pszService = MODULE"/RequestAuth"; mi.name.t = LPGENT("Request authorization"); mi.position = CMI_POSITION + CMI_AUTH_REQUEST; mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_REQUEST); SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e); ContactMenuItems[CMI_AUTH_REQUEST] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::OnRequestAuth>); // Grant authorization mi.pszService = MODULE"/GrantAuth"; mi.name.t = LPGENT("Grant authorization"); mi.position = CMI_POSITION + CMI_AUTH_GRANT; mi.hIcolibItem = ::Skin_GetIconHandle(SKINICON_AUTH_GRANT); SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30); ContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::OnGrantAuth>); mi.pszService = MODULE"/GetHistory"; mi.name.t = LPGENT("Get server history"); mi.position = CMI_POSITION + CMI_GETSERVERHISTORY; mi.hIcolibItem = GetIconHandle(IDI_SYNCHISTORY); SET_UID(mi, 0xc9a64e98, 0x9257, 0x4b52, 0x98, 0xdd, 0x7f, 0x56, 0xb3, 0x90, 0xe3, 0xde); ContactMenuItems[CMI_GETSERVERHISTORY] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::GetContactHistory>); mi.pszService = MODULE"/BlockContact"; mi.name.t = LPGENT("Block contact"); mi.position = CMI_POSITION + CMI_BLOCK; mi.hIcolibItem = GetIconHandle(IDI_BLOCKUSER); SET_UID(mi ,0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32); ContactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockContact>); mi.pszService = MODULE"/UnblockContact"; mi.name.t = LPGENT("Unblock contact"); mi.position = CMI_POSITION + CMI_UNBLOCK; mi.hIcolibItem = GetIconHandle(IDI_UNBLOCKUSER); SET_UID(mi, 0x88542f43, 0x7448, 0x48d0, 0x81, 0xa3, 0x26, 0x0, 0x4f, 0x37, 0xee, 0xe0); ContactMenuItems[CMI_UNBLOCK] = Menu_AddContactMenuItem(&mi); CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::UnblockContact>); }
static int CreateTTButtons(WPARAM wParam, LPARAM lParam) { TTBButton ttb = {sizeof(ttb)}; ttb.dwFlags = (Enabled == 1 ? 0 : TTBBF_PUSHED) | TTBBF_VISIBLE | TTBBF_ASPUSHBUTTON; ttb.pszService = SS_SERVICE_NAME; ttb.hIconHandleDn = GetIconHandle(DISABLE_SILENCETTB); ttb.hIconHandleUp = GetIconHandle(ENABLE_SILENCETTB); ttb.name = TTBNAME; ttb.pszTooltipUp = SS_IS_ON; ttb.pszTooltipDn = SS_IS_OFF; Buttons = TopToolbar_AddButton(&ttb); if (Buttons) ttbButtons.insert(Buttons); return 0; }
int FacebookProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam) { char text[200]; strcpy(text,m_szModuleName); char *tDest = text+strlen(text); HGENMENU hRoot; CLISTMENUITEM mi = {sizeof(mi)}; mi.pszService = text; hRoot = MO_GetProtoRootMenu(m_szModuleName); if (hRoot == NULL) { mi.popupPosition = 500085000; mi.hParentMenu = HGENMENU_ROOT; mi.flags = CMIF_ICONFROMICOLIB | CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | ( this->isOnline() ? 0 : CMIF_GRAYED ); mi.icolibItem = GetIconHandle( "facebook" ); mi.ptszName = m_tszUserName; hRoot = m_hMenuRoot = reinterpret_cast<HGENMENU>( CallService( MS_CLIST_ADDPROTOMENUITEM,0,reinterpret_cast<LPARAM>(&mi)) ); } else { if ( m_hMenuRoot ) CallService( MS_CLIST_REMOVEMAINMENUITEM, ( WPARAM )m_hMenuRoot, 0 ); m_hMenuRoot = NULL; } mi.flags = CMIF_ICONFROMICOLIB | CMIF_CHILDPOPUP | ( this->isOnline() ? 0 : CMIF_GRAYED ); mi.position = 201001; CreateProtoService(m_szModuleName,"/Mind",&FacebookProto::OnMind,this); strcpy(tDest,"/Mind"); mi.hParentMenu = hRoot; mi.pszName = LPGEN("Mind..."); mi.icolibItem = GetIconHandle("mind"); m_hStatusMind = reinterpret_cast<HGENMENU>( CallService( MS_CLIST_ADDPROTOMENUITEM,0,reinterpret_cast<LPARAM>(&mi)) ); CreateProtoService(m_szModuleName,"/VisitProfile",&FacebookProto::VisitProfile,this); strcpy(tDest,"/VisitProfile"); mi.flags = CMIF_ICONFROMICOLIB | CMIF_CHILDPOPUP; mi.pszName = LPGEN("Visit Profile"); mi.icolibItem = GetIconHandle("homepage"); // TODO RM: remember and properly free in destructor? /*m_hStatusMind = */reinterpret_cast<HGENMENU>( CallService( MS_CLIST_ADDPROTOMENUITEM,0,reinterpret_cast<LPARAM>(&mi)) ); return 0; }
void CVkProto::InitPopups(void) { TCHAR desc[256]; char name[256]; POPUPCLASS ppc = { sizeof(ppc) }; ppc.flags = PCF_TCHAR; mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors")); mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = Skin_LoadIcon(SKINICON_ERROR); ppc.colorBack = RGB(191, 0, 0); //Red ppc.colorText = RGB(255, 245, 225); //Yellow ppc.iSeconds = 60; m_hPopupClassError = Popup_RegisterClass(&ppc); mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Notification")); mir_snprintf(name, "%s_%s", m_szModuleName, "Notification"); ppc.ptszDescription = desc; ppc.pszName = name; ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_NOTIFICATION)); ppc.colorBack = RGB(190, 225, 255); //Blue ppc.colorText = RGB(255, 255, 255); //White ppc.iSeconds = 4; m_hPopupClassNotification = Popup_RegisterClass(&ppc); }
int ServicesModulesLoaded(WPARAM wParam, LPARAM lParam) { // add main menu item CLISTMENUITEM menu = {0}; menu.cbSize=sizeof(menu); menu.flags = CMIM_ALL | CMIF_ICONFROMICOLIB; menu.icolibItem = GetIconHandle(I_CHKUPD); menu.pszName = "Check for updates"; menu.pszService= MS_UPDATE_CHECKFORUPDATES; menu.position = 500010000; #ifdef MS_CLIST_ADDGROUPMENUITEM if (ServiceExists(MS_CLIST_ADDGROUPMENUITEM)) { GroupMenuParam gmp = {0}; hGroupMenuItem = (HANDLE)CallService(MS_CLIST_ADDGROUPMENUITEM,(WPARAM)&gmp,(LPARAM)&menu); } #endif hMainMenuItem = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&menu); hEventServicesModulesLoaded2 = HookEvent(ME_SYSTEM_MODULESLOADED, ServicesModulesLoaded2); startup_timer_id = SetTimer(0, 0, 5000, StartupTimerProc); return 0; }
HICON GetIcolibIcon(int iconId) { HANDLE handle = GetIconHandle(iconId); if (handle != NULL) { return (HICON) CallService(MS_SKIN2_GETICONBYHANDLE, 0, (LPARAM)handle); } return NULL; }
static void set_ES_icon(CAimProto* ppro, MCONTACT hContact) { if (ppro->isChatRoom(hContact)) return; unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1; ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : NULL); }
/** * Sets statusbar text of hContact with last read time (from facy.readers map) */ void FacebookProto::MessageRead(MCONTACT hContact) { /*std::map<MCONTACT, time_t>::iterator it = facy.readers.find(hContact); if (it == facy.readers.end()) return;*/ // We may use this instead of checing map as we have this info already in memory (this value is resident) time_t time = getDword(hContact, FACEBOOK_KEY_MESSAGE_READ, 0); if (!time) return; TCHAR ttime[64]; _tcsftime(ttime, _countof(ttime), _T("%X"), localtime(&time)); StatusTextData st = { 0 }; st.cbSize = sizeof(st); st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("read")); if (isChatRoom(hContact)) { // Load readers names ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); mir_sntprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : _T("???")); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){ mir_sntprintf(st.tszText, TranslateT("Message read: %s"), ttime); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } }
INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { InviteChatReqParam* param = (InviteChatReqParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param = (InviteChatReqParam*)lParam; Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_YAHOO)); SetDlgItemTextA(hwndDlg, IDC_SCREENNAME, param->who); SetDlgItemText(hwndDlg, IDC_MSG, param->msg); SetDlgItemText(hwndDlg, IDC_MSG2, TranslateT("No, thank you...")); break; case WM_CLOSE: DestroyWindow(hwndDlg); break; case WM_NCDESTROY: Window_FreeIcon_IcoLib(hwndDlg); delete param; break; case WM_COMMAND: { CYahooProto::ChatRoom *cm = param->ppro->m_chatrooms.find((CYahooProto::ChatRoom*)¶m->room); switch (LOWORD(wParam)) { case IDOK: if (cm) { param->ppro->ChatStart(param->room); for (YList *l = cm->members; l; l = l->next) param->ppro->ChatEvent(param->room, (char*)l->data, GC_EVENT_JOIN); yahoo_conference_logon(param->ppro->m_id, NULL, cm->members, param->room); } DestroyWindow(hwndDlg); break; case IDCANCEL: if (cm) { TCHAR msg[1024]; GetDlgItemText(hwndDlg, IDC_MSG2, msg, _countof(msg)); yahoo_conference_decline(param->ppro->m_id, NULL, cm->members, param->room, T2Utf(msg)); param->ppro->m_chatrooms.remove((CYahooProto::ChatRoom*)¶m->room); } DestroyWindow(hwndDlg); break; } } break; } return FALSE; }
void MSN_InitContactMenu(void) { char servicefunction[100]; mir_strcpy(servicefunction, "MSN"); char* tDest = servicefunction + mir_strlen(servicefunction); CMenuItem mi; mi.pszService = servicefunction; SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32); mir_strcpy(tDest, MSN_BLOCK); hBlockCom = CreateServiceFunction(servicefunction, MsnMenuBlockCommand); mi.position = -500050000; mi.hIcolibItem = GetIconHandle(IDI_MSNBLOCK); mi.name.a = LPGEN("&Block"); hBlockMenuItem = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x7f7e4c24, 0x821c, 0x450f, 0x93, 0x76, 0xbe, 0x65, 0xe9, 0x2f, 0xb6, 0xc2); mir_strcpy(tDest, MSN_VIEW_PROFILE); hViewProfile = CreateServiceFunction(servicefunction, MsnMenuViewProfile); mi.position = -500050003; mi.hIcolibItem = GetIconHandle(IDI_PROFILE); mi.name.a = LPGEN("View &Profile"); hLiveSpaceMenuItem = Menu_AddContactMenuItem(&mi); #ifdef OBSOLETE mir_strcpy(tDest, MSN_NETMEETING); hNetMeeting = CreateServiceFunction(servicefunction, MsnMenuSendNetMeeting); mi.flags = CMIF_NOTOFFLINE; mi.position = -500050002; mi.hIcolibItem = GetIconHandle(IDI_NETMEETING); mi.name.a = LPGEN("&Start Netmeeting"); hNetmeetingMenuItem = Menu_AddContactMenuItem(&mi); #endif SET_UID(mi,0x25a007c0, 0x8dc7, 0x4284, 0x8a, 0x5e, 0x2, 0x83, 0x17, 0x5d, 0x52, 0xea); mir_strcpy(tDest, "/SendHotmail"); hSendHotMail = CreateServiceFunction(servicefunction, MsnMenuSendHotmail); mi.position = -2000010005; mi.flags = CMIF_HIDDEN; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SENDEMAIL); mi.name.a = LPGEN("Open &Hotmail Inbox"); hOpenInboxMenuItem = Menu_AddContactMenuItem(&mi); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, MSN_OnPrebuildContactMenu); }
void CVkCaptchaForm::OnInitDialog() { Window_SetIcon_IcoLib(m_hwnd, GetIconHandle(IDI_KEYS)); m_btnOk.Disable(); m_btnOpenInBrowser.Enable((m_param->bmp != NULL)); m_instruction.SetText(TranslateT("Enter the text you see")); }
HICON GetIcolibIcon(int iconId) { HANDLE handle = GetIconHandle(iconId); if (handle != NULL) return IcoLib_GetIconByHandle(handle); return NULL; }
void CFacebookGuardDialog::OnInitDialog() { Window_SetIcon_IcoLib(m_hwnd, GetIconHandle("facebook")); SendMessage(m_text.GetHwnd(), EM_LIMITTEXT, 6, 0); Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow"); }
HANDLE CSkypeProto::Skin_GetIconHandle(const char *name) { char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, name); HANDLE hIcon = IcoLib_GetIconHandle(iconName); if (hIcon == NULL) hIcon = GetIconHandle(name); return hIcon; }