int ModulesLoad(WPARAM, LPARAM) { profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%")); if (hFolder = FoldersRegisterCustomPathT(LPGEN("Database backups"), LPGEN("Backup folder"), DIR SUB_DIR)) { HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersGetBackupPath); FoldersGetBackupPath(0, 0); } CreateServiceFunction(MS_AB_BACKUP, ABService); CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs); CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500100000); mi.name.a = LPGEN("Backup profile"); mi.pszService = MS_AB_BACKUP; mi.hIcolibItem = iconList[0].hIcolib; mi.position = 500100000; Menu_AddMainMenuItem(&mi); mi.name.a = LPGEN("Save profile as..."); mi.pszService = MS_AB_SAVEAS; mi.hIcolibItem = iconList[1].hIcolib; mi.position = 500100001; Menu_AddMainMenuItem(&mi); HookEvent(ME_OPT_INITIALISE, OptionsInit); LoadOptions(); if (options.backup_types & BT_START) BackupStart(NULL); return 0; }
void InitMenu() { CMenuItem mi; mi.flags = CMIF_TCHAR | CMIF_NOTOFFLINE; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("News Aggregator"), 500099000); SET_UID(mi, 0x3ec91864, 0xefa7, 0x4994, 0xb7, 0x75, 0x6c, 0x96, 0xcb, 0x29, 0x2f, 0x93); mi.position = 10100001; if (db_get_b(NULL, MODULE, "AutoUpdate", 1)) mi.name.t = LPGENT("Auto Update Enabled"); else mi.name.t = LPGENT("Auto Update Disabled"); mi.hIcolibItem = GetIconHandle("main"); mi.pszService = MS_NEWSAGGREGATOR_ENABLED; hService2[0] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x8076bb4d, 0x1e44, 0x43af, 0x97, 0x1e, 0x31, 0xd8, 0xa4, 0xe9, 0xb8, 0x37); mi.position = 20100001; mi.name.t = LPGENT("Check All Feeds"); mi.pszService = MS_NEWSAGGREGATOR_CHECKALLFEEDS; hService2[1] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xb876484d, 0x28aa, 0x4e03, 0x9e, 0x98, 0xed, 0xbc, 0xd1, 0xcf, 0x31, 0x80); mi.position = 20100002; mi.hIcolibItem = GetIconHandle("addfeed"); mi.name.t = LPGENT("Add Feed"); mi.pszService = MS_NEWSAGGREGATOR_ADDFEED; hService2[2] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x600bf2c2, 0xa974, 0x44d3, 0x98, 0xf9, 0xe6, 0x65, 0x7c, 0x1f, 0x63, 0x37); mi.position = 20100003; mi.hIcolibItem = GetIconHandle("importfeeds"); mi.name.t = LPGENT("Import Feeds"); mi.pszService = MS_NEWSAGGREGATOR_IMPORTFEEDS; hService2[3] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xc09c8119, 0x64c2, 0x49bd, 0x81, 0xf, 0x54, 0x20, 0x69, 0xd7, 0x30, 0xcf); mi.position = 20100004; mi.hIcolibItem = GetIconHandle("exportfeeds"); mi.name.t = LPGENT("Export Feeds"); mi.pszService = MS_NEWSAGGREGATOR_EXPORTFEEDS; hService2[4] = Menu_AddMainMenuItem(&mi); // adding contact menu items SET_UID(mi, 0x92be499c, 0x928c, 0x4789, 0x8f, 0x36, 0x28, 0xa2, 0x9f, 0xb7, 0x1a, 0x97); mi.root = NULL; mi.position = -0x7FFFFFFA; mi.hIcolibItem = GetIconHandle("checkfeed"); mi.name.t = LPGENT("Check feed"); mi.pszService = MS_NEWSAGGREGATOR_CHECKFEED; hService2[5] = Menu_AddContactMenuItem(&mi, MODULE); SET_UID(mi, 0x41a70fbc, 0x9241, 0x44c0, 0x90, 0x90, 0x87, 0xd2, 0xc5, 0x9f, 0xc9, 0xac); mi.name.t = LPGENT("Change feed"); mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED; hService2[6] = Menu_AddContactMenuItem(&mi, MODULE); Menu_ModifyItem(hService2[0], NULL, GetIconHandle(db_get_b(NULL, MODULE, "AutoUpdate", 1) ? "enabled" : "disabled")); }
static int CreateMainMenuItems(WPARAM, LPARAM) { char servicename[128]; int i, count; CMenuItem mi; mi.position = 2000100000; mi.flags = CMIF_TCHAR; mcount = 0; count = GetProfileCount(0, 0); for (i = 0; i < count; i++) { TCHAR profilename[128]; if (!db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename)) continue; if (db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1)) mi.root = Menu_CreateRoot(MO_STATUS, LPGENT("Status profiles"), 2000100000); mi.name.t = profilename; mi.position = 2000100000 + mcount; mir_snprintf(servicename, _countof(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount); switch(mcount) { case 0: hProfileServices[mcount] = CreateServiceFunction(servicename, profileService0); break; case 1: hProfileServices[mcount] = CreateServiceFunction(servicename, profileService1); break; case 2: hProfileServices[mcount] = CreateServiceFunction(servicename, profileService2); break; case 3: hProfileServices[mcount] = CreateServiceFunction(servicename, profileService3); break; case 4: hProfileServices[mcount] = CreateServiceFunction(servicename, profileService4); break; case 5: hProfileServices[mcount] = CreateServiceFunction(servicename, profileService5); break; default: MessageBox(NULL, TranslateT("There is a maximum of 6 menu items"), TranslateT("StartupStatus"), MB_OK); return 0; } mi.pszService = servicename; if (Menu_AddStatusMenuItem(&mi)) { menuprofiles[mcount] = i; mcount += 1; } } return 0; }
static int lua_CreateRoot(lua_State *L) { int hMenuObject = lua_tointeger(L, 1); const char *name = luaL_checkstring(L, 2); int position = lua_tointeger(L, 3); HANDLE hIcon = (HANDLE)lua_touserdata(L, 4); HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrT(Utf8DecodeT(name)), position, hIcon); lua_pushlightuserdata(L, res); return 1; }
int ModulesLoaded(WPARAM, LPARAM) { IcoLibRegister(); // Register menu item CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 1900000001); SET_UID(mi, 0xe298849c, 0x1a8c, 0x4fc7, 0xa0, 0xf4, 0x78, 0x18, 0xf, 0xe2, 0xf7, 0xc9); mi.position = 1900000001; mi.hIcolibItem = GetIcoLibHandle(ICO_DBE_BUTT); mi.name.a = modFullname; mi.pszService = "DBEditorpp/MenuCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x2fed8613, 0xac43, 0x4148, 0xbd, 0x5c, 0x44, 0x88, 0xaf, 0x68, 0x69, 0x10); mi.root = NULL; mi.hIcolibItem = GetIcoLibHandle(ICO_REGUSER); mi.name.a = LPGEN("Open user tree in DBE++"); mi.pszService = "DBEditorpp/MenuCommand"; hUserMenu = Menu_AddContactMenuItem(&mi); // Register hotkeys _A2T text(modFullname); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.dwFlags = HKD_TCHAR; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; hkd.ptszDescription = LPGENT("Open Database Editor"); hkd.ptszSection = text; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); g_bUsePopups = db_get_b(NULL, modname, "UsePopUps", 0) != 0; // Load the name order for (int i = 0; i < NAMEORDERCOUNT; i++) nameOrder[i] = i; DBVARIANT dbv = { 0 }; if (!db_get_s(NULL, "Contact", "NameOrder", &dbv, DBVT_BLOB)) { memcpy(nameOrder, dbv.pbVal, dbv.cpbVal); db_free(&dbv); } HookEvent(ME_TTB_MODULELOADED, OnTTBLoaded); if (g_bServiceMode) CallService("DBEditorpp/MenuCommand", 0, 0); return 0; }
int TN_ModuleInit() { hPopupsList = WindowList_Create(); OnePopup = M.GetByte(Module, SET_ONEPOPUP, DEF_ONEPOPUP); ShowMenu = M.GetByte(Module, SET_SHOWDISABLEMENU, DEF_SHOWDISABLEMENU); int i = M.GetByte(Module, SET_DISABLED, DEF_DISABLED); Disabled = i & 1; StartDisabled = i & 2; StopDisabled = i & 4; ColorMode = M.GetByte(Module, SET_COLOR_MODE, DEF_COLOR_MODE); TimeoutMode = M.GetByte(Module, SET_TIMEOUT_MODE, DEF_TIMEOUT_MODE); Timeout = M.GetByte(Module, SET_TIMEOUT, DEF_TIMEOUT); TimeoutMode2 = M.GetByte(Module, SET_TIMEOUT_MODE2, DEF_TIMEOUT_MODE2); Timeout2 = M.GetByte(Module, SET_TIMEOUT2, DEF_TIMEOUT2); if (!(M.GetDword(Module, colorPicker[0].desc, 1) && !M.GetDword(Module, colorPicker[0].desc, 0))) for (i = 0; i < _countof(colorPicker); i++) colorPicker[i].color = M.GetDword(Module, colorPicker[i].desc, 0); mir_sntprintf(szStart, _countof(szStart), TranslateT("...is typing a message.")); mir_sntprintf(szStop, _countof(szStop), TranslateT("...has stopped typing.")); if (PluginConfig.g_bPopupAvail && ShowMenu) { hTypingNotify = CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand); CMenuItem mi; if (!Disabled) { mi.name.a = LPGEN("Disable &typing notification"); mi.hIcolibItem = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED)); } else { mi.name.a = LPGEN("Enable &typing notification"); mi.hIcolibItem = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED)); } mi.pszService = "TypingNotify/EnableDisableMenuCommand"; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); hDisableMenu = Menu_AddMainMenuItem(&mi); } SkinAddNewSoundEx("TNStart", LPGEN("Instant messages"), LPGEN("Contact started typing")); SkinAddNewSoundEx("TNStop", LPGEN("Instant messages"), LPGEN("Contact stopped typing")); return 0; }
int LoadHelpModule(void) { HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownHelpModule); CreateServiceFunction("Help/AboutCommand", AboutCommand); CreateServiceFunction("Help/IndexCommand", IndexCommand); CreateServiceFunction("Help/WebsiteCommand", WebsiteCommand); CreateServiceFunction("Help/BugCommand", BugCommand); CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("&Help"), 2000090000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "8824ECA5-6942-46D7-9D07-1BA600E0D02E"); SET_UID(mi, 0xf3ebf1fa, 0x587c, 0x494d, 0xbd, 0x33, 0x7f, 0x88, 0xb3, 0x61, 0x1e, 0xd3); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDA); mi.position = 2000090000; mi.name.a = LPGEN("&About..."); mi.pszService = "Help/AboutCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x495df66f, 0x844e, 0x479a, 0xaf, 0x21, 0x3e, 0x42, 0xc5, 0x14, 0x7c, 0x7e); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_HELP); mi.position = -500050000; mi.name.a = LPGEN("&Support"); mi.pszService = "Help/IndexCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x15e18b58, 0xec73, 0x45c2, 0xb9, 0xf4, 0x2a, 0xfe, 0xc2, 0xb7, 0xd3, 0x25); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MIRANDAWEB); mi.position = 2000050000; mi.name.a = LPGEN("&Miranda NG homepage"); mi.pszService = "Help/WebsiteCommand"; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xe7d0fe8b, 0xfdeb, 0x45b3, 0xba, 0x83, 0x3, 0x1e, 0x15, 0xda, 0x7e, 0x52); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); mi.position = 2000040000; mi.name.a = LPGEN("&Report bug"); mi.pszService = "Help/BugCommand"; Menu_AddMainMenuItem(&mi); return 0; }
void InitMenuItems(void) { bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0)); CMenuItem mi; mi.flags = CMIF_TCHAR; mi.root = hMenuRoot; SET_UID(mi, 0x92c386ae, 0x6e81, 0x452d, 0xb5, 0x71, 0x87, 0x46, 0xe9, 0x2, 0x66, 0xe9); mi.hIcolibItem = IcoLib_GetIcon(ICO_HISTORY, 0); mi.pszService= MS_POPUP_SHOWHISTORY; mi.name.t = LPGENT("Popup History"); hMenuItemHistory = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f); mi.hIcolibItem = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0); mi.pszService = "Popup/EnableDisableMenuCommand"; mi.name.t = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups")); hMenuItem = Menu_AddMainMenuItem(&mi); }
static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM) { CDb3Mmap *db = (CDb3Mmap*)obj; Icon_Register(g_hInst, LPGEN("Database"), iconList, _countof(iconList), "mmap"); HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, db); CMenuItem mi; // main menu item mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Database"), 500000000, iconList[0].hIcolib); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "F7C5567C-D1EE-484B-B4F6-24677A5AAAEF"); SET_UID(mi, 0x50321866, 0xba1, 0x46dd, 0xb3, 0xa6, 0xc3, 0xcc, 0x55, 0xf2, 0x42, 0x9e); mi.flags = CMIF_TCHAR; mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = db->GetMenuTitle(); mi.pszService = MS_DB_CHANGEPASSWORD; hSetPwdMenu = Menu_AddMainMenuItem(&mi); return 0; }
void TlenProtocol::initMenuItems() { char text[MAX_PATH]; strncpy_s(text, m_szModuleName, _TRUNCATE); char *pSvcName = text + mir_strlen(text); CMenuItem mi; mi.root = hMenuRoot = Menu_CreateRoot(MO_MAIN, m_tszUserName, -1999901009, GetIconHandle(IDI_TLEN)); mi.pszService = text; hMenuChats = NULL; // "Multi-User Conference" SET_UID(mi,0x4984828, 0x2066, 0x43da, 0x87, 0x9e, 0x71, 0x23, 0xc6, 0xe2, 0x46, 0xd5); mir_strcpy(pSvcName, "/MainMenuMUC"); CreateProtoService(pSvcName, &TlenProtocol::MUCMenuHandleMUC); mi.name.a = LPGEN("Multi-User Conference"); mi.position = 2000050002; mi.hIcolibItem = GetIconHandle(IDI_MUC); mi.pszService = text; hMenuMUC = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x594133f1, 0xc5b1, 0x4825, 0xa3, 0x8d, 0x33, 0x0, 0x33, 0x74, 0x3a, 0x29); mir_strcpy(pSvcName, "/MainMenuInbox"); CreateProtoService(pSvcName, &TlenProtocol::MenuHandleInbox); mi.name.a = LPGEN("Tlen Mail"); mi.position = 2000050003; mi.hIcolibItem = GetIconHandle(IDI_MAIL); mi.pszService = text; hMenuInbox = Menu_AddMainMenuItem(&mi); // contact menu items mi.root = NULL; // "Send picture" SET_UID(mi, 0x12c66fb1, 0x6e57, 0x4acd, 0x90, 0x16, 0xc, 0x83, 0xae, 0x16, 0xe3, 0x12); mi.pszService = "/SendPicture"; CreateProtoService(mi.pszService, &TlenProtocol::ContactMenuHandleSendPicture); mi.name.a = LPGEN("Send picture"); mi.position = -2000019030; mi.hIcolibItem = GetIconHandle(IDI_IMAGE); hMenuPicture = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Invite to MUC" SET_UID(mi, 0x4728c863, 0xe95f, 0x4203, 0x9b, 0xe8, 0x1, 0xbf, 0x5e, 0x57, 0x88, 0x43); mi.pszService = "/ContactMenuMUC"; CreateProtoService(mi.pszService, &TlenProtocol::MUCContactMenuHandleMUC); mi.name.a = LPGEN("Multi-User Conference"); mi.position = -2000019020; mi.hIcolibItem = GetIconHandle(IDI_MUC); hMenuContactMUC = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Invite to voice chat" SET_UID(mi, 0x53f919b6, 0x313c, 0x4ed4, 0x96, 0xbc, 0xf6, 0xa2, 0x67, 0x10, 0x7b, 0xa2); mi.pszService = "/ContactMenuVoice"; CreateProtoService(mi.pszService, &TlenProtocol::VoiceContactMenuHandleVoice); mi.name.a = LPGEN("Voice Chat"); mi.position = -2000019010; mi.hIcolibItem = GetIconHandle(IDI_VOICE); hMenuContactVoice = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Request authorization" SET_UID(mi, 0x36375a1f, 0xc142, 0x4d6e, 0xa6, 0x57, 0xe4, 0x76, 0x5d, 0xbc, 0x59, 0x8e); mi.pszService = "/RequestAuth"; CreateProtoService(mi.pszService, &TlenProtocol::ContactMenuHandleRequestAuth); mi.name.a = LPGEN("Request authorization"); mi.position = -2000001001; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST); hMenuContactRequestAuth = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Grant authorization" SET_UID(mi, 0x4c90452a, 0x869a, 0x4a81, 0xaf, 0xa8, 0x28, 0x34, 0xaf, 0x2b, 0x6b, 0x30); mi.pszService = "/GrantAuth"; CreateProtoService(mi.pszService, &TlenProtocol::ContactMenuHandleGrantAuth); mi.name.a = LPGEN("Grant authorization"); mi.position = -2000001000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_GRANT); hMenuContactGrantAuth = Menu_AddContactMenuItem(&mi, m_szModuleName); }
void TlenProtocol::initMenuItems() { char text[MAX_PATH]; strncpy_s(text, m_szModuleName, _TRUNCATE); char *pSvcName = text + mir_strlen(text); CMenuItem mi; mi.root = hMenuRoot = Menu_CreateRoot(MO_MAIN, m_tszUserName, -1999901009, GetIconHandle(IDI_TLEN)); mi.pszService = text; hMenuChats = NULL; // "Multi-User Conference" mir_strcpy(pSvcName, "/MainMenuMUC"); CreateProtoService(pSvcName, &TlenProtocol::MUCMenuHandleMUC); mi.name.a = LPGEN("Multi-User Conference"); mi.position = 2000050002; mi.hIcolibItem = GetIconHandle(IDI_MUC); mi.pszService = text; hMenuMUC = Menu_AddMainMenuItem(&mi); mir_strcpy(pSvcName, "/MainMenuInbox"); CreateProtoService(pSvcName, &TlenProtocol::MenuHandleInbox); mi.name.a = LPGEN("Tlen Mail"); mi.position = 2000050003; mi.hIcolibItem = GetIconHandle(IDI_MAIL); mi.pszService = text; hMenuInbox = Menu_AddMainMenuItem(&mi); // contact menu items mi.root = NULL; // "Send picture" mi.pszService = "/SendPicture"; CreateProtoService(mi.pszService, &TlenProtocol::ContactMenuHandleSendPicture); mi.name.a = LPGEN("Send picture"); mi.position = -2000019030; mi.hIcolibItem = GetIconHandle(IDI_IMAGE); hMenuPicture = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Invite to MUC" mi.pszService = "/ContactMenuMUC"; CreateProtoService(mi.pszService, &TlenProtocol::MUCContactMenuHandleMUC); mi.name.a = LPGEN("Multi-User Conference"); mi.position = -2000019020; mi.hIcolibItem = GetIconHandle(IDI_MUC); hMenuContactMUC = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Invite to voice chat" mi.pszService = "/ContactMenuVoice"; CreateProtoService(mi.pszService, &TlenProtocol::VoiceContactMenuHandleVoice); mi.name.a = LPGEN("Voice Chat"); mi.position = -2000019010; mi.hIcolibItem = GetIconHandle(IDI_VOICE); hMenuContactVoice = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Request authorization" mi.pszService = "/RequestAuth"; CreateProtoService(mi.pszService, &TlenProtocol::ContactMenuHandleRequestAuth); mi.name.a = LPGEN("Request authorization"); mi.position = -2000001001; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_REQUEST); hMenuContactRequestAuth = Menu_AddContactMenuItem(&mi, m_szModuleName); // "Grant authorization" mi.pszService = "/GrantAuth"; CreateProtoService(mi.pszService, &TlenProtocol::ContactMenuHandleGrantAuth); mi.name.a = LPGEN("Grant authorization"); mi.position = -2000001000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_AUTH_GRANT); hMenuContactGrantAuth = Menu_AddContactMenuItem(&mi, m_szModuleName); }
extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfoEx); mir_getCLI(); HookEvent(ME_CLIST_DOUBLECLICKED, Doubleclick); hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); hRichEd = LoadLibrary(_T("Msftedit.dll")); /*TIMERS*/ if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME) != 0)) { timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME)) * MINUTE), timerfunc); db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0); Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc); } InitialiseGlobals(); // register netlib handle char tempNdesc[50]; mir_snprintf(tempNdesc, _countof(tempNdesc), "%s connection settings", MODULENAME); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS; nlu.szSettingsModule = MODULENAME; nlu.szDescriptiveName = tempNdesc; hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu); // register webview protocol PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); pd.szName = MODULENAME; pd.type = PROTOTYPE_PROTOCOL; Proto_RegisterModule(&pd); //protocol services InitServices(); //add sound event to options SkinAddNewSoundExT("webviewalert", _T(MODULENAME), LPGENT("Alert event")); //value is 1 if menu is disabled db_set_b(NULL, MODULENAME, MENU_IS_DISABLED_KEY, 1); CMenuItem mi; mi.flags = CMIF_TCHAR; if ( db_get_b(NULL, MODULENAME, MENU_OFF, 0)) { //value is 0 if menu is enabled db_set_b(NULL, MODULENAME, MENU_IS_DISABLED_KEY, 0); /*DISABLE WEBVIEW*/ CreateServiceFunction("DisableWebview", AutoUpdateMCmd); mi.root = Menu_CreateRoot(MO_MAIN, _T(MODULENAME), 20200001); mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)); if (db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0)) mi.name.t = LPGENT("Auto update disabled"); else mi.name.t = LPGENT("Auto update enabled"); mi.pszService = "DisableWebview"; hMenuItem1 = Menu_AddMainMenuItem(&mi); // Update all webview contacts CreateServiceFunction("UpdateAll", UpdateAllMenuCommand); mi.position = 500090002; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL)); mi.name.t = LPGENT("Update all Webview sites"); mi.pszService = "UpdateAll"; Menu_AddMainMenuItem(&mi); // Mark All Webview Sites As Read CreateServiceFunction("MarkAllSitesRead", MarkAllReadMenuCommand); mi.position = 500090099; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MARKALLREAD)); mi.name.t = LPGENT("Mark all Webview sites as read"); mi.pszService = "MarkAllSitesRead"; Menu_AddMainMenuItem(&mi); // open cache directory CreateServiceFunction("OpenCacheFolder", OpenCacheDir); mi.position = 500090099; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_FOLDER)); mi.name.t = LPGENT("Open cache folder"); mi.pszService = "OpenCacheFolder"; Menu_AddMainMenuItem(&mi); // Countdown test CreateServiceFunction("Countdown", CountdownMenuCommand); mi.flags |= CMIF_KEEPUNTRANSLATED; TCHAR countername[100]; mir_sntprintf(countername, _countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0)); mi.position = 600090099; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL)); mi.name.t = countername; mi.pszService = "Countdown"; hMenuItemCountdown = Menu_AddMainMenuItem(&mi); } // contact menu mi.flags = CMIF_TCHAR; CreateServiceFunction("Open web page", WebsiteMenuCommand); mi.position = 100; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_URL)); mi.pszService = "Open web page"; mi.name.t = LPGENT("Open web page"); Menu_AddContactMenuItem(&mi, MODULENAME); CreateServiceFunction("OpenClose Window", DataWndMenuCommand); mi.pszService = "OpenClose Window"; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SHOW_HIDE)); mi.name.t = LPGENT("Open/Close window"); Menu_AddContactMenuItem(&mi, MODULENAME); mi.position = 2222220; mi.pszService = "UpdateData"; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATE)); mi.name.t = LPGENT("Update data"); Menu_AddContactMenuItem(&mi, MODULENAME); CreateServiceFunction("ContactOptions", CntOptionsMenuCommand); mi.pszService = "ContactOptions"; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS)); mi.name.t = LPGENT("Contact options"); Menu_AddContactMenuItem(&mi, MODULENAME); CreateServiceFunction("ContactAlertOpts", CntAlertMenuCommand); mi.pszService = "ContactAlertOpts"; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT)); mi.name.t = LPGENT("Contact alert options"); Menu_AddContactMenuItem(&mi, MODULENAME); CreateServiceFunction("PingWebsite", PingWebsiteMenuCommand); mi.pszService = "PingWebsite"; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_PING)); mi.name.t = LPGENT("Ping web site"); Menu_AddContactMenuItem(&mi, MODULENAME); CreateServiceFunction("StopDataProcessing", StpPrcssMenuCommand); mi.pszService = "StopDataProcessing"; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_STOP)); mi.name.t = LPGENT("Stop data processing"); Menu_AddContactMenuItem(&mi, MODULENAME); hWindowList = WindowList_Create(); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged); HookEvent(ME_DB_CONTACT_DELETED, SiteDeleted); db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1); return 0; }
static int ModulesLoaded(WPARAM, LPARAM) { char temp[MAX_PATH]; CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)_countof(temp), (LPARAM)temp); crs_a2t(vertxt, temp); if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) { replaceStrT(profpath, _T("%miranda_userdata%")); // Removed because it isn't available on Load() // hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder); hVerInfoFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Version Information"), VersionInfoFolder); HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged); FoldersPathChanged(0, 0); } CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Version Information"), 2000089999, GetIconHandle(IDI_VI)); SET_UID(mi, 0x52930e40, 0xb2ee, 0x4433, 0xad, 0x77, 0xf5, 0x42, 0xe, 0xf6, 0x57, 0xc1); mi.position = 2000089995; mi.name.a = LPGEN("Copy to clipboard"); mi.hIcolibItem = GetIconHandle(IDI_VITOCLIP); mi.pszService = MS_CRASHDUMPER_STORETOCLIP; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x54109094, 0x494e, 0x4535, 0x9c, 0x3a, 0xf6, 0x9e, 0x9a, 0xf7, 0xcd, 0xbe); mi.position = 2000089996; mi.name.a = LPGEN("Store to file"); mi.hIcolibItem = GetIconHandle(IDI_VITOFILE); mi.pszService = MS_CRASHDUMPER_STORETOFILE; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x4004f9ee, 0x2c5a, 0x420a, 0xb1, 0x54, 0x3e, 0x47, 0xc1, 0xde, 0x46, 0xec); mi.position = 2000089997; mi.name.a = LPGEN("Show"); mi.hIcolibItem = GetIconHandle(IDI_VISHOW); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x8526469a, 0x8ab4, 0x4dd4, 0xad, 0xbf, 0x51, 0xfd, 0x71, 0x10, 0xd3, 0x3c); mi.position = 2000089998; mi.name.a = LPGEN("Show with DLLs"); mi.hIcolibItem = GetIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_VIEWINFO; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); SET_UID(mi, 0xc6e3b558, 0xe1e8, 0x4cce, 0x96, 0x8, 0xc6, 0x89, 0x1b, 0x79, 0xf3, 0x7e); mi.position = 2000089999; mi.name.a = LPGEN("Upload"); mi.hIcolibItem = GetIconHandle(IDI_VIUPLOAD); mi.pszService = MS_CRASHDUMPER_UPLOAD; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xa23da95a, 0x7624, 0x4343, 0x8c, 0xc0, 0xa6, 0x16, 0xbc, 0x30, 0x13, 0x8c); mi.position = 2000089999; mi.name.a = LPGEN("Copy link to clipboard"); mi.hIcolibItem = GetIconHandle(IDI_LINKTOCLIP);//need icon mi.pszService = MS_CRASHDUMPER_URLTOCLIP; Menu_AddMainMenuItem(&mi); if (catchcrashes && !needrestart) { SET_UID(mi, 0xecae52f2, 0xd601, 0x4f85, 0x87, 0x9, 0xec, 0x8e, 0x84, 0xfe, 0x1b, 0x3c); mi.position = 2000099990; mi.name.a = LPGEN("Open crash report directory"); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_FILE); mi.pszService = MS_CRASHDUMPER_URL; Menu_AddMainMenuItem(&mi); } SET_UID(mi, 0x6b19be3, 0xfb7d, 0x457d, 0x85, 0xde, 0xe0, 0x26, 0x4c, 0x87, 0x35, 0xf4); mi.position = 2000099991; mi.name.a = LPGEN("Open online Version Info"); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_URL); mi.pszService = MS_CRASHDUMPER_URL; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); HOTKEYDESC hk = { 0 }; hk.cbSize = sizeof(hk); hk.pszSection = PluginName; hk.pszDescription = LPGEN("Copy Version Info to clipboard"); hk.pszName = "CopyVerInfo"; hk.pszService = MS_CRASHDUMPER_STORETOCLIP; Hotkey_Register(&hk); hk.pszDescription = LPGEN("Show Version Info"); hk.pszName = "ShowVerInfo"; hk.pszService = MS_CRASHDUMPER_VIEWINFO; Hotkey_Register(&hk); UploadInit(); if (catchcrashes && !needrestart) SetExceptionHandler(); HookEvent(ME_TTB_MODULELOADED, ToolbarModulesLoaded); if (servicemode) ViewVersionInfo(0, 0); else if (db_get_b(NULL, PluginName, "UploadChanged", 0) && !ProcessVIHash(false)) UploadVersionInfo(0, 0xa1); return 0; }
void InitMenu() { CMenuItem mi; mi.flags = CMIF_TCHAR; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Quotes"), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "B474F556-22B6-42A1-A91E-22FE4F671388"); SET_UID(mi, 0x9de6716, 0x3591, 0x48c4, 0x9f, 0x64, 0x1b, 0xfd, 0xc6, 0xd1, 0x34, 0x97); mi.name.t = LPGENT("Enable/Disable Auto Update"); mi.position = 10100001; mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = g_pszAutoUpdateCmd; g_hEnableDisableMenu = Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_EnableDisable); UpdateMenu(g_bAutoUpdate); SET_UID(mi, 0x91cbabf6, 0x5073, 0x4a78, 0x84, 0x8, 0x34, 0x61, 0xc1, 0x8a, 0x34, 0xd9); mi.name.t = LPGENT("Refresh All Quotes\\Rates"); mi.position = 20100001; mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN); mi.pszService = "Quotes/RefreshAll"; Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_RefreshAll); SET_UID(mi, 0x3663409c, 0xbd36, 0x473b, 0x9b, 0x4f, 0xff, 0x80, 0xf6, 0x2c, 0xdf, 0x9b); mi.name.t = LPGENT("Currency Converter..."); mi.position = 20100002; mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_CURRENCY_CONVERTER); mi.pszService = g_pszCurrencyConverter; Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_CurrencyConverter); SET_UID(mi, 0x7cca4fd9, 0x903f, 0x4b7d, 0x93, 0x7a, 0x18, 0x63, 0x23, 0xd4, 0xa9, 0xa9); mi.name.t = LPGENT("Export All Quotes"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_EXPORT); mi.pszService = "Quotes/ExportAll"; mi.position = 20100003; Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_ExportAll); SET_UID(mi, 0xa994d3b, 0x77c2, 0x4612, 0x8d, 0x5, 0x6a, 0xae, 0x8c, 0x21, 0xbd, 0xc9); mi.name.t = LPGENT("Import All Quotes"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_IMPORT); mi.pszService = "Quotes/ImportAll"; mi.position = 20100004; Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, QuotesMenu_ImportAll); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, Quotes_PrebuildContactMenu); g_hMenuRoot = mi.root = Menu_CreateRoot(MO_CONTACT, _T(QUOTES_PROTOCOL_NAME), 0, Quotes_GetIconHandle(IDI_ICON_MAIN)); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "C259BE01-642C-461E-997D-0E756B2A3AD6"); SET_UID(mi, 0xb9812194, 0x3235, 0x4e76, 0xa3, 0xa4, 0x73, 0x32, 0x96, 0x1c, 0x1c, 0xf4); mi.name.t = LPGENT("Refresh"); mi.hIcolibItem = Quotes_GetIconHandle(IDI_ICON_REFRESH); mi.pszService = "Quotes/RefreshContact"; g_hMenuRefresh = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); Menu_ConfigureItem(g_hMenuRefresh, MCI_OPT_EXECPARAM, INT_PTR(0)); CreateServiceFunction(mi.pszService, QuotesMenu_RefreshContact); SET_UID(mi, 0x19a16fa2, 0xf370, 0x4201, 0x92, 0x9, 0x25, 0xde, 0x4e, 0x55, 0xf9, 0x1a); mi.name.t = LPGENT("Open Log File..."); mi.hIcolibItem = NULL; mi.pszService = "Quotes/OpenLogFile"; g_hMenuOpenLogFile = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); Menu_ConfigureItem(g_hMenuOpenLogFile, MCI_OPT_EXECPARAM, 1); CreateServiceFunction(mi.pszService, QuotesMenu_OpenLogFile); #ifdef CHART_IMPLEMENT SET_UID(mi, 0x65da7256, 0x43a2, 0x4857, 0xac, 0x52, 0x1c, 0xb7, 0xff, 0xd7, 0x96, 0xfa); mi.name.t = LPGENT("Chart..."); mi.popupPosition = 2; mi.hIcolibItem = NULL; mi.pszService = "Quotes/Chart"; g_hMenuChart = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); CreateServiceFunction(mi.pszService, QuotesMenu_Chart); #endif SET_UID(mi, 0xac5fc17, 0x5640, 0x4f81, 0xa3, 0x44, 0x8c, 0xb6, 0x9a, 0x5c, 0x98, 0xf); mi.name.t = LPGENT("Edit Settings..."); mi.hIcolibItem = NULL; mi.pszService = "Quotes/EditSettings"; g_hMenuEditSettings = Menu_AddContactMenuItem(&mi, QUOTES_PROTOCOL_NAME); #ifdef CHART_IMPLEMENT Menu_ConfigureItem(g_hMenuEditSettings, MCI_OPT_EXECPARAM, 3); #else Menu_ConfigureItem(g_hMenuEditSettings, MCI_OPT_EXECPARAM, 2); #endif CreateServiceFunction(mi.pszService, QuotesMenu_EditSettings); }
int OnModulesLoaded(WPARAM wparam, LPARAM lparam) { // register fonts and hotkeys RegisterFontServiceFonts(); RegisterKeyBindings(); g_AddContListMI = (BOOL)db_get_dw(0,MODULENAME,"AddContactMenuItems",1); // register menus CMenuItem mi; mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Notes && Reminders"), 1600000000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "A5E140BC-D697-4689-B75B-8ECFB6FE5931"); mi.flags = CMIF_TCHAR; mi.position = 1600000000; mi.hIcolibItem = iconList[2].hIcolib; mi.name.t = LPGENT("New &Note"); mi.pszService = MODULENAME"/MenuCommandAddNew"; addMenuItem(mi); mi.position = 1600000001; mi.hIcolibItem = iconList[0].hIcolib; mi.name.t = LPGENT("New &Reminder"); mi.pszService = MODULENAME"/MenuCommandNewReminder"; addMenuItem(mi); mi.position = 1600100000; mi.hIcolibItem = iconList[3].hIcolib; mi.name.t = LPGENT("&Show / Hide Notes"); mi.pszService = MODULENAME"/MenuCommandShowHide"; addMenuItem(mi); mi.position = 1600100001; mi.hIcolibItem = iconList[13].hIcolib; mi.name.t = LPGENT("Vie&w Notes"); mi.pszService = MODULENAME"/MenuCommandViewNotes"; addMenuItem(mi); mi.position = 1600100002; mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = LPGENT("&Delete All Notes"); mi.pszService = MODULENAME"/MenuCommandDeleteAll"; addMenuItem(mi); mi.position = 1600100003; mi.hIcolibItem = iconList[11].hIcolib; mi.name.t = LPGENT("&Bring All to Front"); mi.pszService = MODULENAME"/MenuCommandBringAllFront"; addMenuItem(mi); mi.position = 1600200000; mi.hIcolibItem = iconList[6].hIcolib; mi.name.t = LPGENT("&View Reminders"); mi.pszService = MODULENAME"/MenuCommandViewReminders"; addMenuItem(mi); mi.position = 1600200001; mi.hIcolibItem = iconList[5].hIcolib; mi.name.t = LPGENT("D&elete All Reminders"); mi.pszService = MODULENAME"/MenuCommandDeleteReminders"; addMenuItem(mi); // register misc hkOptInit = HookEvent(ME_OPT_INITIALISE, OnOptInitialise); hkTopToolbarInit = HookEvent("TopToolBar/ModuleLoaded", OnTopToolBarInit); UnhookEvent(hkModulesLoaded); // init vars and load all data InitSettings(); CreateMsgWindow(); LoadNotes(TRUE); LoadReminders(); return 0; }
static int PluginInit(WPARAM, LPARAM) { HookEvent(ME_MSG_WINDOWEVENT, GetContactHandle); HookEvent(ME_OPT_INITIALISE, OptionsInit); HookEvent(ME_TTB_MODULELOADED, CreateButtons); // Hotkeys HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszSection = LPGEN("Sessions"); hkd.pszName = "OpenSessionsManager"; hkd.pszDescription = LPGEN("Open Sessions Manager"); hkd.pszService = MS_SESSIONS_OPENMANAGER; Hotkey_Register(&hkd); hkd.pszName = "RestoreLastSession"; hkd.pszDescription = LPGEN("Restore last Session"); hkd.pszService = MS_SESSIONS_RESTORELASTSESSION; Hotkey_Register(&hkd); hkd.pszName = "SaveSession"; hkd.pszDescription = LPGEN("Save Session"); hkd.pszService = MS_SESSIONS_SAVEUSERSESSION; Hotkey_Register(&hkd); hkd.pszName = "CloseSession"; hkd.pszDescription = LPGEN("Close Session"); hkd.pszService = MS_SESSIONS_CLOSESESSION; Hotkey_Register(&hkd); // Main menu CMenuItem mi; mi.position = 1000000000; mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Sessions Manager"), 1000000000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D77B9AB4-AF7E-43DB-A487-BD581704D635"); SET_UID(mi, 0xd35302fa, 0x8326, 0x4323, 0xa3, 0xe5, 0xb4, 0x41, 0xff, 0xfb, 0xaa, 0x2d); mi.name.a = LPGEN("Save session..."); mi.hIcolibItem = iconList[4].hIcolib; mi.pszService = MS_SESSIONS_SAVEUSERSESSION; hmSaveCurrentSession = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x8de4d8b1, 0x9a62, 0x4f4e, 0xb0, 0x3d, 0x99, 0x7, 0x80, 0xe8, 0x93, 0xc2); mi.name.a = LPGEN("Load session..."); mi.pszService = MS_SESSIONS_OPENMANAGER; mi.hIcolibItem = iconList[3].hIcolib; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x73ea91d6, 0xb7e5, 0x4f67, 0x96, 0x96, 0xa, 0x24, 0x21, 0x48, 0x6f, 0x15); mi.name.a = LPGEN("Close session"); mi.pszService = MS_SESSIONS_CLOSESESSION; mi.hIcolibItem = 0; Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xe2c4e4ba, 0x5d08, 0x441b, 0xb5, 0x93, 0xc4, 0xe7, 0x9a, 0xfb, 0xa4, 0x6c); mi.name.a = LPGEN("Load last session"); mi.pszService = MS_SESSIONS_RESTORELASTSESSION; mi.hIcolibItem = iconList[5].hIcolib; mi.position = 10100000; Menu_AddMainMenuItem(&mi); return 0; }