# HG changeset patch # User Christian Hammond # Date 1060814441 0 # Node ID ff4551719cc7b59fca0b30ee3b856a8e9a7ca536 # Parent b52870734c21a0a26d129c0ae98c428db51fb636 [gaim-migrate @ 6969] I almost hate to do this in a way, but I added another connection UI op specifically for reporting disconnects, so that it's no longer in the core. This will let UIs display a disconnect in ways other than an error dialog, or allow plugins to turn off disconnect notifications. committer: Tailor Script diff -r b52870734c21 -r ff4551719cc7 src/connection.c --- a/src/connection.c Wed Aug 13 22:02:50 2003 +0000 +++ b/src/connection.c Wed Aug 13 22:40:41 2003 +0000 @@ -316,7 +316,7 @@ } else if (gc->state == GAIM_DISCONNECTED) { if (ops != NULL && ops->disconnected != NULL) - ops->disconnected(gc, NULL); + ops->disconnected(gc); } } @@ -399,27 +399,23 @@ gaim_connection_error(GaimConnection *gc, const char *text) { GaimConnectionUiOps *ops; - gchar *primary, *secondary; g_return_if_fail(gc != NULL); g_return_if_fail(text != NULL); /* If we've already got one error, we don't need any more */ - if(gc->disconnect_timeout) + if (gc->disconnect_timeout) return; - primary = g_strdup_printf(_("%s has been disconnected"), - gaim_account_get_username(gaim_connection_get_account(gc))); - secondary = g_strdup_printf("%s\n%s", full_date(), - text ? text : _("Reason Unknown.")); - gaim_notify_error(NULL, _("Connection Error"), primary, secondary); - g_free(primary); - g_free(secondary); - ops = gaim_get_connection_ui_ops(); - if (ops != NULL && ops->disconnected != NULL) - ops->disconnected(gc, text); + if (ops != NULL) { + if (ops->report_disconnect != NULL) + ops->report_disconnect(gc, text); + + if (ops->disconnected != NULL) + ops->disconnected(gc); + } gc->disconnect_timeout = g_timeout_add(0, gaim_connection_disconnect_cb, gaim_connection_get_account(gc)); diff -r b52870734c21 -r ff4551719cc7 src/connection.h --- a/src/connection.h Wed Aug 13 22:02:50 2003 +0000 +++ b/src/connection.h Wed Aug 13 22:40:41 2003 +0000 @@ -5,7 +5,7 @@ * gaim * * Copyright (C) 2003 Christian Hammond - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -48,8 +48,9 @@ void (*connect_progress)(GaimConnection *gc, const char *text, size_t step, size_t step_count); void (*connected)(GaimConnection *gc); - void (*disconnected)(GaimConnection *gc, const char *reason); + void (*disconnected)(GaimConnection *gc); void (*notice)(GaimConnection *gc, const char *text); + void (*report_disconnect)(GaimConnection *gc, const char *text); } GaimConnectionUiOps; diff -r b52870734c21 -r ff4551719cc7 src/gtkconn.c --- a/src/gtkconn.c Wed Aug 13 22:02:50 2003 +0000 +++ b/src/gtkconn.c Wed Aug 13 22:40:41 2003 +0000 @@ -16,12 +16,12 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #include "gtkinternal.h" #include "account.h" #include "debug.h" +#include "notify.h" #include "prefs.h" #include "util.h" @@ -241,8 +241,7 @@ kill_meter(meter, _("Done.")); } -static void gaim_gtk_connection_disconnected(GaimConnection *gc, - const char *reason) +static void gaim_gtk_connection_disconnected(GaimConnection *gc) { struct signon_meter *meter = find_signon_meter(gc); @@ -267,12 +266,27 @@ { } +static void +gaim_gtk_connection_report_disconnect(GaimConnection *gc, const char *text) +{ + gchar *primary, *secondary; + + primary = g_strdup_printf(_("%s has been disconnected"), + gaim_account_get_username(gaim_connection_get_account(gc))); + secondary = g_strdup_printf("%s\n%s", full_date(), + text ? text : _("Reason Unknown.")); + gaim_notify_error(NULL, _("Connection Error"), primary, secondary); + g_free(primary); + g_free(secondary); +} + static GaimConnectionUiOps conn_ui_ops = { gaim_gtk_connection_connect_progress, gaim_gtk_connection_connected, gaim_gtk_connection_disconnected, - gaim_gtk_connection_notice + gaim_gtk_connection_notice, + gaim_gtk_connection_report_disconnect }; GaimConnectionUiOps *gaim_get_gtk_connection_ui_ops(void) diff -r b52870734c21 -r ff4551719cc7 src/gtkconv.c --- a/src/gtkconv.c Wed Aug 13 22:02:50 2003 +0000 +++ b/src/gtkconv.c Wed Aug 13 22:40:41 2003 +0000 @@ -3804,8 +3804,6 @@ gboolean new_ui; GaimConversationType conv_type; const char *name; - struct buddy *b = NULL; - GaimAccount *account; name = gaim_conversation_get_name(conv); conv_type = gaim_conversation_get_type(conv); diff -r b52870734c21 -r ff4551719cc7 src/prpl.c --- a/src/prpl.c Wed Aug 13 22:02:50 2003 +0000 +++ b/src/prpl.c Wed Aug 13 22:40:41 2003 +0000 @@ -2,7 +2,7 @@ * gaim * * Copyright (C) 1998-1999, Mark Spencer - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or