Esempio n. 1
0
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
#if _MSC_VER >= 1300
	Log("%s", "Entering function " __FUNCTION__);
#endif
	pluginLink = link;
	mir_getLP(&pluginInfo);
	mir_getMMI(&mmi);
	
	Log("%s", "Creating service functions ...");
	InitServices();
	InitEvents();
	
#ifdef _DEBUG	
	hTestPlugin = CreateServiceFunction(MS_FOLDERS_TEST_PLUGIN, TestPlugin);
	CLISTMENUITEM mi = {0};
	
	mi.cbSize=sizeof(mi);
	mi.position=300050000;
	mi.flags=0;
	mi.hIcon=0;
	mi.pszName=Translate("Test folders");
	mi.pszService=MS_FOLDERS_TEST_PLUGIN;
	CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi);
#endif
#if _MSC_VER >= 1300
	Log("%s", "Hooking events ...");	
#endif
	HookEvents();
#if _MSC_VER >= 1300
	Log("%s", "Leaving function " __FUNCTION__);
#endif
	return 0;
}
Esempio n. 2
0
extern "C" int __declspec(dllexport) Load(void)
{
	mir_getLP(&pluginInfo);
	INITCOMMONCONTROLSEX icex;

	icex.dwSize = sizeof(icex);
	icex.dwICC = ICC_DATE_CLASSES;

	InitCommonControlsEx(&icex);

	if ((hUxTheme = LoadLibraryA("uxtheme.dll")) != 0)
		MyEnableThemeDialogTexture = (BOOL(WINAPI *)(HANDLE, DWORD))GetProcAddress(hUxTheme, "EnableThemeDialogTexture");

	/// all initialization here
	hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_HISTORYICON));
	hOpenWindowsList = WindowList_Create();

	InitServices();

	/// menu items
	CMenuItem mi;
	mi.name.t = LPGENT("View &history");
	mi.flags = CMIF_TCHAR;
	mi.position = 1000090000;
	mi.hIcolibItem = hIcon;
	mi.pszService = MS_HISTORY_SHOWCONTACTHISTORY;
	Menu_AddContactMenuItem(&mi);

	/// @todo (White-Tiger#1#08/19/14): fully implement System History someday^^
	mi.name.t = LPGENT("&System History");
	Menu_AddMainMenuItem(&mi);

	HookEvents();
	return 0;
}
Esempio n. 3
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);
	mir_getCLI();
	hmiranda = GetModuleHandle(NULL);

	INITCOMMONCONTROLSEX ctrls = {0};
	ctrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
	ctrls.dwICC = ICC_DATE_CLASSES;
	InitCommonControlsEx(&ctrls);

	hRichedDll = LoadLibrary(_T("Msftedit.dll"));
	if (!hRichedDll) {
		if (MessageBox(0, TranslateT("Miranda could not load the Notes & Reminders plugin, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), _T(SECTIONNAME), MB_YESNO | MB_ICONINFORMATION) != IDYES)
			return 1;
		return 0;
	}

	InitServices();
	WS_Init();

	hkModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
	InitIcons();

	return 0;
}
Esempio n. 4
0
int CMPlugin::Load()
{
	hiMailIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_MAIL));
	InitServices();
	HookEvents();
	return 0;
}
Esempio n. 5
0
extern "C" int __declspec(dllexport) Load(void) 
{
	mir_getLP(&pluginInfoEx);

	// initialize global variables
	InitVar();

	// load options and set defaults
	LoadOptions();

	// reset the weather data at startup for individual contacts
	EraseAllInfo();

	// load weather update data
	LoadWIData(true);

	// set status to online if "Do not display weather condition as protocol status" is enabled
	old_status = status = ID_STATUS_OFFLINE;

	// add an event on weather update and error
	hHookWeatherUpdated = CreateHookableEvent(ME_WEATHER_UPDATED);
	hHookWeatherError = CreateHookableEvent(ME_WEATHER_ERROR);

	// initialize options and network
	HookEvent(ME_OPT_INITIALISE, OptInit);
	HookEvent(ME_SYSTEM_MODULESLOADED, WeatherInit);
	HookEvent(ME_DB_CONTACT_DELETED, ContactDeleted);
	HookEvent(ME_CLIST_DOUBLECLICKED, BriefInfo);
	HookEvent(ME_WEATHER_UPDATED, WeatherPopup);
	HookEvent(ME_WEATHER_ERROR, WeatherError);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, WeatherShutdown);
	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, BuildContactMenu);

	hDataWindowList = WindowList_Create();
	hWindowList = WindowList_Create();

	hUpdateMutex = CreateMutex(NULL, FALSE, NULL);

	// register weather protocol
	PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
	pd.szName = WEATHERPROTONAME;
	pd.type = (opt.NoProtoCondition) ? PROTOTYPE_VIRTUAL : PROTOTYPE_PROTOCOL;
	CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);

	// initialize weather protocol services
	InitServices();

	// add sound event
	SkinAddNewSoundExT("weatherupdated", _T(WEATHERPROTONAME), LPGENT("Weather Condition Changed"));
	SkinAddNewSoundExT("weatheralert", _T(WEATHERPROTONAME), LPGENT("Weather Alert Issued"));

	// window needed for popup commands
	TCHAR SvcFunc[100];
	mir_sntprintf(SvcFunc, SIZEOF(SvcFunc), _T("%s__PopupWindow"), _T(WEATHERPROTONAME));
	hPopupWindow = CreateWindowEx(WS_EX_TOOLWINDOW, _T("static"), SvcFunc, 0, CW_USEDEFAULT, CW_USEDEFAULT,
		CW_USEDEFAULT, CW_USEDEFAULT, HWND_DESKTOP, NULL, hInst, NULL);
	SetWindowLongPtr(hPopupWindow, GWLP_WNDPROC, (LONG_PTR)PopupWndProc);
	return 0; 
}
Esempio n. 6
0
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfo);

	InitServices();
	InitEvents();
	InitOptions();
	return 0;
}
Esempio n. 7
0
extern "C" int __declspec(dllexport) Load()
{
	mir_getLP(&pluginInfo);
	mir_getCLI();

	currentCodePage = Langpack_GetDefaultCodePage();
	
	InitServices();
	
	HookEvents();
	
	return 0;
}
Esempio n. 8
0
extern "C" int __declspec(dllexport) Load()
{
//	Log("%s", "Entering function " __FUNCTION__);
	//pluginLink = link;
	mir_getLP( &pluginInfo );
//	Log("%s", "Initialising miranda memory functions");
//	InitializeMirandaMemFunctions();
	hiMailIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIL));
