Mercurial > pidgin.yaz
annotate src/gaimrc.c @ 4625:819ba05f5b1b
[gaim-migrate @ 4916]
This fixes some problems with gender, in that, if someone
specified either male of female, Gaim would always show
"Age: Female," which isn't exactly right.
Gender?! I don't even know her!
I also made bunches of email addresses show up, and
made them show up as mailto: links. I guess these
will just get passed to your browser.
And I fixed the UIN field. That was a dumb mistake.
So aliases should update themselves better now. Still
not automagically, though.
Oh, and I made the day show up as MM/DD/YY instead of
DD/MM/YY. For a second there I thought I was in a
different country, but I safe and sound now, back in
good old 1955.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 28 Feb 2003 07:29:17 +0000 |
parents | 7e1591c6d0d8 |
children | d19872836812 |
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 |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2036
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
340
diff
changeset
|
24 #endif |
1 | 25 #include <string.h> |
3630 | 26 |
27 #ifndef _WIN32 | |
1 | 28 #include <sys/time.h> |
3630 | 29 #include <unistd.h> |
30 #endif | |
1 | 31 |
32 #include <sys/types.h> | |
33 #include <sys/stat.h> | |
34 | |
4201
511c2b63caa4
[gaim-migrate @ 4432]
Christian Hammond <chipx86@chipx86.com>
parents:
4189
diff
changeset
|
35 #include <ctype.h> |
1 | 36 #include <stdio.h> |
37 #include <stdlib.h> | |
38 #include "gaim.h" | |
1264
6210d06da99b
[gaim-migrate @ 1274]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1254
diff
changeset
|
39 #include "prpl.h" |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
40 #include "proxy.h" |
4561 | 41 #include "sound.h" |
1 | 42 |
3630 | 43 #ifdef _WIN32 |
44 #include "win32dep.h" | |
45 #endif | |
46 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
47 /* for people like myself, who are too lazy to add an away msg :) */ |
4596 | 48 #define BORING_DEFAULT_AWAY_MSG _("sorry, i ran out for a while. bbl") |
1139 | 49 #define MAX_VALUES 10 |
1 | 50 |
4491 | 51 GSList *gaim_accounts = NULL; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
52 guint misc_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
53 guint logging_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
54 guint blist_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
55 guint convo_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
56 guint im_options; |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
57 guint conv_placement_option; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
58 guint chat_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
59 guint font_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
60 guint sound_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
61 guint away_options; |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
62 guint away_resend; |
4137 | 63 static guint is_loading_prefs = 0; |
64 static guint request_save_prefs = 0; | |
65 static guint is_saving_prefs = 0; | |
66 static guint request_load_prefs = 0; | |
67 guint proxy_info_is_from_gaimrc = 1; /* Only save proxy info if it | |
68 * was loaded from the file | |
69 * or otherwise explicitly requested */ | |
1 | 70 |
3630 | 71 int report_idle; |
72 int web_browser; | |
1 | 73 struct save_pos blist_pos; |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
74 struct window_size conv_size, buddy_chat_size; |
4189 | 75 char web_command[2048] = ""; |
1 | 76 |
77 struct parse { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
78 char option[256]; |
2286
f00bf9537bb7
[gaim-migrate @ 2296]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
79 char value[MAX_VALUES][4096]; |
1 | 80 }; |
81 | |
3493 | 82 static struct parse *parse_line(char *line, struct parse *p) |
1 | 83 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
84 char *c = line; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
85 int inopt = 1, inval = 0, curval = -1; |
4137 | 86 int optlen = 0, vallen = 0, last_non_space = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
87 int x; |
1 | 88 |
1137 | 89 for (x = 0; x < MAX_VALUES; x++) { |
3493 | 90 p->value[x][0] = 0; |
1137 | 91 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
92 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
93 while (*c) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
94 if (*c == '\t') { |
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 } |
4049 | 98 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
99 if (inopt) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
100 if ((*c < 'a' || *c > 'z') && *c != '_' && (*c < 'A' || *c > 'Z')) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
101 inopt = 0; |
3493 | 102 p->option[optlen] = 0; |
1 | 103 c++; |
104 continue; | |
105 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
106 |
3493 | 107 p->option[optlen] = *c; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
108 optlen++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
109 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
110 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
111 } else if (inval) { |
4049 | 112 if (*c == '\\') { |
113 /* if we have a \ take the char after it literally.. */ | |
114 c++; | |
115 p->value[curval][vallen] = *c; | |
116 | |
117 vallen++; | |
4137 | 118 last_non_space = vallen; |
4049 | 119 c++; |
120 continue; | |
121 } else if (*c == '}') { | |
122 /* } that isn't escaped should end this chunk of data, and | |
123 * should have a space before it.. */ | |
4137 | 124 p->value[curval][last_non_space] = 0; |
4049 | 125 inval = 0; |
126 c++; | |
127 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
128 } else { |
3493 | 129 p->value[curval][vallen] = *c; |
4049 | 130 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
131 vallen++; |
4137 | 132 if (! isspace(*c)) |
133 last_non_space = vallen; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
134 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
135 continue; |
1 | 136 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
137 } else if (*c == '{') { |
4049 | 138 /* i really don't think this if ever succeeds, but i'm |
139 * not brave enough to take it out... */ | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
140 if (*(c - 1) == '\\') { |
4137 | 141 p->value[curval][vallen] = *c; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
142 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
143 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
144 } else { |
4049 | 145 /* { that isn't escaped should signify the start of a |
146 * piece of data and should have a space after it.. */ | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
147 curval++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
148 vallen = 0; |
4137 | 149 last_non_space = vallen; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
150 inval = 1; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
151 c++; |
4137 | 152 while (*c && isspace(*c)) |
153 c++; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
154 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
155 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
156 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
157 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
158 } |
1137 | 159 |
3493 | 160 return p; |
1 | 161 } |
162 | |
163 | |
164 static int gaimrc_parse_tag(FILE *f) | |
165 { | |
166 char buf[2048]; | |
167 char tag[256]; | |
168 buf[0] = '#'; | |
169 | |
170 while (buf[0] == '#' && !feof(f)) | |
171 fgets(buf, sizeof(buf), f); | |
172 | |
173 if (feof(f)) | |
174 return -1; | |
175 | |
176 sscanf(buf, "%s {", tag); | |
177 | |
178 if (!strcmp(tag, "users")) { | |
179 return 0; | |
180 } else if (!strcmp(tag, "options")) { | |
181 return 1; | |
182 } else if (!strcmp(tag, "away")) { | |
183 return 2; | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
184 } else if (!strcmp(tag, "plugins")) { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
185 return 3; |
673 | 186 } else if (!strcmp(tag, "pounce")) { |
187 return 4; | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
188 } else if (!strcmp(tag, "sound_files")) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
189 return 6; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
190 } else if (!strcmp(tag, "proxy")) { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
191 return 7; |
4026
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3924
diff
changeset
|
192 } else if (!strcmp(tag, "wgaim")) { |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3924
diff
changeset
|
193 return 8; |
1 | 194 } |
195 return -1; | |
196 } | |
197 | |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
198 static char *escape_text2(const char *msg) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
199 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
200 char *c, *cpy; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
201 char *woo; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
202 int cnt = 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
203 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
204 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
205 woo = malloc(strlen(msg) * 4 + 1); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
206 cpy = g_strndup(msg, 2048); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
207 c = cpy; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
208 while (*c) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
209 switch (*c) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
210 case '\n': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
211 woo[cnt++] = '<'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
212 woo[cnt++] = 'B'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
213 woo[cnt++] = 'R'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
214 woo[cnt++] = '>'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
215 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
216 case '{': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
217 case '}': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
218 case '\\': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
219 case '"': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
220 woo[cnt++] = '\\'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
221 /* Fall through */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
222 default: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
223 woo[cnt++] = *c; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
224 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
225 c++; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
226 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
227 woo[cnt] = '\0'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
228 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
229 g_free(cpy); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
230 return woo; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
231 } |
44 | 232 |
1 | 233 static void gaimrc_read_away(FILE *f) |
234 { | |
3493 | 235 struct parse parse_buffer; |
1 | 236 struct parse *p; |
237 char buf[4096]; | |
238 struct away_message *a; | |
239 | |
240 buf[0] = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
241 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
242 while (buf[0] != '}') { |
1 | 243 if (!fgets(buf, sizeof(buf), f)) |
244 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
245 |
1 | 246 if (buf[0] == '}') |
247 return; | |
248 | |
3493 | 249 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
250 if (!strcmp(p->option, "message")) { |
15 | 251 a = g_new0(struct away_message, 1); |
1 | 252 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
253 g_snprintf(a->name, sizeof(a->name), "%s", p->value[0]); |
15 | 254 g_snprintf(a->message, sizeof(a->message), "%s", p->value[1]); |
1209 | 255 away_messages = g_slist_insert_sorted(away_messages, a, sort_awaymsg_list); |
15 | 256 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
257 /* auto { time } { default message } */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
258 else if (!strcmp(p->option, "auto")) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
259 auto_away = atoi(p->value[0]); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2369
diff
changeset
|
260 default_away = g_slist_nth_data(away_messages, atoi(p->value[1])); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
261 } |
1 | 262 } |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
263 if (!away_messages) { |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
264 a = g_new0(struct away_message, 1); |
4589 | 265 g_snprintf(a->name, sizeof(a->name), _("boring default")); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
266 g_snprintf(a->message, sizeof(a->message), "%s", BORING_DEFAULT_AWAY_MSG); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
267 away_messages = g_slist_append(away_messages, a); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
268 } |
1 | 269 } |
270 | |
271 static void gaimrc_write_away(FILE *f) | |
272 { | |
940 | 273 GSList *awy = away_messages; |
1 | 274 struct away_message *a; |
275 | |
276 fprintf(f, "away {\n"); | |
277 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
278 if (awy) { |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
279 while (awy) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
280 char *str1, *str2; |
26 | 281 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
282 a = (struct away_message *)awy->data; |
26 | 283 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
284 str1 = escape_text2(a->name); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
285 str2 = escape_text2(a->message); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
286 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
287 fprintf(f, "\tmessage { %s } { %s }\n", str1, str2); |
26 | 288 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
289 /* 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
|
290 free(str1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
291 free(str2); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
292 |
940 | 293 awy = g_slist_next(awy); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
294 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2369
diff
changeset
|
295 fprintf(f, "\tauto { %d } { %d }\n", auto_away, |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
296 g_slist_index(away_messages, default_away)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
297 } else { |
4596 | 298 fprintf(f, "\tmessage { %s } { %s }\n", _("boring default"), BORING_DEFAULT_AWAY_MSG); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
299 fprintf(f, "\tauto { 0 } { 0 }\n"); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
300 } |
1 | 301 |
302 fprintf(f, "}\n"); | |
303 } | |
304 | |
673 | 305 static void gaimrc_read_pounce(FILE *f) |
306 { | |
3493 | 307 struct parse parse_buffer; |
673 | 308 struct parse *p; |
309 char buf[4096]; | |
310 struct buddy_pounce *b; | |
311 | |
312 buf[0] = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
313 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
314 while (buf[0] != '}') { |
673 | 315 if (!fgets(buf, sizeof(buf), f)) |
316 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
317 |
673 | 318 if (buf[0] == '}') |
319 return; | |
320 | |
3493 | 321 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
322 if (!strcmp(p->option, "entry")) { |
673 | 323 b = g_new0(struct buddy_pounce, 1); |
324 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
325 g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); |
1155 | 326 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
|
327 g_snprintf(b->command, sizeof(b->command), "%s", p->value[2]); |
673 | 328 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
329 b->options = atoi(p->value[3]); |
1137 | 330 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
331 g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
332 b->protocol = atoi(p->value[5]); |
1137 | 333 |
1694 | 334 g_snprintf(b->sound, sizeof(b->sound), "%s", p->value[6]); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2369
diff
changeset
|
335 |
673 | 336 buddy_pounces = g_list_append(buddy_pounces, b); |
337 } | |
338 } | |
339 } | |
340 | |
341 static void gaimrc_write_pounce(FILE *f) | |
342 { | |
343 GList *pnc = buddy_pounces; | |
344 struct buddy_pounce *b; | |
345 | |
346 fprintf(f, "pounce {\n"); | |
347 | |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
348 while (pnc) { |
1694 | 349 char *str1, *str2, *str3, *str4; |
673 | 350 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
351 b = (struct buddy_pounce *)pnc->data; |
673 | 352 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
353 str1 = escape_text2(b->name); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
354 if (strlen(b->message)) |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
355 str2 = escape_text2(b->message); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
356 else { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
357 str2 = malloc(1); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
358 str2[0] = 0; |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
359 } |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
360 if (strlen(b->command)) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
361 str3 = escape_text2(b->command); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
362 else { |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
363 str3 = malloc(1); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
364 str3[0] = 0; |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
365 } |
1694 | 366 if (strlen(b->sound)) |
367 str4 = escape_text2(b->sound); | |
368 else { | |
369 str4 = malloc(1); | |
370 str4[0] = 0; | |
371 } | |
673 | 372 |
1694 | 373 fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %s } { %d } { %s }\n", |
374 str1, str2, str3, b->options, b->pouncer, b->protocol, str4); | |
673 | 375 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
376 /* 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
|
377 free(str1); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
378 free(str2); |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
379 free(str3); |
1694 | 380 free(str4); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
381 |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
382 pnc = pnc->next; |
673 | 383 } |
384 | |
385 fprintf(f, "}\n"); | |
386 } | |
387 | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
388 #ifdef GAIM_PLUGINS |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
389 static void gaimrc_write_plugins(FILE *f) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
390 { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
391 GList *pl = plugins; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
392 struct gaim_plugin *p; |
1 | 393 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
394 fprintf(f, "plugins {\n"); |
1 | 395 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
396 while (pl) { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
397 char *path; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
398 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
399 p = (struct gaim_plugin *)pl->data; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
400 |
3563 | 401 path = escape_text2(p->path); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
402 fprintf(f, "\tplugin { %s }\n", path); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
403 free(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 pl = pl->next; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
406 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
407 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
408 fprintf(f, "}\n"); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
409 } |
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 static void gaimrc_read_plugins(FILE *f) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
412 { |
3493 | 413 struct parse parse_buffer; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
414 struct parse *p; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
415 char buf[4096]; |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
416 GSList *load = NULL; |
142
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 buf[0] = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
419 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
420 while (buf[0] != '}') { |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
421 if (!fgets(buf, sizeof(buf), f)) |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
422 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
423 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
424 if (buf[0] == '}') |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
425 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
426 |
3493 | 427 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
428 if (!strcmp(p->option, "plugin")) { |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
429 load = g_slist_append(load, g_strdup(p->value[0])); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
430 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
431 } |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
432 /* 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
|
433 * 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
|
434 * which ones to load before loading them. */ |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
435 while (load) { |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
436 if (load->data) |
2095
df9710306152
[gaim-migrate @ 2105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2091
diff
changeset
|
437 load_plugin(load->data); |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
438 g_free(load->data); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
439 load = g_slist_remove(load, load->data); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
440 } |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
441 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
442 #endif /* GAIM_PLUGINS */ |
1 | 443 |
4491 | 444 static struct gaim_account *gaimrc_read_user(FILE *f) |
1 | 445 { |
3493 | 446 struct parse parse_buffer; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
447 struct parse *p; |
4491 | 448 struct gaim_account *account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
449 int i; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
450 char buf[4096]; |
1 | 451 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
452 if (!fgets(buf, sizeof(buf), f)) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
453 return NULL; |
1 | 454 |
3493 | 455 p = parse_line(buf, &parse_buffer); |
1 | 456 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
457 if (strcmp(p->option, "ident")) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
458 return NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
459 |
4491 | 460 account = g_new0(struct gaim_account, 1); |
1 | 461 |
4491 | 462 strcpy(account->username, p->value[0]); |
463 strcpy(account->password, p->value[1]); | |
1 | 464 |
4491 | 465 account->user_info[0] = 0; |
466 account->options = OPT_ACCT_REM_PASS; | |
467 account->protocol = DEFAULT_PROTO; | |
468 account->permit = account->deny = NULL; | |
1 | 469 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
470 if (!fgets(buf, sizeof(buf), f)) |
4491 | 471 return account; |
1 | 472 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
473 if (strcmp(buf, "\t\tuser_info {\n")) { |
4491 | 474 return account; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
475 } |
1 | 476 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
477 if (!fgets(buf, sizeof(buf), f)) |
4491 | 478 return account; |
1 | 479 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
480 while (strncmp(buf, "\t\t}", 3)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
481 if (strlen(buf) > 3) |
4491 | 482 strcat(account->user_info, buf + 3); |
1 | 483 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
484 if (!fgets(buf, sizeof(buf), f)) { |
4491 | 485 return account; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
486 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
487 } |
1 | 488 |
4491 | 489 if ((i = strlen(account->user_info))) { |
490 account->user_info[i - 1] = '\0'; | |
1292 | 491 } |
492 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
493 if (!fgets(buf, sizeof(buf), f)) { |
4491 | 494 return account; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
495 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
496 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
497 if (!strcmp(buf, "\t}")) { |
4491 | 498 return account; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
499 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
500 |
3493 | 501 p = parse_line(buf, &parse_buffer); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
502 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
503 if (strcmp(p->option, "user_opts")) |
4491 | 504 return account; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
505 |
4491 | 506 account->options = atoi(p->value[0]); |
507 account->protocol = atoi(p->value[1]); | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
508 |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
509 if (!fgets(buf, sizeof(buf), f)) |
4491 | 510 return account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
511 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
512 if (!strcmp(buf, "\t}")) |
4491 | 513 return account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
514 |
3493 | 515 p = parse_line(buf, &parse_buffer); |
1051
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(p->option, "proto_opts")) |
4491 | 518 return account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
519 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
520 for (i = 0; i < 7; i++) |
4491 | 521 g_snprintf(account->proto_opt[i], sizeof account->proto_opt[i], "%s", p->value[i]); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
522 |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
523 if (!fgets(buf, sizeof(buf), f)) |
4491 | 524 return account; |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
525 |
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
526 if (!strcmp(buf, "\t}")) |
4491 | 527 return account; |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
528 |
3493 | 529 p = parse_line(buf, &parse_buffer); |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
530 |
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
531 if (strcmp(p->option, "iconfile")) |
4491 | 532 return account; |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
533 |
4491 | 534 g_snprintf(account->iconfile, sizeof(account->iconfile), "%s", p->value[0]); |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
535 |
3205 | 536 if (!fgets(buf, sizeof(buf), f)) |
4491 | 537 return account; |
3205 | 538 |
539 if (!strcmp(buf, "\t}")) | |
4491 | 540 return account; |
3205 | 541 |
3493 | 542 p = parse_line(buf, &parse_buffer); |
3205 | 543 |
544 if (strcmp(p->option, "alias")) | |
4491 | 545 return account; |
3205 | 546 |
4491 | 547 g_snprintf(account->alias, sizeof(account->alias), "%s", p->value[0]); |
3205 | 548 |
4491 | 549 return account; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
550 |
1 | 551 } |
552 | |
4491 | 553 static void gaimrc_write_user(FILE *f, struct gaim_account *account) |
1 | 554 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
555 char *c; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
556 int nl = 1, i; |
3309 | 557 |
4491 | 558 if (account->options & OPT_ACCT_REM_PASS) { |
559 fprintf(f, "\t\tident { %s } { %s }\n", account->username, (c = escape_text2(account->password))); | |
3309 | 560 free(c); |
561 } else { | |
4491 | 562 fprintf(f, "\t\tident { %s } { }\n", account->username); |
3309 | 563 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
564 fprintf(f, "\t\tuser_info {"); |
4491 | 565 c = account->user_info; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
566 while (*c) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
567 /* This is not as silly as it looks. */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
568 if (*c == '\n') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
569 nl++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
570 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
571 if (nl) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
572 while (nl) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
573 fprintf(f, "\n\t\t\t"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
574 nl--; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
575 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
576 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
577 fprintf(f, "%c", *c); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
578 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
579 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
580 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
581 fprintf(f, "\n\t\t}\n"); |
4491 | 582 fprintf(f, "\t\tuser_opts { %d } { %d }\n", account->options, account->protocol); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
583 fprintf(f, "\t\tproto_opts"); |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
584 for (i = 0; i < 7; i++) |
4491 | 585 fprintf(f, " { %s }", account->proto_opt[i]); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
586 fprintf(f, "\n"); |
4480
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
587 #ifndef _WIN32 |
4491 | 588 fprintf(f, "\t\ticonfile { %s }\n", account->iconfile); |
4480
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
589 #else |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
590 { |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
591 /* Make sure windows dir speparators arn't swallowed up when |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
592 path is read back in from resource file */ |
4491 | 593 char* tmp=wgaim_escape_dirsep(account->iconfile); |
594 fprintf(f, "\t\ticonfile { %s }\n", tmp); | |
4480
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
595 g_free(tmp); |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
596 } |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
597 #endif |
4491 | 598 fprintf(f, "\t\talias { %s }\n", account->alias); |
1 | 599 } |
600 | |
601 static void gaimrc_read_users(FILE *f) | |
602 { | |
603 char buf[2048]; | |
4491 | 604 struct gaim_account *account = NULL; |
3493 | 605 struct parse parse_buffer; |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
606 struct parse *p=NULL; |
1 | 607 |
608 buf[0] = 0; | |
609 | |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
610 while (fgets(buf, sizeof(buf), f)) { |
1 | 611 if (buf[0] == '#') |
612 continue; | |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
613 else if(buf[0] == '}') |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
614 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
615 |
3493 | 616 p = parse_line(buf, &parse_buffer); |
1 | 617 |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
618 if (strcmp(p->option, "user")==0 || |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
619 strcmp(p->option, "current_user")==0) { |
4491 | 620 if((account=gaimrc_read_user(f))!=NULL) |
621 gaim_accounts = g_slist_append(gaim_accounts, account); | |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
622 else { |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
623 debug_printf("Error reading in users from .gaimrc\n"); |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
624 return; |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
625 } |
159
d56878f647fb
[gaim-migrate @ 169]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
626 } |
1 | 627 } |
628 } | |
629 | |
630 static void gaimrc_write_users(FILE *f) | |
631 { | |
4491 | 632 GSList *usr = gaim_accounts; |
633 struct gaim_account *account; | |
1 | 634 |
635 fprintf(f, "users {\n"); | |
636 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
637 while (usr) { |
4491 | 638 account = (struct gaim_account *)usr->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
639 fprintf(f, "\tuser {\n"); |
4491 | 640 gaimrc_write_user(f, account); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
641 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
642 fprintf(f, "\t}\n"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
643 |
1 | 644 usr = usr->next; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
645 } |
1 | 646 |
647 fprintf(f, "}\n"); | |
648 } | |
649 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
650 struct replace { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
651 int old; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
652 guint *val; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
653 int new; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
654 }; |
1 | 655 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
656 static struct replace gen_replace[] = { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
657 { /* OPT_GEN_ENTER_SENDS */ 0x00000001, &convo_options, OPT_CONVO_ENTER_SENDS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
658 { /* OPT_GEN_APP_BUDDY_SHOW */ 0x00000010, &blist_options, OPT_BLIST_APP_BUDDY_SHOW }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
659 { /* OPT_GEN_POPUP_WINDOWS */ 0x00000020, &im_options, OPT_IM_POPUP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
660 { /* OPT_GEN_SEND_LINKS */ 0x00000040, &convo_options, OPT_CONVO_SEND_LINKS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
661 { /* OPT_GEN_DEBUG */ 0x00000100, &misc_options, OPT_MISC_DEBUG }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
662 { /* OPT_GEN_BROWSER_POPUP */ 0x00000800, &misc_options, OPT_MISC_BROWSER_POPUP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
663 { /* OPT_GEN_SAVED_WINDOWS */ 0x00001000, &blist_options, OPT_BLIST_SAVED_WINDOWS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
664 { /* OPT_GEN_DISCARD_WHEN_AWAY */ 0x00002000, &away_options, OPT_AWAY_DISCARD }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
665 { /* OPT_GEN_NEAR_APPLET */ 0x00004000, &blist_options, OPT_BLIST_NEAR_APPLET }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
666 { /* OPT_GEN_CHECK_SPELLING */ 0x00008000, &convo_options, OPT_CONVO_CHECK_SPELLING }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
667 { /* OPT_GEN_POPUP_CHAT */ 0x00010000, &chat_options, OPT_CHAT_POPUP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
668 { /* OPT_GEN_BACK_ON_IM */ 0x00020000, &away_options, OPT_AWAY_BACK_ON_IM }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
669 { /* OPT_GEN_CTL_CHARS */ 0x00080000, &convo_options, OPT_CONVO_CTL_CHARS }, |
3792 | 670 #if 0 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
671 { /* OPT_GEN_TIK_HACK */ 0x00100000, &away_options, OPT_AWAY_TIK_HACK }, |
3792 | 672 #endif |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
673 { /* OPT_GEN_CTL_SMILEYS */ 0x00200000, &convo_options, OPT_CONVO_CTL_SMILEYS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
674 { /* OPT_GEN_AUTO_AWAY */ 0x00800000, &away_options, OPT_AWAY_AUTO }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
675 { /* OPT_GEN_ESC_CAN_CLOSE */ 0x01000000, &convo_options, OPT_CONVO_ESC_CAN_CLOSE }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
676 { /* OPT_GEN_CTL_ENTER */ 0x02000000, &convo_options, OPT_CONVO_CTL_ENTER }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
677 { /* OPT_GEN_F2_TOGGLES */ 0x04000000, &convo_options, OPT_CONVO_F2_TOGGLES }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
678 { /* OPT_GEN_NO_AUTO_RESP */ 0x08000000, &away_options, OPT_AWAY_NO_AUTO_RESP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
679 { /* OPT_GEN_QUEUE_WHEN_AWAY */ 0x10000000, &away_options, OPT_AWAY_QUEUE }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
680 { 0,NULL,0 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
681 }; |
1 | 682 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
683 #define OPT_GEN_LOG_ALL 0x00000004 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
684 #define OPT_GEN_STRIP_HTML 0x00000008 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
685 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
686 static struct replace disp_replace[] = { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
687 { /* OPT_DISP_SHOW_TIME */ 0x00000001, &convo_options, OPT_CONVO_SHOW_TIME }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
688 { /* OPT_DISP_SHOW_GRPNUM */ 0x00000002, &blist_options, OPT_BLIST_SHOW_GRPNUM }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
689 { /* OPT_DISP_SHOW_PIXMAPS */ 0x00000004, &blist_options, OPT_BLIST_SHOW_PIXMAPS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
690 { /* OPT_DISP_SHOW_IDLETIME */ 0x00000008, &blist_options, OPT_BLIST_SHOW_IDLETIME }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
691 { /* OPT_DISP_SHOW_BUTTON_XPM */ 0x00000010, &blist_options, OPT_BLIST_SHOW_BUTTON_XPM }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
692 { /* OPT_DISP_IGNORE_COLOUR */ 0x00000020, &convo_options, OPT_CONVO_IGNORE_COLOUR }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
693 { /* OPT_DISP_SHOW_LOGON */ 0x00000040, &im_options, OPT_IM_LOGON }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
694 { /* OPT_DISP_SHOW_SMILEY */ 0x00000100, &convo_options, OPT_CONVO_SHOW_SMILEY }, |
3903 | 695 { /* OPT_DISP_COOL_LOOK */ 0x00000400, &misc_options, 0}, |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
696 { /* OPT_DISP_CHAT_LOGON */ 0x00000800, &chat_options, OPT_CHAT_LOGON }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
697 { /* OPT_DISP_NO_BUTTONS */ 0x00002000, &blist_options, OPT_BLIST_NO_BUTTONS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
698 { /* OPT_DISP_CONV_BUTTON_TEXT */ 0x00004000, &im_options, OPT_IM_BUTTON_TEXT }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
699 { /* OPT_DISP_CHAT_BUTTON_TEXT */ 0x00008000, &chat_options, OPT_CHAT_BUTTON_TEXT }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
700 { /* OPT_DISP_NO_MT_GRP */ 0x00040000, &blist_options, OPT_BLIST_NO_MT_GRP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
701 { /* OPT_DISP_CONV_BUTTON_XPM */ 0x00080000, &im_options, OPT_IM_BUTTON_XPM }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
702 { /* OPT_DISP_CHAT_BUTTON_XPM */ 0x00100000, &chat_options, OPT_CHAT_BUTTON_XPM }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
703 { /* OPT_DISP_SHOW_WARN */ 0x00200000, &blist_options, OPT_BLIST_SHOW_WARN }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
704 { /* OPT_DISP_IGNORE_FONTS */ 0x00400000, &convo_options, OPT_CONVO_IGNORE_FONTS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
705 { /* OPT_DISP_IGNORE_SIZES */ 0x00800000, &convo_options, OPT_CONVO_IGNORE_SIZES }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
706 { /* OPT_DISP_ONE_WINDOW */ 0x01000000, &im_options, OPT_IM_ONE_WINDOW }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
707 { /* OPT_DISP_ONE_CHAT_WINDOW */ 0x02000000, &chat_options, OPT_CHAT_ONE_WINDOW }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
708 { /* OPT_DISP_CONV_SIDE_TAB */ 0x04000000, &im_options, OPT_IM_SIDE_TAB }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
709 { /* OPT_DISP_CONV_BR_TAB */ 0x08000000, &im_options, OPT_IM_BR_TAB }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
710 { /* OPT_DISP_CHAT_SIDE_TAB */ 0x10000000, &chat_options, OPT_CHAT_SIDE_TAB }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
711 { /* OPT_DISP_CHAT_BR_TAB */ 0x20000000, &chat_options, OPT_CHAT_BR_TAB }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
712 { 0,NULL,0 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
713 }; |
1 | 714 |
715 static void gaimrc_read_options(FILE *f) | |
716 { | |
717 char buf[2048]; | |
3493 | 718 struct parse parse_buffer; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
719 struct parse *p; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
720 gboolean read_logging = FALSE, read_general = FALSE, read_display = FALSE; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
721 int general_options = 0, display_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
722 int i; |
1 | 723 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
724 buf[0] = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
725 |
1 | 726 while (buf[0] != '}') { |
727 if (buf[0] == '#') | |
728 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
729 |
1 | 730 if (!fgets(buf, sizeof(buf), f)) |
731 return; | |
732 | |
3493 | 733 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
734 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
735 if (!strcmp(p->option, "general_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
736 general_options = atoi(p->value[0]); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
737 read_general = TRUE; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
738 } else if (!strcmp(p->option, "display_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
739 display_options = atoi(p->value[0]); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
740 read_display = TRUE; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
741 } else if (!strcmp(p->option, "misc_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
742 misc_options = atoi(p->value[0]); |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
743 } else if (!strcmp(p->option, "logging_options")) { |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
744 logging_options = atoi(p->value[0]); |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
745 read_logging = TRUE; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
746 } else if (!strcmp(p->option, "blist_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
747 blist_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
748 } else if (!strcmp(p->option, "convo_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
749 convo_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
750 } else if (!strcmp(p->option, "im_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
751 im_options = atoi(p->value[0]); |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
752 } else if (!strcmp(p->option, "conv_placement")) { |
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
753 conv_placement_option = atoi(p->value[0]); |
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
754 gaim_conv_placement_set_active(conv_placement_option); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
755 } else if (!strcmp(p->option, "chat_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
756 chat_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
757 } else if (!strcmp(p->option, "font_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
758 font_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
759 } else if (!strcmp(p->option, "sound_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
760 sound_options = atoi(p->value[0]); |
4581 | 761 gaim_sound_change_output_method(); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
762 } else if (!strcmp(p->option, "away_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
763 away_options = atoi(p->value[0]); |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
764 away_resend = atoi(p->value[1]); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
765 } else if (!strcmp(p->option, "font_face")) { |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2592
diff
changeset
|
766 g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
767 } else if (!strcmp(p->option, "font_size")) { |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
768 fontsize = atoi(p->value[0]); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
769 } else if (!strcmp(p->option, "foreground")) { |
697 | 770 fgcolor.red = atoi(p->value[0]); |
771 fgcolor.green = atoi(p->value[1]); | |
772 fgcolor.blue = atoi(p->value[2]); | |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
773 } else if (!strcmp(p->option, "background")) { |
697 | 774 bgcolor.red = atoi(p->value[0]); |
775 bgcolor.green = atoi(p->value[1]); | |
776 bgcolor.blue = atoi(p->value[2]); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
777 } else if (!strcmp(p->option, "report_idle")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
778 report_idle = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
779 } else if (!strcmp(p->option, "web_browser")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
780 web_browser = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
781 } else if (!strcmp(p->option, "web_command")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
782 strcpy(web_command, p->value[0]); |
4288 | 783 } else if (!strcmp(p->option, "smiley_theme")) { |
784 load_smiley_theme(p->value[0], TRUE); | |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
785 } else if (!strcmp(p->option, "conv_size")) { |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
786 conv_size.width = atoi(p->value[0]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
787 conv_size.height = atoi(p->value[1]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
788 conv_size.entry_height = atoi(p->value[2]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
789 } else if (!strcmp(p->option, "buddy_chat_size")) { |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
790 buddy_chat_size.width = atoi(p->value[0]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
791 buddy_chat_size.height = atoi(p->value[1]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
792 buddy_chat_size.entry_height = atoi(p->value[2]); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
793 } else if (!strcmp(p->option, "blist_pos")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
794 blist_pos.x = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
795 blist_pos.y = atoi(p->value[1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
796 blist_pos.width = atoi(p->value[2]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
797 blist_pos.height = atoi(p->value[3]); |
82 | 798 } |
1 | 799 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
800 } |
1 | 801 |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2580
diff
changeset
|
802 /* this is where we do bugs and compatibility stuff */ |
4581 | 803 if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_NORMAL | OPT_SOUND_ESD |
4592 | 804 | OPT_SOUND_ARTS | OPT_SOUND_NAS | OPT_SOUND_CMD))) { |
4561 | 805 sound_options |= OPT_SOUND_NORMAL; |
4592 | 806 gaim_sound_change_output_method(); |
807 } | |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2580
diff
changeset
|
808 |
2352
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
809 if (conv_size.width == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
810 conv_size.height == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
811 conv_size.entry_height == 0) { |
3671 | 812 conv_size.width = 410; |
813 conv_size.height = 160; | |
2352
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
814 conv_size.entry_height = 50; |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
815 } |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
816 |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
817 if (buddy_chat_size.width == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
818 buddy_chat_size.height == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
819 buddy_chat_size.entry_height == 0) { |
3671 | 820 buddy_chat_size.width = 410; |
2352
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
821 buddy_chat_size.height = 160; |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
822 buddy_chat_size.entry_height = 50; |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
823 } |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
824 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
825 if (read_general) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
826 if (!read_logging) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
827 logging_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
828 if (general_options & OPT_GEN_LOG_ALL) |
4581 | 829 logging_options |= OPT_LOG_CONVOS | OPT_LOG_CHATS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
830 if (general_options & OPT_GEN_STRIP_HTML) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
831 logging_options |= OPT_LOG_STRIP_HTML; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
832 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
833 for (i = 0; gen_replace[i].val; i++) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
834 if (general_options & gen_replace[i].old) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
835 *gen_replace[i].val |= gen_replace[i].new; |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
836 } |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
837 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
838 if (read_display) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
839 for (i = 0; disp_replace[i].val; i++) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
840 if (display_options & disp_replace[i].old) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
841 *disp_replace[i].val |= disp_replace[i].new; |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
842 |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
843 if (!away_resend) |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
844 away_resend = 120; |
3391 | 845 |
846 if (misc_options & OPT_MISC_BUDDY_TICKER) { | |
3438 | 847 #ifdef GAIM_PLUGINS |
3630 | 848 gchar* buf; |
849 | |
850 buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, | |
851 #ifndef _WIN32 | |
852 "ticker.so", | |
853 #else | |
854 "ticker.dll", | |
855 #endif | |
856 NULL); | |
857 load_plugin(buf); | |
858 g_free(buf); | |
3438 | 859 #endif |
3391 | 860 misc_options &= ~OPT_MISC_BUDDY_TICKER; |
861 } | |
1 | 862 } |
863 | |
864 static void gaimrc_write_options(FILE *f) | |
865 { | |
866 | |
867 fprintf(f, "options {\n"); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
868 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
869 fprintf(f, "\tmisc_options { %u }\n", misc_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
870 fprintf(f, "\tlogging_options { %u }\n", logging_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
871 fprintf(f, "\tblist_options { %u }\n", blist_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
872 fprintf(f, "\tconvo_options { %u }\n", convo_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
873 fprintf(f, "\tim_options { %u }\n", im_options); |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
874 fprintf(f, "\tconv_placement { %u }\n", conv_placement_option); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
875 fprintf(f, "\tchat_options { %u }\n", chat_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
876 fprintf(f, "\tfont_options { %u }\n", font_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
877 fprintf(f, "\tsound_options { %u }\n", sound_options); |
2908
aa590ecc67a7
[gaim-migrate @ 2921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
878 fprintf(f, "\taway_options { %u } { %u }\n", away_options, away_resend); |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2592
diff
changeset
|
879 fprintf(f, "\tfont_face { %s }\n", fontface); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
880 fprintf(f, "\tfont_size { %d }\n", fontsize); |
697 | 881 fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue); |
882 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
|
883 fprintf(f, "\treport_idle { %d }\n", report_idle); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
884 fprintf(f, "\tweb_browser { %d }\n", web_browser); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
885 fprintf(f, "\tweb_command { %s }\n", web_command); |
4288 | 886 if (current_smiley_theme) |
887 fprintf(f, "\tsmiley_theme { %s }\n", current_smiley_theme->path); | |
3541 | 888 fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d }\n", |
889 blist_pos.x, blist_pos.y, blist_pos.width, blist_pos.height); | |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
890 fprintf(f, "\tconv_size { %d } { %d } { %d }\n", |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
891 conv_size.width, conv_size.height, conv_size.entry_height); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
892 fprintf(f, "\tbuddy_chat_size { %d } { %d } { %d }\n", |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
893 buddy_chat_size.width, buddy_chat_size.height, buddy_chat_size.entry_height); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
894 |
1 | 895 fprintf(f, "}\n"); |
896 } | |
897 | |
898 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
899 static void gaimrc_read_sounds(FILE *f) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
900 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
901 int i; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
902 char buf[2048]; |
3493 | 903 struct parse parse_buffer; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
904 struct parse *p; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
905 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
906 buf[0] = 0; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
907 |
4561 | 908 for(i=0; i<GAIM_NUM_SOUNDS; i++) |
909 gaim_sound_set_event_file(i, NULL); | |
910 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
911 while (buf[0] != '}') { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
912 if (buf[0] == '#') |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
913 continue; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
914 |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
915 if (!fgets(buf, sizeof(buf), f)) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
916 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
917 |
3493 | 918 p = parse_line(buf, &parse_buffer); |
3630 | 919 #ifndef _WIN32 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
920 if (!strcmp(p->option, "sound_cmd")) { |
4561 | 921 gaim_sound_set_command(p->value[0]); |
922 } else | |
3630 | 923 #endif |
924 if (!strncmp(p->option, "sound", strlen("sound"))) { | |
2036
ab15b91b93d8
[gaim-migrate @ 2046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1976
diff
changeset
|
925 i = p->option[strlen("sound")] - 'A'; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
926 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
927 if (p->value[0][0]) |
4561 | 928 gaim_sound_set_event_file(i, p->value[0]); |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
929 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
930 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
931 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
932 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
933 static void gaimrc_write_sounds(FILE *f) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
934 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
935 int i; |
4561 | 936 char *cmd; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
937 fprintf(f, "sound_files {\n"); |
4561 | 938 for (i = 0; i < GAIM_NUM_SOUNDS; i++) { |
939 char *file = gaim_sound_get_event_file(i); | |
940 if (file) { | |
4405
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
941 #ifndef _WIN32 |
4561 | 942 fprintf(f, "\tsound%c { %s }\n", i + 'A', file); |
4405
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
943 #else |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
944 /* Make sure windows dir speparators arn't swallowed up when |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
945 path is read back in from resource file */ |
4561 | 946 char* tmp=wgaim_escape_dirsep(file); |
4405
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
947 fprintf(f, "\tsound%c { %s }\n", i + 'A', tmp); |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
948 g_free(tmp); |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
949 #endif |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
950 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
951 else |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
952 fprintf(f, "\tsound%c { }\n", i + 'A'); |
4561 | 953 } |
3630 | 954 #ifndef _WIN32 |
4561 | 955 cmd = gaim_sound_get_command(); |
956 if(cmd) | |
957 fprintf(f, "\tsound_cmd { %s }\n", cmd); | |
958 else | |
959 fprintf(f, "\tsound_cmd { }\n"); | |
3630 | 960 #endif |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
961 fprintf(f, "}\n"); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
962 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
963 |
3435 | 964 static gboolean gaimrc_parse_proxy_uri(const char *proxy) |
965 { | |
966 char *c, *d; | |
967 char buffer[2048]; | |
968 | |
969 char host[128]; | |
970 char user[128]; | |
971 char pass[128]; | |
972 int port = 0; | |
973 int len = 0; | |
974 | |
4137 | 975 host[0] = '\0'; |
976 user[0] = '\0'; | |
977 pass[0] = '\0'; | |
978 | |
979 debug_printf("gaimrc_parse_proxy_uri(%s)\n", proxy); | |
980 | |
3435 | 981 if ((c = strchr(proxy, ':')) == NULL) |
982 { | |
4137 | 983 debug_printf("no uri detected\n"); |
3435 | 984 /* No URI detected. */ |
985 return FALSE; | |
986 } | |
987 | |
988 len = c - proxy; | |
989 | |
4137 | 990 if (!strncmp(proxy, "http://", len + 3)) |
3435 | 991 proxytype = PROXY_HTTP; |
992 else | |
993 return FALSE; | |
994 | |
4137 | 995 debug_printf("found http proxy\n"); |
3435 | 996 /* Get past "://" */ |
997 c += 3; | |
998 | |
4137 | 999 debug_printf("looking at %s\n", c); |
1000 | |
3435 | 1001 for (;;) |
1002 { | |
1003 *buffer = '\0'; | |
1004 d = buffer; | |
1005 | |
1006 while (*c != '\0' && *c != '@' && *c != ':' && *c != '/') | |
1007 *d++ = *c++; | |
1008 | |
1009 *d = '\0'; | |
1010 | |
1011 if (*c == ':') | |
1012 { | |
1013 /* | |
1014 * If there is a '@' in there somewhere, we are in the auth part. | |
1015 * If not, host. | |
1016 */ | |
1017 if (strchr(c, '@') != NULL) | |
4137 | 1018 strcpy(user, buffer); |
3435 | 1019 else |
4137 | 1020 strcpy(host, buffer); |
3435 | 1021 } |
1022 else if (*c == '@') | |
1023 { | |
4137 | 1024 if (user[0] == '\0') |
1025 strcpy(user, buffer); | |
3435 | 1026 else |
4137 | 1027 strcpy(pass, buffer); |
3435 | 1028 } |
1029 else if (*c == '/' || *c == '\0') | |
1030 { | |
4137 | 1031 if (host[0] == '\0') |
1032 strcpy(host, buffer); | |
3435 | 1033 else |
1034 port = atoi(buffer); | |
1035 | |
1036 /* Done. */ | |
1037 break; | |
1038 } | |
1039 | |
1040 c++; | |
1041 } | |
1042 | |
1043 /* NOTE: HTTP_PROXY takes precendence. */ | |
4137 | 1044 if (host[0]) |
3435 | 1045 strcpy(proxyhost, host); |
1046 else | |
1047 *proxyhost = '\0'; | |
1048 | |
4137 | 1049 if (user[0]) |
3435 | 1050 strcpy(proxyuser, user); |
1051 else | |
1052 *proxyuser = '\0'; | |
1053 | |
4137 | 1054 if (pass[0]) |
3435 | 1055 strcpy(proxypass, pass); |
1056 else | |
1057 *proxypass = '\0'; | |
1058 | |
1059 proxyport = port; | |
1060 | |
4137 | 1061 debug_printf("host '%s'\nuser '%s'\npassword '%s'\nport %d\n", |
1062 proxyhost, proxyuser, proxypass, proxyport); | |
1063 | |
3435 | 1064 return TRUE; |
1065 } | |
1066 | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1067 static void gaimrc_read_proxy(FILE *f) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1068 { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1069 char buf[2048]; |
3493 | 1070 struct parse parse_buffer; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1071 struct parse *p; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1072 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1073 buf[0] = 0; |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1074 proxyhost[0] = 0; |
4137 | 1075 debug_printf("gaimrc_read_proxy\n"); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1076 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1077 while (buf[0] != '}') { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1078 if (buf[0] == '#') |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1079 continue; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1080 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1081 if (!fgets(buf, sizeof(buf), f)) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1082 return; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1083 |
3493 | 1084 p = parse_line(buf, &parse_buffer); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1085 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1086 if (!strcmp(p->option, "host")) { |
4137 | 1087 g_snprintf(proxyhost, sizeof(proxyhost), "%s", |
1088 p->value[0]); | |
1089 debug_printf("set proxyhost %s\n", proxyhost); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1090 } else if (!strcmp(p->option, "port")) { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1091 proxyport = atoi(p->value[0]); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1092 } else if (!strcmp(p->option, "type")) { |
1921
a84a41ecf380
[gaim-migrate @ 1931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1886
diff
changeset
|
1093 proxytype = atoi(p->value[0]); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1094 } else if (!strcmp(p->option, "user")) { |
4137 | 1095 g_snprintf(proxyuser, sizeof(proxyuser), "%s", |
1096 p->value[0]); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1097 } else if (!strcmp(p->option, "pass")) { |
4137 | 1098 g_snprintf(proxypass, sizeof(proxypass), "%s", |
1099 p->value[0]); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1100 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1101 } |
4137 | 1102 if (proxyhost[0]) |
1103 proxy_info_is_from_gaimrc = 1; | |
1104 else if (!proxyhost[0]) { | |
1105 | |
3435 | 1106 gboolean getVars = TRUE; |
4137 | 1107 proxy_info_is_from_gaimrc = 0; |
3435 | 1108 |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1109 if (g_getenv("HTTP_PROXY")) |
4137 | 1110 g_snprintf(proxyhost, sizeof(proxyhost), "%s", |
1111 g_getenv("HTTP_PROXY")); | |
1938
c9db54d8d8dc
[gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1936
diff
changeset
|
1112 else if (g_getenv("http_proxy")) |
4137 | 1113 g_snprintf(proxyhost, sizeof(proxyhost), "%s", |
1114 g_getenv("http_proxy")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1115 else if (g_getenv("HTTPPROXY")) |
4137 | 1116 g_snprintf(proxyhost, sizeof(proxyhost), "%s", |
1117 g_getenv("HTTPPROXY")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1118 |
3435 | 1119 if (*proxyhost != '\0') |
1120 getVars = !gaimrc_parse_proxy_uri(proxyhost); | |
1121 | |
1122 if (getVars) | |
1123 { | |
1124 if (g_getenv("HTTP_PROXY_PORT")) | |
1125 proxyport = atoi(g_getenv("HTTP_PROXY_PORT")); | |
1126 else if (g_getenv("http_proxy_port")) | |
1127 proxyport = atoi(g_getenv("http_proxy_port")); | |
1128 else if (g_getenv("HTTPPROXYPORT")) | |
1129 proxyport = atoi(g_getenv("HTTPPROXYPORT")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1130 |
3435 | 1131 if (g_getenv("HTTP_PROXY_USER")) |
4137 | 1132 g_snprintf(proxyuser, sizeof(proxyuser), "%s", |
1133 g_getenv("HTTP_PROXY_USER")); | |
3435 | 1134 else if (g_getenv("http_proxy_user")) |
4137 | 1135 g_snprintf(proxyuser, sizeof(proxyuser), "%s", |
1136 g_getenv("http_proxy_user")); | |
3435 | 1137 else if (g_getenv("HTTPPROXYUSER")) |
4137 | 1138 g_snprintf(proxyuser, sizeof(proxyuser), "%s", |
1139 g_getenv("HTTPPROXYUSER")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1140 |
3435 | 1141 if (g_getenv("HTTP_PROXY_PASS")) |
4137 | 1142 g_snprintf(proxypass, sizeof(proxypass), "%s", |
1143 g_getenv("HTTP_PROXY_PASS")); | |
3435 | 1144 else if (g_getenv("http_proxy_pass")) |
4137 | 1145 g_snprintf(proxypass, sizeof(proxypass), "%s", |
1146 g_getenv("http_proxy_pass")); | |
3435 | 1147 else if (g_getenv("HTTPPROXYPASS")) |
4137 | 1148 g_snprintf(proxypass, sizeof(proxypass), "%s", |
1149 g_getenv("HTTPPROXYPASS")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1150 |
3435 | 1151 |
1152 if (proxyhost[0]) | |
1153 proxytype = PROXY_HTTP; | |
1154 } | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1155 } |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1156 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1157 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1158 static void gaimrc_write_proxy(FILE *f) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1159 { |
3309 | 1160 char *str; |
1161 | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1162 fprintf(f, "proxy {\n"); |
4137 | 1163 if (proxy_info_is_from_gaimrc) { |
1164 fprintf(f, "\thost { %s }\n", proxyhost); | |
1165 fprintf(f, "\tport { %d }\n", proxyport); | |
1166 fprintf(f, "\ttype { %d }\n", proxytype); | |
1167 fprintf(f, "\tuser { %s }\n", proxyuser); | |
1168 fprintf(f, "\tpass { %s }\n", (str = escape_text2(proxypass))); | |
1169 free(str); | |
1170 } else { | |
1171 fprintf(f, "\thost { %s }\n", ""); | |
1172 fprintf(f, "\tport { %d }\n", 0); | |
1173 fprintf(f, "\ttype { %d }\n", 0); | |
1174 fprintf(f, "\tuser { %s }\n", ""); | |
1175 fprintf(f, "\tpass { %s }\n", ""); | |
1176 } | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1177 fprintf(f, "}\n"); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1178 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1179 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1180 static void set_defaults() |
1 | 1181 { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1182 int i; |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1183 struct away_message *a; |
917 | 1184 |
4227 | 1185 misc_options = |
1186 OPT_MISC_USE_SERVER_ALIAS; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1187 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1188 logging_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1189 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1190 blist_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1191 OPT_BLIST_APP_BUDDY_SHOW | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1192 OPT_BLIST_SAVED_WINDOWS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1193 OPT_BLIST_NEAR_APPLET | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1194 OPT_BLIST_SHOW_GRPNUM | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1195 OPT_BLIST_SHOW_PIXMAPS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1196 OPT_BLIST_SHOW_IDLETIME | |
3367 | 1197 OPT_BLIST_GREY_IDLERS | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1198 OPT_BLIST_SHOW_BUTTON_XPM; |
870 | 1199 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1200 convo_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1201 OPT_CONVO_ENTER_SENDS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1202 OPT_CONVO_SEND_LINKS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1203 OPT_CONVO_CTL_CHARS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1204 OPT_CONVO_CTL_SMILEYS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1205 OPT_CONVO_SHOW_TIME | |
3919 | 1206 OPT_CONVO_SHOW_SMILEY | |
1207 OPT_CONVO_CHECK_SPELLING; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1208 |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
1209 conv_placement_option = 0; |
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
1210 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1211 im_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1212 OPT_IM_LOGON | |
3367 | 1213 OPT_IM_BUTTON_XPM | |
1214 OPT_IM_ONE_WINDOW ; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1215 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1216 chat_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1217 OPT_CHAT_LOGON | |
2388
5a7234d5e052
[gaim-migrate @ 2401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2383
diff
changeset
|
1218 OPT_CHAT_BUTTON_XPM | |
3367 | 1219 OPT_CHAT_TAB_COMPLETE | |
1220 OPT_CHAT_ONE_WINDOW; | |
870 | 1221 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1222 font_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1223 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1224 away_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1225 OPT_AWAY_BACK_ON_IM; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1226 |
4561 | 1227 for (i = 0; i < GAIM_NUM_SOUNDS; i++) |
1228 gaim_sound_set_event_file(i, NULL); | |
1229 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1230 font_options = 0; |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1231 /* Enable all of the sound players that might be available. The first |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1232 available one will be used. */ |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1233 sound_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1234 OPT_SOUND_LOGIN | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1235 OPT_SOUND_LOGOUT | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1236 OPT_SOUND_RECV | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1237 OPT_SOUND_SEND | |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1238 OPT_SOUND_SILENT_SIGNON | |
4581 | 1239 OPT_SOUND_NORMAL | |
1240 OPT_SOUND_NAS; | |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1241 |
2990 | 1242 #ifdef USE_SCREENSAVER |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1243 report_idle = IDLE_SCREENSAVER; |
2990 | 1244 #else |
1245 report_idle = IDLE_GAIM; | |
1246 #endif | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1247 web_browser = BROWSER_NETSCAPE; |
3434 | 1248 g_snprintf(web_command, sizeof(web_command), "xterm -e lynx %%s"); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1249 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1250 auto_away = 10; |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1251 a = g_new0(struct away_message, 1); |
4589 | 1252 g_snprintf(a->name, sizeof(a->name), _("boring default")); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1253 g_snprintf(a->message, sizeof(a->message), "%s", BORING_DEFAULT_AWAY_MSG); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1254 away_messages = g_slist_append(away_messages, a); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1255 default_away = a; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1256 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1257 blist_pos.width = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1258 blist_pos.height = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1259 blist_pos.x = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1260 blist_pos.y = 0; |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
1261 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1262 conv_size.width = 320; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1263 conv_size.height = 175; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1264 conv_size.entry_height = 50; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1265 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1266 buddy_chat_size.width = 320; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1267 buddy_chat_size.height = 160; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1268 buddy_chat_size.entry_height = 50; |
1 | 1269 } |
1270 | |
1271 void load_prefs() | |
1272 { | |
1273 FILE *f; | |
1274 char buf[1024]; | |
1275 int ver = 0; | |
4137 | 1276 debug_printf("load_prefs\n"); |
1277 if (is_saving_prefs) { | |
1278 request_load_prefs = 1; | |
1279 debug_printf("currently saving, will request load\n"); | |
1280 return; | |
1281 } | |
570 | 1282 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1283 if (opt_rcfile_arg) |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1284 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); |
3630 | 1285 else if (gaim_home_dir()) |
1286 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaimrc", gaim_home_dir()); | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1287 else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1288 set_defaults(); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1289 return; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1290 } |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1291 |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1292 if ((f = fopen(buf, "r"))) { |
4137 | 1293 is_loading_prefs = 1; |
1294 debug_printf("start load_prefs\n"); | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1295 fgets(buf, sizeof(buf), f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1296 sscanf(buf, "# .gaimrc v%d", &ver); |
2389
021ba044ab0b
[gaim-migrate @ 2402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2388
diff
changeset
|
1297 if ((ver <= 3) || (buf[0] != '#')) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1298 set_defaults(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1299 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1300 while (!feof(f)) { |
4137 | 1301 int tag = gaimrc_parse_tag(f); |
1302 debug_printf("starting read tag %d\n", tag); | |
1303 switch (tag) { | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1304 case -1: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1305 /* Let the loop end, EOF */ |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1306 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1307 case 0: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1308 gaimrc_read_users(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1309 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1310 case 1: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1311 gaimrc_read_options(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1312 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1313 case 2: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1314 gaimrc_read_away(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1315 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1316 #ifdef GAIM_PLUGINS |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1317 case 3: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1318 gaimrc_read_plugins(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1319 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1320 #endif |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1321 case 4: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1322 gaimrc_read_pounce(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1323 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1324 case 6: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1325 gaimrc_read_sounds(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1326 break; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1327 case 7: |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1328 gaimrc_read_proxy(f); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1329 break; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1330 default: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1331 /* NOOP */ |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1332 break; |
1 | 1333 } |
4137 | 1334 debug_printf("ending read tag %d\n", tag); |
1 | 1335 } |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1336 fclose(f); |
4137 | 1337 is_loading_prefs = 0; |
1338 debug_printf("end load_prefs\n"); | |
1339 if (request_save_prefs) { | |
1340 debug_printf("saving prefs on request\n"); | |
1341 save_prefs(); | |
1342 request_save_prefs = 0; | |
1343 } | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1344 } else if (opt_rcfile_arg) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1345 g_snprintf(buf, sizeof(buf), _("Could not open config file %s."), opt_rcfile_arg); |
3427 | 1346 do_error_dialog(buf, NULL, GAIM_ERROR); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1347 set_defaults(); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1348 } else { |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1349 set_defaults(); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1350 save_prefs(); |
1 | 1351 } |
1352 } | |
1353 | |
1354 void save_prefs() | |
1355 { | |
1356 FILE *f; | |
1357 char buf[BUF_LONG]; | |
4393
bca8256a91a6
[gaim-migrate @ 4659]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4381
diff
changeset
|
1358 |
4381
af485b4bb8c1
[gaim-migrate @ 4647]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4349
diff
changeset
|
1359 debug_printf("enter save_prefs\n"); |
4137 | 1360 if (is_loading_prefs) { |
1361 request_save_prefs = 1; | |
1362 debug_printf("currently loading, will request save\n"); | |
1363 return; | |
1364 } | |
1 | 1365 |
3630 | 1366 if (opt_rcfile_arg) { |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1367 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); |
3630 | 1368 } |
1369 else if (gaim_home_dir()) { | |
1370 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaimrc", gaim_home_dir()); | |
1371 } | |
1372 else { | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1373 return; |
3630 | 1374 } |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1375 if ((f = fopen(buf, "w"))) { |
4137 | 1376 is_saving_prefs = 1; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1377 fprintf(f, "# .gaimrc v%d\n", 4); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1378 gaimrc_write_users(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1379 gaimrc_write_options(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1380 gaimrc_write_sounds(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1381 gaimrc_write_away(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1382 gaimrc_write_pounce(f); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1383 #ifdef GAIM_PLUGINS |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1384 gaimrc_write_plugins(f); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1385 #endif |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1386 gaimrc_write_proxy(f); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1387 fclose(f); |
3717
988485669631
[gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3671
diff
changeset
|
1388 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1389 chmod(buf, S_IRUSR | S_IWUSR); |
4137 | 1390 is_saving_prefs = 0; |
1 | 1391 } |
3630 | 1392 else |
1393 debug_printf("Error opening .gaimrc\n"); | |
4137 | 1394 if (request_load_prefs) { |
1395 debug_printf("loading prefs on request\n"); | |
1396 load_prefs(); | |
1397 request_load_prefs = 0; | |
1398 } | |
1399 debug_printf("exit save_prefs\n"); | |
1 | 1400 } |
1401 | |
1209 | 1402 |
1403 | |
1404 /* This function is called by g_slist_insert_sorted to compare the item | |
1405 * being compared to the rest of the items on the list. | |
1406 */ | |
1407 | |
1408 gint sort_awaymsg_list(gconstpointer a, gconstpointer b) | |
1409 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1410 struct away_message *msg_a; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1411 struct away_message *msg_b; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1412 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1413 msg_a = (struct away_message *)a; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1414 msg_b = (struct away_message *)b; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1415 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1416 return (strcmp(msg_a->name, msg_b->name)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1417 |
1209 | 1418 } |