Mercurial > pidgin.yaz
changeset 10400:6a043ae92db6
[gaim-migrate @ 11631]
I'm about to go home for the holidays, so I figured I'd commit this before
I left so someone else could pick up on it while I'm gone.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 19 Dec 2004 20:32:32 +0000 |
parents | aab0c9508318 |
children | 3e4ecbdf8d0a |
files | plugins/timestamp.c src/account.c src/account.h src/connection.c src/connection.h src/gtkaccount.c src/gtkconn.c src/gtkgaim.h src/gtkmain.c src/gtkstatusselector.c src/protocols/oscar/oscar.c src/protocols/yahoo/yahoo.c src/prpl.h src/server.c src/server.h src/status.c |
diffstat | 16 files changed, 209 insertions(+), 388 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/timestamp.c Sun Dec 19 17:35:59 2004 +0000 +++ b/plugins/timestamp.c Sun Dec 19 20:32:32 2004 +0000 @@ -57,11 +57,23 @@ is_conversation_active = GPOINTER_TO_INT(gaim_conversation_get_data(c, "timestamp-conv-active")); if (is_conversation_active){ - GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(conv->imhtml)); + int y, height; + GdkRectangle rect; + gboolean scroll = TRUE; + GtkWidget *imhtml = conv->imhtml; + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(imhtml)); gtk_text_buffer_get_end_iter(buffer, &iter); gaim_conversation_set_data(c, "timestamp-conv-active", GINT_TO_POINTER(FALSE)); strftime(mdate, sizeof(mdate), "\n%H:%M", localtime(&tim)); + gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); + gtk_text_view_get_line_yrange(GTK_TEXT_VIEW(imhtml), &iter, &y, &height); + if(((y + height) - (rect.y + rect.height)) > height + && gtk_text_buffer_get_char_count(buffer)){ + scroll = FALSE; + } gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL); + if (scroll) + gtk_imhtml_scroll_to_end(imhtml); } else gaim_conversation_set_data(c, "timestamp-enabled", GINT_TO_POINTER(FALSE));
--- a/src/account.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/account.c Sun Dec 19 20:32:32 2004 +0000 @@ -227,7 +227,7 @@ } GaimConnection * -gaim_account_connect(GaimAccount *account) +gaim_account_connect(GaimAccount *account, GaimStatus *status) { GaimConnection *gc; @@ -241,7 +241,7 @@ gaim_debug_info("account", "Connecting to account %p. gc = %p\n", account, gc); - gaim_connection_connect(gc); + gaim_connection_connect(gc, status); return gc; } @@ -508,8 +508,8 @@ } void -gaim_account_set_auto_login(GaimAccount *account, const char *ui, - gboolean value) +gaim_account_set_enabled(GaimAccount *account, const char *ui, + gboolean value) { g_return_if_fail(account != NULL); g_return_if_fail(ui != NULL); @@ -829,7 +829,7 @@ } gboolean -gaim_account_get_auto_login(const GaimAccount *account, const char *ui) +gaim_account_get_enabled(const GaimAccount *account, const char *ui) { g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(ui != NULL, FALSE); @@ -1631,8 +1631,8 @@ for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { account = l->data; - if (gaim_account_get_auto_login(account, ui)) - gaim_account_connect(account); + if (gaim_account_get_enabled(account, ui)) + gaim_account_connect(account, gaim_account_get_status(account, "online")); } }
--- a/src/account.h Sun Dec 19 17:35:59 2004 +0000 +++ b/src/account.h Sun Dec 19 20:32:32 2004 +0000 @@ -113,10 +113,11 @@ * Connects to an account. * * @param account The account to connect to. + * @param status The status the account should use when logging in. * * @return The gaim connection. */ -GaimConnection *gaim_account_connect(GaimAccount *account); + GaimConnection *gaim_account_connect(GaimAccount *account, GaimStatus *status); /** * Registers an account. @@ -240,15 +241,15 @@ void gaim_account_set_check_mail(GaimAccount *account, gboolean value); /** - * Sets whether or not this account should auto-login for the specified + * Sets whether or not this account is enabled for the specified * UI. * * @param account The account. * @param ui The UI. - * @param value @c TRUE if it should check for mail. + * @param value @c TRUE if it is enabled. */ -void gaim_account_set_auto_login(GaimAccount *account, const char *ui, - gboolean value); +void gaim_account_set_enabled(GaimAccount *account, const char *ui, + gboolean value); /** * Sets the account's proxy information. @@ -458,16 +459,16 @@ gboolean gaim_account_get_check_mail(const GaimAccount *account); /** - * Returns whether or not this account should auto-login for the + * Returns whether or not this account is enabled for the * specified UI. * * @param account The account. * @param ui The UI. * - * @return @c TRUE if it should auto-login on this UI. + * @return @c TRUE if it enabled on this UI. */ -gboolean gaim_account_get_auto_login(const GaimAccount *account, - const char *ui); +gboolean gaim_account_get_enabled(const GaimAccount *account, + const char *ui); /** * Returns the account's proxy information. @@ -695,6 +696,13 @@ GList *gaim_accounts_get_all(void); /** + * Returns a list of all enabled accounts + * + * @return A list of all enabled accounts. + */ +GList *gaim_accounts_get_all_active(void); + +/** * Finds an account with the specified name and protocol id. * * @param name The account username.
--- a/src/connection.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/connection.c Sun Dec 19 20:32:32 2004 +0000 @@ -89,7 +89,8 @@ { gaim_account_set_password(account, (*entry != '\0') ? entry : NULL); - gaim_account_connect(account); + /* XXX - connect with correct status */ + gaim_account_connect(account, gaim_account_get_status(account, "online")); } void @@ -143,7 +144,7 @@ void -gaim_connection_connect(GaimConnection *gc) +gaim_connection_connect(GaimConnection *gc, GaimStatus *status) { GaimAccount *account; GaimConnectionUiOps *ops; @@ -201,7 +202,7 @@ gaim_debug_info("connection", "Calling serv_login\n"); - serv_login(account); + serv_login(account, status); } void @@ -321,10 +322,6 @@ /* Set the time the account came online */ time(&gc->login_time); - /* XXX - STATUS - Need to handle away at login here. */ - if (gaim_presence_is_online(presence) == FALSE) - gaim_presence_set_status_active(presence, "online", TRUE); - if (gaim_prefs_get_bool("/core/logging/log_system") && gaim_prefs_get_bool("/core/logging/log_own_states")){ GaimLog *log = gaim_account_get_log(account);
--- a/src/connection.h Sun Dec 19 17:35:59 2004 +0000 +++ b/src/connection.h Sun Dec 19 20:32:32 2004 +0000 @@ -57,6 +57,7 @@ #include "account.h" #include "plugin.h" +#include "status.h" typedef struct { @@ -130,10 +131,11 @@ * Logs in to this connection. * * @param gc The connection to log in. + * @param status The status to login to. * * @see gaim_connection_disconnect() */ -void gaim_connection_connect(GaimConnection *gc); +void gaim_connection_connect(GaimConnection *gc, GaimStatus *status); /** * Registers a connection.
--- a/src/gtkaccount.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/gtkaccount.c Sun Dec 19 20:32:32 2004 +0000 @@ -49,8 +49,7 @@ { COLUMN_ICON, COLUMN_SCREENNAME, - COLUMN_ONLINE, - COLUMN_AUTOLOGIN, + COLUMN_ENABLED, COLUMN_PROTOCOL, COLUMN_DATA, COLUMN_PULSE_DATA, @@ -112,7 +111,6 @@ GtkWidget *password_entry; GtkWidget *alias_entry; GtkWidget *remember_pass_check; - GtkWidget *auto_login_check; /* User Options */ GtkWidget *user_frame; @@ -733,13 +731,6 @@ FALSE, FALSE, 0); gtk_widget_show(dialog->remember_pass_check); - /* Auto log in */ - dialog->auto_login_check = - gtk_check_button_new_with_label(_("Auto log in")); - gtk_box_pack_start(GTK_BOX(vbox), dialog->auto_login_check, - FALSE, FALSE, 0); - gtk_widget_show(dialog->auto_login_check); - /* Set the fields. */ if (dialog->account != NULL) { if (gaim_account_get_password(dialog->account)) @@ -753,10 +744,6 @@ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(dialog->remember_pass_check), gaim_account_get_remember_password(dialog->account)); - - gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON(dialog->auto_login_check), - gaim_account_get_auto_login(dialog->account, GAIM_GTK_UI)); } if (dialog->prpl_info != NULL && @@ -1354,11 +1341,6 @@ gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(dialog->new_mail_check))); - /* Auto Login */ - gaim_account_set_auto_login(dialog->account, GAIM_GTK_UI, - gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(dialog->auto_login_check))); - /* Password */ value = gtk_entry_get_text(GTK_ENTRY(dialog->password_entry)); @@ -1762,12 +1744,11 @@ if (!gaim_account_is_connected(account)) gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); } - gtk_list_store_set(dialog->model, &iter, - COLUMN_ICON, scale, - COLUMN_ONLINE, gaim_account_is_connected(account), - COLUMN_PULSE_DATA, NULL, - -1); + COLUMN_ICON, scale, + COLUMN_PULSE_DATA, NULL, + -1); + if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); if (scale != NULL) g_object_unref(G_OBJECT(scale)); @@ -2035,84 +2016,27 @@ gaim_gtk_accounts_window_hide(); } -static void -online_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) -{ - AccountsWindow *dialog = (AccountsWindow *)data; - GaimAccount *account; - GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); - GtkTreeIter iter; - GaimGtkPulseData *pulse_data; - gboolean online; - - gtk_tree_model_get_iter_from_string(model, &iter, path_str); - gtk_tree_model_get(model, &iter, - COLUMN_DATA, &account, - COLUMN_ONLINE, &online, - -1); - - if (online) - { - account->gc->wants_to_die = TRUE; - gaim_account_disconnect(account); - } - else - { - GdkPixbuf *pixbuf; - - pulse_data = g_new0(GaimGtkPulseData, 1); - pulse_data->pulse_to_grey = TRUE; - pulse_data->pulse_value = 0; - pulse_data->account = account; - pulse_data->model = model; - - pixbuf = create_prpl_icon(account); - - if (pixbuf != NULL) - { - pulse_data->online_pixbuf = - gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); - - g_object_unref(G_OBJECT(pixbuf)); - } - - if (pulse_data->online_pixbuf == NULL) - { - g_free(pulse_data); - } - else - { - pulse_data->timeout = g_timeout_add(100, - (GSourceFunc)account_pulse_update, pulse_data); - - gtk_list_store_set(GTK_LIST_STORE(model), &iter, - COLUMN_PULSE_DATA, pulse_data, -1); - } - - gaim_account_connect(account); - } -} static void -autologin_cb(GtkCellRendererToggle *renderer, gchar *path_str, +enabled_cb(GtkCellRendererToggle *renderer, gchar *path_str, gpointer data) { AccountsWindow *dialog = (AccountsWindow *)data; GaimAccount *account; GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); GtkTreeIter iter; - gboolean autologin; + gboolean enabled; gtk_tree_model_get_iter_from_string(model, &iter, path_str); gtk_tree_model_get(model, &iter, COLUMN_DATA, &account, - COLUMN_AUTOLOGIN, &autologin, + COLUMN_ENABLED, &enabled, -1); - gaim_account_set_auto_login(account, GAIM_GTK_UI, !autologin); + gaim_account_set_enabled(account, GAIM_GTK_UI, !enabled); gtk_list_store_set(dialog->model, &iter, - COLUMN_AUTOLOGIN, !autologin, + COLUMN_ENABLED, !enabled, -1); } @@ -2141,28 +2065,14 @@ "text", COLUMN_SCREENNAME); dialog->screenname_col = column; - /* Online? */ + /* Enabled */ renderer = gtk_cell_renderer_toggle_new(); g_signal_connect(G_OBJECT(renderer), "toggled", - G_CALLBACK(online_cb), dialog); - - gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), - -1, _("Online"), - renderer, - "active", COLUMN_ONLINE, - NULL); - column = gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), 1); - gtk_tree_view_column_set_resizable(column, TRUE); - - /* Auto Log In? */ - renderer = gtk_cell_renderer_toggle_new(); - - g_signal_connect(G_OBJECT(renderer), "toggled", - G_CALLBACK(autologin_cb), dialog); - - column = gtk_tree_view_column_new_with_attributes(_("Auto Log In"), - renderer, "active", COLUMN_AUTOLOGIN, NULL); + G_CALLBACK(enabled_cb), dialog); + + column = gtk_tree_view_column_new_with_attributes(_("Enabled"), + renderer, "active", COLUMN_ENABLED, NULL); gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); gtk_tree_view_column_set_resizable(column, TRUE); @@ -2200,8 +2110,7 @@ gtk_list_store_set(store, iter, COLUMN_ICON, scale, COLUMN_SCREENNAME, gaim_account_get_username(account), - COLUMN_ONLINE, gaim_account_is_connected(account), - COLUMN_AUTOLOGIN, gaim_account_get_auto_login(account, GAIM_GTK_UI), + COLUMN_ENABLED, gaim_account_get_enabled(account, GAIM_GTK_UI), COLUMN_PROTOCOL, gaim_account_get_protocol_name(account), COLUMN_DATA, account, -1); @@ -2275,8 +2184,7 @@ /* Create the list model. */ dialog->model = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, - G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, - G_TYPE_STRING, G_TYPE_POINTER, + G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER); /* And now the actual treeview */
--- a/src/gtkconn.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/gtkconn.c Sun Dec 19 20:32:32 2004 +0000 @@ -36,227 +36,29 @@ #include "gtkdialogs.h" #include "gtkutils.h" -/* - * The next couple of functions deal with the connection dialog - */ -struct login_meter { - GaimAccount *account; - GtkWidget *button; - GtkWidget *progress; - GtkWidget *status; -}; - -struct meter_window { - GtkWidget *window; - GtkWidget *table; - gint rows; - gint active_count; - GSList *meters; -}; -struct meter_window *meter_win = NULL; - -static void kill_meter(struct login_meter *meter, const char *text) -{ - if(gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(meter->progress)) == 1) - return; - - gtk_widget_set_sensitive(meter->button, FALSE); - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), 1); - gtk_label_set_text(GTK_LABEL(meter->status), text); - meter_win->active_count--; - - if (meter_win->active_count == 0) { - gtk_widget_destroy(meter_win->window); - g_free(meter_win); - meter_win = NULL; - } -} - -static void cancel_login(GtkWidget *button, struct login_meter *meter) -{ - if (meter->account->gc != NULL) { - meter->account->gc->wants_to_die = TRUE; - gaim_connection_destroy(meter->account->gc); - } else { - kill_meter(meter, _("Done.")); - - if (gaim_connections_get_all() == NULL) { - gaim_gtkdialogs_destroy_all(); - } - } -} - -static void cancel_all () -{ - GSList *m = meter_win ? meter_win->meters : NULL; - struct login_meter *meter; - - while (m) { - meter = m->data; - if (gaim_connection_get_state(meter->account->gc) != GAIM_CONNECTED) - cancel_login(NULL, meter); - m = m->next; - } -} - -static gint meter_destroy(GtkWidget *window, GdkEvent *evt, struct login_meter *meter) -{ - return TRUE; -} - -static struct login_meter *find_login_meter(GaimConnection *gc) -{ - GSList *m = meter_win ? meter_win->meters : NULL; - struct login_meter *meter; - - while (m) { - meter = m->data; - if (meter->account == gaim_connection_get_account(gc)) - return m->data; - m = m->next; - } - - return NULL; -} - -static GtkWidget* create_meter_pixmap (GaimConnection *gc) -{ - GdkPixbuf *pb = create_prpl_icon(gc->account); - GdkPixbuf *scale = gdk_pixbuf_scale_simple(pb, 30,30,GDK_INTERP_BILINEAR); - GtkWidget *image = - gtk_image_new_from_pixbuf(scale); - g_object_unref(G_OBJECT(pb)); - g_object_unref(G_OBJECT(scale)); - return image; -} - -static struct login_meter * -new_meter(GaimConnection *gc, GtkWidget *widget, - GtkWidget *table, gint *rows) -{ - GtkWidget *graphic; - GtkWidget *label; - GtkWidget *nest_vbox; - GString *name_to_print; - struct login_meter *meter; - - - meter = g_new0(struct login_meter, 1); - - meter->account = gaim_connection_get_account(gc); - name_to_print = g_string_new(gaim_account_get_username(meter->account)); - - (*rows)++; - gtk_table_resize (GTK_TABLE(table), *rows, 4); - - graphic = create_meter_pixmap(gc); - - nest_vbox = gtk_vbox_new (FALSE, 0); - - g_string_prepend(name_to_print, _("Logging in: ")); - label = gtk_label_new (name_to_print->str); - g_string_free(name_to_print, TRUE); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - - meter->status = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(meter->status), 0, 0.5); - gtk_widget_set_size_request(meter->status, 250, -1); - - meter->progress = gtk_progress_bar_new (); - - meter->button = gaim_pixbuf_button_from_stock (_("Cancel"), GTK_STOCK_CANCEL, GAIM_BUTTON_HORIZONTAL); - g_signal_connect(G_OBJECT (meter->button), "clicked", - G_CALLBACK (cancel_login), meter); - - gtk_table_attach (GTK_TABLE (table), graphic, 0, 1, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), nest_vbox, 1, 2, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (label), FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (nest_vbox), GTK_WIDGET (meter->status), FALSE, FALSE, 0); - gtk_table_attach (GTK_TABLE (table), meter->progress, 2, 3, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), meter->button, 3, 4, *rows, *rows+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - - gtk_widget_show_all (GTK_WIDGET (meter_win->window)); - - meter_win->active_count++; - - return meter; -} - static void gaim_gtk_connection_connect_progress(GaimConnection *gc, const char *text, size_t step, size_t step_count) { - struct login_meter *meter; - - if(!meter_win) { - GtkWidget *vbox; - GtkWidget *cancel_button; - - meter_win = g_new0(struct meter_window, 1); - meter_win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_resizable(GTK_WINDOW(meter_win->window), FALSE); - gtk_window_set_role(GTK_WINDOW(meter_win->window), "logging_in"); - gtk_container_set_border_width(GTK_CONTAINER(meter_win->window), 5); - gtk_window_set_title(GTK_WINDOW(meter_win->window), _("Logging In")); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_container_add(GTK_CONTAINER(meter_win->window), vbox); - - meter_win->table = gtk_table_new(1, 4, FALSE); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(meter_win->table), - FALSE, FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(meter_win->table), 5); - gtk_table_set_row_spacings(GTK_TABLE(meter_win->table), 5); - gtk_table_set_col_spacings(GTK_TABLE(meter_win->table), 10); - - cancel_button = gaim_pixbuf_button_from_stock(_("Cancel All"), - GTK_STOCK_QUIT, GAIM_BUTTON_HORIZONTAL); - g_signal_connect_swapped(G_OBJECT(cancel_button), "clicked", - G_CALLBACK(cancel_all), NULL); - gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(cancel_button), - FALSE, FALSE, 0); - - g_signal_connect(G_OBJECT(meter_win->window), "delete_event", - G_CALLBACK(meter_destroy), NULL); - } - - meter = find_login_meter(gc); - if(!meter) { - meter = new_meter(gc, meter_win->window, meter_win->table, - &meter_win->rows); - - meter_win->meters = g_slist_append(meter_win->meters, meter); - } - - gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(meter->progress), - (float)step / (float)step_count); - gtk_label_set_text(GTK_LABEL(meter->status), text); + /* SME - Pulse the statusselector */ } static void gaim_gtk_connection_connected(GaimConnection *gc) { - struct login_meter *meter = find_login_meter(gc); #if 0 /* XXX CORE/UI */ do_away_menu(); #endif gaim_gtk_blist_update_protocol_actions(); - if (meter) - kill_meter(meter, _("Done.")); } static void gaim_gtk_connection_disconnected(GaimConnection *gc) { - struct login_meter *meter = find_login_meter(gc); - #if 0 /* XXX CORE/UI */ do_away_menu(); #endif gaim_gtk_blist_update_protocol_actions(); - if (meter) - kill_meter(meter, _("Done.")); - if (gaim_connections_get_all() != NULL) return; @@ -409,7 +211,7 @@ l_accts_iter = l_accts; while (l_accts_iter != NULL) { account = l_accts_iter->data; - gaim_account_connect(account); + /* gaim_account_connect(account); */ l_accts_iter = l_accts_iter->next; } g_list_free(l_accts); @@ -466,7 +268,7 @@ g_list_free(l_del); } - gaim_account_connect(account); + /* gaim_account_connect(account); */ disconnect_window_update_buttons(model); break;
--- a/src/gtkgaim.h Sun Dec 19 17:35:59 2004 +0000 +++ b/src/gtkgaim.h Sun Dec 19 20:32:32 2004 +0000 @@ -31,6 +31,11 @@ #include <gtk/gtk.h> +/** + * Our UI's identifier. + */ +#define GAIM_GTK_UI "gtk-gaim" + #ifndef _WIN32 # define GAIM_ALERT_TITLE "" #else
--- a/src/gtkmain.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/gtkmain.c Sun Dec 19 20:32:32 2004 +0000 @@ -112,14 +112,14 @@ account = gaim_accounts_find(names[i], NULL); if (account != NULL) { /* found a user */ ret = 0; - gaim_account_connect(account); + //gaim_account_connect(account); } } g_strfreev(names); } else { /* no name given, use the first account */ account = (GaimAccount *)gaim_accounts_get_all()->data; ret = 0; - gaim_account_connect(account); + //gaim_account_connect(account); } return ret;
--- a/src/gtkstatusselector.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/gtkstatusselector.c Sun Dec 19 20:32:32 2004 +0000 @@ -183,14 +183,14 @@ g_signal_connect(G_OBJECT(entry), "key_press_event", G_CALLBACK(key_press_cb), selector); - +#if 0 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", selector, GAIM_CALLBACK(signed_on_off_cb), selector); gaim_signal_connect(gaim_connections_get_handle(), "signed-off", selector, GAIM_CALLBACK(signed_on_off_cb), selector); - +#endif rebuild_list(selector); } @@ -295,14 +295,16 @@ gtk_text_buffer_set_text(buffer, text, -1); - for (l = gaim_connections_get_all(); l != NULL; l = l->next) + for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { - GaimConnection *gc = (GaimConnection *)l->data; - GaimAccount *account = gaim_connection_get_account(gc); + GaimAccount *account = (GaimAccount*)l->data; GaimStatusType *status_type; + + if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) + continue; status_type = gaim_account_get_status_type(account, - status_type_id); + status_type_id); if (status_type == NULL) continue; @@ -314,8 +316,8 @@ else { gaim_account_set_status(account, - status_type_id, TRUE, - NULL); + status_type_id, TRUE, + NULL); } } @@ -353,11 +355,13 @@ message = gtk_imhtml_get_markup(GTK_IMHTML(selector->priv->entry)); - for (l = gaim_connections_get_all(); l != NULL; l = l->next) + for (l = gaim_accounts_get_all(); l != NULL; l = l->next) { - GaimConnection *gc = (GaimConnection *)l->data; - GaimAccount *account = gaim_connection_get_account(gc); + GaimAccount *account = (GaimAccount*)l->data; GaimStatusType *status_type; + + if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) + continue; status_type = gaim_account_get_status_type(account, status_type_id); @@ -493,6 +497,8 @@ rebuild_list(GaimGtkStatusSelector *selector) { gboolean single_prpl = TRUE; + GList *accounts; + gboolean enabled = FALSE; GaimAccount *first_account = NULL; const char *first_prpl_type = NULL; GList *l; @@ -510,10 +516,18 @@ #endif /* - * If no accounts are connected then gray ourself out and get + * If no accounts are enabled then gray ourself out and get * outta hee. */ - if (gaim_connections_get_all() == NULL) + for(accounts = gaim_accounts_get_all(); accounts; accounts = accounts->next) { + GaimAccount *a = accounts->data; + if (gaim_account_get_enabled(a, GAIM_GTK_UI)) { + enabled = TRUE; + break; + } + } + + if (enabled == FALSE) { gtk_widget_set_sensitive(GTK_WIDGET(selector), FALSE); return; @@ -526,14 +540,21 @@ * who use only one account, or one single protocol. Everyone else * gets Available and Away and a list of saved statuses. */ - for (l = gaim_connections_get_all(); l != NULL && single_prpl; l = l->next) + for (l = gaim_accounts_get_all(); l != NULL && single_prpl; l = l->next) { - GaimConnection *gc = (GaimConnection *)l->data; - GaimAccount *account = gaim_connection_get_account(gc); + GaimAccount *account = l->data; GaimPluginProtocolInfo *prpl_info; + GaimPlugin *plugin; const char *basename; - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); + if (!gaim_account_get_enabled(account, GAIM_GTK_UI)) + continue; + + plugin = gaim_find_prpl(account->protocol_id); + if (!plugin) + continue; + + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); basename = prpl_info->list_icon(account, NULL); if (first_prpl_type == NULL)
--- a/src/protocols/oscar/oscar.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/protocols/oscar/oscar.c Sun Dec 19 20:32:32 2004 +0000 @@ -1706,13 +1706,21 @@ ck[1] = 0x65; } -static void oscar_login(GaimAccount *account) { +static void oscar_login(GaimAccount *account, GaimStatus *status) { aim_session_t *sess; aim_conn_t *conn; GaimConnection *gc = gaim_account_get_connection(account); OscarData *od = gc->proto_data = g_new0(OscarData, 1); + GaimStatusType *status_type; + GaimStatusPrimitive primitive; + + status_type = gaim_status_get_type(status); + primitive = gaim_status_type_get_primitive(status_type); gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); + + if (primitive == GAIM_STATUS_OFFLINE) + return; if (!aim_snvalid(gaim_account_get_username(account))) { gchar *buf; @@ -5553,7 +5561,7 @@ oscar_set_status_aim(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); - OscarData *od = (OscarData *)gc->proto_data; + OscarData *od = NULL; GaimStatusType *status_type; GaimStatusPrimitive primitive; GaimPresence *presence; @@ -5568,15 +5576,21 @@ status_id = gaim_status_get_id(status); presence = gaim_account_get_presence(account); + if (!gaim_status_is_active(status)) /* Is this right? I'm confused. */ + return; + gaim_debug_info("oscar", "Setting status to %s\n", status_id); - if (od->rights.maxawaymsglen == 0) + if (gc) + od = (OscarData *)gc->proto_data; + + if (od && od->rights.maxawaymsglen == 0) gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), - _("You have probably requested to set your " - "away message before the login procedure " - "completed. You remain in a \"present\" " - "state; try setting it again when you are " - "fully connected.")); + _("You have probably requested to set your " + "away message before the login procedure " + "completed. You remain in a \"present\" " + "state; try setting it again when you are " + "fully connected.")); if (primitive == GAIM_STATUS_AVAILABLE) { aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); @@ -5681,13 +5695,20 @@ oscar_set_status(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); - OscarData *od = (OscarData *)gc->proto_data; - - if (od->icq) - oscar_set_status_icq(account, status); - else - oscar_set_status_aim(account, status); - + GaimStatusType *type = gaim_status_get_type(status); + int primitive = gaim_status_type_get_primitive(type); + + if (primitive == !GAIM_STATUS_OFFLINE && !gc) { + gaim_account_connect(account, status); + } else if (primitive == GAIM_STATUS_OFFLINE && gc) { + gaim_account_disconnect(account); + } else { + + if (aim_sn_is_icq(gaim_account_get_username(account))) + oscar_set_status_icq(account, status); + else + oscar_set_status_aim(account, status); + } return; } @@ -6868,12 +6889,12 @@ /* Oscar-common status types */ type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE, OSCAR_STATUS_ID_OFFLINE, - _("Offline"), FALSE, FALSE, FALSE); + _("Offline"), FALSE, TRUE, FALSE); status_types = g_list_append(status_types, type); type = gaim_status_type_new_full(GAIM_STATUS_ONLINE, OSCAR_STATUS_ID_ONLINE, - _("Online"), FALSE, FALSE, FALSE); + _("Online"), FALSE, TRUE, FALSE); status_types = g_list_append(status_types, type); type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE,
--- a/src/protocols/yahoo/yahoo.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Sun Dec 19 20:32:32 2004 +0000 @@ -1464,8 +1464,8 @@ sprintf(byte, "%c", delimit_lookup[lookup]); strcat(resp_96, byte); } - - pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); + printf("yahoo status : %d\n", yd->current_status); + pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, 0); yahoo_packet_hash(pack, "sssss", 0, name, 6, resp_6, 96, resp_96, 1, name, 135, "6,0,0,1710"); if (yd->picture_checksum) @@ -1997,7 +1997,7 @@ GaimConnection *gc = data; struct yahoo_data *yd; struct yahoo_packet *pkt; - + if (!g_list_find(gaim_connections_get_all(), gc)) { close(source); return; @@ -2010,7 +2010,7 @@ yd = gc->proto_data; yd->fd = source; - + pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0); yahoo_packet_hash_str(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc)))); @@ -2219,10 +2219,10 @@ } -static void yahoo_login(GaimAccount *account) { +static void yahoo_login(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); - + char *id = gaim_status_get_id(status); gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_URLDESC; gaim_connection_update_progress(gc, _("Connecting"), 1, 2); @@ -2233,7 +2233,39 @@ yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); yd->confs = NULL; yd->conf_id = 2; - + + if (!strcmp(id, YAHOO_STATUS_TYPE_AVAILABLE) || !strcmp(id, YAHOO_STATUS_TYPE_ONLINE)) { + yd->current_status = YAHOO_STATUS_AVAILABLE; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_BRB)) { + yd->current_status = YAHOO_STATUS_BRB; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_BUSY)) { + yd->current_status = YAHOO_STATUS_BUSY; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_NOTATHOME)) { + yd->current_status = YAHOO_STATUS_NOTATHOME; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_NOTATDESK)) { + yd->current_status = YAHOO_STATUS_NOTATDESK; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_NOTINOFFICE)) { + yd->current_status = YAHOO_STATUS_NOTINOFFICE; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_ONPHONE)) { + yd->current_status = YAHOO_STATUS_ONPHONE; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_ONVACATION)) { + yd->current_status = YAHOO_STATUS_ONVACATION; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) { + yd->current_status = YAHOO_STATUS_OUTTOLUNCH; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_STEPPEDOUT)) { + yd->current_status = YAHOO_STATUS_STEPPEDOUT; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_INVISIBLE)) { + yd->current_status = YAHOO_STATUS_INVISIBLE; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_AWAY)) { + yd->current_status = YAHOO_STATUS_CUSTOM; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_AVAILABLE_WM)) { + yd->current_status = YAHOO_STATUS_CUSTOM; + } else if (gc->is_idle) { /* i think this is broken */ + yd->current_status = YAHOO_STATUS_IDLE; + } else { + gaim_debug_error("yahoo", "Unexpected GaimStatus passed to yahoo_set_status!\n"); + yd->current_status = YAHOO_STATUS_AVAILABLE; + } yahoo_server_check(account); yahoo_picture_check(account); @@ -2695,14 +2727,26 @@ static void yahoo_set_status(GaimAccount *account, GaimStatus *status) { GaimConnection *gc = gaim_account_get_connection(account); - struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; + struct yahoo_data *yd; struct yahoo_packet *pkt; - int old_status = yd->current_status; + int old_status; const char *id; char *conv_msg = NULL; char *conv_msg2 = NULL; id = gaim_status_get_id(status); + if (!gaim_status_is_active(status)) + return; + if (strcmp(id, YAHOO_STATUS_TYPE_OFFLINE) && !gc) { + gaim_account_connect(account, status); + return; + } else if (!strcmp(id, YAHOO_STATUS_TYPE_OFFLINE) && gc) { + gaim_account_disconnect(account); + return; + } + + yd = (struct yahoo_data *)gc->proto_data; + old_status = yd->current_status; if (!strcmp(id, YAHOO_STATUS_TYPE_AVAILABLE)) { yd->current_status = YAHOO_STATUS_AVAILABLE; @@ -2733,7 +2777,7 @@ } else if (gc->is_idle) { /* i think this is broken */ yd->current_status = YAHOO_STATUS_IDLE; } else { - gaim_debug_error("yahoo", "Unexpected GaimStatus passed to yahoo_set_status!\n"); + gaim_debug_error("yahoo", "Unexpected GaimStatus passed to yahoo_login!\n"); yd->current_status = YAHOO_STATUS_AVAILABLE; } @@ -2827,10 +2871,10 @@ if (gc) yd = gc->proto_data; - type = gaim_status_type_new(GAIM_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, _("Offline"), FALSE); + type = gaim_status_type_new(GAIM_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, _("Offline"), TRUE); types = g_list_append(types, type); - type = gaim_status_type_new(GAIM_STATUS_ONLINE, YAHOO_STATUS_TYPE_ONLINE, _("Online"), FALSE); + type = gaim_status_type_new(GAIM_STATUS_ONLINE, YAHOO_STATUS_TYPE_ONLINE, _("Online"), TRUE); types = g_list_append(types, type); type = gaim_status_type_new(GAIM_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, _("Available"), TRUE);
--- a/src/prpl.h Sun Dec 19 17:35:59 2004 +0000 +++ b/src/prpl.h Sun Dec 19 20:32:32 2004 +0000 @@ -210,7 +210,7 @@ /* All the server-related functions */ /** This must be implemented. */ - void (*login)(GaimAccount *); + void (*login)(GaimAccount *, GaimStatus *); /** This must be implemented. */ void (*close)(GaimConnection *);
--- a/src/server.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/server.c Sun Dec 19 20:32:32 2004 +0000 @@ -44,7 +44,7 @@ #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" -void serv_login(GaimAccount *account) +void serv_login(GaimAccount *account, GaimStatus *status) { GaimPlugin *p = gaim_find_prpl(gaim_account_get_protocol_id(account)); GaimPluginProtocolInfo *prpl_info = NULL; @@ -70,7 +70,7 @@ gaim_signal_emit(gaim_accounts_get_handle(), "account-connecting", account); - prpl_info->login(account); + prpl_info->login(account, status); } }
--- a/src/server.h Sun Dec 19 17:35:59 2004 +0000 +++ b/src/server.h Sun Dec 19 20:32:32 2004 +0000 @@ -33,7 +33,7 @@ extern "C" { #endif -void serv_login(GaimAccount *); +void serv_login(GaimAccount *, GaimStatus *); void serv_close(GaimConnection *); void serv_touch_idle(GaimConnection *); int serv_send_im(GaimConnection *, const char *, const char *, GaimConvImFlags);
--- a/src/status.c Sun Dec 19 17:35:59 2004 +0000 +++ b/src/status.c Sun Dec 19 20:32:32 2004 +0000 @@ -25,6 +25,7 @@ #include "internal.h" #include "blist.h" +#include "core.h" #include "debug.h" #include "notify.h" #include "prefs.h" @@ -639,7 +640,7 @@ GaimAccount *account = gaim_presence_get_account(presence); GaimAccountUiOps *ops = gaim_accounts_get_ui_ops(); - if (gaim_account_is_connected(account)) + if (gaim_account_get_enabled(account, gaim_core_get_ui())) { GaimPluginProtocolInfo *prpl_info = NULL; GaimPlugin *prpl;