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.1.1.1,1.2


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.1.1.1,1.2
Date: Tue, 31 Dec 2002 06:41:35 -0500

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

Modified Files:
        msn.C 
Log Message:
connection check for msn


Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- msn.C       23 Dec 2002 22:04:57 -0000      1.1.1.1
+++ msn.C       31 Dec 2002 11:41:33 -0000      1.2
@@ -119,6 +119,8 @@
 static char *StrToUtf8(char *in);
 void eb_msn_format_message (message * msg);
 static char *eb_msn_get_color(void) { static char color[]="#aa0000"; return 
color; }
+void close_conn(msnconn *conn);
+               
 GList *eb_msn_get_smileys(void) { return psmileys; }
 }
 
@@ -134,6 +136,9 @@
 static char msn_server[MAX_PREF_LEN] = "messenger.hotmail.com";
 static char msn_port[MAX_PREF_LEN] = "1863";
 
+/* hack to check conn */
+static int waiting_ans = 0;
+
 static int do_mail_notify = 1;
 static int do_mail_notify_show = 1;
 static int do_mail_notify_folders = 0;
@@ -469,12 +474,32 @@
 gboolean eb_msn_query_connected( eb_account * account )
 {
     eb_msn_account_data * mad = (eb_msn_account_data 
*)account->protocol_account_data;
-
+    eb_debug(DBG_MOD,"msn ref_count=%d\n",ref_count);
     if(ref_count <= 0 )
         mad->status = MSN_OFFLINE;
     return mad->status != MSN_OFFLINE;
 }
 
+static int conncheck_handler = -1;
+
+static int checkconn(msnconn *conn) {
+       int status;
+       eb_debug(DBG_MOD, "msn: checking conn\n");
+       if(waiting_ans == 1) {
+               eb_debug(DBG_MOD, "msn conn closed !(no answer to fname 
set)\n");
+               close_conn(conn);
+       }
+       if(fname_pref[0]!='\0') {
+               status = msn_set_friendlyname(conn, fname_pref); 
+               waiting_ans = 1;
+       }
+       if (status == 0) {
+               eb_debug(DBG_MOD, "conn closed... :(\n");
+               close_conn(conn);
+       }
+       return 1;
+}
+
 void eb_msn_login( eb_local_account * account )
 {
        eb_msn_local_account_data * mlad;
@@ -502,6 +527,10 @@
        }
        account->connected=1;
        mlad->status=MSN_ONLINE;
+       /* hack to check conn status */
+        if (conncheck_handler == -1)
+           conncheck_handler = gtk_timeout_add(10000, (GtkFunction)checkconn, 
(gpointer)mlad->mc);
+
 }
 
 void eb_msn_logout( eb_local_account * account )
@@ -527,7 +556,9 @@
                msn_clean_up(mlad->mc);
                mlad->mc=NULL;
        }
-       ref_count--;
+       mainconn = NULL;
+       if(ref_count >0)
+               ref_count--;
 }
 
 int eb_msn_send_typing( eb_local_account * from, eb_account * account_to )
@@ -1203,9 +1234,17 @@
   local_account_name=((authdata_NS *)conn->auth)->username;
   ela = find_local_account_by_handle(local_account_name, 
SERVICE_INFO.protocol_id);
   strncpy(ela->alias, friendlyname, 255);
-
+  waiting_ans = 0;
   if(fname_pref[0]=='\0')
   { strncpy(fname_pref, friendlyname, MAX_PREF_LEN); }
+  
+  if(!ela->connected) {
+         printf("not connected, shouldn't get it\n");
+         ela->connected = 1;
+         close_conn(conn);
+         msn_clean_up(conn);
+         mainconn = NULL;
+  }
 }
 
 void ext_got_info(msnconn * conn, syncinfo * info)
@@ -1600,7 +1639,6 @@
      eb_update_status(ea, _("typing..."));
 }
 
-
 void ext_new_connection(msnconn * conn)
 {
   if(conn->type==CONN_NS)
@@ -1609,6 +1647,7 @@
     // Currently, no caching implemented (*thinks to self - how about 
$HOME/.everybuddy/contacts?*)
     // ---vance
     msn_sync_lists(conn, 0);
+
   }
 }
 
@@ -1639,9 +1678,18 @@
     mlad = (eb_msn_local_account_data *)ela->protocol_local_account_data;
     /* We're being called as part of an  msn_clean_up anyway, so make sure 
eb_msn_logout doesn't try to clean up */
     mlad->mc=NULL;
-    eb_msn_logout(ela);
+    eb_msn_logout(ela);              
+    if (conncheck_handler != -1) {
+           gtk_timeout_remove(conncheck_handler);
+           conncheck_handler = -1;
+    }
+
   }
   eb_debug(DBG_MOD, "Closed connection with socket %d\n", conn->sock);
+}
+
+void close_conn(msnconn *conn) {
+       ext_closing_connection(conn);
 }
 
 void ext_changed_state(msnconn * conn, char * state)




reply via email to

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