コード例 #1
0
int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
	char buffer[1024];
	Update update = {0};
	update.cbSize = sizeof(Update);
	update.szComponentName = __PLUGIN_DISPLAY_NAME;
	update.pbVersion = (BYTE *) CreateVersionString(VERSION, buffer);
	update.cpbVersion = (int)strlen((char *) update.pbVersion);
	update.szUpdateURL = UPDATER_AUTOREGISTER;
	update.szBetaVersionURL = FOLDERS_VERSION_URL;
	update.szBetaUpdateURL = FOLDERS_UPDATE_URL;
	update.pbBetaVersionPrefix = (BYTE *) FOLDERS_VERSION_PREFIX;
	update.cpbBetaVersionPrefix = (int)strlen(FOLDERS_VERSION_PREFIX);
	CallService(MS_UPDATE_REGISTER, 0, (LPARAM) &update);
	
	return 0;
}
コード例 #2
0
ファイル: tipper.cpp プロジェクト: TonyAlloa/miranda-dev
void InitUpdaterSupport()
{
#ifndef _WIN64
	if (ServiceExists(MS_UPDATE_REGISTER)) 
	{
		Update update = {0};
		char szVersion[16];

		update.cbSize = sizeof(Update);
		update.szComponentName = pluginInfoEx.shortName;
		update.pbVersion = (BYTE *)CreateVersionString(pluginInfoEx.version, szVersion);
		update.cpbVersion = (int)strlen((char *)update.pbVersion);
#ifdef _UNICODE
		update.szUpdateURL = "http://miranda-easy.net/addons/updater/tipper-ym.zip";
#else
		update.szUpdateURL = "http://miranda-easy.net/addons/updater/tipper-ym_ansi.zip";
#endif
		update.szVersionURL = "http://miranda-easy.net/addons/updater/tipper_version.txt";
		update.pbVersionPrefix = (BYTE *)"Tipper YM ";
		update.cpbVersionPrefix = (int)strlen((char *)update.pbVersionPrefix);
		CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
	}
#endif
}
コード例 #3
0
ファイル: sametime.cpp プロジェクト: MrtsComputers/miranda-ng
int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {

	// register with chat module

	GCREGISTER gcr = {0};
	gcr.cbSize = sizeof(gcr);
	gcr.pszModule = PROTO;
	gcr.pszModuleDispName = Translate(PROTO);
	gcr.dwFlags = GC_TCHAR;
	int ret = CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr);
	if(ret == GC_REGISTER_NOUNICODE) {
		gcr.dwFlags = 0;
		ret = CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr);
		if(ret) 
			MessageBox(0, TranslateT("You must install chat.dll to enable group chat."), TranslateT("Sametime Error"), MB_OK);
	} else {
		if(ret)
			MessageBox(0, TranslateT("You must install chat.dll to enable group chat."), TranslateT("Sametime Error"), MB_OK);
		else {
			//MessageBox(0, _T("Unicode chat"), _T("msg"), MB_OK);
			unicode_chat = true;
		}
	}
	//int ret = CallService(MS_GC_REGISTER, 0, (LPARAM)(GCREGISTER *) &gcr);
	//if(ret) MessageBox(0, TranslateT("You must install chat.dll to enable group chat."), TranslateT("Sametime Error"), MB_OK);
	
	if(ServiceExists(MS_UPDATE_REGISTER)) {
		// register with updater
		Update update = {0};
		char szVersion[16];

		update.cbSize = sizeof(Update);

		update.szComponentName = pluginInfo.shortName;
		update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
		update.cpbVersion = strlen((char *)update.pbVersion);

		// these are the three lines that matter - the archive, the page containing the version string, and the text (or data) 
		// before the version that we use to locate it on the page
		// (note that if the update URL and the version URL point to standard file listing entries, the backend xml
		// data will be used to check for updates rather than the actual web page - this is not true for beta urls)
		update.szBetaUpdateURL = "http://sje.twosx.net/sametime.zip";
		update.szBetaVersionURL = "http://sje.twosx.net/ver_sametime.html";
		update.pbBetaVersionPrefix = (BYTE *)"Sametime Protocol version ";
		
		update.cpbBetaVersionPrefix = strlen((char *)update.pbBetaVersionPrefix);

		CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
	}

	NETLIBUSER nl_user = {0};
	nl_user.cbSize = sizeof(nl_user);
	nl_user.szSettingsModule = PROTO;
	//nl_user.flags = NUF_OUTGOING | (http_proxying_enabled ? NUF_HTTPCONNS : 0);
	nl_user.flags = NUF_OUTGOING | NUF_HTTPCONNS;
	nl_user.szDescriptiveName = PROTO;

	hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
	
	hWindowEventHook = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent);

	hIdleEventHook = HookEvent(ME_IDLE_CHANGED, IdleChanged);

	// funny logic :) ... try to avoid message boxes
	// if want baloons but no balloons, try popups
	// if want popups but no popups, try baloons
	// if, after that, you want balloons but no balloons, revert to message boxes
	if(options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_POP; 
	if(options.err_method == ED_POP && !ServiceExists(MS_POPUP_SHOWMESSAGE)) options.err_method = ED_BAL;
	if(options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_MB;

	InitSessionMenu();
	InitConferenceMenu();

	return 0;
}
コード例 #4
0
int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
	hIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
	hExtraIconListRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnExtraIconListRebuild);
	hExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraImageApply);
	hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
	hTopToolBarModuleLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
	//hContactSendMessage = HookEvent(ME_WWI_SENDMESSAGE, OnContactSendMessage);
	
	SkinAddNewSoundEx(BIRTHDAY_NEAR_SOUND, "WhenWasIt", "Birthday near");
	SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, "WhenWasIt", "Birthday today");
	
	RebuildAdvIconList();
	
	char buffer[1024];
	Update update = {0};
	update.cbSize = sizeof(Update);
	update.szComponentName = __PLUGIN_DISPLAY_NAME;
	update.pbVersion = (BYTE *) CreateVersionString(VERSION, buffer);
	update.cpbVersion = (int) strlen((char *) update.pbVersion);
	update.szUpdateURL = UPDATER_AUTOREGISTER;
	update.szBetaVersionURL = WHENWASIT_VERSION_URL;
	update.szBetaUpdateURL = WHENWASIT_UPDATE_URL;
	update.pbBetaVersionPrefix = (BYTE *) WHENWASIT_VERSION_PREFIX;
	update.cpbBetaVersionPrefix = (int) strlen(WHENWASIT_VERSION_PREFIX);
	CallService(MS_UPDATE_REGISTER, 0, (LPARAM) &update);

	UpdateTimers();
	CLISTMENUITEM cl = {0};
	cl.cbSize = sizeof(CLISTMENUITEM);
	cl.hIcon = hiCheckMenu;
	cl.position = 10000000;
	cl.pszService = MS_WWI_CHECK_BIRTHDAYS;
	cl.pszName = "Check for birthdays";
	cl.pszPopupName = "Birthdays (When Was It)";
	hmCheckBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
	
	cl.pszService = MS_WWI_LIST_SHOW;
	cl.pszName = "Birthday list";
	cl.hIcon = hiListMenu;
	hmBirthdayList = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
	
	cl.pszService = MS_WWI_REFRESH_USERDETAILS;
	cl.position = 10100000;
	cl.pszName = "Refresh user details";
	cl.hIcon = hiRefreshUserDetails;
	hmRefreshDetails = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
	
	cl.pszService = MS_WWI_IMPORT_BIRTHDAYS;
	cl.position = 10200000;
	cl.pszName = "Import birthdays";
	cl.hIcon = hiImportBirthdays;
	hmImportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
	
	cl.pszService = MS_WWI_EXPORT_BIRTHDAYS;
	cl.pszName = "Export birthdays";
	cl.hIcon = hiExportBirthdays;
	hmExportBirthdays = (HANDLE) CallService(MS_CLIST_ADDMAINMENUITEM, 0, (LPARAM) &cl);
	
	cl.pszService = MS_WWI_ADD_BIRTHDAY;
	cl.position = 10000000;
	cl.hIcon = hiAddBirthdayContact;
	cl.pszName = "Add/change user &birthday";
	hmAddChangeBirthday = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) &cl);

	if(ServiceExists(MS_HOTKEY_REGISTER))
	{
		HOTKEYDESC hotkey = {0};
		hotkey.cbSize = sizeof(hotkey);
		hotkey.dwFlags = HKD_TCHAR;
		hotkey.ptszSection = LPGENT("Birthdays");

		hotkey.pszName = "wwi_birthday_list";
		hotkey.ptszDescription = LPGENT("Birthday list");
		hotkey.pszService = MS_WWI_LIST_SHOW;
		CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey);
		
		hotkey.pszName = "wwi_check_birthdays";
		hotkey.ptszDescription = LPGENT("Check for birthdays");
		hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS;
		CallService(MS_HOTKEY_REGISTER,0,(LPARAM)&hotkey);
	}
	
	return 0;
}
コード例 #5
0
ファイル: popups2.cpp プロジェクト: TonyAlloa/miranda-dev
int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
	MNotifyGetLink();

	if (ServiceExists(MS_HPP_EG_WINDOW))
	{
		lstPopupHistory.SetRenderer(RENDER_HISTORYPP);
	}

	if(ServiceExists(MS_UPDATE_REGISTER)) {
		// register with updater
		Update update = {0};
		char szVersion[16];

		update.cbSize = sizeof(Update);

		update.szComponentName = pluginInfo.shortName;
		update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
		update.cpbVersion = (int)strlen((char *)update.pbVersion);
		update.szBetaChangelogURL = "https://server.scottellis.com.au/wsvn/mim_plugs/yapp/?op=log&rev=0&sc=0&isdir=1";

		update.szUpdateURL = UPDATER_AUTOREGISTER;
		
		// these are the three lines that matter - the archive, the page containing the version string, and the text (or data) 
		// before the version that we use to locate it on the page
		// (note that if the update URL and the version URL point to standard file listing entries, the backend xml
		// data will be used to check for updates rather than the actual web page - this is not true for beta urls)
#ifdef _WIN64
		update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/yapp_x64.zip";
#endif
		update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_yapp.html";
		update.pbBetaVersionPrefix = (BYTE *)"YAPP version ";
		
		update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);

		CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
	}

