comparison src/list.c @ 5041:c4b691b0cc0d

[gaim-migrate @ 5385] some dragging fixes. hopefully kill off the last of the hangs and crashes associated with dragging buddies and editng the list committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 05 Apr 2003 18:47:34 +0000
parents 070181118a77
children 5b1d70deda02
comparison
equal deleted inserted replaced
5040:9af91af51192 5041:c4b691b0cc0d
206 206
207 return b; 207 return b;
208 } 208 }
209 void gaim_blist_add_buddy (struct buddy *buddy, struct group *group, GaimBlistNode *node) 209 void gaim_blist_add_buddy (struct buddy *buddy, struct group *group, GaimBlistNode *node)
210 { 210 {
211 GaimBlistNode *n = node, *node2, *node3; 211 GaimBlistNode *n = node, *bnode = (GaimBlistNode*)buddy;
212 struct group *g = group; 212 struct group *g = group;
213 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops; 213 struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops;
214 gboolean save = FALSE; 214 gboolean save = FALSE;
215 215
216 if (!n) { 216 if (!n) {
222 } else { 222 } else {
223 g = (struct group*)n->parent; 223 g = (struct group*)n->parent;
224 } 224 }
225 225
226 /* if we're moving to overtop of ourselves, do nothing */ 226 /* if we're moving to overtop of ourselves, do nothing */
227 if((GaimBlistNode*)buddy == n) 227 if(bnode == n)
228 return; 228 return;
229 229
230 if (((GaimBlistNode*)buddy)->parent) { 230 if (bnode->parent) {
231 /* This buddy was already in the list and is 231 /* This buddy was already in the list and is
232 * being moved. 232 * being moved.
233 */ 233 */
234 ops->remove(gaimbuddylist, (GaimBlistNode*)buddy); 234 if(bnode->next)
235 node2 = ((GaimBlistNode*)buddy)->next; 235 bnode->next->prev = bnode->prev;
236 node3 = ((GaimBlistNode*)buddy)->prev; 236 if(bnode->prev)
237 237 bnode->prev->next = bnode->next;
238 if (node2) 238 if(bnode->parent->child == bnode)
239 node2->prev = node3; 239 bnode->parent->child = bnode->next;
240 if (node3) 240
241 node3->next = node2; 241 ops->remove(gaimbuddylist, bnode);
242 242
243 if (((GaimBlistNode*)buddy)->parent != ((GaimBlistNode*)g)) 243 if (bnode->parent != ((GaimBlistNode*)g))
244 serv_move_buddy(buddy, (struct group*)((GaimBlistNode*)buddy)->parent, g); 244 serv_move_buddy(buddy, (struct group*)bnode->parent, g);
245 save = TRUE; 245 save = TRUE;
246 } 246 }
247 247
248 if (n) { 248 if (n) {
249 if(n->next)
250 n->next->prev = (GaimBlistNode*)buddy;
249 ((GaimBlistNode*)buddy)->next = n->next; 251 ((GaimBlistNode*)buddy)->next = n->next;
250 ((GaimBlistNode*)buddy)->prev = n; 252 ((GaimBlistNode*)buddy)->prev = n;
251 ((GaimBlistNode*)buddy)->parent = n->parent; 253 ((GaimBlistNode*)buddy)->parent = n->parent;
252 n->next = (GaimBlistNode*)buddy; 254 n->next = (GaimBlistNode*)buddy;
253 } else { 255 } else {