예제 #1
0
파일: common.c 프로젝트: N8Fear/pidgin-otr
OtrlPolicy
otrg_buddy_prefs_get_policy(PurpleAccount *account, const char *name)
{
	const gchar *proto;
	PurpleBuddy *buddy;
	gboolean p_enabled, p_automatic, p_onlyprivate;
	gboolean _unused;

	proto = purple_account_get_protocol_id(account);
	if (!otrg_plugin_proto_supports_otr(proto))
		return OTRL_POLICY_NEVER;

	buddy = purple_blist_find_buddy(account, name);
	if (buddy) {
		otrg_prefs_buddy_load(buddy, &_unused, &p_enabled,
			&p_automatic, &p_onlyprivate, &_unused);
	} else {
		otrg_prefs_global_load(&p_enabled, &p_automatic,
			&p_onlyprivate, &_unused);
	}

	if (!p_enabled)
		return OTRL_POLICY_NEVER;
	if (p_automatic && p_onlyprivate)
		return OTRL_POLICY_ALWAYS;
	if (p_automatic)
		return OTRL_POLICY_OPPORTUNISTIC;
	return OTRL_POLICY_MANUAL;
}
예제 #2
0
파일: common.c 프로젝트: N8Fear/pidgin-otr
gboolean
otrg_buddy_prefs_get_avoid_logging(PurpleAccount *account, const char *name)
{
	const gchar *proto;
	PurpleBuddy *buddy;
	gboolean p_enabled, p_avoidloggingotr;
	gboolean _unused;

	proto = purple_account_get_protocol_id(account);
	if (!otrg_plugin_proto_supports_otr(proto))
		return TRUE;

	buddy = purple_blist_find_buddy(account, name);
	if (buddy) {
		otrg_prefs_buddy_load(buddy, &_unused, &p_enabled,
			&_unused, &_unused, &p_avoidloggingotr);
	} else {
		otrg_prefs_global_load(&p_enabled, &_unused, &_unused,
			&p_avoidloggingotr);
	}

	if (p_enabled)
		return p_avoidloggingotr;
	else
		return OTRL_POLICY_NEVER;
}
예제 #3
0
/* Load the preferences for a particular account / username */
void otrg_ui_get_prefs(OtrgUiPrefs *prefsp, PurpleAccount *account,
	const char *name)
{
    /* Check to see if the protocol for this account supports OTR at all. */
    const char *proto = purple_account_get_protocol_id(account);
    if (!otrg_plugin_proto_supports_otr(proto)) {
	prefsp->policy = OTRL_POLICY_NEVER;
	prefsp->avoid_logging_otr = FALSE;
	prefsp->show_otr_button = FALSE;
	return;
    }

    if (ui_ops != NULL) {
	ui_ops->get_prefs(prefsp, account, name);
	return;
    }
    /* If we've got no other way to get the prefs, use sensible defaults */
    prefsp->policy = OTRL_POLICY_DEFAULT;
    prefsp->avoid_logging_otr = FALSE;
    prefsp->show_otr_button = FALSE;
}