static void set_gc_away(GObject *obj, GaimConnection *gc) { struct away_message *awy = g_object_get_data(obj, "away_message"); if (awy) serv_set_away(gc, GAIM_AWAY_CUSTOM, awy->message); else serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); }
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); } }
static void set_gc_state(GObject *obj, GaimConnection *gc) { char *awy = g_object_get_data(obj, "away_state"); serv_set_away(gc, awy, NULL); }