static void __clear_user_list(TrepiaSession *session) { GaimBlistNode *gnode, *cnode, *bnode; for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { cnode = gnode->child; while(cnode) { if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { bnode = cnode->child; cnode = cnode->next; while(bnode) { GaimBuddy *buddy = (GaimBuddy *)bnode; if(GAIM_BLIST_NODE_IS_BUDDY(bnode) && buddy->account == session->gc->account) { bnode = bnode->next; gaim_blist_remove_buddy(buddy); } else { bnode = bnode->next; } } } else { cnode = cnode->next; } } } }
static void save_cb(GaimBlistNode *node, int choice) { if (GAIM_BLIST_NODE_IS_BUDDY(node)) node = node->parent; g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node)); gaim_blist_node_set_int(node, "autoaccept", choice); }
static void file_recv_request_cb(GaimXfer *xfer, gpointer handle) { GaimAccount *account; GaimBlistNode *node; const char *pref; char *filename; char *dirname; account = xfer->account; node = (GaimBlistNode *)gaim_find_buddy(account, xfer->who); if (!node) { if (gaim_prefs_get_bool(PREF_STRANGER)) xfer->status = GAIM_XFER_STATUS_CANCEL_LOCAL; return; } node = node->parent; g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node)); pref = gaim_prefs_get_string(PREF_PATH); switch (gaim_blist_node_get_int(node, "autoaccept")) { case FT_ASK: break; case FT_ACCEPT: if (ensure_path_exists(pref)) { dirname = g_build_filename(pref, xfer->who, NULL); if (!ensure_path_exists(dirname)) { g_free(dirname); break; } filename = g_build_filename(dirname, xfer->filename, NULL); gaim_xfer_request_accepted(xfer, filename); g_free(dirname); g_free(filename); } gaim_signal_connect(gaim_xfers_get_handle(), "file-recv-complete", handle, GAIM_CALLBACK(auto_accept_complete_cb), xfer); break; case FT_REJECT: xfer->status = GAIM_XFER_STATUS_CANCEL_LOCAL; break; } }
static void context_menu(GaimBlistNode *node, GList **menu, gpointer plugin) { GaimMenuAction *action; if (!GAIM_BLIST_NODE_IS_BUDDY(node) && !GAIM_BLIST_NODE_IS_CONTACT(node)) return; action = gaim_menu_action_new(_("Autoaccept File Transfers..."), GAIM_CALLBACK(set_auto_accept_settings), plugin, NULL); (*menu) = g_list_prepend(*menu, action); }
static void blist_node_extended_menu_cb(GaimBlistNode *node, void *data) { GaimContact *p = (GaimContact *)node; GaimBuddy *b = (GaimBuddy *)node; GaimChat *c = (GaimChat *)node; GaimGroup *g = (GaimGroup *)node; if (GAIM_BLIST_NODE_IS_CONTACT(node)) gaim_debug_misc("signals test", "blist-node-extended-menu (Contact: %s)\n", p->alias); else if (GAIM_BLIST_NODE_IS_BUDDY(node)) gaim_debug_misc("signals test", "blist-node-extended-menu (Buddy: %s)\n", b->name); else if (GAIM_BLIST_NODE_IS_CHAT(node)) gaim_debug_misc("signals test", "blist-node-extended-menu (Chat: %s)\n", c->alias); else if (GAIM_BLIST_NODE_IS_GROUP(node)) gaim_debug_misc("signals test", "blist-node-extended-menu (Group: %s)\n", g->name); else gaim_debug_misc("signals test", "blist-node-extended-menu (UNKNOWN: %d)\n", node->type); }
static void set_auto_accept_settings(GaimBlistNode *node, gpointer plugin) { char *message; if (GAIM_BLIST_NODE_IS_BUDDY(node)) node = node->parent; g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node)); message = g_strdup_printf(_("When a file-transfer request arrives from %s"), gaim_contact_get_alias((GaimContact *)node)); gaim_request_choice(plugin, _("Set Autoaccept Setting"), message, NULL, gaim_blist_node_get_int(node, "autoaccept"), _("_Save"), G_CALLBACK(save_cb), _("_Cancel"), NULL, node, _("Ask"), FT_ASK, _("Auto Accept"), FT_ACCEPT, _("Auto Reject"), FT_REJECT, NULL); g_free(message); }
void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state) { GaimConnectionUiOps *ops; g_return_if_fail(gc != NULL); if (gc->state == state) return; gc->state = state; ops = gaim_get_connection_ui_ops(); if (gc->state == GAIM_CONNECTING) { connections_connecting = g_list_append(connections_connecting, gc); } else { connections_connecting = g_list_remove(connections_connecting, gc); } if (gc->state == GAIM_CONNECTED) { GaimBlistNode *gnode,*cnode,*bnode; GList *wins; GList *add_buds=NULL; /* Set the time the account came online */ time(&gc->login_time); if (ops != NULL && ops->connected != NULL) ops->connected(gc); gaim_blist_show(); gaim_blist_add_account(gc->account); /* * 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) { GaimWindow *win = (GaimWindow *)wins->data; gaim_conversation_update(gaim_window_get_conversation_at(win, 0), GAIM_CONV_ACCOUNT_ONLINE); } gaim_signal_emit(gaim_connections_get_handle(), "signed-on", gc); system_log(log_signon, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); #if 0 /* away option given? */ if (opt_away) { away_on_login(opt_away_arg); /* don't do it again */ opt_away = 0; } else if (awaymessage) { serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message); } if (opt_away_arg != NULL) { g_free(opt_away_arg); opt_away_arg = NULL; } #endif /* let the prpl know what buddies we pulled out of the local list */ for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = gnode->child; cnode; cnode = cnode->next) { if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) continue; for(bnode = cnode->child; bnode; bnode = bnode->next) { GaimBuddy *b; if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (GaimBuddy *)bnode; if(b->account == gc->account) { add_buds = g_list_append(add_buds, b->name); } } } } if(add_buds) { serv_add_buddies(gc, add_buds); g_list_free(add_buds); } serv_set_permit_deny(gc); } else if (gc->state == GAIM_DISCONNECTED) { if (ops != NULL && ops->disconnected != NULL) ops->disconnected(gc); } }