comparison src/toc.c @ 657:4bbc103a3294

[gaim-migrate @ 667] merge buddy lists instead of overwrite them committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 10 Aug 2000 08:14:00 +0000
parents eaddaa0dbbcb
children 9c49d2456773
comparison
equal deleted inserted replaced
656:732ee4f6f541 657:4bbc103a3294
870 char *name; 870 char *name;
871 GList *bud; 871 GList *bud;
872 int how_many = 0; 872 int how_many = 0;
873 873
874 /* Clean out the permit/deny list!*/ 874 /* Clean out the permit/deny list!*/
875 /* why? if we're going to merge things, then these should stay
875 g_list_free(permit); 876 g_list_free(permit);
876 g_list_free(deny); 877 g_list_free(deny);
877 permit = NULL; 878 permit = NULL;
878 deny = NULL; 879 deny = NULL;
880 */
879 bud = NULL; 881 bud = NULL;
880 882
881 /* skip "CONFIG:" (if it exists)*/ 883 /* skip "CONFIG:" (if it exists)*/
882 884
883 if (config != NULL) { 885 if (config != NULL) {
895 } else if (*c == 'b' && !find_buddy(c+2)) { 897 } else if (*c == 'b' && !find_buddy(c+2)) {
896 add_buddy(current, c+2); 898 add_buddy(current, c+2);
897 how_many++; 899 how_many++;
898 bud = g_list_append(bud, c+2); 900 bud = g_list_append(bud, c+2);
899 } else if (*c == 'p') { 901 } else if (*c == 'p') {
902 GList *d = deny;
900 name = g_malloc(strlen(c+2) + 2); 903 name = g_malloc(strlen(c+2) + 2);
901 g_snprintf(name, strlen(c+2) + 1, "%s", c+2); 904 g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
902 permit = g_list_append(permit, name); 905 while (d) {
906 char *n = g_strdup(normalize(name));
907 if (!strcmp(n, normalize(d->data)))
908 break;
909 d = d->next;
910 g_free(n);
911 }
912 if (!d)
913 permit = g_list_append(permit, name);
903 } else if (*c == 'd') { 914 } else if (*c == 'd') {
915 GList *d = permit;
904 name = g_malloc(strlen(c+2) + 2); 916 name = g_malloc(strlen(c+2) + 2);
905 g_snprintf(name, strlen(c+2) + 1, "%s", c+2); 917 g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
906 deny = g_list_append(deny, name); 918 while (d) {
919 char *n = g_strdup(normalize(name));
920 if (!strcmp(n, normalize(d->data)))
921 break;
922 d = d->next;
923 g_free(n);
924 }
925 if (!d)
926 deny = g_list_append(deny, name);
907 } else if (*c == 'm') { 927 } else if (*c == 'm') {
908 sscanf(c + strlen(c) - 1, "%d", &permdeny); 928 sscanf(c + strlen(c) - 1, "%d", &permdeny);
909 if (permdeny == 0) 929 if (permdeny == 0)
910 permdeny = 1; 930 permdeny = 1;
911 } 931 }