Ejemplo n.º 1
0
gboolean
gaim_privacy_permit_remove(GaimAccount *account, const char *who,
						   gboolean local_only)
{
	GSList *l;
	char *name;

	g_return_val_if_fail(account != NULL, FALSE);
	g_return_val_if_fail(who     != NULL, FALSE);

	name = g_strdup(normalize(who));

	for (l = account->permit; l != NULL; l = l->next) {
		if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data)))
			break;
	}

	g_free(name);

	if (l == NULL)
		return FALSE;

	account->permit = g_slist_remove(account->permit, l->data);
	g_free(l->data);

	if (!local_only && gaim_account_is_connected(account))
		serv_rem_deny(gaim_account_get_connection(account), who);

	gaim_blist_save();

	if (privacy_ops != NULL && privacy_ops->permit_removed != NULL)
		privacy_ops->permit_removed(account, who);

	return TRUE;
}
Ejemplo n.º 2
0
gboolean
purple_privacy_deny_remove(PurpleAccount *account, const char *who,
						 gboolean local_only)
{
	GSList *l;
	const char *normalized;
	char *name;
	PurpleBuddy *buddy;

	g_return_val_if_fail(account != NULL, FALSE);
	g_return_val_if_fail(who     != NULL, FALSE);

	normalized = purple_normalize(account, who);

	for (l = account->deny; l != NULL; l = l->next) {
		if (!purple_utf8_strcasecmp(normalized, (char *)l->data))
			break;
	}

	buddy = purple_find_buddy(account, normalized);

	if (l == NULL)
		return FALSE;

	name = l->data;
	account->deny = g_slist_delete_link(account->deny, l);

	if (!local_only && purple_account_is_connected(account))
		serv_rem_deny(purple_account_get_connection(account), name);

	if (privacy_ops != NULL && privacy_ops->deny_removed != NULL)
		privacy_ops->deny_removed(account, who);

	if (buddy != NULL) {
		purple_signal_emit(purple_blist_get_handle(),
                "buddy-privacy-changed", buddy);
	}

	g_free(name);
	purple_blist_schedule_save();

	return TRUE;
}
Ejemplo n.º 3
0
gboolean
gaim_privacy_deny_remove(GaimAccount *account, const char *who,
						 gboolean local_only)
{
	GSList *l;
	char *name;

	g_return_val_if_fail(account != NULL, FALSE);
	g_return_val_if_fail(who     != NULL, FALSE);

	name = g_strdup(normalize(who));

	for (l = account->deny; l != NULL; l = l->next) {
		if (!gaim_utf8_strcasecmp(name, normalize((char *)l->data)))
			break;
	}

	g_free(name);

	if (l == NULL)
		return FALSE;

	account->deny = g_slist_remove(account->deny, l->data);
	g_free(l->data);

	if (!local_only && gaim_account_is_connected(account)) {
		gaim_debug(GAIM_DEBUG_INFO, "privacy",
				   "Removing %s from server-side deny list\n", who);
		serv_rem_deny(gaim_account_get_connection(account), who);
	}

	gaim_blist_save();

	if (privacy_ops != NULL && privacy_ops->deny_removed != NULL)
		privacy_ops->deny_removed(account, who);

	return TRUE;
}