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.53,1.54 util.h,1.25,1.26


From: Philip S Tellis <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src util.c,1.53,1.54 util.h,1.25,1.26
Date: Mon, 17 Mar 2003 03:03:24 -0500

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

Modified Files:
        util.c util.h 
Log Message:
fix segfault when merging contacts - warning, this is a hack

Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- util.c      15 Mar 2003 11:28:04 -0000      1.53
+++ util.c      17 Mar 2003 08:03:22 -0000      1.54
@@ -1157,7 +1157,7 @@
 
 }
 
-void move_account (struct contact * con, eb_account *ea)
+struct contact * move_account (struct contact * con, eb_account *ea)
 {
        struct contact *c = ea->account_contact;
        char * new_group = con->group->name;
@@ -1170,9 +1170,10 @@
                c->accounts = l_list_remove(c->accounts, ea);
 
                remove_account_line(ea);
-               if(l_list_length(c->accounts) == 0)
+               if(l_list_length(c->accounts) == 0) {
                        remove_contact(c);
-               else {
+                       c=NULL;
+               } else {
                        LList *l;
                        c->online = 0;
                        for(l=c->accounts; l; l=l->next)
@@ -1196,6 +1197,8 @@
        add_contact_and_accounts(con);
 
        write_contact_list();
+
+       return c;
 }
 
 void move_contact (char * group, struct contact * c)
@@ -1265,11 +1268,9 @@
        if(con) {
                eb_debug(DBG_CORE,"found existing contact\n");
                rename_nick_log(c->group->name, c->nick, c->group->name, 
con->nick);
-               l = c->accounts;
-               while(l) {
+               while(c && (l=c->accounts)) {
                        eb_account *ea = l->data;
-                       move_account(con,ea);
-                       l = c->accounts;
+                       c=move_account(con,ea);
                }
                update_contact_list ();
                write_contact_list();

Index: util.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- util.h      11 Feb 2003 06:21:59 -0000      1.25
+++ util.h      17 Mar 2003 08:03:22 -0000      1.26
@@ -115,7 +115,7 @@
 void add_unknown_with_name( eb_account * ea, char * name );
 void add_account( char * contact, eb_account * account );
 void add_account_silent( char * contact, eb_account * account );
-void move_account( struct contact * c, eb_account *account );
+struct contact * move_account( struct contact * c, eb_account *account );
 void move_contact( char * group, struct contact * c);
 void invite_dialog( eb_local_account * ela, char * user, char * chat_room,
                    void * id );





reply via email to

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