changeset 1153:3063e6743913

[gaim-migrate @ 1163] handle the keepalives better. have ICQ force keepalives for connections, it's a bad hack but it's probably necessary for a UDP protocol. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 28 Nov 2000 04:12:06 +0000
parents 201ec77f3a60
children 938d9cd76148
files Makefile.am plugins/icq/gaim_icq.c src/multi.c src/multi.h src/oscar.c src/server.c src/toc.c
diffstat 7 files changed, 14 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Tue Nov 28 02:22:42 2000 +0000
+++ b/Makefile.am	Tue Nov 28 04:12:06 2000 +0000
@@ -1,5 +1,5 @@
 
-EXTRA_DIST = gaim.spec.in gaim_applet.gnorba gaim.desktop gaim_applet.desktop gaim.soundlist \
+EXTRA_DIST = gaim.spec.in gaim_applet.gnorba gaim.desktop gaim_applet.desktop \
 	buddytrans buddytrans2 README.plugins HACKING
 
 if GNOMEAPPLET
--- a/plugins/icq/gaim_icq.c	Tue Nov 28 02:22:42 2000 +0000
+++ b/plugins/icq/gaim_icq.c	Tue Nov 28 04:12:06 2000 +0000
@@ -56,6 +56,7 @@
 	struct icq_data *id = (struct icq_data *)gc->proto_data;
 	debug_printf("%s is now online.\n", gc->username);
 	account_online(gc);
+	gc->options |= OPT_USR_KEEPALV;
 	serv_finish_login(gc);
 
 	if (bud_list_cache_exists(gc))
--- a/src/multi.c	Tue Nov 28 02:22:42 2000 +0000
+++ b/src/multi.c	Tue Nov 28 04:12:06 2000 +0000
@@ -55,7 +55,8 @@
 	gc->prpl = find_prpl(user->protocol);
 	g_snprintf(gc->username, sizeof(gc->username), "%s", user->username);
 	g_snprintf(gc->password, sizeof(gc->password), "%s", user->password);
-	gc->keepalive = -1;
+	gc->options = user->options;
+	gc->keepalive = 0;
 	gc->inpa = -1;
 	gc->buddy_chats = NULL;
 	gc->groups = NULL;
--- a/src/multi.h	Tue Nov 28 02:22:42 2000 +0000
+++ b/src/multi.h	Tue Nov 28 04:12:06 2000 +0000
@@ -54,10 +54,10 @@
 	char password[32];
 	char g_screenname[64];
 	int options; /* same as aim_user options */
-	int keepalive;
+	guint keepalive;
 	int correction_time;
 	/* stuff needed for per-connection idle times */
-	int idle_timer;
+	guint idle_timer;
 	time_t login_time;
 	time_t lastsent;
 	int is_idle;
--- a/src/oscar.c	Tue Nov 28 02:22:42 2000 +0000
+++ b/src/oscar.c	Tue Nov 28 04:12:06 2000 +0000
@@ -383,9 +383,6 @@
 	gc->inpa = gdk_input_add(conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
 			oscar_callback, conn);
 
-	gc->options = user->options;
-	save_prefs(); /* is this necessary anymore? */
-
 	debug_print(_("Password sent, waiting for response\n"));
 }
 
@@ -1014,9 +1011,6 @@
 		do_error_dialog(_("Your connection may be lost."),
 				_("AOL error"));
 
-	if (gc->keepalive < 0)
-		update_keepalive(gc, gc->keepalive);
-
 	return 1;
 }
 
--- a/src/server.c	Tue Nov 28 02:22:42 2000 +0000
+++ b/src/server.c	Tue Nov 28 04:12:06 2000 +0000
@@ -67,11 +67,11 @@
 
 	if (gc->idle_timer > 0)
 		gtk_timeout_remove(gc->idle_timer);
-        gc->idle_timer = -1;
+        gc->idle_timer = 0;
 
 	if (gc->keepalive > 0)
 		gtk_timeout_remove(gc->keepalive);
-	gc->keepalive = -1;
+	gc->keepalive = 0;
 
 	if (gc->prpl && gc->prpl->close)
 		(*gc->prpl->close)(gc);
@@ -111,6 +111,8 @@
         time(&gc->login_time);
 
         serv_add_buddy(gc, gc->username);
+
+	update_keepalive(gc, gc->options & OPT_USR_KEEPALV);
 }
 
 
@@ -704,18 +706,17 @@
 
 void send_keepalive(gpointer d) {
 	struct gaim_connection *gc = (struct gaim_connection *)d;
-	debug_print("sending oscar NOP\n");
 	if (gc->prpl && gc->prpl->keepalive)
 		(*gc->prpl->keepalive)(gc);
 }
 
 void update_keepalive(struct gaim_connection *gc, gboolean on) {
-	if (on && gc->keepalive < 0 && blist) {
+	if (on && !gc->keepalive && blist) {
 		debug_print("allowing NOP\n");
 		gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc);
-	} else if (!on && gc->keepalive > -1) {
+	} else if (!on && gc->keepalive > 0) {
 		debug_print("removing NOP\n");
 		gtk_timeout_remove(gc->keepalive);
-		gc->keepalive = -1;
+		gc->keepalive = 0;
 	}
 }
--- a/src/toc.c	Tue Nov 28 02:22:42 2000 +0000
+++ b/src/toc.c	Tue Nov 28 04:12:06 2000 +0000
@@ -47,7 +47,7 @@
 #include "pixmaps/dt_icon.xpm"
 #include "pixmaps/free_icon.xpm"
 
-#define REVISION "gaim:$Revision: 1156 $"
+#define REVISION "gaim:$Revision: 1163 $"
 
 #define TYPE_SIGNON    1
 #define TYPE_DATA      2
@@ -311,7 +311,6 @@
 		 * version of the config and then the toc_init_done message. we'll come back to
 		 * the callback in a better state if we get CONFIG anyway */
 
-		gc->options = gc->user->options;
 		tdt->state = STATE_ONLINE;
 
 		account_online(gc);
@@ -328,9 +327,6 @@
 			FILE_SEND_UID, FILE_GET_UID, B_ICON_UID, IMAGE_UID, VOICE_UID);
 		sflap_send(gc, snd, -1, TYPE_DATA);
 
-		if (gc->keepalive < 0)
-			update_keepalive(gc, gc->options & OPT_USR_KEEPALV);
-
 		return;
 	}