changeset 84:51943f1a97a0

[gaim-migrate @ 94] Changed how some of the applet away and callbacks work so that you can't open the buddy list or be away without signing on first. Also made it so you can't try to sign on *while* signing on, by clicking "signon" while already signing on. Apparently, this had caused segfaults and other bad things to happen to some people. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 05 Apr 2000 21:46:07 +0000
parents 8a98f129c849
children 2cae618a91e2
files src/aim.c src/away.c src/buddy.c src/dialogs.c src/gaimrc.c src/gnome_applet_mgr.c src/prefs.c
diffstat 7 files changed, 36 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/aim.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/aim.c	Wed Apr 05 21:46:07 2000 +0000
@@ -111,6 +111,7 @@
 
 void dologin(GtkWidget *widget, GtkWidget *w)
 {
+	static gboolean running = FALSE;
 	char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry));
         char *password = gtk_entry_get_text(GTK_ENTRY(pass));
 
@@ -131,11 +132,29 @@
 	setUserState(signing_on);
 #endif /* USE_APPLET */
 
+	if (running) return;
+	running = TRUE;
 
-        if (serv_login(username, password) < 0)
+        if (serv_login(username, password) < 0) {
+		running = FALSE;
                 return;
+	}
 
-        return;
+#ifdef USE_APPLET
+	 applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon");
+	 applet_widget_register_callback(APPLET_WIDGET(applet),
+			 "buddy",
+			 _("Buddy List"),
+			 (AppletCallbackFunc)make_buddy,
+			 NULL);
+	 applet_widget_register_callback(APPLET_WIDGET(applet),
+			 "signoff",
+			 _("Signoff"),
+			 signoff,
+			 NULL);
+#endif
+	 running = FALSE;
+	 return;
 }
 
 
--- a/src/away.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/away.c	Wed Apr 05 21:46:07 2000 +0000
@@ -33,6 +33,9 @@
 #include "gaim.h"
 
 static GtkWidget *imaway=NULL;
+#ifdef USE_APPLET
+extern enum gaim_user_states MRI_user_status;
+#endif
 
 GtkWidget *awaymenu;
 struct away_message *awaymessage = NULL;
@@ -56,6 +59,7 @@
       		        (AppletCallbackFunc)make_buddy,
                 	NULL);
 	}
+  MRI_user_status = online;
   insert_applet_away();
 #endif /* USE_APPLET */
 	if (imaway) {
@@ -93,6 +97,7 @@
                                         _("Back"),
                                         (AppletCallbackFunc) do_im_back,
                                         NULL);
+	MRI_user_status = away;
 #endif
 
 	if (!imaway) {
--- a/src/buddy.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/buddy.c	Wed Apr 05 21:46:07 2000 +0000
@@ -22,6 +22,7 @@
 #ifdef USE_APPLET
 #include <gnome.h>
 #include <applet-widget.h>
+#include "gnome_applet_mgr.h"
 #endif /* USE_APPLET */
 #include <string.h>
 #include <stdio.h>
@@ -299,6 +300,7 @@
 #endif
 
 
+extern enum gaim_user_states MRI_user_status;
 void signoff()
 {
 	GList *mem;
@@ -317,6 +319,7 @@
         destroy_buddy();
         hide_login_progress("");
 #ifdef USE_APPLET
+	MRI_user_status = offline;
         set_applet_draw_closed();
         applet_widget_unregister_callback(APPLET_WIDGET(applet),"signoff");
 	remove_applet_away();
--- a/src/dialogs.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/dialogs.c	Wed Apr 05 21:46:07 2000 +0000
@@ -290,6 +290,8 @@
         g_list_free(dialogwindows);
         dialogwindows = NULL;
 
+	do_im_back(NULL, NULL);
+
         if (imdialog) {
                 destroy_dialog(NULL, imdialog);
                 imdialog = NULL;
--- a/src/gaimrc.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/gaimrc.c	Wed Apr 05 21:46:07 2000 +0000
@@ -32,7 +32,7 @@
 #include "gaim.h"
 #include "proxy.h"
 
-#if USE_APPLET
+#ifdef USE_APPLET
 #include "gnome_applet_mgr.h"
 #endif
 
--- a/src/gnome_applet_mgr.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/gnome_applet_mgr.c	Wed Apr 05 21:46:07 2000 +0000
@@ -268,6 +268,7 @@
 
 void applet_show_login(AppletWidget *widget, gpointer data) {
         show_login();
+	/*
         applet_widget_unregister_callback(APPLET_WIDGET(applet),"signon");
         applet_widget_register_callback(APPLET_WIDGET(applet),
                 "signoff",
@@ -280,6 +281,7 @@
                 _("Buddy List"),
                 (AppletCallbackFunc)make_buddy,
                 NULL);
+	*/
 }
 
 void insert_applet_away() {
@@ -312,8 +314,6 @@
 		awy = awy->next;
 		free(awayname);
 	}
-
-	MRI_user_status = online;
 }
 
 void remove_applet_away() {
@@ -337,8 +337,6 @@
 	}
 	applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away/");
 	applet_widget_unregister_callback(APPLET_WIDGET(applet), "away");
-
-	MRI_user_status = away;
 }
 
 /***************************************************************
--- a/src/prefs.c	Wed Apr 05 09:20:25 2000 +0000
+++ b/src/prefs.c	Wed Apr 05 21:46:07 2000 +0000
@@ -105,7 +105,7 @@
 
 	if (blist) update_button_pix();
 
-#if USE_APPLET
+#ifdef USE_APPLET
 	update_pixmaps();
 #endif
 
@@ -712,7 +712,7 @@
 	gaim_button("Transparent text window (experimental)", &transparent, appbox );
 #endif
 	gaim_button("Show logon/logoffs in conversation windows", &display_options, OPT_DISP_SHOW_LOGON, appbox );
-#if USE_APPLET
+#ifdef USE_APPLET
 	gaim_button("Use devil icons in applet", &display_options, OPT_DISP_DEVIL_PIXMAPS, appbox );
 #endif