static int ModulesLoaded(WPARAM wParam, LPARAM lParam)
{
	mir_sntprintf(basedir, MAX_REGS(basedir), _T("%s\\Avatars History"), profilePath);

	hFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("Avatar History"), 
		PROFILE_PATHT _T("\\") CURRENT_PROFILET _T("\\Avatars History"));
	InitPopups();

	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://code.google.com/p/pescuma/downloads/list?q=label:Plugin-AVH";
		upd.szBetaChangelogURL = "http://code.google.com/p/pescuma/source/list";
#ifdef _WIN64
		upd.pbBetaVersionPrefix = (BYTE *) "Avatar History (x64) ";
		upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/avatarhistW.%VERSION%-x64.zip";
#elif _UNICODE
		upd.pbBetaVersionPrefix = (BYTE *) "Avatar History (Unicode) ";
		upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/avatarhistW.%VERSION%.zip";
#else
		upd.pbBetaVersionPrefix = (BYTE *) "Avatar History (ANSI) ";
		upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/avatarhist.%VERSION%.zip";
#endif
		upd.cpbBetaVersionPrefix = (int) strlen((char *)upd.pbBetaVersionPrefix);

		upd.pbVersion = (BYTE *)CreateVersionStringPluginEx(&pluginInfo, szCurrentVersion);
		upd.cpbVersion = (int) strlen((char *)upd.pbVersion);

        CallService(MS_UPDATE_REGISTER, 0, (LPARAM)&upd);
	}

	if (DBGetContactSettingByte(NULL, MODULE_NAME, "LogToHistory", AVH_DEF_LOGTOHISTORY))
	{
		char *templates[] = { "Avatar change\nchanged his/her avatar", 
							  "Avatar removal\nremoved his/her avatar" };
		HICON hIcon = createDefaultOverlayedIcon(FALSE);
		HistoryEvents_RegisterWithTemplates(MODULE_NAME, "avatarchange", "Avatar change", EVENTTYPE_AVATAR_CHANGE, hIcon, 
			HISTORYEVENTS_FORMAT_CHAR | HISTORYEVENTS_FORMAT_WCHAR | HISTORYEVENTS_FORMAT_RICH_TEXT,
			HISTORYEVENTS_FLAG_SHOW_IM_SRMM | HISTORYEVENTS_FLAG_EXPECT_CONTACT_NAME_BEFORE, 
			GetHistoryEventText, templates, MAX_REGS(templates));
		DestroyIcon(hIcon);
	}
	
	hHooks[2] = HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);

	return 0;
}
Beispiel #2
0
//register Updatersupport
void registerUpdate(){	
	Update update = {0};
	char szVersion[16];
	update.cbSize				= sizeof(Update);
	update.szComponentName		= pluginInfoEx.shortName;
	update.pbVersion			= (BYTE *)CreateVersionStringPluginEx(&pluginInfoEx, szVersion);
	update.cpbVersion			= (int)strlen((char *)update.pbVersion);

	update.szUpdateURL			= __FLUpdateURL /*UPDATER_AUTOREGISTER*/;
	update.szVersionURL			= __FLVersionURL;
	update.pbVersionPrefix		= (BYTE *)__FLVersionPrefix;
	update.cpbVersionPrefix		= (int)strlen((char *)update.pbVersionPrefix);

	update.szBetaUpdateURL		= __BetaUpdateURL;
	update.szBetaVersionURL		= __BetaVersionURL;
	// bytes occuring in VersionURL before the version, used to locate the version information within the URL data
	update.pbBetaVersionPrefix	= (BYTE *)__BetaVersionPrefix;
	update.cpbBetaVersionPrefix	= (int)strlen((char *)update.pbBetaVersionPrefix);

	update.szBetaChangelogURL	= __BetaChangelogURL;

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