comparison src/server.c @ 4349:0c68d402f59f

[gaim-migrate @ 4614] XML Blist Gaim stores all the buddy lists in one big happy file now. You can order the buddies however you want, and they'll stay ordered that way. We can also store some per-buddy information now, which will be cool. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 19 Jan 2003 22:16:52 +0000
parents cc2f780c0505
children 5fb47ec9bfe4
comparison
equal deleted inserted replaced
4348:922b66840a51 4349:0c68d402f59f
331 /* 331 /*
332 * Set buddy's alias on server roster/list 332 * Set buddy's alias on server roster/list
333 */ 333 */
334 void serv_alias_buddy(struct buddy *b) 334 void serv_alias_buddy(struct buddy *b)
335 { 335 {
336 if(b && b->gc && b->gc->prpl && b->gc->prpl->alias_buddy) { 336 if(b && b->user->gc && b->user->gc->prpl && b->user->gc->prpl->alias_buddy) {
337 b->gc->prpl->alias_buddy(b->gc, b->name, b->alias); 337 b->user->gc->prpl->alias_buddy(b->user->gc, b->name, b->alias);
338 } 338 }
339 } 339 }
340 340
341 void serv_got_alias(struct gaim_connection *gc, char *who, char *alias) { 341 void serv_got_alias(struct gaim_connection *gc, char *who, char *alias) {
342 struct buddy *b = find_buddy(gc, who); 342 struct buddy *b = find_buddy(gc->user, who);
343 if(!b) 343 if(!b)
344 return; 344 return;
345 345
346 if(alias) 346 if(alias)
347 g_snprintf(b->server_alias, sizeof(b->server_alias), "%s", alias); 347 g_snprintf(b->server_alias, sizeof(b->server_alias), "%s", alias);
357 * Note: For now we'll not deal with changing gc's at the same time, but 357 * Note: For now we'll not deal with changing gc's at the same time, but
358 * it should be possible. Probably needs to be done, someday. 358 * it should be possible. Probably needs to be done, someday.
359 */ 359 */
360 void serv_move_buddy(struct buddy *b, struct group *og, struct group *ng) 360 void serv_move_buddy(struct buddy *b, struct group *og, struct group *ng)
361 { 361 {
362 if(b && b->gc && og && og->gc && ng && ng->gc) { 362 if(b && b->user->gc && og && ng) {
363 /* 363 if(b->user->gc->prpl && b->user->gc->prpl->group_buddy) {
364 * If there are no connection changes... 364 b->user->gc->prpl->group_buddy(b->user->gc, b->name, og->name, ng->name);
365 */
366 if(b->gc == og->gc && b->gc == ng->gc && ng->gc == og->gc) {
367 if(b->gc->prpl && b->gc->prpl->group_buddy) {
368 b->gc->prpl->group_buddy(b->gc, b->name, og->name, ng->name);
369 }
370 } 365 }
371 } 366 }
372 } 367 }
373 368
374 /* 369 /*
394 389
395 g_list_free(tobemoved); 390 g_list_free(tobemoved);
396 } 391 }
397 } 392 }
398 393
399 void serv_add_permit(struct gaim_connection *g, char *name) 394 void serv_add_permit(struct gaim_connection *g, const char *name)
400 { 395 {
401 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_permit) 396 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_permit)
402 g->prpl->add_permit(g, name); 397 g->prpl->add_permit(g, name);
403 } 398 }
404 399
405 void serv_add_deny(struct gaim_connection *g, char *name) 400 void serv_add_deny(struct gaim_connection *g, const char *name)
406 { 401 {
407 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_deny) 402 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->add_deny)
408 g->prpl->add_deny(g, name); 403 g->prpl->add_deny(g, name);
409 } 404 }
410 405
411 void serv_rem_permit(struct gaim_connection *g, char *name) 406 void serv_rem_permit(struct gaim_connection *g, const char *name)
412 { 407 {
413 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_permit) 408 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_permit)
414 g->prpl->rem_permit(g, name); 409 g->prpl->rem_permit(g, name);
415 } 410 }
416 411
417 void serv_rem_deny(struct gaim_connection *g, char *name) 412 void serv_rem_deny(struct gaim_connection *g, const char *name)
418 { 413 {
419 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_deny) 414 if (g && g_slist_find(connections, g) && g->prpl && g->prpl->rem_deny)
420 g->prpl->rem_deny(g, name); 415 g->prpl->rem_deny(g, name);
421 } 416 }
422 417
620 * then it's easy. if we are, then there are three or four different ways of handling it 615 * then it's easy. if we are, then there are three or four different ways of handling it
621 * and different things we have to do for each. */ 616 * and different things we have to do for each. */
622 if (gc->away) { 617 if (gc->away) {
623 time_t t; 618 time_t t;
624 char *tmpmsg; 619 char *tmpmsg;
625 struct buddy *b = find_buddy(gc, name); 620 struct buddy *b = find_buddy(gc->user, name);
626 char *alias = b ? get_buddy_alias(b) : name; 621 char *alias = b ? get_buddy_alias(b) : name;
627 int row; 622 int row;
628 struct queued_away_response *qar; 623 struct queued_away_response *qar;
629 624
630 time(&t); 625 time(&t);
785 780
786 781
787 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, 782 void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon,
788 time_t idle, int type, guint caps) 783 time_t idle, int type, guint caps)
789 { 784 {
790 struct buddy *b = find_buddy(gc, name); 785 struct buddy *b = find_buddy(gc->user, name);
791 786
792 if (signon && (gc->prpl->options & OPT_PROTO_CORRECT_TIME)) { 787 if (signon && (gc->prpl->options & OPT_PROTO_CORRECT_TIME)) {
793 char *tmp = g_strdup(normalize(name)); 788 char *tmp = g_strdup(normalize(name));
794 if (!g_strcasecmp(tmp, normalize(gc->username))) { 789 if (!g_strcasecmp(tmp, normalize(gc->username))) {
795 gc->evil = evil; 790 gc->evil = evil;
809 /* store things how THEY want it... */ 804 /* store things how THEY want it... */
810 if (strcmp(name, b->name)) { 805 if (strcmp(name, b->name)) {
811 char *who = g_strdup(b->name); 806 char *who = g_strdup(b->name);
812 g_snprintf(b->name, sizeof(b->name), "%s", name); 807 g_snprintf(b->name, sizeof(b->name), "%s", name);
813 handle_buddy_rename(b, who); 808 handle_buddy_rename(b, who);
814 do_export(b->gc); 809 gaim_blist_save();
815 g_free(who); 810 g_free(who);
816 } 811 }
817 812
818 if (!b->idle && idle) { 813 if (!b->idle && idle) {
819 plugin_event(event_buddy_idle, gc, b->name); 814 plugin_event(event_buddy_idle, gc, b->name);