comparison src/list.c @ 2998:6fe330f1b951

[gaim-migrate @ 3011] selected smilies will look selected now. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 03 Mar 2002 20:19:30 +0000
parents 4697411bd90c
children e729c064bc1b
comparison
equal deleted inserted replaced
2997:0dba6ea7d632 2998:6fe330f1b951
347 char *name; 347 char *name;
348 GList *bud; 348 GList *bud;
349 int how_many = 0; 349 int how_many = 0;
350 350
351 bud = NULL; 351 bud = NULL;
352 352
353 if (config != NULL) { 353 if (config != NULL) {
354 354
355 /* skip "CONFIG:" (if it exists) */ 355 /* skip "CONFIG:" (if it exists) */
356 c = strncmp(config + 6 /* sizeof(struct sflap_hdr) */ , "CONFIG:", strlen("CONFIG:")) ? 356 c = strncmp(config + 6 /* sizeof(struct sflap_hdr) */ , "CONFIG:", strlen("CONFIG:")) ?
357 strtok(config, "\n") : 357 strtok(config, "\n") :
358 strtok(config + 6 /* sizeof(struct sflap_hdr) */ + strlen("CONFIG:"), "\n"); 358 strtok(config + 6 /* sizeof(struct sflap_hdr) */ + strlen("CONFIG:"), "\n");
359 do { 359 do {
360 if (c == NULL) 360 if (c == NULL)
361 break; 361 break;
362 if (*c == 'g') { 362 if (*c == 'g') {
363 strncpy(current, c + 2, sizeof(current)); 363 strncpy(current, c + 2, sizeof(current));
366 how_many++; 366 how_many++;
367 } 367 }
368 } else if (*c == 'b' && !find_buddy(gc, c + 2)) { 368 } else if (*c == 'b' && !find_buddy(gc, c + 2)) {
369 char nm[80], sw[388], *tmp = c + 2; 369 char nm[80], sw[388], *tmp = c + 2;
370 int i = 0; 370 int i = 0;
371 while (*tmp != ':' && *tmp && i < sizeof(nm) - 1)
372 nm[i++] = *tmp++;
373
371 while (*tmp != ':' && *tmp) 374 while (*tmp != ':' && *tmp)
372 nm[i++] = *tmp++; 375 *tmp++;
376
373 if (*tmp == ':') 377 if (*tmp == ':')
374 *tmp++ = '\0'; 378 *tmp++ = '\0';
379
375 nm[i] = '\0'; 380 nm[i] = '\0';
376 i = 0; 381 i = 0;
377 while (*tmp) 382 while (*tmp && i < sizeof(sw) - 1)
378 sw[i++] = *tmp++; 383 sw[i++] = *tmp++;
379 sw[i] = '\0'; 384 sw[i] = '\0';
380 if (!find_buddy(gc, nm)) { 385 if (!find_buddy(gc, nm)) {
381 add_buddy(gc, current, nm, sw); 386 add_buddy(gc, current, nm, sw);
382 how_many++; 387 how_many++;
388 name = g_malloc(strlen(c + 2) + 2); 393 name = g_malloc(strlen(c + 2) + 2);
389 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2); 394 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
390 n = g_strdup(normalize (name)); 395 n = g_strdup(normalize (name));
391 while (d) { 396 while (d) {
392 if (!g_strcasecmp(n, normalize (d->data))) 397 if (!g_strcasecmp(n, normalize (d->data)))
393 break; 398 break;
394 d = d->next; 399 d = d->next;
395 } 400 }
396 g_free(n); 401 g_free(n);
397 if (!d) { 402 if (!d) {
398 gc->permit = g_slist_append(gc->permit, name); 403 gc->permit = g_slist_append(gc->permit, name);
405 name = g_malloc(strlen(c + 2) + 2); 410 name = g_malloc(strlen(c + 2) + 2);
406 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2); 411 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
407 n = g_strdup(normalize (name)); 412 n = g_strdup(normalize (name));
408 while (d) { 413 while (d) {
409 if (!g_strcasecmp(n, normalize (d->data))) 414 if (!g_strcasecmp(n, normalize (d->data)))
410 break; 415 break;
411 d = d->next; 416 d = d->next;
412 } 417 }
413 g_free(n); 418 g_free(n);
414 if (!d) { 419 if (!d) {
415 gc->deny = g_slist_append(gc->deny, name); 420 gc->deny = g_slist_append(gc->deny, name);
416 how_many++; 421 how_many++;
417 } else 422 } else
418 g_free(name); 423 g_free(name);
419 } else if (!strncmp("toc", c, 3)) { 424 } else if (!strncmp("toc", c, 3)) {
420 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny); 425 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny);
421 debug_printf("permdeny: %d\n", gc->permdeny); 426 debug_printf("permdeny: %d\n", gc->permdeny);
422 if (gc->permdeny == 0) 427 if (gc->permdeny == 0)
423 gc->permdeny = 1; 428 gc->permdeny = 1;
426 debug_printf("permdeny: %d\n", gc->permdeny); 431 debug_printf("permdeny: %d\n", gc->permdeny);
427 if (gc->permdeny == 0) 432 if (gc->permdeny == 0)
428 gc->permdeny = 1; 433 gc->permdeny = 1;
429 } 434 }
430 } while ((c = strtok(NULL, "\n"))); 435 } while ((c = strtok(NULL, "\n")));
431 436
432 if (bud != NULL) { 437 if (bud != NULL) {
433 serv_add_buddies(gc, bud); 438 serv_add_buddies(gc, bud);
434 g_list_free(bud); 439 g_list_free(bud);
435 } 440 }
436 serv_set_permit_deny(gc); 441 serv_set_permit_deny(gc);
437 } 442 }
438 443
439 if (how_many != 0) 444 if (how_many != 0)
440 do_export(gc); 445 do_export(gc);
446
441 } 447 }
442 448
443 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show) 449 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show)
444 { 450 {
445 GSList *grp = gc->groups; 451 GSList *grp = gc->groups;