int OnModulesLoaded(WPARAM,LPARAM) { if(ServiceExists(MS_UPDATE_REGISTER)) { Update upd = {sizeof(upd)}; char curr_version[30]; upd.szComponentName = pluginInfo.shortName; upd.szUpdateURL = UPDATER_AUTOREGISTER; upd.szBetaVersionURL = "http://twosx.net/mim/twitter/updater/version.html"; upd.szBetaChangelogURL = "http://twosx.net/mim/twitter/updater/changelog.html"; upd.pbBetaVersionPrefix = reinterpret_cast<BYTE*>("Twitter "); upd.cpbBetaVersionPrefix = strlen(reinterpret_cast<char*>(upd.pbBetaVersionPrefix)); #ifdef UNICODE upd.szBetaUpdateURL = "http://twosx.net/mim/twitter/updater/twitter.zip"; #else upd.szBetaUpdateURL = "http://www.teamboxel.com/update/twitter/ansi"; #endif upd.pbVersion = reinterpret_cast<BYTE*>( CreateVersionStringPlugin( reinterpret_cast<PLUGININFO*>(&pluginInfo),curr_version) ); upd.cpbVersion = strlen(reinterpret_cast<char*>(upd.pbVersion)); CallService(MS_UPDATE_REGISTER,0,(LPARAM)&upd); } return 0; }
// Called when all the modules are loaded int ModulesLoaded(WPARAM wParam, LPARAM lParam) { if (ServiceExists(MS_MC_GETPROTOCOLNAME)) metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0); // add our modules to the KnownModules list CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0); CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME "Groups", 0); // updater plugin support if (ServiceExists(MS_UPDATE_REGISTER)) { Update upd = { 0 }; char szCurrentVersion[30]; upd.cbSize = sizeof(upd); upd.szComponentName = pluginInfo.shortName; upd.szUpdateURL = UPDATER_AUTOREGISTER; upd.szBetaVersionURL = "http://pescuma.org/miranda/extraicons_version.txt"; upd.szBetaChangelogURL = "http://pescuma.org/miranda/extraicons#Changelog"; upd.pbBetaVersionPrefix = (BYTE *) "Extra Icons Service "; upd.cpbBetaVersionPrefix = strlen((char *) upd.pbBetaVersionPrefix); upd.szBetaUpdateURL = "http://pescuma.org/miranda/extraicons.zip"; upd.pbVersion = (BYTE *) CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion); upd.cpbVersion = strlen((char *) upd.pbVersion); CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd); } hHooks.push_back(HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged)); InitOptions(); return 0; }
// Called when all the modules are loaded int ModulesLoaded(WPARAM wParam, LPARAM lParam) { if (ServiceExists(MS_MC_GETPROTOCOLNAME)) metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0); // add our modules to the KnownModules list CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0); // updater plugin support if(ServiceExists(MS_UPDATE_REGISTER)) { Update upd = {0}; char szCurrentVersion[30]; upd.cbSize = sizeof(upd); upd.szComponentName = pluginInfo.shortName; upd.szUpdateURL = UPDATER_AUTOREGISTER; upd.szBetaVersionURL = "http://pescuma.mirandaim.ru/miranda/nickhistory_version.txt"; upd.szBetaChangelogURL = "http://pescuma.mirandaim.ru/miranda/nickhistory#Changelog"; upd.pbBetaVersionPrefix = (BYTE *)"Nick History "; upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix); #ifdef UNICODE upd.szBetaUpdateURL = "http://pescuma.mirandaim.ru/miranda/nickhistoryW.zip"; #else upd.szBetaUpdateURL = "http://pescuma.mirandaim.ru/miranda/nickhistory.zip"; #endif upd.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion); upd.cpbVersion = strlen((char *)upd.pbVersion); CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd); } loaded = TRUE; return 0; }
// Called when all the modules are loaded static INT_PTR ModulesLoaded(WPARAM wParam, LPARAM lParam) { // add our modules to the KnownModules list CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0); if (ServiceExists(MS_MC_GETPROTOCOLNAME)) metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0); // updater plugin support if(ServiceExists(MS_UPDATE_REGISTER)) { Update upd = {0}; char szCurrentVersion[30]; upd.cbSize = sizeof(upd); upd.szComponentName = pluginInfo.shortName; upd.szUpdateURL = UPDATER_AUTOREGISTER; upd.szBetaVersionURL = "http://pescuma.org/miranda/voiceservice_version.txt"; upd.szBetaChangelogURL = "http://pescuma.org/miranda/voiceservice#Changelog"; upd.pbBetaVersionPrefix = (BYTE *)"Voice Service "; upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix); #ifdef UNICODE upd.szBetaUpdateURL = "http://pescuma.org/miranda/voiceserviceW.zip"; #else upd.szBetaUpdateURL = "http://pescuma.org/miranda/voiceservice.zip"; #endif upd.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion); upd.cpbVersion = strlen((char *)upd.pbVersion); CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd); } // Init icons { IcoLib_Register(mainIcons[0], _T("Voice Calls"), _T("Main"), IDI_MAIN); IcoLib_Register(mainIcons[1], _T("Voice Calls"), _T("Dialpad"), IDI_DIALPAD); IcoLib_Register(mainIcons[2], _T("Voice Calls"), _T("Secure Overlay"), IDI_SECURE); int i; for(i = 0; i < MAX_REGS(stateNames); i++) IcoLib_Register(stateIcons[i], _T("Voice Calls"), stateNames[i], IDI_TALKING + i); for(i = 0; i < MAX_REGS(actionNames); i++) IcoLib_Register(actionIcons[i], _T("Voice Calls"), actionNames[i], IDI_ACTION_CALL + i); hHooks.push_back( HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged) ); } // Init fonts { FontIDT fi = {0}; fi.cbSize = sizeof(fi); lstrcpyn(fi.group, TranslateT("Voice Calls"), MAX_REGS(fi.group)); strncpy(fi.dbSettingsGroup, MODULE_NAME, MAX_REGS(fi.dbSettingsGroup)); for (int i = 0; i < NUM_FONTS; i++) { fi.order = i; lstrcpyn(fi.name, stateNames[i], MAX_REGS(fi.name)); strncpy(fi.prefix, stateIcons[i], MAX_REGS(fi.prefix)); CallService(MS_FONT_REGISTERT, (WPARAM) &fi, 0); } ReloadFont(0,0); hHooks.push_back( HookEvent(ME_FONT_RELOAD, ReloadFont) ); } // Init bkg color { ColourIDT ci = {0}; ci.cbSize = sizeof(ci); lstrcpyn(ci.group, TranslateT("Voice Calls"), MAX_REGS(ci.group)); lstrcpyn(ci.name, TranslateT("Background"), MAX_REGS(ci.name)); strncpy(ci.dbSettingsGroup, MODULE_NAME, MAX_REGS(ci.dbSettingsGroup)); strncpy(ci.setting, "BkgColor", MAX_REGS(ci.setting)); ci.defcolour = GetSysColor(COLOR_BTNFACE); CallService(MS_COLOUR_REGISTERT, (WPARAM) &ci, 0); ReloadColor(0,0); hHooks.push_back( HookEvent(ME_COLOUR_RELOAD, ReloadColor) ); } // Init history if (ServiceExists(MS_HISTORYEVENTS_REGISTER)) { char *templates[] = { "Talking\nCall from %number% has started\n%number%\tOther side of the call", "Ringing\nCall from %number% is ringing\n%number%\tOther side of the call", "Calling\nCalling %number%\n%number%\tOther side of the call", "On Hold\nCall from %number% is on hold\n%number%\tOther side of the call", "Ended\nCall from %number% has ended\n%number%\tOther side of the call", "Busy\n%number% is busy\n%number%\tOther side of the call", }; HISTORY_EVENT_HANDLER heh = {0}; heh.cbSize = sizeof(heh); heh.module = MODULE_NAME; heh.name = "VoiceCall"; heh.description = "Voice calls"; heh.eventType = EVENTTYPE_VOICE_CALL; heh.defaultIconName = "vca_call"; heh.supports = HISTORYEVENTS_FORMAT_TCHAR; heh.flags = HISTORYEVENTS_FLAG_SHOW_IM_SRMM | HISTORYEVENTS_FLAG_USE_SENT_FLAG | HISTORYEVENTS_REGISTERED_IN_ICOLIB; heh.templates = templates; heh.numTemplates = MAX_REGS(templates); CallService(MS_HISTORYEVENTS_REGISTER, (WPARAM) &heh, 0); } InitOptions(); InitFrames(); // Add menu items CLISTMENUITEM mi = {0}; mi.cbSize = sizeof(mi); mi.position = -2000020000; mi.flags = CMIF_TCHAR; HICON icons[MAX_REGS(actionIcons)]; for(int i = 0; i < MAX_REGS(actionIcons); ++i) icons[i] = IcoLib_LoadIcon(actionIcons[i]); CreateServiceFunction(MS_VOICESERVICE_CM_CALL, Service_Call); mi.ptszName = actionNames[ACTION_CALL]; mi.hIcon = icons[ACTION_CALL]; mi.pszService = MS_VOICESERVICE_CM_CALL; hCMCall = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi); CreateServiceFunction(MS_VOICESERVICE_CM_ANSWER, CMAnswer); mi.position++; mi.ptszName = actionNames[ACTION_ANSWER]; mi.hIcon = icons[ACTION_ANSWER]; mi.pszService = MS_VOICESERVICE_CM_ANSWER; hCMAnswer = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi); CreateServiceFunction(MS_VOICESERVICE_CM_HOLD, CMHold); mi.position++; mi.position++; mi.ptszName = actionNames[ACTION_HOLD]; mi.hIcon = icons[ACTION_HOLD]; mi.pszService = MS_VOICESERVICE_CM_HOLD; hCMHold = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi); CreateServiceFunction(MS_VOICESERVICE_CM_DROP, CMDrop); mi.position++; mi.ptszName = actionNames[ACTION_DROP]; mi.hIcon = icons[ACTION_DROP]; mi.pszService = MS_VOICESERVICE_CM_DROP; hCMDrop = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &mi); for(i = 0; i < MAX_REGS(actionIcons); ++i) IcoLib_ReleaseIcon(icons[i]); hHooks.push_back( HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PreBuildContactMenu) ); // Util services CreateServiceFunction(MS_VOICESERVICE_CALL, Service_Call); CreateServiceFunction(MS_VOICESERVICE_CAN_CALL, Service_CanCall); // Sounds SKINSOUNDDESCEX ssd = {0}; ssd.cbSize = sizeof(ssd); ssd.pszSection = "Voice Calls"; { for(int i = 0; i < MAX_REGS(sounds); ++i) { ssd.pszName = sounds[i].name; ssd.pszDescription = sounds[i].description; CallService(MS_SKIN_ADDNEWSOUND, 0, (LPARAM)&ssd); } } SetTimer(NULL, 0, 1000, ClearOldVoiceCalls); // Accounts int numAccounts; PROTOACCOUNT **accounts; ProtoEnumAccounts(&numAccounts, &accounts); for(i = 0; i < numAccounts; ++i) AddAccount(accounts[i]); hHooks.push_back( HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged) ); return 0; }
// Hook called after init static int MainInit(WPARAM wparam,LPARAM lparam) { if ( mir_skins_getInterface(&mski) != 0 ) { MessageBox(NULL, _T("MyDetails needs Skins plugin in order to work"), _T("MyDetails"), MB_OK | MB_ICONERROR); return 0; } if (CallService(MS_SKIN2_GETICON, 0, (LPARAM) "LISTENING_TO_ICON") == NULL) { SKINICONDESC sid = {0}; sid.cbSize = sizeof(SKINICONDESC); sid.ptszSection = "Contact List"; sid.ptszDescription = "Listening to"; sid.pszName = "LISTENING_TO_ICON"; sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LISTENINGTO)); CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); } { SKINICONDESC sid = {0}; sid.cbSize = sizeof(SKINICONDESC); sid.ptszSection = "My Details"; sid.ptszDescription = "Email"; sid.pszName = "MYDETAILS_EMAIL"; sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_EMAIL)); CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); } { SKINICONDESC sid = {0}; sid.cbSize = sizeof(SKINICONDESC); sid.ptszSection = "My Details"; sid.ptszDescription = "Previous protocol"; sid.pszName = "MYDETAILS_PREV_PROTOCOL"; sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_LEFT_ARROW)); CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); } { SKINICONDESC sid = {0}; sid.cbSize = sizeof(SKINICONDESC); sid.ptszSection = "My Details"; sid.ptszDescription = "Next protocol"; sid.pszName = "MYDETAILS_NEXT_PROTOCOL"; sid.hDefaultIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RIGHT_ARROW)); CallService(MS_SKIN2_ADDICON, 0, (LPARAM)&sid); } { ColourID cid = {0}; cid.cbSize = sizeof(ColourID); lstrcpynA(cid.group, "My Details", sizeof(cid.group)); lstrcpynA(cid.name, "Background", sizeof(cid.name)); lstrcpynA(cid.dbSettingsGroup, MODULE_NAME, sizeof(cid.dbSettingsGroup)); lstrcpynA(cid.setting, "BackgroundColor", sizeof(cid.setting)); cid.defcolour = GetSysColor(COLOR_BTNFACE); CallService(MS_COLOUR_REGISTER, (WPARAM) &cid, 0); ColorChanged(0,0); hColorChangedHook = HookEvent(ME_COLOUR_RELOAD, ColorChanged); } dialog = new SkinDialog("MyDetails", "My Details", MODULE_NAME); if (!dialog->isValid()) { MessageBox(NULL, _T("MyDetails could not create dialog. Check if default skin is installed"), _T("MyDetails"), MB_OK | MB_ICONERROR); return 0; } dialog->addImageField("avatar", "Avatar"); dialog->addTextField("nickname", "Nickname"); dialog->addTextField("protocol", "Protocol"); dialog->addIconField("email_icon", "Unread Email Count Icon"); dialog->addTextField("email", "Unread Email Count"); dialog->addIconField("status_icon", "Status Icon"); dialog->addTextField("status_name", "Status"); dialog->addTextField("status_msg", "Status Message"); dialog->addIconField("listening_icon", "Listening To Icon"); dialog->addTextField("listening", "Listening To"); dialog->addIconField("next_proto", "Next Protocol"); dialog->addIconField("prev_proto", "Previous Protocol"); dialog->setSkinChangedCallback(SkinChanged, NULL); dialog->finishedConfiguring(); InitProtocolData(); // Add options to menu CLISTMENUITEM mi; if (protocols->CanSetAvatars()) { ZeroMemory(&mi,sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; mi.pszPopupName = Translate("My Details"); mi.position = 100001; mi.pszName = Translate("Set My Avatar..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI; CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); } ZeroMemory(&mi,sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; mi.pszPopupName = Translate("My Details"); mi.position = 100002; mi.pszName = Translate("Set My Nickname..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI; CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); ZeroMemory(&mi,sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; mi.pszPopupName = Translate("My Details"); mi.position = 100003; mi.pszName = Translate("Set My Status Message..."); CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI); mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI; CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); // Set protocols to show frame ZeroMemory(&mi,sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = 0; mi.popupPosition = 500050000; mi.pszPopupName = Translate("My Details"); mi.position = 200001; mi.pszName = Translate("Show next protocol"); mi.pszService = MS_MYDETAILS_SHOWNEXTPROTOCOL; CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); InitFrames(); // updater plugin support if(ServiceExists(MS_UPDATE_REGISTER)) { Update upd = {0}; char szCurrentVersion[30]; upd.cbSize = sizeof(upd); upd.szComponentName = pluginInfo.shortName; upd.szUpdateURL = UPDATER_AUTOREGISTER; upd.szBetaVersionURL = "http://svn.berlios.de/svnroot/repos/mgoodies/trunk/mydetails/Docs/mydetails_version.txt"; upd.szBetaChangelogURL = "http://svn.berlios.de/svnroot/repos/mgoodies/trunk/mydetails/Docs/mydetails_changelog.txt"; upd.pbBetaVersionPrefix = (BYTE *)"My Details "; upd.cpbBetaVersionPrefix = strlen((char *)upd.pbBetaVersionPrefix); upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/mydetails.%VERSION%.zip"; upd.pbVersion = (BYTE *)CreateVersionStringPlugin((PLUGININFO*) &pluginInfo, szCurrentVersion); upd.cpbVersion = strlen((char *)upd.pbVersion); CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd); } return 0; }