#ifdef _UNICODE
	if(ServiceExists(MS_FONT_REGISTERW)) 
	{
		font_id_firstlinew.cbSize = sizeof(FontIDW);
		font_id_firstlinew.flags = FIDF_ALLOWEFFECTS;
		_tcscpy(font_id_firstlinew.group, _T("Popups"));
		_tcscpy(font_id_firstlinew.name, _T("First line"));
		strcpy(font_id_firstlinew.dbSettingsGroup, MODULE);
		strcpy(font_id_firstlinew.prefix, "FontFirst");
		font_id_firstlinew.order = 0;

		font_id_secondlinew.cbSize = sizeof(FontIDW);
		font_id_secondlinew.flags = FIDF_ALLOWEFFECTS;
		_tcscpy(font_id_secondlinew.group, _T("Popups"));
		_tcscpy(font_id_secondlinew.name, _T("Second line"));
		strcpy(font_id_secondlinew.dbSettingsGroup, MODULE);
		strcpy(font_id_secondlinew.prefix, "FontSecond");
		font_id_secondlinew.order = 1;

		font_id_timew.cbSize = sizeof(FontIDW);
		font_id_timew.flags = FIDF_ALLOWEFFECTS;
		_tcscpy(font_id_timew.group, _T("Popups"));
		_tcscpy(font_id_timew.name, _T("Time"));
		strcpy(font_id_timew.dbSettingsGroup, MODULE);
		strcpy(font_id_timew.prefix, "FontTime");
		font_id_timew.order = 2;

		CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_firstlinew, 0);
		CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_secondlinew, 0);
		CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_timew, 0);
		
		colour_id_bgw.cbSize = sizeof(ColourIDW);
		_tcscpy(colour_id_bgw.group, _T("Popups"));
		_tcscpy(colour_id_bgw.name, _T("Background"));
		strcpy(colour_id_bgw.dbSettingsGroup, MODULE);
		strcpy(colour_id_bgw.setting, "ColourBg");
		colour_id_bgw.defcolour = GetSysColor(COLOR_3DSHADOW);
		colour_id_bgw.order = 0;

		colour_id_borderw.cbSize = sizeof(ColourIDW);
		_tcscpy(colour_id_borderw.group, _T("Popups"));
		_tcscpy(colour_id_borderw.name, _T("Border"));
		strcpy(colour_id_borderw.dbSettingsGroup, MODULE);
		strcpy(colour_id_borderw.setting, "ColourBorder");
		colour_id_borderw.defcolour = RGB(0, 0, 0);
		colour_id_borderw.order = 1;

		colour_id_sidebarw.cbSize = sizeof(ColourIDW);
		_tcscpy(colour_id_sidebarw.group, _T("Popups"));
		_tcscpy(colour_id_sidebarw.name, _T("Sidebar"));
		strcpy(colour_id_sidebarw.dbSettingsGroup, MODULE);
		strcpy(colour_id_sidebarw.setting, "ColourSidebar");
		colour_id_sidebarw.defcolour = RGB(128, 128, 128);
		colour_id_sidebarw.order = 2;

		colour_id_titleunderlinew.cbSize = sizeof(ColourIDW);
		_tcscpy(colour_id_titleunderlinew.group, _T("Popups"));
		_tcscpy(colour_id_titleunderlinew.name, _T("Title underline"));
		strcpy(colour_id_titleunderlinew.dbSettingsGroup, MODULE);
		strcpy(colour_id_titleunderlinew.setting, "ColourTitleUnderline");
		colour_id_titleunderlinew.defcolour = GetSysColor(COLOR_3DSHADOW);
		colour_id_titleunderlinew.order = 3;

		CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_bgw, 0);
		CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_borderw, 0);
		CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_sidebarw, 0);
		CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_titleunderlinew, 0);
		
		ReloadFont(0, 0);

		hEventReloadFont = HookEvent(ME_FONT_RELOAD, ReloadFont);
	} 
	else 
