diff gtk/gtkconn.c @ 14696:34083fe39891

[gaim-migrate @ 17448] From Paul Betts, NetworkManager integration. This will smartly disconnect and reconnect accounts according to network availability. Probably needs some more tweaking. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 08 Oct 2006 08:40:09 +0000
parents 009db0b357b5
children 05c34aabdcc3
line wrap: on
line diff
--- a/gtk/gtkconn.c	Sun Oct 08 04:31:39 2006 +0000
+++ b/gtk/gtkconn.c	Sun Oct 08 08:40:09 2006 +0000
@@ -101,13 +101,6 @@
 }
 
 static void
-gaim_gtk_connection_notice(GaimConnection *gc,
-		const char *text)
-{
-}
-
-
-static void
 free_auto_recon(gpointer data)
 {
 	GaimAutoRecon *info = data;
@@ -201,6 +194,32 @@
 	}
 }
 
+static void gaim_gtk_connection_network_connected () 
+{
+	GList *list = gaim_accounts_get_all_active();
+	while (list) {
+		GaimAccount *account = (GaimAccount*)list->data;
+		GaimAutoRecon *info = g_hash_table_lookup(hash, account);
+		if (info)
+			free_auto_recon(info);
+		do_signon(account);
+		list = list->next;
+ 	}
+}
+
+static void gaim_gtk_connection_network_disconnected () 
+{
+	GList *l = gaim_accounts_get_all_active();
+	while (l) {
+		GaimAccount *a = (GaimAccount*)l->data;
+		gaim_account_disconnect(a);
+		l = l->next;
+	}
+}
+
+static void gaim_gtk_connection_notice(GaimConnection *gc, const char *text)
+{ }
+
 static GaimConnectionUiOps conn_ui_ops =
 {
 	gaim_gtk_connection_connect_progress,
@@ -208,6 +227,8 @@
 	gaim_gtk_connection_disconnected,
 	gaim_gtk_connection_notice,
 	gaim_gtk_connection_report_disconnect,
+	gaim_gtk_connection_network_connected,
+	gaim_gtk_connection_network_disconnected
 };
 
 GaimConnectionUiOps *