Mercurial > pidgin
comparison src/gaimrc.c @ 1214:0baf39dc5437
[gaim-migrate @ 1224]
can choose to run command to play sounds
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 08 Dec 2000 07:46:22 +0000 |
parents | 7aec3f881c98 |
children | 229bf438c591 |
comparison
equal
deleted
inserted
replaced
1213:1bdb08cc5d59 | 1214:0baf39dc5437 |
---|---|
47 int report_idle, web_browser; | 47 int report_idle, web_browser; |
48 struct save_pos blist_pos; | 48 struct save_pos blist_pos; |
49 char web_command[2048]; | 49 char web_command[2048]; |
50 char latest_ver[25]; | 50 char latest_ver[25]; |
51 char *sound_file[NUM_SOUNDS]; | 51 char *sound_file[NUM_SOUNDS]; |
52 char sound_cmd[2048]; | |
52 | 53 |
53 struct parse { | 54 struct parse { |
54 char option[256]; | 55 char option[256]; |
55 char value[MAX_VALUES][256]; | 56 char value[MAX_VALUES][256]; |
56 }; | 57 }; |
701 | 702 |
702 buf[0] = 0; | 703 buf[0] = 0; |
703 | 704 |
704 for (i = 0; i < NUM_SOUNDS; i++) | 705 for (i = 0; i < NUM_SOUNDS; i++) |
705 sound_file[i] = NULL; | 706 sound_file[i] = NULL; |
707 sound_cmd[0] = 0; | |
706 | 708 |
707 while (buf[0] != '}') { | 709 while (buf[0] != '}') { |
708 if (buf[0] == '#') | 710 if (buf[0] == '#') |
709 continue; | 711 continue; |
710 | 712 |
711 if (!fgets(buf, sizeof(buf), f)) | 713 if (!fgets(buf, sizeof(buf), f)) |
712 return; | 714 return; |
713 | 715 |
714 p = parse_line(buf); | 716 p = parse_line(buf); |
715 | 717 |
716 sscanf(p->option, "sound%c", (char *)&i); | 718 if (!strcmp(p->option, "sound_cmd")) { |
717 i -= 'A'; | 719 g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", p->value[0]); |
718 | 720 } else if (!strncmp(p->option, "sound", strlen("sound"))) { |
719 if (p->value[0][0]) | 721 sscanf(p->option, "sound%c", (char *)&i); |
720 sound_file[i] = g_strdup(p->value[0]); | 722 i -= 'A'; |
721 /* else | 723 |
722 sound_file[i] = NULL; | 724 if (p->value[0][0]) |
723 Removed by Rob. Kill me if this is retarded. | 725 sound_file[i] = g_strdup(p->value[0]); |
724 Tis was causing segfaults on PPC machines, though. | 726 } |
725 */ | |
726 } | 727 } |
727 } | 728 } |
728 | 729 |
729 static void gaimrc_write_sounds(FILE *f) | 730 static void gaimrc_write_sounds(FILE *f) |
730 { | 731 { |
733 for (i = 0; i < NUM_SOUNDS; i++) | 734 for (i = 0; i < NUM_SOUNDS; i++) |
734 if (sound_file[i]) | 735 if (sound_file[i]) |
735 fprintf(f, "\tsound%c { %s }\n", i + 'A', sound_file[i]); | 736 fprintf(f, "\tsound%c { %s }\n", i + 'A', sound_file[i]); |
736 else | 737 else |
737 fprintf(f, "\tsound%c { }\n", i + 'A'); | 738 fprintf(f, "\tsound%c { }\n", i + 'A'); |
739 fprintf(f, "\tsound_cmd { %s }\n", sound_cmd); | |
738 fprintf(f, "}\n"); | 740 fprintf(f, "}\n"); |
739 } | 741 } |
740 | 742 |
741 | 743 |
742 void set_defaults(int saveinfo) | 744 void set_defaults(int saveinfo) |