comparison src/protocols/zephyr/zephyr.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 a614423c648f
children 3196d9044a45
comparison
equal deleted inserted replaced
4348:922b66840a51 4349:0c68d402f59f
318 char *user; 318 char *user;
319 struct buddy *b; 319 struct buddy *b;
320 320
321 if (ZParseLocations(&notice, NULL, &nlocs, &user) != ZERR_NONE) 321 if (ZParseLocations(&notice, NULL, &nlocs, &user) != ZERR_NONE)
322 return; 322 return;
323 if ((b = find_buddy(zgc, user)) == NULL) { 323 if ((b = find_buddy(zgc->user, user)) == NULL) {
324 char *e = strchr(user, '@'); 324 char *e = strchr(user, '@');
325 if (e) *e = '\0'; 325 if (e) *e = '\0';
326 b = find_buddy(zgc, user); 326 b = find_buddy(zgc->user, user);
327 } 327 }
328 if (!b) { 328 if (!b) {
329 free(user); 329 free(user);
330 return; 330 return;
331 } 331 }
443 443
444 ald.user = NULL; 444 ald.user = NULL;
445 memset(&(ald.uid), 0, sizeof(ZUnique_Id_t)); 445 memset(&(ald.uid), 0, sizeof(ZUnique_Id_t));
446 ald.version = NULL; 446 ald.version = NULL;
447 447
448 gr = zgc->groups; 448 gr = groups;
449 while (gr) { 449 while (gr) {
450 struct group *g = gr->data; 450 struct group *g = gr->data;
451 m = g->members; 451 m = g->members;
452 while (m) { 452 while (m) {
453 struct buddy *b = m->data; 453 struct buddy *b = m->data;
454 char *chk; 454 if(b->user->gc == zgc) {
455 chk = zephyr_normalize(b->name); 455 char *chk;
456 /* doesn't matter if this fails or not; we'll just move on to the next one */ 456 chk = zephyr_normalize(b->name);
457 ZRequestLocations(chk, &ald, UNACKED, ZAUTH); 457 /* doesn't matter if this fails or not; we'll just move on to the next one */
458 free(ald.user); 458 ZRequestLocations(chk, &ald, UNACKED, ZAUTH);
459 free(ald.version); 459 free(ald.user);
460 free(ald.version);
461 }
460 m = m->next; 462 m = m->next;
461 } 463 }
462 gr = gr->next; 464 gr = gr->next;
463 } 465 }
464 466
569 filename = g_strconcat(gaim_home_dir(), "/.anyone", NULL); 571 filename = g_strconcat(gaim_home_dir(), "/.anyone", NULL);
570 if ((fd = fopen(filename, "r")) != NULL) { 572 if ((fd = fopen(filename, "r")) != NULL) {
571 while (fgets(buff, BUFSIZ, fd)) { 573 while (fgets(buff, BUFSIZ, fd)) {
572 strip_comments(buff); 574 strip_comments(buff);
573 if (buff[0]) 575 if (buff[0])
574 add_buddy(zgc, "Anyone", buff, buff); 576 add_buddy(zgc->user, "Anyone", buff, buff);
575 } 577 }
576 fclose(fd); 578 fclose(fd);
577 } 579 }
578 g_free(filename); 580 g_free(filename);
579 } 581 }
604 } 606 }
605 607
606 account_online(zgc); 608 account_online(zgc);
607 serv_finish_login(zgc); 609 serv_finish_login(zgc);
608 610
609 if (bud_list_cache_exists(zgc))
610 do_import(zgc, NULL);
611 process_anyone(); 611 process_anyone();
612 process_zsubs(); 612 process_zsubs();
613 613
614 nottimer = g_timeout_add(100, check_notify, NULL); 614 nottimer = g_timeout_add(100, check_notify, NULL);
615 loctimer = g_timeout_add(20000, check_loc, NULL); 615 loctimer = g_timeout_add(20000, check_loc, NULL);
665 if (!fd) { 665 if (!fd) {
666 g_free(fname); 666 g_free(fname);
667 return; 667 return;
668 } 668 }
669 669
670 gr = zgc->groups; 670 gr = groups;
671 while (gr) { 671 while (gr) {
672 g = gr->data; 672 g = gr->data;
673 m = g->members; 673 m = g->members;
674 while (m) { 674 while (m) {
675 b = m->data; 675 b = m->data;
676 if ((ptr = strchr(b->name, '@')) != NULL) { 676 if(b->user->gc == zgc) {
677 ptr2 = ptr + 1; 677 if ((ptr = strchr(b->name, '@')) != NULL) {
678 /* We should only strip the realm name if the principal 678 ptr2 = ptr + 1;
679 is in the user's realm 679 /* We should only strip the realm name if the principal
680 */ 680 is in the user's realm
681 if (!g_strcasecmp(ptr2,ZGetRealm())) { 681 */
682 *ptr = '\0'; 682 if (!g_strcasecmp(ptr2,ZGetRealm())) {
683 *ptr = '\0';
684 }
683 } 685 }
686 fprintf(fd, "%s\n", b->name);
687 if (ptr)
688 *ptr = '@';
684 } 689 }
685 fprintf(fd, "%s\n", b->name);
686 if (ptr)
687 *ptr = '@';
688 m = m->next; 690 m = m->next;
689 } 691 }
690 gr = gr->next; 692 gr = gr->next;
691 } 693 }
692 694