#endif
		if(ServiceExists(MS_FONT_REGISTER)) 
	{
		font_id_firstline.cbSize = sizeof(FontID);
		font_id_firstline.flags = FIDF_ALLOWEFFECTS;
		strcpy(font_id_firstline.group, "Popups");
		strcpy(font_id_firstline.name, "First line");
		strcpy(font_id_firstline.dbSettingsGroup, MODULE);
		strcpy(font_id_firstline.prefix, "FontFirst");
		font_id_firstline.order = 0;

		font_id_secondline.cbSize = sizeof(FontID);
		font_id_secondline.flags = FIDF_ALLOWEFFECTS;
		strcpy(font_id_secondline.group, "Popups");
		strcpy(font_id_secondline.name, "Second line");
		strcpy(font_id_secondline.dbSettingsGroup, MODULE);
		strcpy(font_id_secondline.prefix, "FontSecond");
		font_id_secondline.order = 1;

		font_id_time.cbSize = sizeof(FontID);
		font_id_time.flags = FIDF_ALLOWEFFECTS;
		strcpy(font_id_time.group, "Popups");
		strcpy(font_id_time.name, "Time");
		strcpy(font_id_time.dbSettingsGroup, MODULE);
		strcpy(font_id_time.prefix, "FontTime");
		font_id_time.order = 2;

		CallService(MS_FONT_REGISTER, (WPARAM)&font_id_firstline, 0);
		CallService(MS_FONT_REGISTER, (WPARAM)&font_id_secondline, 0);
		CallService(MS_FONT_REGISTER, (WPARAM)&font_id_time, 0);
		
		colour_id_bg.cbSize = sizeof(ColourID);
		strcpy(colour_id_bg.group, "Popups");
		strcpy(colour_id_bg.name, "Background");
		strcpy(colour_id_bg.dbSettingsGroup, MODULE);
		strcpy(colour_id_bg.setting, "ColourBg");
		colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW);
		colour_id_bg.order = 0;

		colour_id_border.cbSize = sizeof(ColourID);
		strcpy(colour_id_border.group, "Popups");
		strcpy(colour_id_border.name, "Border");
		strcpy(colour_id_border.dbSettingsGroup, MODULE);
		strcpy(colour_id_border.setting, "ColourBorder");
		colour_id_border.defcolour = RGB(0, 0, 0);
		colour_id_border.order = 1;

		colour_id_sidebar.cbSize = sizeof(ColourID);
		strcpy(colour_id_sidebar.group, "Popups");
		strcpy(colour_id_sidebar.name, "Sidebar");
		strcpy(colour_id_sidebar.dbSettingsGroup, MODULE);
		strcpy(colour_id_sidebar.setting, "ColourSidebar");
		colour_id_sidebar.defcolour = RGB(128, 128, 128);
		colour_id_sidebar.order = 2;

		colour_id_titleunderline.cbSize = sizeof(ColourID);
		strcpy(colour_id_titleunderline.group, "Popups");
		strcpy(colour_id_titleunderline.name, "Title underline");
		strcpy(colour_id_titleunderline.dbSettingsGroup, MODULE);
		strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline");
		colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW);
		colour_id_titleunderline.order = 3;

		CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_bg, 0);
		CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_border, 0);
		CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_sidebar, 0);
		CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_titleunderline, 0);
		
		ReloadFont(0, 0);

		hEventReloadFont = HookEvent(ME_FONT_RELOAD, ReloadFont);
	} else {
		LOGFONT lf = {0};
		lf.lfCharSet = DEFAULT_CHARSET;
		lf.lfHeight = -14;
		lf.lfWeight = FW_BOLD;
		hFontFirstLine = CreateFontIndirect(&lf);

		lf.lfHeight = -12;
		lf.lfWeight = 0;
		hFontSecondLine = CreateFontIndirect(&lf);

		lf.lfHeight = -8;
		lf.lfWeight = 0;
		hFontTime = CreateFontIndirect(&lf);
	}
	
	LoadModuleDependentOptions(); 

	if(GetModuleHandle(_T("neweventnotify")))
	{
		ignore_gpd_passed_addy = true;
	}

	return 0;
}
コード例 #6
0
ファイル: init.cpp プロジェクト: TonyAlloa/miranda-dev
/**
 * This function is called by Miranda just after loading all system modules.
 *
 * @param	wParam	- not used
 * @param	lParam	- not used
 *
 * @return	always 0
 **/
