Exemplo n.º 1
0
void JabberMenuUpdateSrmmIcon(JABBER_LIST_ITEM *item)
{
	if ( item->list != LIST_ROSTER || !ServiceExists( MS_MSG_MODIFYICON ))
		return;

	HANDLE hContact = JabberHContactFromJID(item->jid);
	if (!hContact)
		return;

	StatusIconData sid = {0};
	sid.cbSize = sizeof(sid);
	sid.szModule = jabberProtoName;
	sid.flags = item->resourceCount ? 0 : MBF_HIDDEN;
	CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
}
Exemplo n.º 2
0
static int ExtraImgSettingChanged(WPARAM hContact, LPARAM lParam)
{
	DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam;
	if (hContact) {
		/* user details update */
		if (!mir_strcmp(dbcws->szSetting,"RealIP") || !mir_strcmp(dbcws->szSetting,"Country") || !mir_strcmp(dbcws->szSetting,"CompanyCountry")) {
			/* Extra Image */
			SetExtraImage(hContact);
			/* Status Icon */
			if (ServiceExists(MS_MSG_REMOVEICON))
				CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY);
		}
	}
	return 0;
}
Exemplo n.º 3
0
int Chat_ModulesLoaded(WPARAM wParam,LPARAM lParam)
{
	char* mods[3] = { "Chat", "ChatFonts" };
	CallService( "DBEditorpp/RegisterModule", (WPARAM)mods, 2 );

	AddIcons();
	RegisterFonts();
	LoadIcons();

//	g_hIconsChanged2 =	HookEvent(ME_SKIN2_ICONSCHANGED, Chat_IconsChanged);

	if ( ServiceExists( MS_SMILEYADD_SHOWSELECTION )) {
		SmileyAddInstalled = TRUE;
		g_hSmileyOptionsChanged = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged);
	}
	if ( ServiceExists( MS_POPUP_ADDPOPUPEX ))
		PopUpInstalled = TRUE;

	if ( ServiceExists( MS_IEVIEW_WINDOW ))
		IEviewInstalled = TRUE;

	CList_SetAllOffline(TRUE);
 	return 0;
}
Exemplo n.º 4
0
void Options::setTemplatesFileRTL(const char *filename) {
	if (templatesFilenameRTL != NULL) {
		delete [] templatesFilenameRTL;
	}
	templatesFilenameRTL = new char[strlen(filename)+1];
	strcpy(templatesFilenameRTL, filename);
    char tmpPath[MAX_PATH];
    strcpy (tmpPath, filename);
    if (ServiceExists(MS_UTILS_PATHTORELATIVE)) {
    	CallService(MS_UTILS_PATHTORELATIVE, (WPARAM)filename, (LPARAM)tmpPath);
   	}
	DBWriteContactSettingString(NULL, muccModuleName, DBS_TEMPLATESFILE_RTL, tmpPath);

	TemplateMap::loadTemplates("default_rtl", templatesFilenameRTL);
}
Exemplo n.º 5
0
bool CMraProto::MraChatRegister()
{
	if (!ServiceExists(MS_GC_REGISTER))
		return FALSE;

	GCREGISTER gcr = { sizeof(gcr) };
	gcr.iMaxText = MRA_MAXLENOFMESSAGE;
	gcr.nColors = 0;
	gcr.ptszDispName = m_tszUserName;
	gcr.pszModule = m_szModuleName;
	CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);

	HookProtoEvent(ME_GC_EVENT, &CMraProto::MraChatGcEventHook);
	return TRUE;
}
Exemplo n.º 6
0
void DlgDownloadProc()
{
	CallFunctionAsync(CreateDownloadDialog, 0);
	if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
		Title = TranslateT("Pack Updater");
		Text = TranslateT("An error occurred while downloading the update.");
		if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL, MODNAME, "Popups1", DEFAULT_POPUP_ENABLED)) {
			Number = 1;
			show_popup(0, Title, Text, Number, 0);
		}
		else if (db_get_b(NULL, MODNAME, "Popups1M", DEFAULT_MESSAGE_ENABLED))
			MessageBox(NULL, Text, Title, MB_ICONSTOP);
	}
	CallFunctionAsync(DestroyDownloadDialog, 0);
}
Exemplo n.º 7
0
int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata)
{
	if (mask & MASK_OPEN) {
		if (pdata) {
			// do MS_MSG_SENDMESSAGE instead if wanted to reply and not read!
			if (pdata->pluginOptions->bMsgReplyWindow && pdata->eventType == EVENTTYPE_MESSAGE)
				CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)pdata->hContact, 0); // JK, use core (since 0.3.3+)
			else {
				EVENT_DATA_EX *eventData = pdata->firstEventData;
				if (eventData == NULL)
					return 0;

				for (int idx = 0;; idx++) {
					CLISTEVENT *cle = pcli->pfnGetEvent(pdata->hContact, idx);
					if (cle == NULL)
						break;

					if (cle->hDbEvent == eventData->hEvent) {
						if (ServiceExists(cle->pszService))
							CallServiceSync(cle->pszService, 0, (LPARAM)cle); // JK, use core (since 0.3.3+)
						break;
					}
				}
			}
		}
	}

	if (mask & MASK_REMOVE) {
		if (pdata) {
			EVENT_DATA_EX *eventData = pdata->firstEventData;
			pdata->iLock = 1;
			while (eventData) {
				pcli->pfnRemoveEvent(pdata->hContact, eventData->hEvent);
				db_event_markRead(pdata->hContact, eventData->hEvent);			
				eventData = eventData->next;
			}		
			FreePopupEventData(pdata);
		}
	}

	if (mask & MASK_DISMISS) {
		KillTimer(hWnd, TIMER_TO_ACTION);
		FreePopupEventData(pdata);
		PUDeletePopup(hWnd);
	}

	return 0;
}
Exemplo n.º 8
0
int InitContactListSmileys()
{
	// Register smiley category
	if (ServiceExists(MS_SMILEYADD_REGISTERCATEGORY))
	{
		SMADD_REGCAT rc;

		rc.cbSize = sizeof(rc);
		rc.name = "clist";
		rc.dispname = Translate("Contact List smileys");

		CallService(MS_SMILEYADD_REGISTERCATEGORY, 0, (LPARAM)&rc);
	}

	return 0;
}
Exemplo n.º 9
0
static int lua_Parse(lua_State *L)
{
	if (!ServiceExists(MS_VARS_FORMATSTRING))
	{
		lua_pushvalue(L, 1);
		return 1;
	}

	ptrT format(mir_utf8decodeT(luaL_checkstring(L, 1)));
	MCONTACT hContact = lua_tointeger(L, 2);

	TCHAR *res = variables_parse_ex(format, NULL, hContact, NULL, 0);
	lua_pushstring(L, T2Utf(res));

	return 1;
}
Exemplo n.º 10
0
int TN_OptionsInitialize(WPARAM wParam, LPARAM)
{
	if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
		OPTIONSDIALOGPAGE odp = { 0 };
		odp.position = 100000000;
		odp.hInstance = g_hInst;
		odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TYPINGNOTIFYPOPUP);
		odp.pszTitle = LPGEN("Typing notify");
		odp.pszGroup = LPGEN("Popups");
		odp.groupPosition = 910000000;
		odp.flags = ODPF_BOLDGROUPS;
		odp.pfnDlgProc = DlgProcOpts;
		Options_AddPage(wParam, &odp);
	}
	return 0;
}
Exemplo n.º 11
0
void CtrlButtonLoadModule()/// @fixme : compatibility with UInfoEx is everything but perfect... we get a huge problem if UInfoEx is unloaded...
{
	if(ServiceExists("UserInfo/vCard/Export")) return;
	WNDCLASSEX wc;
	g_init=true;
	
	ZeroMemory(&wc, sizeof(wc));
	wc.cbSize				 = sizeof(wc);
	wc.lpszClassName	= UINFOBUTTONCLASS;
	wc.lpfnWndProc		= Button_WndProc;
	wc.hCursor				= LoadCursor(NULL, IDC_ARROW);
	wc.cbWndExtra		 = sizeof(LPBTNCTRL);
	wc.style					= CS_GLOBALCLASS;
	RegisterClassEx(&wc);
	InitializeCriticalSection(&csTips);
}
Exemplo n.º 12
0
static int systemModulesLoaded(WPARAM, LPARAM)
{
	GetSystemTime(&cfg::dat.st);
	SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft);

	cfg::dat.bMetaEnabled = db_mc_isEnabled();

	cfg::dat.bAvatarServiceAvail = ServiceExists(MS_AV_GETAVATARBITMAP) ? TRUE : FALSE;
	if (cfg::dat.bAvatarServiceAvail)
		HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);

	memset(&overlayicons, 0, sizeof(overlayicons));

	CLN_LoadAllIcons(1);
	return 0;
}
Exemplo n.º 13
0
void InitTabsrmmButton()
{
	if (ServiceExists(MS_BB_ADDBUTTON)) 
	{
		BBButton btn = {0};
		btn.cbSize = sizeof(btn);
		btn.dwButtonID = 1;
		btn.pszModuleName = MODULE;
		btn.dwDefPos = 105;
		btn.hIcon = iconList[ServerList::FTP_COUNT].hIcolib;
		btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN;
		btn.ptszTooltip = TranslateT("FTP File");
		CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn);
		hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
	}
}
Exemplo n.º 14
0
int IsSRMsgWindowOpen(HANDLE hContact, int DefaultRetVal)
{
	if (ServiceExists(MS_MSG_GETWINDOWDATA))
	{
		MessageWindowData mwd = {0};
		mwd.cbSize = sizeof(mwd);
		MessageWindowInputData mwid = {0};
		mwid.cbSize = sizeof(mwid);
		mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
		mwid.hContact = hContact;
		return !CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd) && mwd.hwndWindow;
	} else
	{
		return DefaultRetVal;
	}
}
Exemplo n.º 15
0
void RegisterProtoIcons (char *protoname)
{
	if (ServiceExists(MS_SKIN2_GETICON)&&DBGetContactSettingByte(NULL,"CList","UseProtoIconFromIcoLib",1))
	{
		int i;
		char buf[256];
		char buf2[256];
		for (i=0;i<8;i++)
		{
			sprintf(buf,"%s #%d",protoname,i);
			sprintf(buf2,"Contact List/Connection Icons %s",protoname);
			
			LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i));
		}
	}
}
Exemplo n.º 16
0
void CMimAPI::configureCustomFolders()
{
	m_haveFolders = false;
	if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) {
		m_hDataPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Data path", const_cast<TCHAR *>(getDataPath()));
		m_hSkinsPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Skins root", const_cast<TCHAR *>(getSkinPath()));
		m_hAvatarsPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Saved Avatars", const_cast<TCHAR *>(getSavedAvatarPath()));
		m_hChatLogsPath = (HANDLE)FoldersRegisterCustomPathT("TabSRMM", "Group chat logs root", const_cast<TCHAR *>(getChatLogPath()));
		CGlobals::m_event_FoldersChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, CMimAPI::FoldersPathChanged);
		m_haveFolders = true;
	}
	else
		m_hDataPath = m_hSkinsPath = m_hAvatarsPath = m_hChatLogsPath = 0;

	foldersPathChanged();
}
Exemplo n.º 17
0
HICON IcoLib_LoadIcon(const char *iconName, BOOL copy)
{
	if (!ServiceExists(MS_SKIN2_GETICON))
		return NULL;

	if (iconName == NULL || iconName[0] == 0)
		return NULL;
	
	HICON hIcon = (HICON) CallService(MS_SKIN2_GETICON, 0, (LPARAM) iconName);
	if (copy && hIcon != NULL)
	{
		hIcon = CopyIcon(hIcon);
		CallService(MS_SKIN2_RELEASEICON, (WPARAM) hIcon, 0);
	}
	return hIcon;
}
Exemplo n.º 18
0
void TwitterProto::ShowPopup(const char *text, int Error)
{
	POPUPDATAT popup = {};
	mir_sntprintf(popup.lptzContactName, TranslateT("%s Protocol"), m_tszUserName);
	mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText));
	if (Error) {
		popup.iSeconds = -1;
		popup.colorBack = 0x000000FF;
		popup.colorText = 0x00FFFFFF;
	}

	if (ServiceExists(MS_POPUP_ADDPOPUPT))
		PUAddPopupT(&popup);
	else
		MessageBox(0, popup.lptzText, popup.lptzContactName, 0);
}
Exemplo n.º 19
0
void StartFlash(HWND hwnd, ACCData* data)
{
	if (!ServiceExists(MS_FAVATAR_MAKE))
		return;

	int format;
	if (data->hContact != NULL)
	{
		format = db_get_w(data->hContact, "ContactPhoto", "Format", 0);
	}
	else if (data->proto[0] != '\0')
	{
		protoPicCacheEntry *ace = NULL;
		for (int i = 0; i < g_MyAvatars.getCount(); i++)
		{
			if (!lstrcmpA(data->proto, g_MyAvatars[i].szProtoname))
			{
				ace = &g_MyAvatars[i];
				break;
			}
		}

		if (ace != NULL && ace->szFilename != NULL)
			format = ProtoGetAvatarFormat(ace->szFilename);
		else
			format = 0;
	}
	else
		return;

	if (format != PA_FORMAT_XML && format != PA_FORMAT_SWF)
		return;

	FLASHAVATAR fa = {0};
	fa.hContact = data->hContact;
	fa.cProto = data->proto;
	fa.hParentWindow = hwnd;
	fa.id = 1675;
	CallService(MS_FAVATAR_MAKE, (WPARAM)&fa, 0);

	if (fa.hWindow == NULL)
		return;

	data->showingFlash = TRUE;
	ResizeFlash(hwnd, data);
	SetBkgFlash(hwnd, data);
}
Exemplo n.º 20
0
void Protocol::SetStatus(int aStatus)
{
	TCHAR status_msg[256];

	if (ServiceExists(MS_CS_SETSTATUSEX)) {
		// BEGIN From commomstatus.cpp (KeepStatus)
		int i, count, pCount;
		PROTOACCOUNT **accs;

		pCount = 0;
		ProtoEnumAccounts(&count, &accs);
		for (i = 0; i < count; i++) {
			if (CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
				continue;
			pCount++;
		}
		// END From commomstatus.cpp (KeepStatus)

		PROTOCOLSETTINGEX **pse = (PROTOCOLSETTINGEX **)mir_calloc(pCount * sizeof(PROTOCOLSETTINGEX *));
		for (i = 0; i < pCount; i++) {
			pse[i] = (PROTOCOLSETTINGEX *)mir_calloc(sizeof(PROTOCOLSETTINGEX));
			pse[i]->szName = "";
		}

		pse[0]->cbSize = sizeof(PROTOCOLSETTINGEX);
		pse[0]->status = aStatus;
		pse[0]->szName = name;

		GetStatusMsg(aStatus, status_msg, SIZEOF(status_msg));
		pse[0]->szMsg = status_msg;

		CallService(MS_CS_SETSTATUSEX, (WPARAM)&pse, 0);

		for (i = 0; i < pCount; i++)
			mir_free(pse[i]);
		mir_free(pse);
	}
	else {
		CallProtoService(name, PS_SETSTATUS, aStatus, 0);

		if (CanSetStatusMsg(aStatus)) {
			TCHAR status_msg[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE];
			GetStatusMsg(aStatus, status_msg, SIZEOF(status_msg));
			SetStatusMsg(aStatus, status_msg);
		}
	}
}
Exemplo n.º 21
0
INT CheckDefaults(WPARAM, LPARAM)
{
	DBVARIANT dbv;
	TCHAR *ptszDefault;
	char szStatus[6]={0};

	interval=db_get_w(NULL,protocolname,KEY_REPEATINTERVAL,300);

	if (db_get_ts(NULL,protocolname,KEY_HEADING,&dbv))
		// Heading not set
		db_set_ts(NULL,protocolname,KEY_HEADING,TranslateT("Dear %user%, the owner left the following message:"));
	else
		db_free(&dbv);

	for (int c=ID_STATUS_ONLINE; c<ID_STATUS_IDLE; c++)
	{
		mir_snprintf(szStatus,_countof(szStatus),"%d",c);
		if (c == ID_STATUS_ONLINE || c == ID_STATUS_FREECHAT || c == ID_STATUS_INVISIBLE)
			continue;
		else
		{
			if (db_get_ts(NULL,protocolname,szStatus,&dbv))
			{
				if (c < ID_STATUS_FREECHAT)
					// This mode does not have a preset message
					ptszDefault=ptszDefaultMsg[c-ID_STATUS_ONLINE-1];
				else if(c > ID_STATUS_INVISIBLE)
					ptszDefault=ptszDefaultMsg[c-ID_STATUS_ONLINE-3];
				if (ptszDefault)
					db_set_ts(NULL,protocolname,szStatus,ptszDefault);
			}
			else
				db_free(&dbv);
		}
	}
	HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu);
	if (ServiceExists(MS_VARS_FORMATSTRING))
		gbVarsServiceExist = TRUE;

	BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1);
	if (fEnabled)
		Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib);
	else
		Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib);
	return 0;
}
Exemplo n.º 22
0
BOOL CheckMsgWnd(MCONTACT hContact, BOOL *focus)
{
	if (ServiceExists(MS_MSG_GETWINDOWDATA)) {	// use the new message API
		MessageWindowData mwd = { sizeof(MessageWindowData) };
		MessageWindowInputData mwid = { sizeof(MessageWindowInputData) };
		mwid.hContact = hContact;
		mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
		mwd.hContact = hContact;
		if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd) && mwd.hwndWindow) {
			*focus = mwd.uState & MSG_WINDOW_STATE_FOCUS;
			return TRUE;
		}
	}

	*focus = FALSE;
	return FALSE;
}
Exemplo n.º 23
0
void DestroyFlash(HWND hwnd, ACCData* data)
{
	if (!data->showingFlash)
		return;

	if ((data->hContact != NULL || data->proto[0] != '\0') && ServiceExists(MS_FAVATAR_DESTROY))
	{
		FLASHAVATAR fa = {0};
		fa.hContact = data->hContact;
		fa.cProto = data->proto;
		fa.hParentWindow = hwnd;
		fa.id = 1675;
		CallService(MS_FAVATAR_DESTROY, (WPARAM)&fa, 0);
	}

	data->showingFlash = FALSE;
}
Exemplo n.º 24
0
void SetBkgFlash(HWND hwnd, ACCData* data)
{
	if ((data->hContact != NULL || data->proto[0] != '\0')
		&& ServiceExists(MS_FAVATAR_SETBKCOLOR))
	{
		FLASHAVATAR fa = {0};
		fa.hContact = data->hContact;
		fa.cProto = data->proto;
		fa.hParentWindow = hwnd;
		fa.id = 1675;

		if (data->bkgColor != -1)
			CallService(MS_FAVATAR_SETBKCOLOR, (WPARAM)&fa, (LPARAM)data->bkgColor);
		else
			CallService(MS_FAVATAR_SETBKCOLOR, (WPARAM)&fa, (LPARAM)RGB(255,255,255));
	}
}
Exemplo n.º 25
0
void ShowPopup(ALARM *alarm)
{
	if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
		ALARM *data = new ALARM;
		memset(data, 0, sizeof(ALARM));
		copy_alarm_data(data, alarm);

		POPUPDATAT ppd = { 0 };
		ppd.lchIcon = hIconMenuSet;
		mir_tstrncpy(ppd.lptzContactName, data->szTitle, MAX_CONTACTNAME);
		mir_tstrncpy(ppd.lptzText, data->szDesc, MAX_SECONDLINE);
		ppd.PluginWindowProc = PopupAlarmDlgProc;
		ppd.PluginData = data;
		ppd.iSeconds = -1;
		PUAddPopupT(&ppd);
	}
}
Exemplo n.º 26
0
//returns normal icon or combined with status overlay. Needs to be destroyed.
HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status)
{
	HICON hIcon=NULL;
	HICON hXIcon=NULL;
	// check if options is turned on
	BYTE trayOption=ModernGetSettingByte(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT);
	if (trayOption&3 && szProto!=NULL)
	{
		// check service exists
		char str[MAXMODULELABELLENGTH];
		strcpy(str,szProto);
		strcat(str,"/GetXStatusIcon");
		if (ServiceExists(str))
		{
			// check status is online
			if (status>ID_STATUS_OFFLINE)
			{
				// get xicon
				hXIcon=(HICON)CallService(str,0,0);
				if (hXIcon)
				{
					// check overlay mode
					if (trayOption&2)
					{
						// get overlay
						HICON MainOverlay=(HICON)GetMainStatusOverlay(status);
						hIcon=ske_CreateJoinedIcon(hXIcon,MainOverlay,(trayOption&4)?192:0);
						DestroyIcon_protect(hXIcon);
                        DestroyIcon_protect(MainOverlay);
					}
					else
					{
						// paint it
						hIcon=hXIcon;
					}
				}
			}
		}
	}
	if (!hIcon)
	{
		hIcon=ske_ImageList_GetIcon(g_himlCListClc,ExtIconFromStatusMode(hContact,szProto,status),ILD_NORMAL);
	}
	// if not ready take normal icon
	return hIcon;
}
Exemplo n.º 27
0
int ModulesLoaded(WPARAM, LPARAM)
{
    MNotifyGetLink();

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

    HookEvent(ME_FONT_RELOAD, ReloadFont);
    HookEvent(ME_TTB_MODULELOADED, TTBLoaded);

    LoadModuleDependentOptions();

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

    return 0;
}
Exemplo n.º 28
0
void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
{
	if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) {
		char setting[100];
		mir_snprintf(setting, "Popups%d", Number);
		if (db_get_b(NULL, MODNAME, setting, DEFAULT_POPUP_ENABLED)) {
			POPUPDATAT pd = { 0 };
			pd.lchContact = NULL;
#if MIRANDA_VER >= 0x0A00
			pd.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
#else
			pd.lchIcon = IcoLib_GetIcon("check_update");
#endif
			if (Number == POPUP_TYPE_MSG) {
				pd.PluginWindowProc = PopupDlgProcRestart;
				pd.iSeconds = -1;
			}
			else {
				pd.PluginWindowProc = PopupDlgProc;
				pd.iSeconds = PopupOptions.Timeout;
			}

			lstrcpyn(pd.lptzText, ptszText, MAX_SECONDLINE);
			lstrcpyn(pd.lptzContactName, ptszTitle, MAX_CONTACTNAME);

			switch (PopupOptions.DefColors) {
			case byCOLOR_WINDOWS:
				pd.colorBack = GetSysColor(COLOR_BTNFACE);
				pd.colorText = GetSysColor(COLOR_WINDOWTEXT);
				break;
			case byCOLOR_OWN:
				pd.colorBack = PopupsList[Number].colorBack;
				pd.colorText = PopupsList[Number].colorText;
				break;
			case byCOLOR_POPUP:
				pd.colorBack = pd.colorText = 0;
				break;
			}
			PUAddPopupT(&pd);
			return;
		}
	}

	if (Number == POPUP_TYPE_ERROR)
		MessageBox(0, ptszText, ptszTitle, MB_ICONINFORMATION);
}
Exemplo n.º 29
0
INT_PTR CSteamCaptchaDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
{
	if (msg == WM_PAINT)
	{
		FI_INTERFACE *fei = 0;

		INT_PTR result = CALLSERVICE_NOTFOUND;
		if (ServiceExists(MS_IMG_GETINTERFACE))
			result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);

		if (fei == NULL || result != S_OK) {
			MessageBox(0, TranslateT("Fatal error, image services not found. Avatar services will be disabled."), TranslateT("Avatar Service"), MB_OK);
			return 0;
		}

		FIMEMORY *stream = fei->FI_OpenMemory(m_captchaImage, m_captchaImageSize);
		FREE_IMAGE_FORMAT fif = fei->FI_GetFileTypeFromMemory(stream, 0);
		FIBITMAP *bitmap = fei->FI_LoadFromMemory(fif, stream, 0);
		fei->FI_CloseMemory(stream);

		PAINTSTRUCT ps;
		HDC hDC = BeginPaint(m_hwnd, &ps);

		//SetStretchBltMode(hDC, COLORONCOLOR);
		StretchDIBits(
			hDC,
			11, 11,
			fei->FI_GetWidth(bitmap) - 13,
			fei->FI_GetHeight(bitmap),
			0, 0,
			fei->FI_GetWidth(bitmap),
			fei->FI_GetHeight(bitmap),
			fei->FI_GetBits(bitmap),
			fei->FI_GetInfo(bitmap),
			DIB_RGB_COLORS, SRCCOPY);

		fei->FI_Unload(bitmap);
		//fei->FI_DeInitialise();

		EndPaint(m_hwnd, &ps);

		return FALSE;
	}
	CSteamDlgBase::DlgProc(msg, wParam, lParam);
	return FALSE;
}
Exemplo n.º 30
0
int CMraProto::OnPopupOptInit(WPARAM wParam, LPARAM lParam)
{
	if ( ServiceExists(MS_POPUP_ADDPOPUP)) {
		OPTIONSDIALOGPAGE odp = { sizeof(odp) };
		odp.dwInitParam = (LPARAM)this;
		odp.position = 100000000;
		odp.hInstance = g_hInstance;
		odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUPS);
		odp.pszTitle = m_szModuleName;
		odp.pszGroup = LPGEN("Popups");
		odp.groupPosition = 900000000;
		odp.flags = ODPF_BOLDGROUPS;
		odp.pfnDlgProc = MraPopupDlgProcOpts;
		Options_AddPage(wParam, &odp);
	}
	return 0;
}