コード例 #1
0
ファイル: gaym.c プロジェクト: BackupTheBerlios/qrc-svn
static void gaym_remove_buddy(GaimConnection * gc, GaimBuddy * buddy,
                              GaimGroup * group)
{
    struct gaym_conn *gaym = (struct gaym_conn *) gc->proto_data;

    /**
     * Only remove buddy->name from gaym->buddies if it doesn't
     * exist in any other group on the buddy list.  This allows us
     * to manage the buddy once, even though it might exist in
     * several groups within the buddy list.
     *
     * To add to confusion, the buddy being deleted is not yet deleted,
     * so we look for less than two identical buddies, and if so, then
     * remove the buddy from gaym->buddies.
     */

    GSList *buddies = gaim_find_buddies(gaym->account, buddy->name);
    guint length = g_slist_length(buddies);

    if (length < 2) {
        g_hash_table_remove(gaym->buddies, buddy->name);
    }

    g_slist_free(buddies);
}
コード例 #2
0
void
gaim_buddy_icon_update(GaimBuddyIcon *icon)
{
	GaimConversation *conv;
	GaimAccount *account;
	const char *username;
	GSList *sl;

	g_return_if_fail(icon != NULL);

	account  = gaim_buddy_icon_get_account(icon);
	username = gaim_buddy_icon_get_username(icon);

	for (sl = gaim_find_buddies(account, username); sl != NULL; sl = sl->next)
	{
		GaimBuddy *buddy = (GaimBuddy *)sl->data;

		gaim_buddy_set_icon(buddy, icon);
	}

	conv = gaim_find_conversation_with_account(username, account);

	if (conv != NULL && gaim_conversation_get_type(conv) == GAIM_CONV_IM)
		gaim_im_set_icon(GAIM_IM(conv), icon);
}
コード例 #3
0
ファイル: privacy.c プロジェクト: VoxOx/VoxOx
/* This makes sure that only all the buddies are in the permit list. */
static void
add_buddies_in_permit(GaimAccount *account, gboolean local)
{
    GSList *list, *iter;
    /* Remove anyone in the permit list who is not in the buddylist */
    for (list = account->permit; list != NULL; ) {
        char *person = list->data;
        list = list->next;
        if (!gaim_find_buddy(account, person))
            gaim_privacy_permit_remove(account, person, local);
    }
    /* Now make sure everyone in the buddylist is in the permit list */
    for (iter = list = gaim_find_buddies(account, NULL); iter; iter = iter->next) {
        GaimBuddy *buddy = iter->data;
        if (!g_slist_find_custom(account->permit, buddy->name, (GCompareFunc)g_utf8_collate))
            gaim_privacy_permit_add(account, buddy->name, local);
    }
    g_slist_free(list);
}
コード例 #4
0
ファイル: connection.c プロジェクト: VoxOx/VoxOx
void
gaim_connection_destroy(GaimConnection *gc)
{
	GaimAccount *account;
	GSList *buddies, *tmp;
#if 0
	GList *wins;
#endif
	GaimPluginProtocolInfo *prpl_info = NULL;
	gboolean remove = FALSE;

	g_return_if_fail(gc != NULL);

	account = gaim_connection_get_account(gc);

	gaim_debug_info("connection", "Disconnecting connection %p\n", gc);

	if (gaim_connection_get_state(gc) != GAIM_CONNECTING)
		remove = TRUE;

	gaim_signal_emit(gaim_connections_get_handle(), "signing-off", gc);

	while (gc->buddy_chats)
	{
		GaimConversation *b = gc->buddy_chats->data;

		gc->buddy_chats = g_slist_remove(gc->buddy_chats, b);
		gaim_conv_chat_left(GAIM_CONV_CHAT(b));
	}

	update_keepalive(gc, FALSE);

	gaim_proxy_connect_cancel_with_handle(gc);

	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
	if (prpl_info->close)
		(prpl_info->close)(gc);

	/* Clear out the proto data that was freed in the prpl close method*/
	buddies = gaim_find_buddies(account, NULL);
	for (tmp = buddies; tmp; tmp = tmp->next) {
		GaimBuddy *buddy = tmp->data;
		buddy->proto_data = NULL;
	}
	g_slist_free(buddies);

	connections = g_list_remove(connections, gc);

	gaim_connection_set_state(gc, GAIM_DISCONNECTED);

	if (remove)
		gaim_blist_remove_account(account);

	gaim_signal_emit(gaim_connections_get_handle(), "signed-off", gc);

#if 0
	/* see comment later in file on if 0'd same code */
	/*
	 * XXX This is a hack! Remove this and replace it with a better event
	 *     notification system.
	 */
	for (wins = gaim_get_windows(); wins != NULL; wins = wins->next) {
		GaimConvWindow *win = (GaimConvWindow *)wins->data;
		gaim_conversation_update(gaim_conv_window_get_conversation_at(win, 0),
								 GAIM_CONV_ACCOUNT_OFFLINE);
	}
#endif

	gaim_request_close_with_handle(gc);
	gaim_notify_close_with_handle(gc);

	gaim_debug_info("connection", "Destroying connection %p\n", gc);

	gaim_account_set_connection(account, NULL);

	g_free(gc->password);
	g_free(gc->display_name);

	if (gc->disconnect_timeout)
		gaim_timeout_remove(gc->disconnect_timeout);

	GAIM_DBUS_UNREGISTER_POINTER(gc);
	g_free(gc);
}