ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/src util.c,1.30,1.31 util.h,1.16,1.17


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src util.c,1.30,1.31 util.h,1.16,1.17
Date: Wed, 29 Jan 2003 04:52:42 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv32454/src

Modified Files:
        util.c util.h 
Log Message:
plug change_user_name


Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- util.c      28 Jan 2003 10:35:35 -0000      1.30
+++ util.c      29 Jan 2003 09:52:40 -0000      1.31
@@ -1081,8 +1081,15 @@
 {
        add_unknown(ea);
 
-       if (name && strlen(name))
+       if (name && strlen(name)) {
                strncpy(ea->account_contact->nick, name, 255);
+               if (RUN_SERVICE(ea)->change_user_name) {
+                       if (!find_suitable_local_account(NULL, ea->service_id))
+                               contact_mgmt_queue_add(ea, MGMT_REN, name);
+                       else
+                               RUN_SERVICE(ea)->change_user_name(ea, name);
+               }
+       }       
        else
                strncpy(ea->account_contact->nick, ea->handle, 255);
 
@@ -1179,6 +1186,13 @@
 
                        ea->account_contact = con;
                        con->accounts = l_list_append(con->accounts, ea);
+                       if (RUN_SERVICE(ea)->change_user_name) {
+                               if (!find_suitable_local_account(NULL, 
ea->service_id))
+                                       contact_mgmt_queue_add(ea, MGMT_REN, 
con->nick);
+                               else
+                                       RUN_SERVICE(ea)->change_user_name(ea, 
con->nick);
+                       }
+
                        l = l->next;
                }
                l_list_free(c->accounts);
@@ -1351,13 +1365,31 @@
        mid->callback(ecd);
 }
 
+/* FIXME There are bugs here if another contact with the same name 
+   already exists in the same group */
 void rename_contact( struct contact * c, char *newname) 
 {
+       LList *l = NULL;
         rename_nick_log(c->group->name, c->nick, c->group->name, newname);
         strncpy(c->nick, newname, 254);
         c->nick[254] = '\0';
        if (c->label)
                gtk_label_set_text(GTK_LABEL(c->label), newname);
+       
+       l = c->accounts;
+       while(l) {
+               eb_account *ea = l->data;
+
+               if (RUN_SERVICE(ea)->change_user_name) {
+                       if (!find_suitable_local_account(NULL, ea->service_id))
+                               contact_mgmt_queue_add(ea, MGMT_REN, newname);
+                       else
+                               RUN_SERVICE(ea)->change_user_name(ea, newname);
+               }
+
+               l = l->next;
+       }
+       
        update_contact_list ();
        write_contact_list();
 }
@@ -1456,6 +1488,10 @@
                                strcpy(ea->account_contact->group->name, 
realgrp);
                        }
                        
+                       if (ea && action == MGMT_REN && 
RUN_SERVICE(ea)->change_user_name) {
+                               RUN_SERVICE(ea)->change_user_name(ea, newgroup);
+                       }
+
                        if (!ea) {
                                ea_recreated = FALSE;
                                ea = dummy_account(handle, oldgroup, 

Index: util.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- util.h      27 Jan 2003 13:48:19 -0000      1.16
+++ util.h      29 Jan 2003 09:52:40 -0000      1.17
@@ -73,7 +73,8 @@
 {
   MGMT_ADD,
   MGMT_DEL,
-  MGMT_MOV
+  MGMT_MOV,
+  MGMT_REN
 };
 
 #ifdef __cplusplus





reply via email to

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