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.28,1.29


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/msn2 msn.C,1.28,1.29
Date: Wed, 15 Jan 2003 06:55:54 -0500

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

Modified Files:
        msn.C 
Log Message:
Update server-side friends' list
when moving a contact between groups



Index: msn.C
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/msn2/msn.C,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- msn.C       15 Jan 2003 08:37:56 -0000      1.28
+++ msn.C       15 Jan 2003 11:55:49 -0000      1.29
@@ -152,6 +152,7 @@
 static int do_mail_notify_run_script = 0;
 static int do_guess_away = 1;
 static char do_mail_notify_script_name[MAX_PREF_LEN];
+static GList *msn_grouplist;
 
 #ifdef __MINGW32__
 #include "globals.h"
@@ -1208,6 +1209,64 @@
 void msn_info_update(info_window *iw)
 {}
 
+void ext_got_group(char *id, char *name) 
+{
+       eb_debug(DBG_MOD,"got group id %s, %s\n",id,name);
+       msn_grouplist = value_pair_add (msn_grouplist, strdup(name), 
strdup(id));
+}
+
+static int finish_group_move(value_pair *tomove);
+
+void eb_msn_change_group(eb_account * ea, gchar *new_group)
+{
+       char *oldid = NULL, *newid = NULL;
+       char *int_new_group = NULL, *int_old_group;
+       if (!strcmp(_("Buddies"), new_group))
+               int_new_group = "~";
+       else
+               int_new_group = new_group;
+       if (!strcmp(_("Buddies"), ea->account_contact->group->name))
+               int_old_group = "~";
+       else
+               int_old_group = ea->account_contact->group->name;
+       if (!mainconn)
+               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);
+       newid = value_pair_get_value(msn_grouplist, int_new_group);
+       if (newid == NULL || !strcmp("-1",newid)) {
+               value_pair *tomove = g_new0(value_pair, 1);
+               if (newid == NULL) {
+                       msn_add_group(mainconn, int_new_group);
+                       ext_got_group("-1",int_new_group);
+               }
+               strcpy(tomove->key, ea->handle);
+               strcpy(tomove->value, int_new_group);
+               gtk_timeout_add(1000, (GtkFunction)finish_group_move, 
(gpointer)tomove);
+               return;
+       } 
+       msn_change_group(mainconn, ea->handle, oldid, newid);
+}
+
+
+static int finish_group_move(value_pair *tomove) 
+{
+       char *group = tomove->value;
+       char *handle = tomove->key;
+       eb_account *ea = find_account_by_handle(handle, 
SERVICE_INFO.protocol_id);
+       if (ea && group) {
+               char *id = value_pair_get_value(msn_grouplist, group);
+               if (id == NULL || !strcmp(id,"-1")) {
+                       eb_debug(DBG_MOD,"ID still %s\n",id);
+                       return TRUE;
+               }
+               eb_debug(DBG_MOD,"Got ID %s\n",id);
+               eb_msn_change_group(ea,group);
+               return FALSE;
+       }
+       return TRUE;
+}
+
 input_list * eb_msn_get_prefs()
 {
        return(NULL);
@@ -1263,6 +1322,7 @@
 
         sc->get_color = eb_msn_get_color;
         sc->get_smileys = eb_msn_get_smileys;
+        sc->change_group = eb_msn_change_group;
 
        return sc;
 }
@@ -2056,3 +2116,4 @@
   g_free(s);
   return retval;
 }
+





reply via email to

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