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.29,1.30


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.29,1.30
Date: Wed, 15 Jan 2003 08:12:23 -0500

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

Modified Files:
        msn.C 
Log Message:
Update client-side friend's groups
when accounts do not exist


Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- msn.C       15 Jan 2003 11:55:49 -0000      1.29
+++ msn.C       15 Jan 2003 13:12:21 -0000      1.30
@@ -153,7 +153,7 @@
 static int do_guess_away = 1;
 static char do_mail_notify_script_name[MAX_PREF_LEN];
 static GList *msn_grouplist;
-
+static int listsyncing=0;
 #ifdef __MINGW32__
 #include "globals.h"
 #endif
@@ -976,7 +976,7 @@
 void eb_msn_add_user(eb_account * account )
 {
        msn_contacts = g_list_append(msn_contacts, account->handle);
-       if (mainconn != NULL) {
+       if (mainconn != NULL && !listsyncing) {
          msn_del_from_list(mainconn, "BL", account->handle);
          msn_add_to_list(mainconn, "FL", account->handle);
          msn_add_to_list(mainconn, "AL", account->handle);
@@ -1209,10 +1209,54 @@
 void msn_info_update(info_window *iw)
 {}
 
+void ext_got_friend(char *name, char *groups) 
+{
+       char *group = NULL, groupname[255];
+       GList *walk = msn_grouplist;
+       eb_account *ea = find_account_by_handle(name, SERVICE_INFO.protocol_id);
+       if (ea)
+               return; /* we already know him */
+       
+       groupname[0]=0;
+       if(strstr(groups,","))
+               group = strdup(strstr(groups,",")+1);
+       else
+               group = groups;
+       
+       if(strstr(group,","))
+               group[ strstr(group,",")-group ] = 0;
+       eb_debug(DBG_MOD,"got a friend %s, %s (all=%s)\n",name,group,groups);
+       
+       ea = eb_msn_new_account(name);
+       
+       for (walk = msn_grouplist; walk && walk->data; walk=walk->next) {
+               value_pair *grpinfo = (value_pair *)walk->data;
+               if(grpinfo && !strcmp(grpinfo->value, group)) {
+                       strcpy(groupname, grpinfo->key);
+                       eb_debug(DBG_MOD,"found group id %s: %s\n",group, 
groupname);
+               }
+       }
+       if (groupname == NULL || !groupname[0] || !strcmp("~", groupname))
+               strcpy(groupname,_("Buddies"));
+       if(!find_grouplist_by_name(groupname))
+               add_group(groupname);
+       add_unknown(ea);
+       move_contact(groupname, ea->account_contact);
+       update_contact_list();
+       write_contact_list();
+}
+
 void ext_got_group(char *id, char *name) 
 {
+       char *eb_name = NULL;
+       if (!strcmp(name,"~"))
+               eb_name = _("Buddies");
+       else
+               eb_name = name;
        eb_debug(DBG_MOD,"got group id %s, %s\n",id,name);
        msn_grouplist = value_pair_add (msn_grouplist, strdup(name), 
strdup(id));
+       if(!find_grouplist_by_name(eb_name))
+               add_group(eb_name);
 }
 
 static int finish_group_move(value_pair *tomove);
@@ -1229,7 +1273,7 @@
                int_old_group = "~";
        else
                int_old_group = ea->account_contact->group->name;
-       if (!mainconn)
+       if (!mainconn || listsyncing) /* not now */
                return;
        eb_debug(DBG_MOD,"moving %s from %s to %s\n", ea->handle, 
int_old_group, int_new_group);
        oldid = value_pair_get_value(msn_grouplist, int_old_group);
@@ -1481,18 +1525,18 @@
     eb_debug(DBG_MOD, "First call to find_account_by_handle returned %p\n", 
ea);
     if (ea)
         mad = (eb_msn_account_data *)ea->protocol_account_data;
-        else
-       {
-               eb_debug(DBG_MOD, "ea not found, creating new account\n");
-               ea = eb_msn_new_account(buddy);
-                mad = (eb_msn_account_data *)ea->protocol_account_data;
-               if(!find_grouplist_by_name(_("Buddies")))
-                       add_group(_("Buddies"));
-               add_unknown_with_name(ea,friendlyname);
-               move_contact(_("Buddies"), ea->account_contact);
-               update_contact_list();
-               write_contact_list();
-       }
+    else
+    {
+           eb_debug(DBG_MOD, "ea not found, creating new account\n");
+           ea = eb_msn_new_account(buddy);
+            mad = (eb_msn_account_data *)ea->protocol_account_data;
+           if(!find_grouplist_by_name(_("Buddies")))
+                   add_group(_("Buddies"));
+           add_unknown_with_name(ea,friendlyname);
+           move_contact(_("Buddies"), ea->account_contact);
+           update_contact_list();
+           write_contact_list();
+    }
     if ((state != MSN_OFFLINE) && (mad->status == MSN_OFFLINE))
                buddy_login(ea);
     else if ((state == MSN_OFFLINE) && (mad->status != MSN_OFFLINE))
@@ -2101,6 +2145,11 @@
     l=l->next;
   }
   return;
+}
+
+void ext_syncing_lists(int state) 
+{
+       listsyncing = state;    
 }
 
 char * realloc_cpp(char * s)  // this is an ugly hack and loses performance, 
but what do you do?





reply via email to

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