comparison mcabber/src/roster.c @ 192:62bc2992216b

[/trunk] Changeset 204 by mikael * Correctly set "agent" type... * Free all jidtodisp results with g_free() * Bugfix: Make sure to strip resource part when adding a buddy * Bugfix: do not treat users and agents separately (it can leads to 2 entries with the same jid).
author mikael
date Fri, 06 May 2005 17:05:53 +0000
parents aa5b635520ef
children 41fafa0ecfd8
comparison
equal deleted inserted replaced
191:24e6bcb589b0 192:62bc2992216b
72 GSList *sl_roster_elt = groups; 72 GSList *sl_roster_elt = groups;
73 GSList *res; 73 GSList *res;
74 roster sample; 74 roster sample;
75 GCompareFunc comp; 75 GCompareFunc comp;
76 76
77 if (!jidname) 77 if (!jidname) return NULL;
78 return NULL; // should not happen
79 78
80 if (!roster_type) 79 if (!roster_type)
81 roster_type = ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_GROUP; 80 roster_type = ROSTER_TYPE_USER|ROSTER_TYPE_AGENT|ROSTER_TYPE_GROUP;
82 81
83 sample.type = roster_type; 82 sample.type = roster_type;
137 136
138 // Let's be arbitrary: default group has an empty name (""). 137 // Let's be arbitrary: default group has an empty name ("").
139 if (!group) group = ""; 138 if (!group) group = "";
140 139
141 // #1 Check this user doesn't already exist 140 // #1 Check this user doesn't already exist
142 if ((slist = roster_find(jid, jidsearch, type)) != NULL) 141 slist = roster_find(jid, jidsearch, ROSTER_TYPE_USER|ROSTER_TYPE_AGENT);
143 return slist; 142 if (slist) return slist;
144 // #2 add group if necessary 143 // #2 add group if necessary
145 slist = roster_add_group(group); 144 slist = roster_add_group(group);
146 if (!slist) return NULL; 145 if (!slist) return NULL;
147 my_group = (roster*)slist->data; 146 my_group = (roster*)slist->data;
148 // #3 Create user node 147 // #3 Create user node