Mercurial > pidgin.yaz
comparison src/gaimrc.c @ 15:b9cc0a3a68b2
[gaim-migrate @ 24]
Fixed problem with away messages.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Thu, 23 Mar 2000 10:18:02 +0000 |
parents | 2846a03bda67 |
children | b9e90a914e20 |
comparison
equal
deleted
inserted
replaced
14:d5119dc66284 | 15:b9cc0a3a68b2 |
---|---|
181 | 181 |
182 if (buf[0] == '}') | 182 if (buf[0] == '}') |
183 return; | 183 return; |
184 | 184 |
185 p = parse_line(buf); | 185 p = parse_line(buf); |
186 a = g_new0(struct away_message, 1); | 186 if (!strcmp(p->option, "message")) |
187 | 187 { |
188 g_snprintf(a->name, sizeof(a->name), "%s", p->option); | 188 a = g_new0(struct away_message, 1); |
189 g_snprintf(a->message, sizeof(a->message), "%s", p->value[0]); | 189 |
190 filter_break(a->message); | 190 g_snprintf(a->name, sizeof(a->name), "%s", p->value[0]); |
191 away_messages = g_list_append(away_messages, a); | 191 g_snprintf(a->message, sizeof(a->message), "%s", p->value[1]); |
192 filter_break(a->message); | |
193 away_messages = g_list_append(away_messages, a); | |
194 } | |
192 } | 195 } |
193 } | 196 } |
194 | 197 |
195 static void gaimrc_write_away(FILE *f) | 198 static void gaimrc_write_away(FILE *f) |
196 { | 199 { |
199 | 202 |
200 fprintf(f, "away {\n"); | 203 fprintf(f, "away {\n"); |
201 | 204 |
202 while (awy) { | 205 while (awy) { |
203 a = (struct away_message *)awy->data; | 206 a = (struct away_message *)awy->data; |
204 // escape_text(a->name); | 207 fprintf(f, "\tmessage { %s } { %s }\n", escape_text2(a->name), escape_text2(a->message)); |
205 // escape_text(a->message); | |
206 fprintf(f, "\t%s { %s }\n", escape_text2(a->name), escape_text2(a->message)); | |
207 awy = awy->next; | 208 awy = awy->next; |
208 } | 209 } |
209 | 210 |
210 fprintf(f, "}\n"); | 211 fprintf(f, "}\n"); |
211 } | 212 } |
472 if (getenv("HOME")) { | 473 if (getenv("HOME")) { |
473 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); | 474 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); |
474 if ((f = fopen(buf,"r"))) { | 475 if ((f = fopen(buf,"r"))) { |
475 fgets(buf, sizeof(buf), f); | 476 fgets(buf, sizeof(buf), f); |
476 sscanf(buf, "# .gaimrc v%d", &ver); | 477 sscanf(buf, "# .gaimrc v%d", &ver); |
477 if ( (ver <= 0) || (buf[0] != '#')) { | 478 if ( (ver <= 1) || (buf[0] != '#')) { |
478 fclose(f); | 479 fclose(f); |
479 set_defaults(); | 480 set_defaults(); |
480 save_prefs(); | 481 save_prefs(); |
481 load_prefs(); | 482 load_prefs(); |
482 return; | 483 return; |
512 char buf[BUF_LONG]; | 513 char buf[BUF_LONG]; |
513 | 514 |
514 if (getenv("HOME")) { | 515 if (getenv("HOME")) { |
515 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); | 516 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); |
516 if ((f = fopen(buf,"w"))) { | 517 if ((f = fopen(buf,"w"))) { |
517 fprintf(f, "# .gaimrc v%d\n", 1); | 518 fprintf(f, "# .gaimrc v%d\n", 2); |
518 gaimrc_write_users(f); | 519 gaimrc_write_users(f); |
519 gaimrc_write_options(f); | 520 gaimrc_write_options(f); |
520 gaimrc_write_away(f); | 521 gaimrc_write_away(f); |
521 fclose(f); | 522 fclose(f); |
522 chmod(buf, S_IRUSR | S_IWUSR); | 523 chmod(buf, S_IRUSR | S_IWUSR); |