int cp_compat_stat(struct kstat *kbuf, struct compat_stat __user *ubuf) { typeof(ubuf->st_uid) uid = 0; typeof(ubuf->st_gid) gid = 0; SET_UID(uid, kbuf->uid); SET_GID(gid, kbuf->gid); if (!old_valid_dev(kbuf->dev) || !old_valid_dev(kbuf->rdev)) return -EOVERFLOW; if (kbuf->size >= 0x7fffffff) return -EOVERFLOW; if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct compat_stat)) || __put_user (old_encode_dev(kbuf->dev), &ubuf->st_dev) || __put_user (kbuf->ino, &ubuf->st_ino) || __put_user (kbuf->mode, &ubuf->st_mode) || __put_user (kbuf->nlink, &ubuf->st_nlink) || __put_user (uid, &ubuf->st_uid) || __put_user (gid, &ubuf->st_gid) || __put_user (old_encode_dev(kbuf->rdev), &ubuf->st_rdev) || __put_user (kbuf->size, &ubuf->st_size) || __put_user (kbuf->atime.tv_sec, &ubuf->st_atime) || __put_user (kbuf->atime.tv_nsec, &ubuf->st_atime_nsec) || __put_user (kbuf->mtime.tv_sec, &ubuf->st_mtime) || __put_user (kbuf->mtime.tv_nsec, &ubuf->st_mtime_nsec) || __put_user (kbuf->ctime.tv_sec, &ubuf->st_ctime) || __put_user (kbuf->ctime.tv_nsec, &ubuf->st_ctime_nsec) || __put_user (kbuf->blksize, &ubuf->st_blksize) || __put_user (kbuf->blocks, &ubuf->st_blocks)) return -EFAULT; return 0; }
static int OnModulesLoaded(WPARAM, LPARAM) { ReloadGlobals(); LoadGlobalIcons(); LoadMsgLogIcons(); ModuleLoad(0, 0); CMenuItem mi; SET_UID(mi, 0x58d8dc1, 0x1c25, 0x49c0, 0xb8, 0x7c, 0xa3, 0x22, 0x2b, 0x3d, 0xf1, 0xd8); mi.position = -2000090000; mi.flags = CMIF_DEFAULT; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_MESSAGE); mi.name.a = LPGEN("&Message"); mi.pszService = MS_MSG_SENDMESSAGE; hMsgMenuItem = Menu_AddContactMenuItem(&mi); IcoLib_ReleaseIcon((HICON)mi.hIcolibItem); HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged); HookEvent(ME_IEVIEW_OPTIONSCHANGED, SmileySettingsChanged); HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); HookEvent(ME_FONT_RELOAD, FontServiceFontsChanged); HookEvent(ME_MSG_ICONPRESSED, StatusIconPressed); HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactChanged); RestoreUnreadMessageAlerts(); OptionsInit(); RegisterStatusIcons(); return 0; }
static int ModulesLoaded(WPARAM, LPARAM) { CMenuItem mi; SET_UID(mi, 0x5ba238de, 0xe16b, 0x4928, 0xa0, 0x70, 0xff, 0x43, 0xf6, 0x1f, 0x16, 0xd4); mi.position = 2000070050; mi.hIcolibItem = icon.hIcolib; mi.name.a = LPGEN("Assign smiley category"); hContactMenuItem = Menu_AddContactMenuItem(&mi); DownloadInit(); //install hooks if enabled InstallDialogBoxHook(); g_SmileyCategories.AddAllProtocolsAsCategory(); g_SmileyCategories.ClearAndLoadAll(); ColourID cid = { sizeof(cid) }; strcpy_s(cid.dbSettingsGroup, "SmileyAdd"); strcpy_s(cid.group, LPGEN("SmileyAdd")); strcpy_s(cid.name, LPGEN("Background color")); strcpy_s(cid.setting, "SelWndBkgClr"); cid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegister(&cid); return 0; }
int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf) { struct compat_stat tmp; if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev)) return -EOVERFLOW; memset(&tmp, 0, sizeof(tmp)); tmp.st_dev = new_encode_dev(stat->dev); tmp.st_ino = stat->ino; tmp.st_mode = stat->mode; tmp.st_nlink = stat->nlink; SET_UID(tmp.st_uid, stat->uid); SET_GID(tmp.st_gid, stat->gid); tmp.st_rdev = new_encode_dev(stat->rdev); tmp.st_size = stat->size; tmp.st_atime = stat->atime.tv_sec; tmp.st_mtime = stat->mtime.tv_sec; tmp.st_ctime = stat->ctime.tv_sec; #ifdef STAT_HAVE_NSEC tmp.st_atime_nsec = stat->atime.tv_nsec; tmp.st_mtime_nsec = stat->mtime.tv_nsec; tmp.st_ctime_nsec = stat->ctime.tv_nsec; #endif tmp.st_blocks = stat->blocks; tmp.st_blksize = stat->blksize; return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; }
int LoadFavoriteContactMenu() { Icon_Register(g_hInst, LPGEN("Contact list"), iconList, _countof(iconList)); CreateServiceFunction(CLUI_FAVSETRATE, FAV_SetRate); CreateServiceFunction(CLUI_FAVTOGGLESHOWOFFLINE, FAV_ToggleShowOffline); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, FAV_OnContactMenuBuild); CMenuItem mi; SET_UID(mi, 0xf99a2320, 0xc024, 0x48bd, 0x81, 0xf7, 0x9f, 0xa2, 0x5, 0xb0, 0x7f, 0xdc); mi.name.t = FAVMENUROOTNAME; mi.flags = CMIF_TCHAR; hFavoriteContactMenu = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(hFavoriteContactMenu, MCI_OPT_UNIQUENAME, "ModernClistMenu_ContactRate"); UNSET_UID(mi); mi.root = hFavoriteContactMenu; mi.flags = CMIF_TCHAR | CMIF_SYSTEM; // not included into new menu settings mi.pszService = CLUI_FAVSETRATE; for (int i = 0; i < _countof(rates); i++) { mi.hIcolibItem = iconList[i].hIcolib; mi.name.t = rates[i]; hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(hFavoriteContactMenuItems[i], MCI_OPT_EXECPARAM, i); } mi.hIcolibItem = NULL; mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE; mi.position = -100000000; mi.name.t = LPGENT("Show even if offline"); hShowIfOflineItem = Menu_AddContactMenuItem(&mi); Menu_ConfigureItem(hShowIfOflineItem, MCI_OPT_EXECPARAM, _countof(rates) + 100000000); return 0; }
static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf) { struct compat_stat tmp; if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) return -EOVERFLOW; memset(&tmp, 0, sizeof(tmp)); tmp.st_dev = old_encode_dev(stat->dev); tmp.st_ino = stat->ino; if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) return -EOVERFLOW; tmp.st_mode = stat->mode; tmp.st_nlink = stat->nlink; if (tmp.st_nlink != stat->nlink) return -EOVERFLOW; SET_UID(tmp.st_uid, stat->uid); SET_GID(tmp.st_gid, stat->gid); tmp.st_rdev = old_encode_dev(stat->rdev); if ((u64) stat->size > MAX_NON_LFS) return -EOVERFLOW; tmp.st_size = stat->size; tmp.st_atime = stat->atime.tv_sec; tmp.st_atime_nsec = stat->atime.tv_nsec; tmp.st_mtime = stat->mtime.tv_sec; tmp.st_mtime_nsec = stat->mtime.tv_nsec; tmp.st_ctime = stat->ctime.tv_sec; tmp.st_ctime_nsec = stat->ctime.tv_nsec; tmp.st_blocks = stat->blocks; tmp.st_blksize = stat->blksize; return copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; }
/* * Another set for IA32/LFS -- x86_64 struct stat is different due to * support for 64bit inode numbers. */ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat) { typeof(ubuf->st_uid) uid = 0; typeof(ubuf->st_gid) gid = 0; SET_UID(uid, stat->uid); SET_GID(gid, stat->gid); if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct stat64)) || __put_user(huge_encode_dev(stat->dev), &ubuf->st_dev) || __put_user(stat->ino, &ubuf->__st_ino) || __put_user(stat->ino, &ubuf->st_ino) || __put_user(stat->mode, &ubuf->st_mode) || __put_user(stat->nlink, &ubuf->st_nlink) || __put_user(uid, &ubuf->st_uid) || __put_user(gid, &ubuf->st_gid) || __put_user(huge_encode_dev(stat->rdev), &ubuf->st_rdev) || __put_user(stat->size, &ubuf->st_size) || __put_user(stat->atime.tv_sec, &ubuf->st_atime) || __put_user(stat->atime.tv_nsec, &ubuf->st_atime_nsec) || __put_user(stat->mtime.tv_sec, &ubuf->st_mtime) || __put_user(stat->mtime.tv_nsec, &ubuf->st_mtime_nsec) || __put_user(stat->ctime.tv_sec, &ubuf->st_ctime) || __put_user(stat->ctime.tv_nsec, &ubuf->st_ctime_nsec) || __put_user(stat->blksize, &ubuf->st_blksize) || __put_user(stat->blocks, &ubuf->st_blocks)) return -EFAULT; return 0; }
void SetShutdownMenuItem(bool fActive) { /* main menu */ CMenuItem mi; SET_UID(mi, 0x61e2a38f, 0xcd94, 0x4f72, 0x84, 0x8c, 0x72, 0x92, 0xde, 0x1d, 0x6d, 0x5); mi.position = 2001090000; if (fActive) { mi.hIcolibItem = iconList[1].hIcolib; mi.name.t = LPGENT("Stop automatic &shutdown"); } else { mi.hIcolibItem = iconList[2].hIcolib; mi.name.t = LPGENT("Automatic &shutdown..."); } mi.pszService = "AutoShutdown/MenuCommand"; mi.flags = CMIF_TCHAR; if (hMainMenuItem != NULL) Menu_ModifyItem(hMainMenuItem, mi.name.t, mi.hIcolibItem); else hMainMenuItem = Menu_AddMainMenuItem(&mi); /* tray menu */ mi.position = 899999; if (hTrayMenuItem != NULL) Menu_ModifyItem(hTrayMenuItem, mi.name.t, mi.hIcolibItem); else hTrayMenuItem = Menu_AddTrayMenuItem(&mi); }
extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfoEx); TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\" DEFAULT_UPDATES_FOLDER)); mir_tstrncpy(tszRoot, tszFolder, _countof(tszRoot)); hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER); if (hPackUpdaterFolder) FoldersGetCustomPathT(hPackUpdaterFolder, tszRoot, MAX_PATH, _T("")); mir_free(tszFolder); LoadOptions(); InitPopupList(); NetlibInit(); IcoLibInit(); // Add cheking update menu item CreateServiceFunction(MODNAME"/CheckUpdates", MenuCommand); CMenuItem mi; SET_UID(mi, 0x326495e8, 0xab0a, 0x47d2, 0xb2, 0x22, 0x2a, 0x8e, 0xa8, 0xae, 0x53, 0x1a); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = IcoLib_GetIcon("check_update"); mi.name.t = LPGENT("Check for pack updates"); mi.pszService = MODNAME"/CheckUpdates"; Menu_AddMainMenuItem(&mi); // Add empty updates folder menu item CreateServiceFunction(MODNAME"/EmptyFolder", EmptyFolder); memset(&mi, 0, sizeof(mi)); SET_UID(mi, 0xc3eea590, 0xaba3, 0x454f, 0x93, 0x93, 0xbc, 0x97, 0x15, 0x2c, 0x3b, 0x3d); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = IcoLib_GetIcon("empty_folder"); mi.name.t = LPGENT("Clear pack updates folder"); mi.pszService = MODNAME"/EmptyFolder"; Menu_AddMainMenuItem(&mi); // Add options hook HookEvent(ME_OPT_INITIALISE, OptInit); HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); return 0; }
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 InitMenu() { CMenuItem mi(g_plugin); mi.flags = CMIF_UNICODE | CMIF_NOTOFFLINE; mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("News Aggregator"), 500099000); Menu_ConfigureItem(mi.root, MCI_OPT_UID, "D9733E4F-1946-4390-8EB3-591E8687222E"); SET_UID(mi, 0x3ec91864, 0xefa7, 0x4994, 0xb7, 0x75, 0x6c, 0x96, 0xcb, 0x29, 0x2f, 0x93); mi.position = 10100001; if (db_get_b(NULL, MODULENAME, "AutoUpdate", 1)) mi.name.w = LPGENW("Auto Update Enabled"); else mi.name.w = LPGENW("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.w = LPGENW("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.w = LPGENW("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.w = LPGENW("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.w = LPGENW("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 = nullptr; mi.position = -0x7FFFFFFA; mi.hIcolibItem = GetIconHandle("checkfeed"); mi.name.w = LPGENW("Check feed"); mi.pszService = MS_NEWSAGGREGATOR_CHECKFEED; hService2[5] = Menu_AddContactMenuItem(&mi, MODULENAME); SET_UID(mi, 0x41a70fbc, 0x9241, 0x44c0, 0x90, 0x90, 0x87, 0xd2, 0xc5, 0x9f, 0xc9, 0xac); mi.name.w = LPGENW("Change feed"); mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED; hService2[6] = Menu_AddContactMenuItem(&mi, MODULENAME); Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(db_get_b(NULL, MODULENAME, "AutoUpdate", 1) ? "enabled" : "disabled")); }
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; }
static inline int __put_compat_ipc_perm(struct ipc64_perm *p, struct compat_ipc_perm __user *up) { int err; __compat_uid_t u; __compat_gid_t g; err = __put_user(p->key, &up->key); SET_UID(u, p->uid); err |= __put_user(u, &up->uid); SET_GID(g, p->gid); err |= __put_user(g, &up->gid); SET_UID(u, p->cuid); err |= __put_user(u, &up->cuid); SET_GID(g, p->cgid); err |= __put_user(g, &up->cgid); err |= __put_user(p->mode, &up->mode); err |= __put_user(p->seq, &up->seq); return err; }
int MainInit(WPARAM, LPARAM) { CMenuItem mi; SET_UID(mi, 0x719c1596, 0xb0fd, 0x4c74, 0xb7, 0xe4, 0xeb, 0x22, 0xf4, 0x99, 0xd7, 0x68); mi.position = 10; mi.hIcolibItem = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POUNCE)); mi.name.a = LPGEN("&Buddy Pounce"); mi.pszService = "BuddyPounce/MenuCommand"; Menu_AddContactMenuItem(&mi); return 0; }
void MTG_OnmodulesLoad() { HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnContactMenuBuild); CreateServiceFunction(MTG_MOVE, MTG_DOMOVE); CMenuItem mi; SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5); mi.position = 100000; mi.name.a = LPGEN("&Move to group"); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP); hMoveToGroupItem = Menu_AddContactMenuItem(&mi); }
void CYahooProto::MenuContactInit(void) { // Show Profile CreateProtoService(YAHOO_SHOW_PROFILE, &CYahooProto::OnShowProfileCommand); CMenuItem mi; SET_UID(mi, 0x4f006492, 0x9fe5, 0x4d10, 0x88, 0xce, 0x47, 0x53, 0xba, 0x27, 0xe9, 0xc9); mi.pszService = YAHOO_SHOW_PROFILE; mi.position = -2000006000; mi.hIcolibItem = GetIconHandle(IDI_PROFILE); mi.name.a = LPGEN("&Show Profile"); hShowProfileMenuItem = Menu_AddContactMenuItem(&mi, m_szModuleName); }
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); }
void InitMainMenuItem() { CMenuItem mi(g_plugin); SET_UID(mi, 0x22b7b4db, 0xa9a1, 0x4d43, 0x88, 0x80, 0x4c, 0x23, 0x20, 0x31, 0xc6, 0xa0); mi.flags = CMIF_UNICODE; if (ServiceExists(MS_POPUP_ADDPOPUPT)) mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); mi.pszService = MS_STATUSCHANGE_MENUCOMMAND; hEnableDisableMenu = Menu_AddMainMenuItem(&mi); opt.TempDisabled = !opt.TempDisabled; EnableDisableMenuCommand(0, 0); }
HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bIsMain, const IconItem *pgdiItems, size_t dwCount, HGENMENU *hResult) { if (!pgdiItems || !dwCount || !hResult) return NULL; char szServiceFunction[MAX_PATH]; CMenuItem mi; HGENMENU hRootMenu, (__stdcall *fnAddFunc)(TMO_MenuItem*, const char*); if (bIsMain) { fnAddFunc = Menu_AddProtoMenuItem; hRootMenu = Menu_GetProtocolRoot(this); if (hRootMenu == NULL) { mi.name.t = m_tszUserName; mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.hIcolibItem = g_hMainIcon; hRootMenu = Menu_AddProtoMenuItem(&mi); } mi.position = 20003; mi.root = hRootMenu; } else { fnAddFunc = Menu_AddContactMenuItem; mi.position = lPosition; } SET_UID(mi, 0x83C8B6A7, 0xEC0D, 0x41D6, 0x8A, 0x0E, 0xAC, 0x90, 0x8C, 0xEE, 0xAF, 0xFE); mi.flags = 0; mi.name.a = LPGEN("Services..."); mi.hIcolibItem = g_hMainIcon; hRootMenu = fnAddFunc(&mi, m_szModuleName); UNSET_UID(mi); mi.flags = CMIF_SYSTEM; mi.root = hRootMenu; mi.pszService = szServiceFunction; for (size_t i = 0; i < dwCount; i++) { mi.pszService = pgdiItems[i].szName; mi.position = int(lPosition + i); mi.hIcolibItem = pgdiItems[i].hIcolib; mi.name.a = pgdiItems[i].szDescr; hResult[i] = fnAddFunc(&mi, m_szModuleName); Menu_ConfigureItem(hResult[i], MCI_OPT_EXECPARAM, lPopupPosition); } return hRootMenu; }
static void LoadMenus() { CMenuItem mi; // Remove thumb menu item CreateServiceFunction(MODULE "/RemoveThumb", OnContactMenu_Remove); SET_UID(mi,0xbab83df0, 0xe126, 0x4d9a, 0xbc, 0xc3, 0x2b, 0xea, 0x84, 0x90, 0x58, 0xc8); mi.position = 0xFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = LoadIcon(hInst, MAKEINTRESOURCE(IDI_HIDE)); mi.name.t = LPGENT("Remove thumb"); mi.pszService = MODULE "/RemoveThumb"; hMenuItemRemove = Menu_AddContactMenuItem(&mi); // Hide all thumbs main menu item CreateServiceFunction(MODULE "/MainHideAllThumbs", OnMainMenu_HideAll); SET_UID(mi, 0x9ce9983f, 0x782a, 0x4ec1, 0xb5, 0x9b, 0x41, 0x4e, 0x9d, 0x92, 0x8e, 0xcb); mi.pszService = MODULE "/MainHideAllThumbs"; int i = (fcOpt.bHideAll) ? 0 : 1; mi.hIcolibItem = g_iconList[i].hIcolib; mi.name.t = g_iconList[i].tszDescr; hMainMenuItemHideAll = Menu_AddMainMenuItem(&mi); // Register hotkeys HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszSection = "Floating Contacts"; hkd.pszName = MODULE "/MainHideAllThumbs"; hkd.pszDescription = LPGEN("Show/Hide all thumbs"); hkd.pszService = MODULE "/MainHideAllThumbs"; Hotkey_Register(&hkd); CreateServiceFunction(MODULE "/HideWhenCListShow", OnHotKey_HideWhenCListShow); hkd.pszName = MODULE "/HideWhenCListShow"; hkd.pszDescription = LPGEN("Hide when contact list is shown"); hkd.pszService = MODULE "/HideWhenCListShow"; Hotkey_Register(&hkd); }
int LoadSendRecvEMailModule(void) { CMenuItem mi; SET_UID(mi, 0x61d8e25a, 0x92e, 0x4470, 0x84, 0x57, 0x5e, 0x52, 0x17, 0x7f, 0xfa, 0x3); mi.position = -2000010000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_SENDEMAIL); mi.name.a = LPGEN("&E-mail"); mi.pszService = MS_EMAIL_SENDEMAIL; hEMailMenuItem = Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_EMAIL_SENDEMAIL, SendEMailCommand); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, EMailPreBuildMenu); return 0; }
void InitSubGroupMenus(void) { HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu); // add exit command to menu GroupMenuParam gmp = { POPUP_GROUPSHOWOFFLINE, 0 }; CMenuItem mi; SET_UID(mi, 0x7E081A28, 0x19B3, 0x407F, 0x80, 0x6B, 0x70, 0xC3, 0xC3, 0xA9, 0xD2, 0xA4); mi.position = 1002; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; mi.name.a = LPGEN("&Show offline users in here"); hShowOfflineUsersHereMenuItem = Menu_AddSubGroupMenuItem(&mi, &gmp); }
static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) { struct stat tmp; #if BITS_PER_LONG == 32 if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) return -EOVERFLOW; #else if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev)) return -EOVERFLOW; #endif memset(&tmp, 0, sizeof(tmp)); #if BITS_PER_LONG == 32 tmp.st_dev = old_encode_dev(stat->dev); #else tmp.st_dev = new_encode_dev(stat->dev); #endif tmp.st_ino = stat->ino; if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) return -EOVERFLOW; tmp.st_mode = stat->mode; tmp.st_nlink = stat->nlink; if (tmp.st_nlink != stat->nlink) return -EOVERFLOW; SET_UID(tmp.st_uid, stat->uid); SET_GID(tmp.st_gid, stat->gid); #if BITS_PER_LONG == 32 tmp.st_rdev = old_encode_dev(stat->rdev); #else tmp.st_rdev = new_encode_dev(stat->rdev); #endif #if BITS_PER_LONG == 32 if (stat->size > MAX_NON_LFS) return -EOVERFLOW; #endif tmp.st_size = stat->size; tmp.st_atime = stat->atime.tv_sec; tmp.st_mtime = stat->mtime.tv_sec; tmp.st_ctime = stat->ctime.tv_sec; #ifdef STAT_HAVE_NSEC tmp.st_atime_nsec = stat->atime.tv_nsec; tmp.st_mtime_nsec = stat->mtime.tv_nsec; tmp.st_ctime_nsec = stat->ctime.tv_nsec; #endif tmp.st_blocks = stat->blocks; tmp.st_blksize = stat->blksize; scribe_data_non_det(); return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; }
int ModulesLoaded(WPARAM, LPARAM) { // create contact menu item CMenuItem mi; mi.flags = CMIF_TCHAR; SET_UID(mi, 0xede12697, 0x3e9d, 0x47ca, 0x83, 0xe0, 0xc1, 0x40, 0x69, 0xbf, 0x2d, 0xab); mi.position = -300010; mi.name.t = LPGENT("Disable History"); mi.pszService = MS_NOHISTORY_TOGGLE; mi.hIcolibItem = hIconRemove; hMenuToggle = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x1c4b1c21, 0xc0d1, 0x44d1, 0xb5, 0x3c, 0xc7, 0x8d, 0xcf, 0x96, 0x51, 0xd7); mi.position = -300005; mi.name.t = LPGENT("Clear History"); mi.pszService = MS_NOHISTORY_CLEAR; mi.hIcolibItem = hIconClear; hMenuClear = Menu_AddContactMenuItem(&mi); // add icon to srmm status icons SrmmMenu_Load(); return 0; }
static int OnContactMenuBuild(WPARAM wParam, LPARAM) { int i; OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare); if (!hMoveToGroupItem) { CMenuItem mi; SET_UID(mi, 0x403c548, 0x4ac6, 0x4ced, 0xa7, 0x6c, 0x4e, 0xb9, 0xc8, 0xba, 0x94, 0x5); mi.position = 100000; mi.name.a = LPGEN("&Move to group"); mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_GROUP); hMoveToGroupItem = Menu_AddContactMenuItem(&mi); } for (i=0; i < lphGroupsItems.getCount(); i++) Menu_RemoveItem((HGENMENU)lphGroupsItems[i]); lphGroupsItems.destroy(); ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group")); int pos = 1000; AddGroupItem(hMoveToGroupItem, TranslateT("<Root group>"), pos, -1, !szContactGroup); pos += 100000; // Separator for (i=0; ; i++) { char intname[20]; _itoa(i, intname, 10); DBVARIANT dbv; if (db_get_ts(NULL, "CListGroups", intname, &dbv)) break; if (dbv.ptszVal[0]) groups.insert(new GroupItemSort(dbv.ptszVal + 1, i + 1)); mir_free(dbv.ptszVal); } for (i=0; i < groups.getCount(); i++) { bool checked = szContactGroup && !mir_tstrcmp(szContactGroup, groups[i].name); AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked); } return 0; }
static int OnLoadInit(WPARAM, LPARAM) { mir_getCI(NULL); CMenuItem mi; SET_UID(mi, 0x5d72ca1f, 0xc52, 0x436d, 0x81, 0x47, 0x29, 0xf6, 0xc3, 0x28, 0xb5, 0xd1); mi.position = -0x7FFFFFFF; mi.flags = CMIF_TCHAR; mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); mi.name.t = LPGENT("Custom contact sound"); mi.pszService = "XSoundNotify/ContactMenuCommand"; hChangeSound = Menu_AddContactMenuItem(&mi); InitSelfSounds(); return 0; }
int InitCustomMenus(void) { InitIconLibMenuIcons(); CreateServiceFunction("CloseAction", CloseAction); CreateServiceFunction("CList/SetContactIgnore", SetContactIgnore); CMenuItem mi(g_plugin); SET_UID(mi, 0xe3b08c6f, 0x8a01, 0x4c94, 0xb3, 0xf5, 0x9d, 0x38, 0x6, 0x63, 0x7a, 0xa9); mi.position = 200000; mi.pszService = "CList/SetContactIgnore"; mi.hIcolibItem = iconItem[0].hIcolib; mi.name.a = LPGEN("&Contact list settings..."); Menu_AddContactMenuItem(&mi); return 0; }
int LoadHistoryModule(void) { CMenuItem mi; SET_UID(mi, 0x28848d7a, 0x6995, 0x4799, 0x82, 0xd7, 0x18, 0x40, 0x3d, 0xe3, 0x71, 0xc4); mi.position = 1000090000; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_HISTORY); mi.name.a = LPGEN("View &history"); mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY; hContactMenu = Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, UserHistoryCommand); hWindowList = WindowList_Create(); HookEvent(ME_DB_CONTACT_DELETED, HistoryContactDelete); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdownHistoryModule); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); return 0; }
extern "C" int __declspec(dllexport) Load() { mir_getLP(&pluginInfo); char *strTmp; CMenuItem mi; SET_UID(mi, 0x2f9f21df, 0xf33c, 0x4640, 0xb9, 0x63, 0xd3, 0x26, 0x8a, 0xb8, 0xb1, 0xf0); mi.position = -0x7FFFFFFF; mi.hIcolibItem = Skin_LoadIcon(SKINICON_OTHER_MIRANDA); mi.name.a = LPGEN("Remove Personal Settings..."); mi.pszService="RemovePersonalSettings/RemoveAll"; Menu_AddMainMenuItem(&mi); CreateServiceFunction(mi.pszService, RemoveAllService); // Get ini file name gMirandaDir[0] = '\0'; GetModuleFileNameA(GetModuleHandle(NULL),gMirandaDir,sizeof(gMirandaDir)); // Remove last name strTmp = strrchr(gMirandaDir,'\\'); if(strTmp != NULL) *strTmp = '\0'; // Set vars mir_strcat(gMirandaDir, "\\"); mir_strcpy(gIniFile, gMirandaDir); // Store last pos strTmp = &gIniFile[mir_strlen(gIniFile)]; // Lets try fist name mir_strcpy(strTmp, INI_FILE_NAME); if (_access(gIniFile, 4) != 0) { // Not found, lets try the other aproach mir_strcpy(strTmp, "plugins\\" INI_FILE_NAME); if (_access(gIniFile, 4) != 0) { // Not found :( gIniFile[0] = '\0'; } } return 0; }
int ModulesLoaded(WPARAM, LPARAM) { HookEvent(ME_USERINFO_INITIALISE, UserinfoInit); // add sounds support g_plugin.addSound("buddyExpectatorReturn", LPGENW("BuddyExpectator"), LPGENW("Contact returned")); g_plugin.addSound("buddyExpectatorStillAbsent", LPGENW("BuddyExpectator"), LPGENW("Contact still absent")); g_plugin.addSound("buddyExpectatorMissYou", LPGENW("BuddyExpectator"), LPGENW("Miss you event")); g_plugin.addSound("buddyExpectatorHide", LPGENW("BuddyExpectator"), LPGENW("Hide contact event")); timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded2); //////////////////////////////////////////////////////////////////////////// if (options.enableMissYou) { HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu); CMenuItem mi(g_plugin); SET_UID(mi, 0xc48c31d4, 0x56b6, 0x48c6, 0x8e, 0xe9, 0xe6, 0x57, 0xb5, 0x80, 0xb8, 0x1e); mi.flags = CMIF_UNICODE; mi.hIcolibItem = iconList[2].hIcolib; mi.position = 200000; mi.name.w = LPGENW("Enable Miss You"); mi.pszService = "BuddyExpectator/actionMissYouClick"; hContactMenu = Menu_AddContactMenuItem(&mi); } missyouactions[0].cbSize = sizeof(POPUPACTION); missyouactions[0].lchIcon = IcoLib_GetIcon("disabled_icon"); strncpy_s(missyouactions[0].lpzTitle, LPGEN("Disable Miss You"), _TRUNCATE); missyouactions[0].wParam = missyouactions[0].lParam = 1; hideactions[0].cbSize = sizeof(POPUPACTION); hideactions[0].lchIcon = IcoLib_GetIcon("hide_icon"); strncpy_s(hideactions[0].lpzTitle, LPGEN("Hide contact"), _TRUNCATE); hideactions[0].wParam = hideactions[0].lParam = 2; hideactions[1].cbSize = sizeof(POPUPACTION); hideactions[1].lchIcon = IcoLib_GetIcon("neverhide_icon"); strncpy_s(hideactions[1].lpzTitle, LPGEN("Never hide this contact"), _TRUNCATE); hideactions[1].wParam = hideactions[1].lParam = 3; return 0; }