//	Log("%s", "Creating service functions ...");
	InitServices();
//	Log("%s", "Hooking events ...");	
	HookEvents();
	return 0;
}
Esempio n. 9
0
void InitMessagePump()
{
	WNDCLASS popup_win_class = { 0 };
	popup_win_class.lpfnWndProc = PopupWindowProc;
	popup_win_class.hInstance = hInst;
	popup_win_class.lpszClassName = POP_WIN_CLASS;
	popup_win_class.hCursor = LoadCursor(NULL, IDC_ARROW); 
	RegisterClass(&popup_win_class);

	InitServices();

	hMPEvent = CreateEvent(0, TRUE, 0, 0);
	CloseHandle(mir_forkthreadex(MessagePumpThread, hMPEvent, &message_pump_thread_id));
	WaitForSingleObject(hMPEvent, INFINITE);
	CloseHandle(hMPEvent);
}
Esempio n. 10
0
 virtual void OnAppStarted(Sandbox::Application* app) {
     m_app = app;
     ANativeActivity* activity = GetNativeActivity(m_app);
     if (activity) {
         // gpg-cpp: Set platform intiialization
         Sandbox::LogInfo() << "GPSExtension AndroidInitialization";
         gpg::AndroidInitialization::ANativeActivity_onCreate(activity,0,0);
         
         // Get the platform configuration.
         gpg::AndroidPlatformConfiguration platform_configuration;
         platform_configuration.SetActivity(activity->clazz);
         
         // Now, create the game service (see StateManager.cpp)
         // and pass in our callback
         InitServices(platform_configuration);
         
     } else {
         Sandbox::LogError() << "GPSExtension : not found activity";
     }
 }
Esempio n. 11
0
extern "C" int __declspec(dllexport) Load(void)
{
	mir_getLP(&pluginInfo);

	HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized);
	HookEvent(ME_SYSTEM_PRESHUTDOWN, &OnPreShutdown);
	
	InitServices();

	if (GetEnvironmentVariableW(L"TEMP", wszTempDir, MAX_PATH) != 0)
	{
		wcscat_s(wszTempDir, L"\\Miranda.Toaster");

		DWORD dwAttributes = GetFileAttributes(wszTempDir);
		if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
			CreateDirectoryTreeT(wszTempDir);
	}
	else
	{
		MessageBox(NULL, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR);
	}

	return 0;
}
Esempio n. 12
0
extern "C" __declspec(dllexport) int Load(PLUGINLINK *link)
{
	pluginLink = link;
	mir_getMMI(&mmi);
	mir_getLI(&li);
	mir_getMD5I(&md5i);
	mir_getUTFI(&utfi);
#else
extern "C" __declspec(dllexport) int Load(void)
{
	mir_getLP(&pluginInfoEx);

	InitServices();
#endif

	db_set_b(NULL, MODNAME, "NeedRestart", 0);

	DWORD dwLen = GetTempPath( SIZEOF(tszTempPath), tszTempPath);
	if (tszTempPath[dwLen-1] == '\\')
		tszTempPath[dwLen-1] = 0;

	LoadOptions();
	InitPopupList();
	InitNetlib();
	InitIcoLib();

	// Add cheking update menu item
	InitCheck();
	CLISTMENUITEM mi = { sizeof(mi) };
	mi.position = 400010000;
	mi.icolibItem = Skin_GetIconHandle("check_update");
	mi.pszName = LPGEN("Check for updates");
	mi.pszService = MODNAME"/CheckUpdates";
	Menu_AddMainMenuItem(&mi);

#if MIRANDA_VER >= 0x0A00
	InitListNew();

	mi.position++;
	mi.icolibItem = Skin_GetIconHandle("plg_list");
	mi.pszName = LPGEN("Available components list");
	mi.pszService = MODNAME"/ShowList";
	Menu_AddMainMenuItem(&mi);

	InitOptions();
#endif

	// Add hotkey
	HOTKEYDESC hkd = { sizeof(hkd) };
	hkd.pszName = "Check for updates";
	hkd.pszDescription = "Check for updates";
	hkd.pszSection = "Plugin Updater";
	hkd.pszService = MODNAME"/CheckUpdates";
	hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL;
	hkd.lParam = FALSE;
	Hotkey_Register(&hkd);

	InitEvents();

	//add sounds
	SkinAddNewSoundEx("updatecompleted",LPGEN("Plugin Updater"),LPGEN("Update completed"));
	SkinAddNewSoundEx("updatefailed",LPGEN("Plugin Updater"),LPGEN("Update failed"));
	return 0;
}
Esempio n. 13
0
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;
}