ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.8,1.9


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.8,1.9
Date: Sat, 04 Jan 2003 14:54:54 -0500

Update of /cvsroot/ayttm/ayttm/modules/msn2
In directory subversions:/tmp/cvs-serv30164/modules/msn2

Modified Files:
        msn.C 
Log Message:
try to fix the infinite loop


Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- msn.C       4 Jan 2003 13:59:27 -0000       1.8
+++ msn.C       4 Jan 2003 19:54:51 -0000       1.9
@@ -100,6 +100,8 @@
 
 llist * chatrooms=NULL;
 llist * transfer_windows = NULL;
+llist * waiting_auth_callbacks = NULL;
+
 eb_chat_room * eb_msn_get_chat_room(msnconn * conn);
 void eb_msn_clean_up_chat_room(msnconn * conn);
 char * realloc_cpp(char * s);
@@ -485,7 +487,7 @@
 void eb_msn_logout( eb_local_account * account );
 static void eb_msn_authorize_callback( gpointer data, int response );
 static void eb_msn_filetrans_callback( gpointer data, int response );
-static void eb_msn_authorize_user ( char * username, char * friendlyname );
+static int eb_msn_authorize_user ( char * username, char * friendlyname );
 static void eb_msn_filetrans_accept(char * filename, void * invitation);
 
 
@@ -854,7 +856,7 @@
   char * username;
   username = (char *) data;
   eb_account *ac = find_account_by_handle(username,SERVICE_INFO.protocol_id);
-
+  eb_debug(DBG_MOD,"entering authorize_callback\n");
   if(response) {
     if (ac == NULL) {
       ac = eb_msn_new_account(username);
@@ -868,7 +870,8 @@
         eb_debug(DBG_MOD, "User (%s) not authorized - removing 
account\n",username);
         remove_account(ac);
      }      
-  }      
+  }
+  msn_del_from_llist(waiting_auth_callbacks, (llist_data *)username);    
 }
 
 void ext_update_contact(char *username) {
@@ -1109,15 +1112,34 @@
   room->protocol_local_chat_room_data=NULL; // (got cleaned up by the above 
line)
 }
 
-static void eb_msn_authorize_user (char * username, char * friendlyname)
+int is_waiting_auth(char *name) 
+{
+  llist * l=waiting_auth_callbacks;
+
+  while(l!=NULL)
+  {
+    char * n=(char *)l->data;
+    if(!strcmp(n,name))
+               return 1;
+    l=l->next;
+  }
+  return 0;    
+}
+
+static int eb_msn_authorize_user (char * username, char * friendlyname)
 {
   char dialog_message[1025];
   char *uname;
-  eb_debug(DBG_MOD, "** %s (%s) has added you to their list.\n", friendlyname, 
username);
-  sprintf(dialog_message, _("The MSN user %s (%s) would like to add you to 
their contact list.\nDo you want to allow them to see when you are online?"), 
friendlyname, username);
-
-  uname = strdup(username);
-  eb_do_dialog(dialog_message, _("Authorize MSN User"), 
eb_msn_authorize_callback, (gpointer)uname );
+  eb_debug(DBG_MOD,"entering authorize_user\n");
+  if(!is_waiting_auth(username)) {
+         eb_debug(DBG_MOD, "** %s (%s) has added you to their list.\n", 
friendlyname, username);
+         sprintf(dialog_message, _("The MSN user %s (%s) would like to add you 
to their contact list.\nDo you want to allow them to see when you are 
online?"), friendlyname, username);
+
+         uname = strdup(username);
+         msn_add_to_llist(waiting_auth_callbacks, (llist_data *)uname);
+         eb_do_dialog(dialog_message, _("Authorize MSN User"), 
eb_msn_authorize_callback, (gpointer)uname );
+         return 1;
+  } else return 0;      
 }
 
 eb_chat_room * eb_msn_make_chat_room( gchar * name, eb_local_account * account 
)
@@ -1309,10 +1331,10 @@
   eb_debug(DBG_MOD, "Your BLP value is now %cL\n", c);
 }
 
-void ext_new_RL_entry(msnconn * conn, char * username, char * friendlyname)
+int ext_new_RL_entry(msnconn * conn, char * username, char * friendlyname)
 {
   eb_debug(DBG_MOD, "%s (%s) has added you to their contact list.\nYou might 
want to add them to your Allow or Block list\n", username, friendlyname);
-  eb_msn_authorize_user(username, friendlyname);
+  return eb_msn_authorize_user(username, friendlyname);
 }
 
 void ext_new_list_entry(msnconn * conn, char * list, char * username)
@@ -1939,6 +1961,7 @@
         delete msg->body;
         msg->body=g_realloc_cpp(retval);
 }
+
 
 eb_chat_room * eb_msn_get_chat_room(msnconn * conn)
 {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]