int NewsAggrInit(WPARAM wParam, LPARAM lParam) { hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER)); if (hNewsAggregatorFolder) FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T("")); else lstrcpyn(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot)); for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1)) db_set_dw(hContact, MODULE, "LastCheck", time(NULL)); SetContactStatus(hContact, ID_STATUS_ONLINE); } NetlibInit(); InitIcons(); InitMenu(); HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded); HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged); // timer for the first update timerId = SetTimer(NULL, 0, 10000, timerProc2); // first update is 10 sec after load return 0; }
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; }
// weather protocol initialization function // run after the event ME_SYSTEM_MODULESLOADED occurs int WeatherInit(WPARAM, LPARAM) { // initialize netlib NetlibInit(); InitMwin(); // load weather menu items AddMenuItems(); // timer for the first update timerId = SetTimer(NULL, 0, 5000, timerProc2); // first update is 5 sec after load // weather user detail HookEvent(ME_USERINFO_INITIALISE, UserInfoInit); HookEvent(ME_TTB_MODULELOADED, OnToolbarLoaded); return 0; }