Mercurial > pidgin.yaz
annotate src/gaimrc.c @ 1716:e316431c1054
[gaim-migrate @ 1726]
so sorry, it's over
so sorry, it's over
there's so much more that i wanted and
so much more that i needed and
time keeps moving on and on and on
SOON WE'LL ALL BE GOD!
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 14 Apr 2001 00:18:24 +0000 |
parents | f42ce672c560 |
children | 998a6a032874 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
340
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
340
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
340
diff
changeset
|
24 #endif |
1 | 25 #include <string.h> |
26 #include <sys/time.h> | |
27 | |
28 #include <sys/types.h> | |
29 #include <sys/stat.h> | |
30 | |
31 #include <unistd.h> | |
32 #include <stdio.h> | |
33 #include <stdlib.h> | |
34 #include <gtk/gtk.h> | |
35 #include "gaim.h" | |
1264
6210d06da99b
[gaim-migrate @ 1274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1254
diff
changeset
|
36 #include "prpl.h" |
1 | 37 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
38 /* for people like myself, who are too lazy to add an away msg :) */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
39 #define BORING_DEFAULT_AWAY_MSG "sorry, i ran out for a while. bbl" |
1139 | 40 #define MAX_VALUES 10 |
1 | 41 |
42 GList *aim_users = NULL; | |
43 int general_options; | |
44 int display_options; | |
45 int sound_options; | |
46 int font_options; | |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
47 int logging_options; |
1 | 48 |
49 int report_idle, web_browser; | |
50 struct save_pos blist_pos; | |
51 char web_command[2048]; | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
52 char *sound_file[NUM_SOUNDS]; |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
53 char sound_cmd[2048]; |
1 | 54 |
55 struct parse { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
56 char option[256]; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
57 char value[MAX_VALUES][256]; |
1 | 58 }; |
59 | |
60 static struct parse *parse_line(char *line) | |
61 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
62 char *c = line; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
63 int inopt = 1, inval = 0, curval = -1; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
64 int optlen = 0, vallen = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
65 static struct parse p; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
66 int x; |
1 | 67 |
1137 | 68 for (x = 0; x < MAX_VALUES; x++) { |
69 p.value[x][0] = 0; | |
70 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
71 |
1 | 72 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
73 while (*c) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
74 if (*c == '\t') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
75 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
76 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
77 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
78 if (inopt) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
79 // if ((*c < 'a' || *c > 'z') && *c != '_') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
80 if ((*c < 'a' || *c > 'z') && *c != '_' && (*c < 'A' || *c > 'Z')) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
81 inopt = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
82 p.option[optlen] = 0; |
1 | 83 c++; |
84 continue; | |
85 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
86 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
87 p.option[optlen] = *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
88 optlen++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
89 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
90 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
91 } else if (inval) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
92 if ((*c == '}')) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
93 if (*(c - 1) == '\\') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
94 p.value[curval][vallen - 1] = *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
95 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
96 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
97 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
98 p.value[curval][vallen - 1] = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
99 inval = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
100 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
101 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
102 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
103 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
104 p.value[curval][vallen] = *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
105 vallen++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
106 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
107 continue; |
1 | 108 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
109 } else if (*c == '{') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
110 if (*(c - 1) == '\\') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
111 p.value[curval][vallen - 1] = *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
112 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
113 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
114 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
115 curval++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
116 vallen = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
117 inval = 1; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
118 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
119 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
120 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
121 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
122 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
123 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
124 } |
1137 | 125 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
126 return &p; |
1 | 127 } |
128 | |
129 | |
130 static int gaimrc_parse_tag(FILE *f) | |
131 { | |
132 char buf[2048]; | |
133 char tag[256]; | |
134 buf[0] = '#'; | |
135 | |
136 while (buf[0] == '#' && !feof(f)) | |
137 fgets(buf, sizeof(buf), f); | |
138 | |
139 if (feof(f)) | |
140 return -1; | |
141 | |
142 sscanf(buf, "%s {", tag); | |
143 | |
144 if (!strcmp(tag, "users")) { | |
145 return 0; | |
146 } else if (!strcmp(tag, "options")) { | |
147 return 1; | |
148 } else if (!strcmp(tag, "away")) { | |
149 return 2; | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
150 } else if (!strcmp(tag, "plugins")) { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
151 return 3; |
673 | 152 } else if (!strcmp(tag, "pounce")) { |
153 return 4; | |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
154 } else if (!strcmp(tag, "chat")) { |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
155 return 5; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
156 } else if (!strcmp(tag, "sound_files")) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
157 return 6; |
1 | 158 } |
159 | |
160 return -1; | |
161 } | |
162 | |
163 void filter_break(char *msg) | |
164 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
165 char *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
166 int mc; |
44 | 167 int cc; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
168 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
169 c = g_malloc(strlen(msg) + 1); |
44 | 170 strcpy(c, msg); |
1 | 171 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
172 mc = 0; |
44 | 173 cc = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
174 while (c[cc] != '\0') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
175 if (c[cc] == '\\') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
176 cc++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
177 msg[mc] = c[cc]; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
178 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
179 msg[mc] = c[cc]; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
180 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
181 mc++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
182 cc++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
183 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
184 msg[mc] = 0; |
44 | 185 g_free(c); |
1 | 186 } |
187 | |
44 | 188 |
1 | 189 static void gaimrc_read_away(FILE *f) |
190 { | |
191 struct parse *p; | |
192 char buf[4096]; | |
193 struct away_message *a; | |
194 | |
195 buf[0] = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
196 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
197 while (buf[0] != '}') { |
1 | 198 if (!fgets(buf, sizeof(buf), f)) |
199 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
200 |
1 | 201 if (buf[0] == '}') |
202 return; | |
203 | |
204 p = parse_line(buf); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
205 if (!strcmp(p->option, "message")) { |
15 | 206 a = g_new0(struct away_message, 1); |
1 | 207 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
208 g_snprintf(a->name, sizeof(a->name), "%s", p->value[0]); |
15 | 209 g_snprintf(a->message, sizeof(a->message), "%s", p->value[1]); |
210 filter_break(a->message); | |
1209 | 211 away_messages = g_slist_insert_sorted(away_messages, a, sort_awaymsg_list); |
15 | 212 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
213 /* auto { time } { default message } */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
214 else if (!strcmp(p->option, "auto")) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
215 auto_away = atoi(p->value[0]); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
216 default_away = g_slist_nth_data(away_messages, |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
217 atoi(p->value[1])); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
218 } |
1 | 219 } |
220 } | |
221 | |
222 static void gaimrc_write_away(FILE *f) | |
223 { | |
940 | 224 GSList *awy = away_messages; |
1 | 225 struct away_message *a; |
226 | |
227 fprintf(f, "away {\n"); | |
228 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
229 if (awy) { |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
230 while (awy) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
231 char *str1, *str2; |
26 | 232 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
233 a = (struct away_message *)awy->data; |
26 | 234 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
235 str1 = escape_text2(a->name); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
236 str2 = escape_text2(a->message); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
237 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
238 fprintf(f, "\tmessage { %s } { %s }\n", str1, str2); |
26 | 239 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
240 /* escape_text2 uses malloc(), so we don't want to g_free these */ |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
241 free(str1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
242 free(str2); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
243 |
940 | 244 awy = g_slist_next(awy); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
245 } |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
246 fprintf(f, "\tauto { %d } { %d }\n", auto_away, |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
247 g_slist_index(away_messages, default_away)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
248 } else { |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
249 fprintf(f, "\tmessage { boring default } { %s }\n", BORING_DEFAULT_AWAY_MSG); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
250 fprintf(f, "\tauto { 0 } { 0 }\n"); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
251 } |
1 | 252 |
253 fprintf(f, "}\n"); | |
254 } | |
255 | |
673 | 256 static void gaimrc_read_pounce(FILE *f) |
257 { | |
258 struct parse *p; | |
259 char buf[4096]; | |
260 struct buddy_pounce *b; | |
261 | |
262 buf[0] = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
263 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
264 while (buf[0] != '}') { |
673 | 265 if (!fgets(buf, sizeof(buf), f)) |
266 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
267 |
673 | 268 if (buf[0] == '}') |
269 return; | |
270 | |
271 p = parse_line(buf); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
272 if (!strcmp(p->option, "entry")) { |
673 | 273 b = g_new0(struct buddy_pounce, 1); |
274 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
275 g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); |
1155 | 276 g_snprintf(b->message, sizeof(b->message), "%s", p->value[1]); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
277 g_snprintf(b->command, sizeof(b->command), "%s", p->value[2]); |
673 | 278 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
279 b->options = atoi(p->value[3]); |
1137 | 280 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
281 g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
282 b->protocol = atoi(p->value[5]); |
1137 | 283 |
1694 | 284 g_snprintf(b->sound, sizeof(b->sound), "%s", p->value[6]); |
285 | |
673 | 286 filter_break(b->message); |
287 buddy_pounces = g_list_append(buddy_pounces, b); | |
288 } | |
289 } | |
290 } | |
291 | |
292 static void gaimrc_write_pounce(FILE *f) | |
293 { | |
294 GList *pnc = buddy_pounces; | |
295 struct buddy_pounce *b; | |
296 | |
297 fprintf(f, "pounce {\n"); | |
298 | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
299 while (pnc) { |
1694 | 300 char *str1, *str2, *str3, *str4; |
673 | 301 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
302 b = (struct buddy_pounce *)pnc->data; |
673 | 303 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
304 str1 = escape_text2(b->name); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
305 if (strlen(b->message)) |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
306 str2 = escape_text2(b->message); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
307 else { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
308 str2 = malloc(1); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
309 str2[0] = 0; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
310 } |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
311 if (strlen(b->command)) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
312 str3 = escape_text2(b->command); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
313 else { |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
314 str3 = malloc(1); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
315 str3[0] = 0; |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
316 } |
1694 | 317 if (strlen(b->sound)) |
318 str4 = escape_text2(b->sound); | |
319 else { | |
320 str4 = malloc(1); | |
321 str4[0] = 0; | |
322 } | |
673 | 323 |
1694 | 324 fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %s } { %d } { %s }\n", |
325 str1, str2, str3, b->options, b->pouncer, b->protocol, str4); | |
673 | 326 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
327 /* escape_text2 uses malloc(), so we don't want to g_free these */ |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
328 free(str1); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
329 free(str2); |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
330 free(str3); |
1694 | 331 free(str4); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
332 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
333 pnc = pnc->next; |
673 | 334 } |
335 | |
336 fprintf(f, "}\n"); | |
337 } | |
338 | |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
339 static void gaimrc_read_chat(FILE *f) |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
340 { |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
341 struct parse *p; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
342 char buf[4096]; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
343 struct chat_room *b; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
344 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
345 buf[0] = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
346 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
347 while (buf[0] != '}') { |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
348 if (!fgets(buf, sizeof(buf), f)) |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
349 return; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
350 |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
351 if (buf[0] == '}') |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
352 return; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
353 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
354 p = parse_line(buf); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
355 if (!strcmp(p->option, "entry")) { |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
356 b = g_new0(struct chat_room, 1); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
357 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
358 g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
359 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
360 b->exchange = atoi(p->value[1]); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
361 |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
362 chat_rooms = g_list_append(chat_rooms, b); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
363 } |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
364 } |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
365 } |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
366 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
367 static void gaimrc_write_chat(FILE *f) |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
368 { |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
369 GList *pnc = chat_rooms; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
370 struct chat_room *b; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
371 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
372 fprintf(f, "chat {\n"); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
373 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
374 if (pnc) { |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
375 while (pnc) { |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
376 char *str1; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
377 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
378 b = (struct chat_room *)pnc->data; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
379 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
380 str1 = escape_text2(b->name); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
381 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
382 fprintf(f, "\tentry { %s } { %d }\n", str1, b->exchange); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
383 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
384 /* escape_text2 uses malloc(), so we don't want to g_free these */ |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
385 free(str1); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
386 |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
387 pnc = pnc->next; |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
388 } |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
389 } |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
390 |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
391 fprintf(f, "}\n"); |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
392 } |
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
697
diff
changeset
|
393 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
394 #ifdef GAIM_PLUGINS |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
395 static void gaimrc_write_plugins(FILE *f) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
396 { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
397 GList *pl = plugins; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
398 struct gaim_plugin *p; |
1 | 399 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
400 fprintf(f, "plugins {\n"); |
1 | 401 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
402 while (pl) { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
403 char *path; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
404 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
405 p = (struct gaim_plugin *)pl->data; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
406 |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1026
diff
changeset
|
407 path = escape_text2(g_module_name(p->handle)); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
408 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
409 fprintf(f, "\tplugin { %s }\n", path); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
410 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
411 free(path); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
412 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
413 pl = pl->next; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
414 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
415 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
416 fprintf(f, "}\n"); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
417 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
418 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
419 static void gaimrc_read_plugins(FILE *f) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
420 { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
421 struct parse *p; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
422 char buf[4096]; |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
423 GSList *load = NULL; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
424 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
425 buf[0] = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
426 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
427 while (buf[0] != '}') { |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
428 if (!fgets(buf, sizeof(buf), f)) |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
429 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
430 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
431 if (buf[0] == '}') |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
432 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
433 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
434 p = parse_line(buf); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
435 if (!strcmp(p->option, "plugin")) { |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
436 load = g_slist_append(load, g_strdup(p->value[0])); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
437 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
438 } |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
439 /* this is such a fucked up hack. the reason we do this is because after |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
440 * we load a plugin the gaimrc file gets rewrit. so we have to remember |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
441 * which ones to load before loading them. */ |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
442 while (load) { |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
443 if (load->data) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
444 load_plugin(load->data); |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
445 g_free(load->data); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
446 load = g_slist_remove(load, load->data); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
447 } |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
448 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
449 #endif /* GAIM_PLUGINS */ |
1 | 450 |
451 static struct aim_user *gaimrc_read_user(FILE *f) | |
452 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
453 struct parse *p; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
454 struct aim_user *u; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
455 int i; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
456 char buf[4096]; |
1 | 457 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
458 if (!fgets(buf, sizeof(buf), f)) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
459 return NULL; |
1 | 460 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
461 p = parse_line(buf); |
1 | 462 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
463 if (strcmp(p->option, "ident")) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
464 return NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
465 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
466 u = g_new0(struct aim_user, 1); |
1 | 467 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
468 strcpy(u->username, p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
469 strcpy(u->password, p->value[1]); |
1 | 470 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
471 u->user_info[0] = 0; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
472 u->options = OPT_USR_REM_PASS; |
1264
6210d06da99b
[gaim-migrate @ 1274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1254
diff
changeset
|
473 u->protocol = PROTO_TOC; |
1 | 474 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
475 if (!fgets(buf, sizeof(buf), f)) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
476 return u; |
1 | 477 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
478 if (strcmp(buf, "\t\tuser_info {\n")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
479 return u; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
480 } |
1 | 481 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
482 if (!fgets(buf, sizeof(buf), f)) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
483 return u; |
1 | 484 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
485 while (strncmp(buf, "\t\t}", 3)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
486 if (strlen(buf) > 3) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
487 strcat(u->user_info, &buf[3]); |
1 | 488 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
489 if (!fgets(buf, sizeof(buf), f)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
490 return u; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
491 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
492 } |
1 | 493 |
1456
6650776468b3
[gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1441
diff
changeset
|
494 if ((i = strlen(u->user_info))) { |
1292 | 495 u->user_info[i-1] = '\0'; |
496 } | |
497 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
498 if (!fgets(buf, sizeof(buf), f)) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
499 return u; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
500 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
501 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
502 if (!strcmp(buf, "\t}")) { |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
503 return u; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
504 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
505 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
506 p = parse_line(buf); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
507 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
508 if (strcmp(p->option, "user_opts")) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
509 return u; |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
510 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
511 u->options = atoi(p->value[0]); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
512 u->protocol = atoi(p->value[1]); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
513 |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
514 if (!fgets(buf, sizeof(buf), f)) |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
515 return u; |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
516 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
517 if (!strcmp(buf, "\t}")) |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
518 return u; |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
519 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
520 p = parse_line(buf); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
521 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
522 if (strcmp(p->option, "proto_opts")) |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
523 return u; |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
524 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
525 for (i = 0; i < 6; i++) |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
526 g_snprintf(u->proto_opt[i], sizeof u->proto_opt[i], "%s", p->value[i]); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
527 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
528 return u; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
529 |
1 | 530 } |
531 | |
532 static void gaimrc_write_user(FILE *f, struct aim_user *u) | |
533 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
534 char *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
535 int nl = 1, i; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
536 if (u->options & OPT_USR_REM_PASS) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
537 fprintf(f, "\t\tident { %s } { %s }\n", u->username, u->password); |
131
350d88f043b6
[gaim-migrate @ 141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
538 else |
350d88f043b6
[gaim-migrate @ 141]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
84
diff
changeset
|
539 fprintf(f, "\t\tident { %s } { }\n", u->username); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
540 fprintf(f, "\t\tuser_info {"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
541 c = u->user_info; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
542 while (*c) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
543 /* This is not as silly as it looks. */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
544 if (*c == '\n') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
545 nl++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
546 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
547 if (nl) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
548 while (nl) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
549 fprintf(f, "\n\t\t\t"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
550 nl--; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
551 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
552 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
553 fprintf(f, "%c", *c); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
554 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
555 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
556 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
557 fprintf(f, "\n\t\t}\n"); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
558 fprintf(f, "\t\tuser_opts { %d } { %d }\n", u->options, u->protocol); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
559 fprintf(f, "\t\tproto_opts"); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
560 for (i = 0; i < 6; i++) |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
561 fprintf(f, " { %s }", u->proto_opt[i]); |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
562 fprintf(f, "\n"); |
1 | 563 } |
564 | |
565 | |
566 static void gaimrc_read_users(FILE *f) | |
567 { | |
568 char buf[2048]; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
569 struct aim_user *u; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
570 struct parse *p; |
1 | 571 |
572 buf[0] = 0; | |
573 | |
574 while (buf[0] != '}') { | |
575 if (buf[0] == '#') | |
576 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
577 |
1 | 578 if (!fgets(buf, sizeof(buf), f)) |
579 return; | |
580 | |
581 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
582 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
583 p = parse_line(buf); |
1 | 584 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
585 if (!strcmp(p->option, "current_user")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
586 } else if (strcmp(p->option, "user")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
587 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
588 } else { |
159
d56878f647fb
[gaim-migrate @ 169]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
589 } |
1 | 590 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
591 u = gaimrc_read_user(f); |
1 | 592 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
593 aim_users = g_list_append(aim_users, u); |
1 | 594 } |
595 } | |
596 | |
597 static void gaimrc_write_users(FILE *f) | |
598 { | |
599 GList *usr = aim_users; | |
600 struct aim_user *u; | |
601 | |
602 fprintf(f, "users {\n"); | |
603 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
604 while (usr) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
605 u = (struct aim_user *)usr->data; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
606 fprintf(f, "\tuser {\n"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
607 gaimrc_write_user(f, u); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
608 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
609 fprintf(f, "\t}\n"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
610 |
1 | 611 usr = usr->next; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
612 } |
1 | 613 |
614 fprintf(f, "}\n"); | |
615 } | |
616 | |
617 | |
618 | |
619 | |
620 static void gaimrc_read_options(FILE *f) | |
621 { | |
622 char buf[2048]; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
623 struct parse *p; |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
624 gboolean read_logging = FALSE; |
1 | 625 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
626 buf[0] = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
627 |
1 | 628 while (buf[0] != '}') { |
629 if (buf[0] == '#') | |
630 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
631 |
1 | 632 if (!fgets(buf, sizeof(buf), f)) |
633 return; | |
634 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
635 p = parse_line(buf); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
636 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
637 if (!strcmp(p->option, "general_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
638 general_options = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
639 } else if (!strcmp(p->option, "display_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
640 display_options = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
641 } else if (!strcmp(p->option, "sound_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
642 sound_options = atoi(p->value[0]); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
643 } else if (!strcmp(p->option, "font_options")) { |
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
644 font_options = atoi(p->value[0]); |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
645 } else if (!strcmp(p->option, "logging_options")) { |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
646 logging_options = atoi(p->value[0]); |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
647 read_logging = TRUE; |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
648 } else if (!strcmp(p->option, "font_face")) { |
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
649 if (p->value[0] != NULL) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
650 g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
651 } else if (!strcmp(p->option, "font_size")) { |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
652 fontsize = atoi(p->value[0]); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
653 } else if (!strcmp(p->option, "foreground")) { |
697 | 654 fgcolor.red = atoi(p->value[0]); |
655 fgcolor.green = atoi(p->value[1]); | |
656 fgcolor.blue = atoi(p->value[2]); | |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
657 } else if (!strcmp(p->option, "background")) { |
697 | 658 bgcolor.red = atoi(p->value[0]); |
659 bgcolor.green = atoi(p->value[1]); | |
660 bgcolor.blue = atoi(p->value[2]); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
661 } else if (!strcmp(p->option, "report_idle")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
662 report_idle = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
663 } else if (!strcmp(p->option, "web_browser")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
664 web_browser = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
665 } else if (!strcmp(p->option, "web_command")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
666 strcpy(web_command, p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
667 } else if (!strcmp(p->option, "blist_pos")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
668 blist_pos.x = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
669 blist_pos.y = atoi(p->value[1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
670 blist_pos.width = atoi(p->value[2]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
671 blist_pos.height = atoi(p->value[3]); |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
672 blist_pos.xoff = atoi(p->value[4]); |
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
673 blist_pos.yoff = atoi(p->value[5]); |
82 | 674 } |
1 | 675 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
676 } |
1 | 677 |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
678 if (!read_logging) { |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
679 logging_options = 0; |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
680 if (general_options & OPT_GEN_LOG_ALL) |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
681 logging_options |= OPT_LOG_ALL; |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
682 if (general_options & OPT_GEN_STRIP_HTML) |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
683 logging_options |= OPT_LOG_STRIP_HTML; |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
684 } |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
685 |
1 | 686 } |
687 | |
688 static void gaimrc_write_options(FILE *f) | |
689 { | |
690 | |
691 fprintf(f, "options {\n"); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
692 fprintf(f, "\tgeneral_options { %d }\n", general_options); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
693 fprintf(f, "\tdisplay_options { %d }\n", display_options); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
694 fprintf(f, "\tsound_options { %d }\n", sound_options); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
695 fprintf(f, "\tfont_options { %d }\n", font_options); |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
696 fprintf(f, "\tlogging_options { %d }\n", logging_options); |
232 | 697 if (fontface) |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
698 fprintf(f, "\tfont_face { %s }\n", fontface); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
699 fprintf(f, "\tfont_size { %d }\n", fontsize); |
697 | 700 fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue); |
701 fprintf(f, "\tbackground { %d } { %d } { %d }\n", bgcolor.red, bgcolor.green, bgcolor.blue); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
702 fprintf(f, "\treport_idle { %d }\n", report_idle); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
703 fprintf(f, "\tweb_browser { %d }\n", web_browser); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
704 fprintf(f, "\tweb_command { %s }\n", web_command); |
1420
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
705 fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n", |
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
706 blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height, |
9be6790092dc
[gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1413
diff
changeset
|
707 blist_pos.xoff, blist_pos.yoff); |
1 | 708 fprintf(f, "}\n"); |
709 } | |
710 | |
711 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
712 static void gaimrc_read_sounds(FILE *f) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
713 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
714 int i; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
715 char buf[2048]; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
716 struct parse *p; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
717 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
718 buf[0] = 0; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
719 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
720 for (i = 0; i < NUM_SOUNDS; i++) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
721 sound_file[i] = NULL; |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
722 sound_cmd[0] = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
723 |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
724 while (buf[0] != '}') { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
725 if (buf[0] == '#') |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
726 continue; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
727 |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
728 if (!fgets(buf, sizeof(buf), f)) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
729 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
730 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
731 p = parse_line(buf); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
732 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
733 if (!strcmp(p->option, "sound_cmd")) { |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
734 g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", p->value[0]); |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
735 } else if (!strncmp(p->option, "sound", strlen("sound"))) { |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
736 sscanf(p->option, "sound%c", (char *)&i); |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
737 i -= 'A'; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
738 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
739 if (p->value[0][0]) |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
740 sound_file[i] = g_strdup(p->value[0]); |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
741 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
742 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
743 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
744 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
745 static void gaimrc_write_sounds(FILE *f) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
746 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
747 int i; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
748 fprintf(f, "sound_files {\n"); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
749 for (i = 0; i < NUM_SOUNDS; i++) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
750 if (sound_file[i]) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
751 fprintf(f, "\tsound%c { %s }\n", i + 'A', sound_file[i]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
752 else |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
753 fprintf(f, "\tsound%c { }\n", i + 'A'); |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
754 fprintf(f, "\tsound_cmd { %s }\n", sound_cmd); |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
755 fprintf(f, "}\n"); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
756 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
757 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
758 |
917 | 759 void set_defaults(int saveinfo) |
1 | 760 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
761 if (!saveinfo) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
762 if (aim_users) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
763 g_list_free(aim_users); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
764 aim_users = NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
765 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
766 if (away_messages) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
767 g_slist_free(away_messages); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
768 away_messages = NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
769 } |
917 | 770 } |
771 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
772 general_options = |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
773 OPT_GEN_SEND_LINKS | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
774 OPT_GEN_ENTER_SENDS | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
775 OPT_GEN_SAVED_WINDOWS | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
776 /* OPT_GEN_REMEMBER_PASS | */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
777 OPT_GEN_REGISTERED | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
778 OPT_GEN_NEAR_APPLET | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
779 OPT_GEN_CTL_SMILEYS | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
780 OPT_GEN_CTL_CHARS; |
870 | 781 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
782 display_options = |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
783 OPT_DISP_SHOW_IDLETIME | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
784 OPT_DISP_SHOW_TIME | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
785 OPT_DISP_SHOW_PIXMAPS | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
786 OPT_DISP_SHOW_BUDDYTICKER | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
787 OPT_DISP_SHOW_BUTTON_XPM | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
788 OPT_DISP_SHOW_SMILEY | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
789 OPT_DISP_COOL_LOOK | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
790 OPT_DISP_CONV_BIG_ENTRY | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
791 OPT_DISP_CONV_BUTTON_XPM | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
792 OPT_DISP_CHAT_BUTTON_TEXT; |
870 | 793 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
794 if (!saveinfo) { |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
795 int i; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
796 for (i = 0; i < 7; i++) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
797 sound_file[i] = NULL; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
798 font_options = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
799 sound_options = |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
800 OPT_SOUND_LOGIN | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
801 OPT_SOUND_LOGOUT | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
802 OPT_SOUND_RECV | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
803 OPT_SOUND_SEND | |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
804 OPT_SOUND_SILENT_SIGNON; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
805 report_idle = IDLE_SCREENSAVER; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
806 web_browser = BROWSER_NETSCAPE; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
807 auto_away = 10; |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
808 default_away = NULL; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
809 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
810 g_snprintf(web_command, sizeof(web_command), "xterm -e lynx %%s"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
811 blist_pos.width = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
812 blist_pos.height = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
813 blist_pos.x = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
814 blist_pos.y = 0; |
917 | 815 } |
1 | 816 } |
817 | |
818 | |
819 void load_prefs() | |
820 { | |
821 FILE *f; | |
822 char buf[1024]; | |
823 int ver = 0; | |
570 | 824 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
825 if (opt_rcfile_arg) |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
826 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
827 else if (getenv("HOME")) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
828 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
829 else { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
830 set_defaults(TRUE); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
831 return; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
832 } |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
833 |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
834 if ((f = fopen(buf, "r"))) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
835 fgets(buf, sizeof(buf), f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
836 sscanf(buf, "# .gaimrc v%d", &ver); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
837 if ((ver <= 1) || (buf[0] != '#')) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
838 fclose(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
839 set_defaults(FALSE); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
840 save_prefs(); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
841 load_prefs(); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
842 return; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
843 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
844 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
845 while (!feof(f)) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
846 switch (gaimrc_parse_tag(f)) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
847 case -1: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
848 /* Let the loop end, EOF */ |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
849 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
850 case 0: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
851 gaimrc_read_users(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
852 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
853 case 1: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
854 gaimrc_read_options(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
855 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
856 case 2: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
857 gaimrc_read_away(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
858 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
859 #ifdef GAIM_PLUGINS |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
860 case 3: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
861 gaimrc_read_plugins(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
862 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
863 #endif |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
864 case 4: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
865 gaimrc_read_pounce(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
866 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
867 case 5: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
868 gaimrc_read_chat(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
869 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
870 case 6: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
871 gaimrc_read_sounds(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
872 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
873 default: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
874 /* NOOP */ |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
875 break; |
1 | 876 } |
877 } | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
878 fclose(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
879 } else if (opt_rcfile_arg) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
880 g_snprintf(buf, sizeof(buf), _("Could not open config file %s."), opt_rcfile_arg); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
881 do_error_dialog(buf, _("Preferences Error")); |
1 | 882 } |
917 | 883 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
884 if ((ver == 2) || (buf[0] != '#')) { |
917 | 885 set_defaults(TRUE); |
886 } | |
1 | 887 } |
888 | |
889 void save_prefs() | |
890 { | |
891 FILE *f; | |
892 char buf[BUF_LONG]; | |
893 | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
894 if (opt_rcfile_arg) |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
895 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
896 else if (getenv("HOME")) |
1 | 897 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME")); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
898 else |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
899 return; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
900 |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
901 if ((f = fopen(buf, "w"))) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
902 fprintf(f, "# .gaimrc v%d\n", 4); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
903 gaimrc_write_users(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
904 gaimrc_write_options(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
905 gaimrc_write_sounds(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
906 gaimrc_write_away(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
907 gaimrc_write_pounce(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
908 gaimrc_write_chat(f); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
909 #ifdef GAIM_PLUGINS |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
910 gaimrc_write_plugins(f); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
911 #endif |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
912 fclose(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
913 chmod(buf, S_IRUSR | S_IWUSR); |
1 | 914 } |
915 } | |
916 | |
1209 | 917 |
918 | |
919 /* This function is called by g_slist_insert_sorted to compare the item | |
920 * being compared to the rest of the items on the list. | |
921 */ | |
922 | |
923 gint sort_awaymsg_list(gconstpointer a, gconstpointer b) | |
924 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
925 struct away_message *msg_a; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
926 struct away_message *msg_b; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
927 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
928 msg_a = (struct away_message *)a; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
929 msg_b = (struct away_message *)b; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
930 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
931 return (strcmp(msg_a->name, msg_b->name)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
932 |
1209 | 933 } |