コード例 #1
0
ファイル: xstatus.cpp プロジェクト: MrtsComputers/miranda-ng
void ExtraStatusChanged(XSTATUSCHANGE *xsc)
{
	if (xsc == NULL)
		return;

	BOOL bEnablePopup = true, bEnableSound = true;
	char buff[12] = {0};

	mir_snprintf(buff, SIZEOF(buff), "%d", ID_STATUS_EXTRASTATUS);

	if (( db_get_b(0, MODULE, buff, 1) == 0)
		|| (db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
		|| (!opt.HiddenContactsToo && db_get_b(xsc->hContact, "CList", "Hidden", 0))
		|| (opt.TempDisabled)
		|| (opt.IgnoreEmpty && (xsc->stzTitle == NULL || xsc->stzTitle[0] == '\0') && (xsc->stzText == NULL || xsc->stzText[0] == '\0'))) {
			 FreeXSC(xsc);
			 return;
	}

	char statusIDs[12], statusIDp[12];
	if (opt.AutoDisable) {
		WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0);
		mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus);
		mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus);
		bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
		bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
	}

	if (!(templates.PopupFlags & xsc->action))
		bEnableSound = bEnablePopup = false;

	int xstatusID = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0);
	if (opt.PDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
		bEnableSound = bEnablePopup = false;

	if (bEnablePopup && db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1) && db_get_b(0, MODULE, xsc->szProto, 1))
		ShowPopup(xsc);

	if (bEnableSound && db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1))
		PlayXStatusSound(xsc->action);

	BYTE enableLog = opt.EnableLogging;
	if (opt.LDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
		enableLog = FALSE;

	if (!(templates.LogFlags & xsc->action))
		enableLog = FALSE;

	if (enableLog && db_get_b(xsc->hContact, MODULE, "EnableLogging", 1)
		 && CallService(MS_MSG_MOD_MESSAGEDIALOGOPENED, (WPARAM)xsc->hContact, 0))
		LogToMessageWindow(xsc, FALSE);

	if (opt.Log)
		LogChangeToFile(xsc);

	FreeXSC(xsc);
}
コード例 #2
0
ファイル: xstatus.cpp プロジェクト: TonyAlloa/miranda-dev
void ExtraStatusChanged(XSTATUSCHANGE *xsc) 
{
	BOOL bEnablePopup = true, bEnableSound = true;
	char buff[12] = {0};

	wsprintfA(buff, "%d", ID_STATUS_EXTRASTATUS); 

	if ((DBGetContactSettingByte(0, MODULE, buff, 1) == 0) ||
		(DBGetContactSettingWord(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) ||
		(!opt.HiddenContactsToo && DBGetContactSettingByte(xsc->hContact, "CList", "Hidden", 0)) ||	
		(opt.TempDisabled))
	{
		return;
	}

	char statusIDs[12], statusIDp[12];
	if (opt.AutoDisable)
	{
		WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0); 
		wsprintfA(statusIDs, "s%d", myStatus);
		wsprintfA(statusIDp, "p%d", myStatus);
		bEnableSound = DBGetContactSettingByte(0, MODULE, statusIDs, 1) ? FALSE : TRUE;
		bEnablePopup = DBGetContactSettingByte(0, MODULE, statusIDp, 1) ? FALSE : TRUE;
	}

	if (!(templates.PopupFlags & xsc->action))
		bEnableSound = bEnablePopup = false;

	int xstatusID = DBGetContactSettingByte(xsc->hContact, xsc->szProto, "XStatusId", 0);
	if (opt.PDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
		bEnableSound = bEnablePopup = false;

	if (bEnablePopup && DBGetContactSettingByte(xsc->hContact, MODULE, "EnableXStatusNotify", 1) && TimeoutCheck()) 
		ShowPopup(xsc);

	if (bEnableSound && DBGetContactSettingByte(xsc->hContact, MODULE, "EnableXStatusNotify", 1)) 
		PlayXStatusSound(xsc->action);

	BYTE enableLog = opt.EnableLogging;
	if (opt.LDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC)
		enableLog = FALSE;

	if (!(templates.LogFlags & xsc->action))
		enableLog = FALSE;

	if (enableLog && DBGetContactSettingByte(xsc->hContact, MODULE, "EnableLogging", 1) && 
		CallService(MS_MSG_MOD_MESSAGEDIALOGOPENED, (WPARAM)xsc->hContact, 0))
	{
		LogToMessageWindow(xsc, FALSE);
	}

	if (opt.Log) 
		LogChangeToFile(xsc);
}
コード例 #3
0
ファイル: xstatus.cpp プロジェクト: TonyAlloa/miranda-dev
void LogXstatusChange(HANDLE hContact, char *szProto, int xstatusType, TCHAR *stzTitle, TCHAR *stzText)
{
	XSTATUSCHANGE *xsc = 
		NewXSC(
			hContact, 
			szProto, 
			xstatusType, 
			NOTIFY_OPENING_ML, 
			stzTitle[0] ? mir_tstrdup(stzTitle): NULL,
			stzText[0] ? mir_tstrdup(stzText) : NULL
		);

	LogToMessageWindow(xsc, TRUE);		
	FreeXSC(xsc);
}