static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam) 
{
#ifdef _DEBUG
	#define new DEBUG_NEW;
	int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
	tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
	_CrtSetDbgFlag(tmpFlag);
//	_CrtSetBreakAlloc(4852);
#endif
	INT_PTR ptr;

	UnhookEvent(ghModulesLoadedHook);

	myGlobals.HaveCListExtraIcons		= ServiceExists(MS_CLIST_EXTRA_SET_ICON);
	myGlobals.ExtraIconsServiceExist	= ServiceExists(MS_EXTRAICON_REGISTER);
	myGlobals.PopUpActionsExist			= ServiceExists(MS_POPUP_REGISTERACTIONS);
	myGlobals.MsgAddIconExist			= ServiceExists(MS_MSG_ADDICON);

	// init meta contacts
	ptr = CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
	myGlobals.szMetaProto = (ptr != CALLSERVICE_NOTFOUND) ? (LPCSTR)ptr : NULL;

	// options
	OptionsLoadModule();
	// create services to receive string lists of languages and timezones
	SvcConstantsLoadModule();
	// load module to remind user about birthday and a anniversary
	SvcReminderOnModulesLoaded();
	// load extended intagration services
	SvcEMailOnModulesLoaded();
	SvcHomepageLoadModule();
	SvcPhoneLoadModule();
	SvcGenderLoadModule();
	SvcFlagsOnModulesLoaded();

#ifdef _DEBUG // new feature, not in release jet
	NServices::NAvatar::OnModulesLoaded();
#endif
	
	// build contact's menuitems
	RebuildMenu();
	ghPrebuildStatusMenu = HookEvent( ME_CLIST_PREBUILDSTATUSMENU, (MIRANDAHOOK)RebuildAccount);

	// finally register for updater
	if (ServiceExists(MS_UPDATE_REGISTER)) 
	{
		Update update = {0};
		CHAR szVersion[16];
		update.cbSize			= sizeof(Update);
		update.szComponentName	= pluginInfo.shortName;
		update.pbVersion		= (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
		update.cpbVersion		= (INT)strlen((LPSTR)update.pbVersion);

		update.szUpdateURL		= UPDATER_AUTOREGISTER;
		
		update.szBetaVersionURL		= "http://userinfoex.googlecode.com/svn/trunk/changelog.txt";
		// bytes occuring in VersionURL before the version, used to locate the version information within the URL data
		// e.g. change '[0.8.1.0 (in work)]' to 'UserinfoEx: 0.8.1.0' for beta versions bump
		update.pbBetaVersionPrefix	= (BYTE *)"UserinfoEx: ";
		update.cpbBetaVersionPrefix	= (INT)strlen((LPSTR)update.pbBetaVersionPrefix);

#ifdef _WIN64
 #ifdef _UNICODE
		update.szBetaUpdateURL		= "http://userinfoex.googlecode.com/files/uinfoex64.zip";
 #endif
#else
 #ifdef _UNICODE
		update.szBetaUpdateURL		= "http://userinfoex.googlecode.com/files/uinfoexW.zip";
 #else
		update.szBetaUpdateURL		= "http://userinfoex.googlecode.com/files/uinfoex.zip";
 #endif
#endif

		// url for displaying changelog for beta versions
		update.szBetaChangelogURL	 = "http://userinfoex.googlecode.com/svn/trunk/changelog.txt";

		CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
	}
	// install known modules strings to database
	DB::Setting::WriteAString(NULL, "KnownModules", MODULELONGNAME, USERINFO","MODNAME","MOD_MBIRTHDAY","MODNAMEFLAGS);

	return 0;
}
コード例 #7
0
ファイル: services.cpp プロジェクト: TonyAlloa/miranda-dev
bool RegisterForFileListing(int file_id, const char *fl_name, DWORD version, bool auto_register, const Category cat) 
{
	// allow multiple registration of same plugin only if new plugin not automatically registered
	// if multiple registration of an auto registered plugin occurs, use newest file id and version
	EnterCriticalSection(&list_cs);
	int i = FindFileInList(fl_name);
	if (i >= 0 && !auto_register)
		update_list.remove(i);
	else if (i >= 0)
	{
		if (update_list[i].auto_register) 
		{
			update_list[i].file_id = file_id;		// in case plugin file id changes (i.e. scan from xml data will overwrite settings read from db on startup)
			char version_str[16];
			update_list[i].update.pbVersion = (BYTE *)safe_strdup(CreateVersionString(version, version_str));
			update_list[i].update.cpbVersion = (int)strlen(version_str);
		}
		LeaveCriticalSection(&list_cs);
		
		// plugin already registered - set file id if AUTOREGISTER
		if (update_list[i].update.szUpdateURL && strcmp(update_list[i].update.szUpdateURL, UPDATER_AUTOREGISTER) == 0) 
		{
			update_list[i].file_id = file_id;
			char *buff = (char *)safe_alloc(strlen(MIM_DOWNLOAD_URL_PREFIX) + 9);
			sprintf(buff, MIM_DOWNLOAD_URL_PREFIX "%d", file_id);
			update_list[i].update.szUpdateURL = buff;
			update_list[i].shortName = safe_strdup(update_list[i].update.szComponentName);

			if(update_list[i].update.szBetaVersionURL)
			{
				update_list[i].update_options.fixed = false;
				LoadUpdateOptions(update_list[i].update.szComponentName, &update_list[i].update_options);
			}
		}
		return false;
	}
	LeaveCriticalSection(&list_cs);

	UpdateInternal update_internal = {0};
	char version_str[16];
	char *buff;

	update_internal.cat = cat;
	update_internal.shortName = safe_strdup(fl_name);

	update_internal.update.szComponentName = safe_strdup(fl_name);
	update_internal.update.pbVersion = (BYTE *)safe_strdup(CreateVersionString(version, version_str));
	update_internal.update.cpbVersion = (int)strlen(version_str);

	buff = (char *)safe_alloc(strlen(MIM_DOWNLOAD_URL_PREFIX) + 9);
	sprintf(buff, MIM_DOWNLOAD_URL_PREFIX "%d", file_id);
	update_internal.update.szUpdateURL = buff;

	///////// only used when not using the xml backend ////////////	
	buff = (char *)safe_alloc(strlen("class=\"fileNameHeader\">") + strlen(fl_name) + 2);
	sprintf(buff, "class=\"fileNameHeader\">%s ", fl_name);
	update_internal.update.pbVersionPrefix = (BYTE *)buff;
	update_internal.update.cpbVersionPrefix = (int)strlen(buff);

	buff = (char *)safe_alloc(strlen(MIM_VIEW_URL_PREFIX) + 9);
	sprintf(buff, MIM_VIEW_URL_PREFIX "%d", file_id);
	update_internal.update.szVersionURL = buff;
	///////////////////////////////////////////////////////////////

	// same as register, except for fileID
	update_internal.file_id = file_id;
	update_internal.auto_register = auto_register;
	update_internal.update_options.fixed = true;
	update_internal.update_options.use_beta = false;

	LoadUpdateOptions(update_internal.update.szComponentName, &update_internal.update_options);

	EnterCriticalSection(&list_cs);
	update_list.insert(new UpdateInternal(update_internal));
	LeaveCriticalSection(&list_cs);

	return true;
}
コード例 #8
0
int OnModulesLoaded(WPARAM wParam, LPARAM lParam) {
	if(ServiceExists(MS_UPDATE_REGISTER)) {
		// register with updater
		Update update = {0};
		char szVersion[16];

		update.cbSize = sizeof(Update);

		update.szComponentName = pluginInfo.shortName;
		update.pbVersion = (BYTE *)CreateVersionString(pluginInfo.version, szVersion);
		update.cpbVersion = (int)strlen((char *)update.pbVersion);
		update.szBetaChangelogURL = "https://server.scottellis.com.au/wsvn/mim_plugs/ping/?op=log&rev=0&sc=0&isdir=1";

		update.szUpdateURL = UPDATER_AUTOREGISTER;
		
		// these are the three lines that matter - the archive, the page containing the version string, and the text (or data) 
		// before the version that we use to locate it on the page
		// (note that if the update URL and the version URL point to standard file listing entries, the backend xml
		// data will be used to check for updates rather than the actual web page - this is not true for beta urls)
		update.szBetaUpdateURL = "http://www.scottellis.com.au/miranda_plugins/ping.zip";
		update.szBetaVersionURL = "http://www.scottellis.com.au/miranda_plugins/ver_ping.html";
		update.pbBetaVersionPrefix = (BYTE *)"Ping version ";
		
		update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);

		CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
	}



	NETLIBUSER nl_user = {0};
	nl_user.cbSize = sizeof(nl_user);
	nl_user.szSettingsModule = PLUG;
	//nl_user.flags = NUF_OUTGOING | NUF_HTTPGATEWAY | NUF_NOOPTIONS;
	//nl_user.flags = NUF_OUTGOING | NUF_NOOPTIONS;
	nl_user.flags = NUF_OUTGOING | NUF_HTTPCONNS;
	nl_user.szDescriptiveName = "Ping Plugin";
	nl_user.szHttpGatewayHello = 0;
	nl_user.szHttpGatewayUserAgent = 0;
	nl_user.pfnHttpGatewayInit = 0;
	nl_user.pfnHttpGatewayWrapSend = 0;
	nl_user.pfnHttpGatewayUnwrapRecv = 0;

	hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);

	InitUtils();

	InitMenus();
	
	hFillListEvent = HookEvent(PLUG "/ListReload", FillList);

	if(!DBGetContactSettingByte(0, PLUG, "PingPlugImport", 0)) {
		if(DBGetContactSettingDword(0, "PingPlug", "NumEntries", 0)) {
			import_ping_addresses();
			DBWriteContactSettingByte(0, PLUG, "PingPlugImport", 1);
		}
	}

	InitList();

	CallService(PLUG "/LoadPingList", 0, 0);	
	
	graphs_init();

	if(options.logging) CallService(PLUG "/Log", (WPARAM)"start", 0);

	return 0;
}
コード例 #9
0
char *CheckVersionURL(char *url, BYTE *pbPrefixBytes, int cpbPrefixBytes, BYTE *pbVersionBytes, int cpbVersionBytes)
{
	if (url == 0 || pbPrefixBytes == 0 || cpbPrefixBytes == 0 || pbVersionBytes == 0 || cpbVersionBytes == 0)
		return 0;

	char *ret = NULL;
	NETLIBHTTPREQUEST req = {0};

	req.cbSize = sizeof(req);
	req.requestType = REQUEST_GET;
	req.szUrl = url;
	req.flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
	req.nlc = hNetlibHttp;

	if (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= PLUGIN_MAKE_VERSION(0,9,0,5))
		req.flags |= NLHRF_PERSISTENT | NLHRF_REDIRECT;

	NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, 
		(WPARAM)hNetlibUser, (LPARAM)&req);

	if (resp) 
	{
		hNetlibHttp = resp->nlc;
		if (resp->resultCode == 200) 
		{
			// find the location of the prefix
			char* ver = (char*)memmem(resp->pData, resp->dataLength, pbPrefixBytes, cpbPrefixBytes);
			if (ver)
			{
				int len = resp->dataLength - ((ver += cpbPrefixBytes) - resp->pData);
				if (cpbVersionBytes <= len && memcmp(ver, pbVersionBytes, cpbVersionBytes) == 0)
				{
					// same version as current
					CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
					return 0;
				} 
				else 
				{
					DWORD ver_current, ver_potential;
					char *buff = (char *)alloca(cpbVersionBytes + 1);
					memcpy(buff, (char *)pbVersionBytes, cpbVersionBytes);
					buff[cpbVersionBytes] = 0;

					// this is safe because pData finishes with a zero always (according to m_netlib.h docs)
					if (VersionFromString(buff, &ver_current) && VersionFromString(ver, &ver_potential)) 
					{
						switch(options.ver_req) 
						{
						case VR_MAJOR:
							ver_current &= 0xFF000000;
							ver_potential &= 0xFF000000;
							break;
						case VR_MINOR:
							ver_current &= 0xFFFF0000;
							ver_potential &= 0xFFFF0000;
							break;
						case VR_RELEASE:
							ver_current &= 0xFFFFFF00;
							ver_potential &= 0xFFFFFF00;
							break;
						case VR_BUILD:
							break;
						}

						// we can covert the versions to DWORDS, so compare...
						if (ver_current < ver_potential) 
						{
							char buff2[16];
							CreateVersionString(ver_potential, buff2);
							ret = _strdup(buff2);
						} 
					} 
					else  // invalid version(s), but different from current - assume it's an update
						ret = _strdup(Translate("Yes"));
				}
			}
		} 
		else if (resp->resultCode == 302) // redirect
		{
			// get new location
			for (int i = 0; i < resp->headersCount; i++) 
			{
				if(_stricmp(resp->headers[i].szName, "Location") == 0) 
				{
					ret = CheckVersionURL(resp->headers[i].szValue, pbPrefixBytes, cpbPrefixBytes, pbVersionBytes, cpbVersionBytes);
					break;
				}
			}
		} 
		else 
			NLogF("CheckVersionURL: error, http result code %d", resp->resultCode);

		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
	} 
	else 
	{
		hNetlibHttp = NULL;
		int err = GetLastError();
		if (err) 
			NLogF("CheckVersionURL: error code %d", err);
	}

	return ret;
}