Пример #1
0
int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
	if (!options.end_offline)
		return 0;

	DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
	if (!lParam || mir_strcmp(cws->szSetting, "Status") != 0) return 0;
	int status = 0;
	switch (cws->value.type) {
	case DBVT_WORD:
		status = cws->value.wVal;
		break;
	case DBVT_BYTE:
		status = cws->value.bVal;
		break;
	case DBVT_DWORD:
		status = cws->value.dVal;
		break;
	}

	if (status == ID_STATUS_OFFLINE) {
		if (!hContact) {
			// Protocol is going offline
			// Terminate sessions with all contacts of that proto
			StatusModeChange((WPARAM)ID_STATUS_OFFLINE, (LPARAM)cws->szModule);
			return 0;
		}
		if (Proto_IsProtoOnContact(hContact, MODULENAME)) {
			// only care about contacts to which this filter is attached
			FinishSession(hContact);
		}
	}

	return 0;
}
IRequest* SessionManager::FinishSessionByCustomIdentify(
		ILiveChatClient* livechat,
		const string& customIdentify
		) {
	char identify[1024];
	sprintf(identify, "%s_%s", CUSTOM_TYPE, customIdentify.c_str());

	return FinishSession(livechat, identify);
}
IRequest* SessionManager::FinishSessionBySeq(
		ILiveChatClient* livechat,
		int seq
		) {
	char identify[1024];
	sprintf(identify, "%s_%d", SEQ_TYPE, seq);

	return FinishSession(livechat, identify);
}
Пример #4
0
int WindowEvent(WPARAM wParam, LPARAM lParam)
{
	MessageWindowEventData *mwd = (MessageWindowEventData *)lParam;
	if (mwd->uType == MSG_WINDOW_EVT_CLOSE && options.end_window_close) {
		FinishSession(mwd->hContact);
		return 0;
	}

	if (mwd->uType != MSG_WINDOW_EVT_OPEN)
		return 0;

	MCONTACT hContact = mwd->hContact, hTemp;
	if ((hTemp = db_mc_getMostOnline(hContact)) != 0)
		hContact = hTemp;

	if (!Proto_IsProtoOnContact(hContact, MODULENAME))
		return 0;

	lib_cs_lock();
	ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
	SetEncryptionStatus(hContact, otr_context_get_trust(context));
	return 0;
}