Mercurial > pidgin
annotate src/gaimrc.c @ 5160:91ea5ef2278b
[gaim-migrate @ 5524]
1) Added neat little protocol icons next to the set away message menu when
you have more than one account signed on. I basically just copied
Nathan's code, so it should be ok.
2) Changed the horizontal rules in the away message menu so they show up
for me. This is how horizontal rules are done in other menus, I'm
not sure why the away message menu was different.
3) Moved 2 gtkish functions from util.c to gtkutils.c. Earlier I used one
of these functions, and then earlier, but not as early, I realized that
gtkutils.c existed, so I put 2 and 2 together and realized you were
probably flying somewhere.
Well then, let's put another shrimp on the barbi'!
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 18 Apr 2003 02:28:06 +0000 |
parents | 145587c11207 |
children | fefad67de2c7 |
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" |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
42 #include "pounce.h" |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
43 #include "gtkpounce.h" |
1 | 44 |
3630 | 45 #ifdef _WIN32 |
46 #include "win32dep.h" | |
47 #endif | |
48 | |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
49 /* for people like myself, who are too lazy to add an away msg :) */ |
4596 | 50 #define BORING_DEFAULT_AWAY_MSG _("sorry, i ran out for a while. bbl") |
1139 | 51 #define MAX_VALUES 10 |
1 | 52 |
4491 | 53 GSList *gaim_accounts = NULL; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
54 guint misc_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
55 guint logging_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
56 guint blist_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
57 guint convo_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
58 guint im_options; |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
59 guint conv_placement_option; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
60 guint chat_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
61 guint font_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
62 guint sound_options; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
63 guint away_options; |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
64 guint away_resend; |
4137 | 65 static guint is_loading_prefs = 0; |
66 static guint request_save_prefs = 0; | |
67 static guint is_saving_prefs = 0; | |
68 static guint request_load_prefs = 0; | |
69 guint proxy_info_is_from_gaimrc = 1; /* Only save proxy info if it | |
70 * was loaded from the file | |
71 * or otherwise explicitly requested */ | |
1 | 72 |
3630 | 73 int report_idle; |
74 int web_browser; | |
1 | 75 struct save_pos blist_pos; |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
76 struct window_size conv_size, buddy_chat_size; |
4189 | 77 char web_command[2048] = ""; |
1 | 78 |
79 struct parse { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
80 char option[256]; |
2286
f00bf9537bb7
[gaim-migrate @ 2296]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2199
diff
changeset
|
81 char value[MAX_VALUES][4096]; |
1 | 82 }; |
83 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
84 /* |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
85 * This is absolutely necessary, unfortunately. It is used to grab |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
86 * the information on the pounce, so that we can then later register |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
87 * them. The reason we do this (well, one of them) is because the buddy |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
88 * list isn't processed yet. |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
89 * |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
90 * -- ChipX86 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
91 */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
92 struct pounce_placeholder |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
93 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
94 char name[80]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
95 char message[2048]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
96 char command[2048]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
97 char sound[2048]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
98 char pouncer[80]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
99 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
100 int protocol; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
101 int options; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
102 }; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
103 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
104 static GList *buddy_pounces = NULL; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
105 |
3493 | 106 static struct parse *parse_line(char *line, struct parse *p) |
1 | 107 { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
108 char *c = line; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
109 int inopt = 1, inval = 0, curval = -1; |
4137 | 110 int optlen = 0, vallen = 0, last_non_space = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
111 int x; |
1 | 112 |
1137 | 113 for (x = 0; x < MAX_VALUES; x++) { |
3493 | 114 p->value[x][0] = 0; |
1137 | 115 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
116 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
117 while (*c) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
118 if (*c == '\t') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
119 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
120 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
121 } |
4049 | 122 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
123 if (inopt) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
124 if ((*c < 'a' || *c > 'z') && *c != '_' && (*c < 'A' || *c > 'Z')) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
125 inopt = 0; |
3493 | 126 p->option[optlen] = 0; |
1 | 127 c++; |
128 continue; | |
129 } | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
130 |
3493 | 131 p->option[optlen] = *c; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
132 optlen++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
133 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
134 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
135 } else if (inval) { |
4049 | 136 if (*c == '\\') { |
137 /* if we have a \ take the char after it literally.. */ | |
138 c++; | |
139 p->value[curval][vallen] = *c; | |
140 | |
141 vallen++; | |
4137 | 142 last_non_space = vallen; |
4049 | 143 c++; |
144 continue; | |
145 } else if (*c == '}') { | |
146 /* } that isn't escaped should end this chunk of data, and | |
147 * should have a space before it.. */ | |
4137 | 148 p->value[curval][last_non_space] = 0; |
4049 | 149 inval = 0; |
150 c++; | |
151 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
152 } else { |
3493 | 153 p->value[curval][vallen] = *c; |
4049 | 154 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
155 vallen++; |
5109 | 156 if (isspace(*c)) |
157 last_non_space = vallen - 1; | |
158 else | |
4137 | 159 last_non_space = vallen; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
160 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
161 continue; |
1 | 162 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
163 } else if (*c == '{') { |
4049 | 164 /* i really don't think this if ever succeeds, but i'm |
165 * not brave enough to take it out... */ | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
166 if (*(c - 1) == '\\') { |
4137 | 167 p->value[curval][vallen] = *c; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
168 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
169 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
170 } else { |
4049 | 171 /* { that isn't escaped should signify the start of a |
172 * piece of data and should have a space after it.. */ | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
173 curval++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
174 vallen = 0; |
4137 | 175 last_non_space = vallen; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
176 inval = 1; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
177 c++; |
4137 | 178 while (*c && isspace(*c)) |
179 c++; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
180 continue; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
181 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
182 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
183 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
184 } |
1137 | 185 |
3493 | 186 return p; |
1 | 187 } |
188 | |
189 | |
190 static int gaimrc_parse_tag(FILE *f) | |
191 { | |
192 char buf[2048]; | |
193 char tag[256]; | |
194 buf[0] = '#'; | |
195 | |
196 while (buf[0] == '#' && !feof(f)) | |
197 fgets(buf, sizeof(buf), f); | |
198 | |
199 if (feof(f)) | |
200 return -1; | |
201 | |
202 sscanf(buf, "%s {", tag); | |
203 | |
204 if (!strcmp(tag, "users")) { | |
205 return 0; | |
206 } else if (!strcmp(tag, "options")) { | |
207 return 1; | |
208 } else if (!strcmp(tag, "away")) { | |
209 return 2; | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
210 } else if (!strcmp(tag, "plugins")) { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
211 return 3; |
673 | 212 } else if (!strcmp(tag, "pounce")) { |
213 return 4; | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
214 } else if (!strcmp(tag, "sound_files")) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
215 return 6; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
216 } else if (!strcmp(tag, "proxy")) { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
217 return 7; |
4026
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3924
diff
changeset
|
218 } else if (!strcmp(tag, "wgaim")) { |
a997156437b6
[gaim-migrate @ 4230]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3924
diff
changeset
|
219 return 8; |
1 | 220 } |
221 return -1; | |
222 } | |
223 | |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
224 static char *escape_text2(const char *msg) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
225 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
226 char *c, *cpy; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
227 char *woo; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
228 int cnt = 0; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
229 /* 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
|
230 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
231 woo = malloc(strlen(msg) * 4 + 1); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
232 cpy = g_strndup(msg, 2048); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
233 c = cpy; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
234 while (*c) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
235 switch (*c) { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
236 case '\n': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
237 woo[cnt++] = '<'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
238 woo[cnt++] = 'B'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
239 woo[cnt++] = 'R'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
240 woo[cnt++] = '>'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
241 break; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
242 case '{': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
243 case '}': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
244 case '\\': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
245 case '"': |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
246 woo[cnt++] = '\\'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
247 /* Fall through */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
248 default: |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
249 woo[cnt++] = *c; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
250 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
251 c++; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
252 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
253 woo[cnt] = '\0'; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
254 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
255 g_free(cpy); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
256 return woo; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
257 } |
44 | 258 |
1 | 259 static void gaimrc_read_away(FILE *f) |
260 { | |
3493 | 261 struct parse parse_buffer; |
1 | 262 struct parse *p; |
263 char buf[4096]; | |
264 struct away_message *a; | |
265 | |
266 buf[0] = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
267 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
268 while (buf[0] != '}') { |
1 | 269 if (!fgets(buf, sizeof(buf), f)) |
270 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
271 |
1 | 272 if (buf[0] == '}') |
273 return; | |
274 | |
3493 | 275 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
276 if (!strcmp(p->option, "message")) { |
15 | 277 a = g_new0(struct away_message, 1); |
1 | 278 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
279 g_snprintf(a->name, sizeof(a->name), "%s", p->value[0]); |
15 | 280 g_snprintf(a->message, sizeof(a->message), "%s", p->value[1]); |
1209 | 281 away_messages = g_slist_insert_sorted(away_messages, a, sort_awaymsg_list); |
15 | 282 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
283 /* auto { time } { default message } */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
284 else if (!strcmp(p->option, "auto")) { |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
285 auto_away = atoi(p->value[0]); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2369
diff
changeset
|
286 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
|
287 } |
1 | 288 } |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
289 if (!away_messages) { |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
290 a = g_new0(struct away_message, 1); |
4589 | 291 g_snprintf(a->name, sizeof(a->name), _("boring default")); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
292 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
|
293 away_messages = g_slist_append(away_messages, a); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
294 } |
1 | 295 } |
296 | |
297 static void gaimrc_write_away(FILE *f) | |
298 { | |
940 | 299 GSList *awy = away_messages; |
1 | 300 struct away_message *a; |
301 | |
302 fprintf(f, "away {\n"); | |
303 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
304 if (awy) { |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
305 while (awy) { |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
306 char *str1, *str2; |
26 | 307 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
308 a = (struct away_message *)awy->data; |
26 | 309 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
310 str1 = escape_text2(a->name); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
311 str2 = escape_text2(a->message); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
312 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
313 fprintf(f, "\tmessage { %s } { %s }\n", str1, str2); |
26 | 314 |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
315 /* 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
|
316 free(str1); |
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
317 free(str2); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
318 |
940 | 319 awy = g_slist_next(awy); |
230
83dd297aa363
[gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
180
diff
changeset
|
320 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2369
diff
changeset
|
321 fprintf(f, "\tauto { %d } { %d }\n", auto_away, |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
322 g_slist_index(away_messages, default_away)); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
323 } else { |
4596 | 324 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
|
325 fprintf(f, "\tauto { 0 } { 0 }\n"); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
326 } |
1 | 327 |
328 fprintf(f, "}\n"); | |
329 } | |
330 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
331 /* |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
332 * This is temporary, and we're using it to translate the new event |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
333 * and action values into the old ones. We're also adding entries for |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
334 * new types, but if you go and use an older gaim, these will be nuked. |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
335 * When we have a better prefs system, this can go away. |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
336 * |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
337 * -- ChipX86 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
338 */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
339 static int pounce_evt_trans_table[] = |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
340 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
341 0x010, GAIM_POUNCE_SIGNON, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
342 0x020, GAIM_POUNCE_AWAY_RETURN, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
343 0x040, GAIM_POUNCE_IDLE_RETURN, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
344 0x080, GAIM_POUNCE_TYPING, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
345 /* 0x100, save, is handled separately. */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
346 0x400, GAIM_POUNCE_SIGNOFF, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
347 0x800, GAIM_POUNCE_AWAY, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
348 0x1000, GAIM_POUNCE_IDLE, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
349 0x2000, GAIM_POUNCE_TYPING_STOPPED |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
350 }; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
351 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
352 static int pounce_act_trans_table[] = |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
353 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
354 0x001, GAIM_GTKPOUNCE_OPEN_WIN, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
355 0x002, GAIM_GTKPOUNCE_SEND_MSG, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
356 0x004, GAIM_GTKPOUNCE_EXEC_CMD, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
357 0x008, GAIM_GTKPOUNCE_PLAY_SOUND, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
358 /* 0x100, save, is handled separately. */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
359 0x200, GAIM_GTKPOUNCE_POPUP |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
360 }; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
361 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
362 static int pounce_evt_trans_table_size = |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
363 (sizeof(pounce_evt_trans_table) / sizeof(*pounce_evt_trans_table)); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
364 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
365 static int pounce_act_trans_table_size = |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
366 (sizeof(pounce_act_trans_table) / sizeof(*pounce_act_trans_table)); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
367 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
368 static int |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
369 new_pounce_opts_to_old(struct gaim_pounce *pounce) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
370 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
371 struct gaim_gtkpounce_data *gtkpounce; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
372 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
373 int opts = 0; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
374 int i; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
375 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
376 gtkpounce = GAIM_GTKPOUNCE(pounce); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
377 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
378 /* First, convert events */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
379 for (i = 0; i < pounce_evt_trans_table_size; i += 2) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
380 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
381 GaimPounceEvent evt = pounce_evt_trans_table[i + 1]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
382 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
383 if ((gaim_pounce_get_events(pounce) & evt) == evt) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
384 opts |= pounce_evt_trans_table[i]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
385 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
386 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
387 for (i = 0; i < pounce_act_trans_table_size; i += 2) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
388 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
389 GaimGtkPounceAction act = pounce_act_trans_table[i + 1]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
390 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
391 if ((gtkpounce->actions & act) == act) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
392 opts |= pounce_act_trans_table[i]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
393 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
394 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
395 if (gtkpounce->save) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
396 opts |= 0x100; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
397 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
398 return opts; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
399 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
400 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
401 static void |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
402 old_pounce_opts_to_new(int opts, GaimPounceEvent *events, |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
403 GaimGtkPounceAction *actions) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
404 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
405 int i; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
406 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
407 *events = 0; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
408 *actions = 0; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
409 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
410 /* First, convert events */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
411 for (i = 0; i < pounce_evt_trans_table_size; i += 2) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
412 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
413 int evt = pounce_evt_trans_table[i]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
414 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
415 if ((opts & evt) == evt) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
416 *events |= pounce_evt_trans_table[i + 1]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
417 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
418 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
419 for (i = 0; i < pounce_act_trans_table_size; i += 2) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
420 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
421 int act = pounce_act_trans_table[i]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
422 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
423 if ((opts & act) == act) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
424 *actions |= pounce_act_trans_table[i + 1]; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
425 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
426 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
427 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
428 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
429 static void |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
430 gaimrc_read_pounce(FILE *f) |
673 | 431 { |
3493 | 432 struct parse parse_buffer; |
673 | 433 struct parse *p; |
434 char buf[4096]; | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
435 struct pounce_placeholder *b; |
673 | 436 |
437 buf[0] = 0; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
438 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
439 while (buf[0] != '}') { |
673 | 440 if (!fgets(buf, sizeof(buf), f)) |
441 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
442 |
673 | 443 if (buf[0] == '}') |
444 return; | |
445 | |
3493 | 446 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
447 if (!strcmp(p->option, "entry")) { |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
448 b = g_new0(struct pounce_placeholder, 1); |
673 | 449 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
450 g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]); |
1155 | 451 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
|
452 g_snprintf(b->command, sizeof(b->command), "%s", p->value[2]); |
673 | 453 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
454 b->options = atoi(p->value[3]); |
1137 | 455 |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
456 g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]); |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
457 b->protocol = atoi(p->value[5]); |
1137 | 458 |
1694 | 459 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
|
460 |
673 | 461 buddy_pounces = g_list_append(buddy_pounces, b); |
462 } | |
463 } | |
464 } | |
465 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
466 static void |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
467 gaimrc_write_pounce(FILE *f) |
673 | 468 { |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
469 GList *pnc; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
470 struct gaim_pounce *pounce; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
471 struct gaim_gtkpounce_data *pounce_data; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
472 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
473 debug_printf("*** Writing pounces.\n"); |
673 | 474 |
475 fprintf(f, "pounce {\n"); | |
476 | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
477 for (pnc = gaim_get_pounces(); pnc != NULL; pnc = pnc->next) { |
1694 | 478 char *str1, *str2, *str3, *str4; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
479 struct gaim_account *account; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
480 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
481 pounce = (struct gaim_pounce *)pnc->data; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
482 pounce_data = GAIM_GTKPOUNCE(pounce); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
483 account = gaim_pounce_get_pouncer(pounce); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
484 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
485 /* Pouncee name */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
486 str1 = escape_text2(gaim_pounce_get_pouncee(pounce)); |
673 | 487 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
488 if (pounce_data == NULL) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
489 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
490 fprintf(f, "\tentry { %s } { } { } { %d } { %s } { %d } { }\n", |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
491 str1, new_pounce_opts_to_old(pounce), |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
492 account->username, account->protocol); |
673 | 493 |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
494 free(str1); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
495 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
496 continue; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
497 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
498 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
499 /* Message */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
500 if (pounce_data->message != NULL) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
501 str2 = escape_text2(pounce_data->message); |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
502 else { |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
503 str2 = malloc(1); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
504 *str2 = '\0'; |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
505 } |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
506 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
507 /* Command */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
508 if (pounce_data->command != NULL) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
509 str3 = escape_text2(pounce_data->command); |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
510 else { |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
511 str3 = malloc(1); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
512 *str3 = '\0'; |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
513 } |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
514 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
515 /* Sound file */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
516 if (pounce_data->sound != NULL) |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
517 str4 = escape_text2(pounce_data->sound); |
1694 | 518 else { |
519 str4 = malloc(1); | |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
520 *str4 = '\0'; |
1694 | 521 } |
673 | 522 |
1694 | 523 fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %s } { %d } { %s }\n", |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
524 str1, str2, str3, new_pounce_opts_to_old(pounce), |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
525 account->username, account->protocol, str4); |
673 | 526 |
1229
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
527 /* 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
|
528 free(str1); |
229bf438c591
[gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
529 free(str2); |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1229
diff
changeset
|
530 free(str3); |
1694 | 531 free(str4); |
673 | 532 } |
533 | |
534 fprintf(f, "}\n"); | |
535 } | |
536 | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
537 #ifdef GAIM_PLUGINS |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
538 static void gaimrc_write_plugins(FILE *f) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
539 { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
540 GList *pl = plugins; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
541 struct gaim_plugin *p; |
1 | 542 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
543 fprintf(f, "plugins {\n"); |
1 | 544 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
545 while (pl) { |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
546 char *path; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
547 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
548 p = (struct gaim_plugin *)pl->data; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
549 |
3563 | 550 path = escape_text2(p->path); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
551 fprintf(f, "\tplugin { %s }\n", path); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
552 free(path); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
553 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
554 pl = pl->next; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
555 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
556 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
557 fprintf(f, "}\n"); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
558 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
559 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
560 static void gaimrc_read_plugins(FILE *f) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
561 { |
3493 | 562 struct parse parse_buffer; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
563 struct parse *p; |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
564 char buf[4096]; |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
565 GSList *load = NULL; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
566 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
567 buf[0] = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
568 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
569 while (buf[0] != '}') { |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
570 if (!fgets(buf, sizeof(buf), f)) |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
571 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
572 |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
573 if (buf[0] == '}') |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
574 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
575 |
3493 | 576 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
577 if (!strcmp(p->option, "plugin")) { |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
578 load = g_slist_append(load, g_strdup(p->value[0])); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
579 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
580 } |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
581 /* 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
|
582 * 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
|
583 * which ones to load before loading them. */ |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
584 while (load) { |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1694
diff
changeset
|
585 if (load->data) |
2095
df9710306152
[gaim-migrate @ 2105]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2091
diff
changeset
|
586 load_plugin(load->data); |
1236
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
587 g_free(load->data); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
588 load = g_slist_remove(load, load->data); |
dcf9242241ee
[gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
589 } |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
590 } |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
591 #endif /* GAIM_PLUGINS */ |
1 | 592 |
4491 | 593 static struct gaim_account *gaimrc_read_user(FILE *f) |
1 | 594 { |
3493 | 595 struct parse parse_buffer; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
596 struct parse *p; |
4491 | 597 struct gaim_account *account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
598 int i; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
599 char buf[4096]; |
1 | 600 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
601 if (!fgets(buf, sizeof(buf), f)) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
602 return NULL; |
1 | 603 |
3493 | 604 p = parse_line(buf, &parse_buffer); |
1 | 605 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
606 if (strcmp(p->option, "ident")) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
607 return NULL; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
608 |
4491 | 609 account = g_new0(struct gaim_account, 1); |
1 | 610 |
4491 | 611 strcpy(account->username, p->value[0]); |
612 strcpy(account->password, p->value[1]); | |
1 | 613 |
4491 | 614 account->user_info[0] = 0; |
615 account->options = OPT_ACCT_REM_PASS; | |
616 account->protocol = DEFAULT_PROTO; | |
617 account->permit = account->deny = NULL; | |
1 | 618 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
619 if (!fgets(buf, sizeof(buf), f)) |
4491 | 620 return account; |
1 | 621 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
622 if (strcmp(buf, "\t\tuser_info {\n")) { |
4491 | 623 return account; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
624 } |
1 | 625 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
626 if (!fgets(buf, sizeof(buf), f)) |
4491 | 627 return account; |
1 | 628 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
629 while (strncmp(buf, "\t\t}", 3)) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
630 if (strlen(buf) > 3) |
4491 | 631 strcat(account->user_info, buf + 3); |
1 | 632 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
633 if (!fgets(buf, sizeof(buf), f)) { |
4491 | 634 return account; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
635 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
636 } |
1 | 637 |
4491 | 638 if ((i = strlen(account->user_info))) { |
639 account->user_info[i - 1] = '\0'; | |
1292 | 640 } |
641 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
642 if (!fgets(buf, sizeof(buf), f)) { |
4491 | 643 return account; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
644 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
645 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
646 if (!strcmp(buf, "\t}")) { |
4491 | 647 return account; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
648 } |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
649 |
3493 | 650 p = parse_line(buf, &parse_buffer); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
651 |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
652 if (strcmp(p->option, "user_opts")) |
4491 | 653 return account; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
654 |
4491 | 655 account->options = atoi(p->value[0]); |
656 account->protocol = atoi(p->value[1]); | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
657 |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
658 if (!fgets(buf, sizeof(buf), f)) |
4491 | 659 return account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
660 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
661 if (!strcmp(buf, "\t}")) |
4491 | 662 return account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
663 |
3493 | 664 p = parse_line(buf, &parse_buffer); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
665 |
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
666 if (strcmp(p->option, "proto_opts")) |
4491 | 667 return account; |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
668 |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
669 for (i = 0; i < 7; i++) |
4491 | 670 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
|
671 |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
672 if (!fgets(buf, sizeof(buf), f)) |
4491 | 673 return account; |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
674 |
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
675 if (!strcmp(buf, "\t}")) |
4491 | 676 return account; |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
677 |
3493 | 678 p = parse_line(buf, &parse_buffer); |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
679 |
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
680 if (strcmp(p->option, "iconfile")) |
4491 | 681 return account; |
2317
ab8ca5d75dcd
[gaim-migrate @ 2327]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2313
diff
changeset
|
682 |
4491 | 683 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
|
684 |
3205 | 685 if (!fgets(buf, sizeof(buf), f)) |
4491 | 686 return account; |
3205 | 687 |
688 if (!strcmp(buf, "\t}")) | |
4491 | 689 return account; |
3205 | 690 |
3493 | 691 p = parse_line(buf, &parse_buffer); |
3205 | 692 |
693 if (strcmp(p->option, "alias")) | |
4491 | 694 return account; |
3205 | 695 |
4491 | 696 g_snprintf(account->alias, sizeof(account->alias), "%s", p->value[0]); |
3205 | 697 |
4634 | 698 if (!fgets(buf, sizeof(buf), f)) |
699 return account; | |
700 | |
701 if (!strcmp(buf, "\t}")) | |
702 return account; | |
703 | |
704 p = parse_line(buf, &parse_buffer); | |
705 | |
706 if (strcmp(p->option, "proxy_opts")) | |
707 return account; | |
708 | |
709 if(atoi(p->value[0]) != PROXY_USE_GLOBAL) { | |
710 account->gpi = g_new0(struct gaim_proxy_info, 1); | |
711 account->gpi->proxytype = atoi(p->value[0]); | |
712 g_snprintf(account->gpi->proxyhost, sizeof(account->gpi->proxyhost), | |
713 "%s", p->value[1]); | |
714 account->gpi->proxyport = atoi(p->value[2]); | |
715 g_snprintf(account->gpi->proxyuser, sizeof(account->gpi->proxyuser), | |
716 "%s", p->value[3]); | |
717 g_snprintf(account->gpi->proxypass, sizeof(account->gpi->proxypass), | |
718 "%s", p->value[4]); | |
719 } | |
720 | |
4491 | 721 return account; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
722 |
1 | 723 } |
724 | |
4491 | 725 static void gaimrc_write_user(FILE *f, struct gaim_account *account) |
1 | 726 { |
4693 | 727 char *c, *d; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
728 int nl = 1, i; |
3309 | 729 |
4491 | 730 if (account->options & OPT_ACCT_REM_PASS) { |
4693 | 731 fprintf(f, "\t\tident { %s } { %s }\n", (d = escape_text2(account->username)), (c = escape_text2(account->password))); |
3309 | 732 free(c); |
4693 | 733 free(d); |
3309 | 734 } else { |
4693 | 735 fprintf(f, "\t\tident { %s } { }\n", (d = escape_text2(account->username))); |
736 free(d); | |
3309 | 737 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
738 fprintf(f, "\t\tuser_info {"); |
4491 | 739 c = account->user_info; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
740 while (*c) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
741 /* This is not as silly as it looks. */ |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
742 if (*c == '\n') { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
743 nl++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
744 } else { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
745 if (nl) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
746 while (nl) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
747 fprintf(f, "\n\t\t\t"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
748 nl--; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
749 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
750 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
751 fprintf(f, "%c", *c); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
752 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
753 c++; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
754 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
755 fprintf(f, "\n\t\t}\n"); |
4491 | 756 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
|
757 fprintf(f, "\t\tproto_opts"); |
1843
4dbd8533d209
[gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
758 for (i = 0; i < 7; i++) |
4491 | 759 fprintf(f, " { %s }", account->proto_opt[i]); |
1051
713b0e14e0a9
[gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1047
diff
changeset
|
760 fprintf(f, "\n"); |
4480
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
761 #ifndef _WIN32 |
4491 | 762 fprintf(f, "\t\ticonfile { %s }\n", account->iconfile); |
4480
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
763 #else |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
764 { |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
765 /* Make sure windows dir speparators arn't swallowed up when |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
766 path is read back in from resource file */ |
4491 | 767 char* tmp=wgaim_escape_dirsep(account->iconfile); |
768 fprintf(f, "\t\ticonfile { %s }\n", tmp); | |
4480
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
769 g_free(tmp); |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
770 } |
a4a87d79c67c
[gaim-migrate @ 4755]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4469
diff
changeset
|
771 #endif |
4491 | 772 fprintf(f, "\t\talias { %s }\n", account->alias); |
4634 | 773 fprintf(f, "\t\tproxy_opts "); |
774 if(account->gpi) { | |
775 fprintf(f, "{ %d } { %s } { %d } { %s } { %s }\n", | |
776 account->gpi->proxytype, account->gpi->proxyhost, | |
777 account->gpi->proxyport, account->gpi->proxyuser, | |
778 (c = escape_text2(account->gpi->proxypass))); | |
779 free(c); | |
780 } else { | |
781 fprintf(f, "{ %d }\n", PROXY_USE_GLOBAL); | |
782 } | |
1 | 783 } |
784 | |
785 static void gaimrc_read_users(FILE *f) | |
786 { | |
787 char buf[2048]; | |
4491 | 788 struct gaim_account *account = NULL; |
3493 | 789 struct parse parse_buffer; |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
790 struct parse *p=NULL; |
1 | 791 |
792 buf[0] = 0; | |
793 | |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
794 while (fgets(buf, sizeof(buf), f)) { |
1 | 795 if (buf[0] == '#') |
796 continue; | |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
797 else if(buf[0] == '}') |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
798 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
799 |
3493 | 800 p = parse_line(buf, &parse_buffer); |
1 | 801 |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
802 if (strcmp(p->option, "user")==0 || |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
803 strcmp(p->option, "current_user")==0) { |
4491 | 804 if((account=gaimrc_read_user(f))!=NULL) |
805 gaim_accounts = g_slist_append(gaim_accounts, account); | |
4410
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
806 else { |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
807 debug_printf("Error reading in users from .gaimrc\n"); |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
808 return; |
61c9c2bd2a9c
[gaim-migrate @ 4683]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4405
diff
changeset
|
809 } |
159
d56878f647fb
[gaim-migrate @ 169]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
158
diff
changeset
|
810 } |
1 | 811 } |
812 } | |
813 | |
814 static void gaimrc_write_users(FILE *f) | |
815 { | |
4491 | 816 GSList *usr = gaim_accounts; |
817 struct gaim_account *account; | |
1 | 818 |
819 fprintf(f, "users {\n"); | |
820 | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
821 while (usr) { |
4491 | 822 account = (struct gaim_account *)usr->data; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
823 fprintf(f, "\tuser {\n"); |
4491 | 824 gaimrc_write_user(f, account); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
825 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
826 fprintf(f, "\t}\n"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
827 |
1 | 828 usr = usr->next; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
829 } |
1 | 830 |
831 fprintf(f, "}\n"); | |
832 } | |
833 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
834 struct replace { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
835 int old; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
836 guint *val; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
837 int new; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
838 }; |
1 | 839 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
840 static struct replace gen_replace[] = { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
841 { /* OPT_GEN_ENTER_SENDS */ 0x00000001, &convo_options, OPT_CONVO_ENTER_SENDS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
842 { /* 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
|
843 { /* OPT_GEN_POPUP_WINDOWS */ 0x00000020, &im_options, OPT_IM_POPUP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
844 { /* OPT_GEN_SEND_LINKS */ 0x00000040, &convo_options, OPT_CONVO_SEND_LINKS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
845 { /* OPT_GEN_DEBUG */ 0x00000100, &misc_options, OPT_MISC_DEBUG }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
846 { /* OPT_GEN_BROWSER_POPUP */ 0x00000800, &misc_options, OPT_MISC_BROWSER_POPUP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
847 { /* OPT_GEN_SAVED_WINDOWS */ 0x00001000, &blist_options, OPT_BLIST_SAVED_WINDOWS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
848 { /* OPT_GEN_NEAR_APPLET */ 0x00004000, &blist_options, OPT_BLIST_NEAR_APPLET }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
849 { /* OPT_GEN_CHECK_SPELLING */ 0x00008000, &convo_options, OPT_CONVO_CHECK_SPELLING }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
850 { /* OPT_GEN_POPUP_CHAT */ 0x00010000, &chat_options, OPT_CHAT_POPUP }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
851 { /* 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
|
852 { /* OPT_GEN_CTL_CHARS */ 0x00080000, &convo_options, OPT_CONVO_CTL_CHARS }, |
3792 | 853 #if 0 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
854 { /* OPT_GEN_TIK_HACK */ 0x00100000, &away_options, OPT_AWAY_TIK_HACK }, |
3792 | 855 #endif |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
856 { /* OPT_GEN_CTL_SMILEYS */ 0x00200000, &convo_options, OPT_CONVO_CTL_SMILEYS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
857 { /* OPT_GEN_AUTO_AWAY */ 0x00800000, &away_options, OPT_AWAY_AUTO }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
858 { /* 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
|
859 { /* OPT_GEN_CTL_ENTER */ 0x02000000, &convo_options, OPT_CONVO_CTL_ENTER }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
860 { /* OPT_GEN_F2_TOGGLES */ 0x04000000, &convo_options, OPT_CONVO_F2_TOGGLES }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
861 { /* 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
|
862 { /* OPT_GEN_QUEUE_WHEN_AWAY */ 0x10000000, &away_options, OPT_AWAY_QUEUE }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
863 { 0,NULL,0 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
864 }; |
1 | 865 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
866 #define OPT_GEN_LOG_ALL 0x00000004 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
867 #define OPT_GEN_STRIP_HTML 0x00000008 |
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 static struct replace disp_replace[] = { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
870 { /* OPT_DISP_SHOW_TIME */ 0x00000001, &convo_options, OPT_CONVO_SHOW_TIME }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
871 { /* OPT_DISP_SHOW_GRPNUM */ 0x00000002, &blist_options, OPT_BLIST_SHOW_GRPNUM }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
872 { /* OPT_DISP_SHOW_PIXMAPS */ 0x00000004, &blist_options, OPT_BLIST_SHOW_PIXMAPS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
873 { /* OPT_DISP_SHOW_IDLETIME */ 0x00000008, &blist_options, OPT_BLIST_SHOW_IDLETIME }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
874 { /* 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
|
875 { /* OPT_DISP_IGNORE_COLOUR */ 0x00000020, &convo_options, OPT_CONVO_IGNORE_COLOUR }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
876 { /* OPT_DISP_SHOW_LOGON */ 0x00000040, &im_options, OPT_IM_LOGON }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
877 { /* OPT_DISP_SHOW_SMILEY */ 0x00000100, &convo_options, OPT_CONVO_SHOW_SMILEY }, |
3903 | 878 { /* OPT_DISP_COOL_LOOK */ 0x00000400, &misc_options, 0}, |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
879 { /* OPT_DISP_CHAT_LOGON */ 0x00000800, &chat_options, OPT_CHAT_LOGON }, |
4944 | 880 { /* OPT_DISP_NO_BUTTONS */ 0x00002000, &blist_options, OPT_BLIST_NO_BUTTON_TEXT }, |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
881 { /* 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
|
882 { /* 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
|
883 { /* 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
|
884 { /* 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
|
885 { /* 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
|
886 { /* OPT_DISP_SHOW_WARN */ 0x00200000, &blist_options, OPT_BLIST_SHOW_WARN }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
887 { /* OPT_DISP_IGNORE_FONTS */ 0x00400000, &convo_options, OPT_CONVO_IGNORE_FONTS }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
888 { /* OPT_DISP_IGNORE_SIZES */ 0x00800000, &convo_options, OPT_CONVO_IGNORE_SIZES }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
889 { /* OPT_DISP_ONE_WINDOW */ 0x01000000, &im_options, OPT_IM_ONE_WINDOW }, |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
890 { /* 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
|
891 { /* 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
|
892 { /* 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
|
893 { /* 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
|
894 { /* 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
|
895 { 0,NULL,0 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
896 }; |
1 | 897 |
898 static void gaimrc_read_options(FILE *f) | |
899 { | |
900 char buf[2048]; | |
3493 | 901 struct parse parse_buffer; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
902 struct parse *p; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
903 gboolean read_logging = FALSE, read_general = FALSE, read_display = FALSE; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
904 int general_options = 0, display_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
905 int i; |
1 | 906 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
907 buf[0] = 0; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
908 |
1 | 909 while (buf[0] != '}') { |
910 if (buf[0] == '#') | |
911 continue; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
912 |
1 | 913 if (!fgets(buf, sizeof(buf), f)) |
914 return; | |
915 | |
3493 | 916 p = parse_line(buf, &parse_buffer); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
917 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
918 if (!strcmp(p->option, "general_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
919 general_options = atoi(p->value[0]); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
920 read_general = TRUE; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
921 } else if (!strcmp(p->option, "display_options")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
922 display_options = atoi(p->value[0]); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
923 read_display = TRUE; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
924 } else if (!strcmp(p->option, "misc_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
925 misc_options = atoi(p->value[0]); |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
926 } else if (!strcmp(p->option, "logging_options")) { |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
927 logging_options = atoi(p->value[0]); |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
928 read_logging = TRUE; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
929 } else if (!strcmp(p->option, "blist_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
930 blist_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
931 } else if (!strcmp(p->option, "convo_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
932 convo_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
933 } else if (!strcmp(p->option, "im_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
934 im_options = atoi(p->value[0]); |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
935 } else if (!strcmp(p->option, "conv_placement")) { |
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
936 conv_placement_option = atoi(p->value[0]); |
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
937 gaim_conv_placement_set_active(conv_placement_option); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
938 } else if (!strcmp(p->option, "chat_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
939 chat_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
940 } else if (!strcmp(p->option, "font_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
941 font_options = atoi(p->value[0]); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
942 } else if (!strcmp(p->option, "sound_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
943 sound_options = atoi(p->value[0]); |
4581 | 944 gaim_sound_change_output_method(); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
945 } else if (!strcmp(p->option, "away_options")) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
946 away_options = atoi(p->value[0]); |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
947 away_resend = atoi(p->value[1]); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
948 } else if (!strcmp(p->option, "font_face")) { |
2763
477a035d81e5
[gaim-migrate @ 2776]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2592
diff
changeset
|
949 g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
950 } else if (!strcmp(p->option, "font_size")) { |
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
951 fontsize = atoi(p->value[0]); |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
952 } else if (!strcmp(p->option, "foreground")) { |
697 | 953 fgcolor.red = atoi(p->value[0]); |
954 fgcolor.green = atoi(p->value[1]); | |
955 fgcolor.blue = atoi(p->value[2]); | |
666
71ea550c22ac
[gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
956 } else if (!strcmp(p->option, "background")) { |
697 | 957 bgcolor.red = atoi(p->value[0]); |
958 bgcolor.green = atoi(p->value[1]); | |
959 bgcolor.blue = atoi(p->value[2]); | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
960 } else if (!strcmp(p->option, "report_idle")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
961 report_idle = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
962 } else if (!strcmp(p->option, "web_browser")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
963 web_browser = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
964 } else if (!strcmp(p->option, "web_command")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
965 strcpy(web_command, p->value[0]); |
4288 | 966 } else if (!strcmp(p->option, "smiley_theme")) { |
967 load_smiley_theme(p->value[0], TRUE); | |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
968 } else if (!strcmp(p->option, "conv_size")) { |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
969 conv_size.width = atoi(p->value[0]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
970 conv_size.height = atoi(p->value[1]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
971 conv_size.entry_height = atoi(p->value[2]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
972 } else if (!strcmp(p->option, "buddy_chat_size")) { |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
973 buddy_chat_size.width = atoi(p->value[0]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
974 buddy_chat_size.height = atoi(p->value[1]); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
975 buddy_chat_size.entry_height = atoi(p->value[2]); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
976 } else if (!strcmp(p->option, "blist_pos")) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
977 blist_pos.x = atoi(p->value[0]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
978 blist_pos.y = atoi(p->value[1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
979 blist_pos.width = atoi(p->value[2]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
980 blist_pos.height = atoi(p->value[3]); |
82 | 981 } |
1 | 982 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
983 } |
1 | 984 |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2580
diff
changeset
|
985 /* this is where we do bugs and compatibility stuff */ |
4581 | 986 if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_NORMAL | OPT_SOUND_ESD |
4592 | 987 | OPT_SOUND_ARTS | OPT_SOUND_NAS | OPT_SOUND_CMD))) { |
4561 | 988 sound_options |= OPT_SOUND_NORMAL; |
4592 | 989 gaim_sound_change_output_method(); |
990 } | |
2592
f194dd8250d4
[gaim-migrate @ 2605]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2580
diff
changeset
|
991 |
2352
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
992 if (conv_size.width == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
993 conv_size.height == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
994 conv_size.entry_height == 0) { |
3671 | 995 conv_size.width = 410; |
996 conv_size.height = 160; | |
2352
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
997 conv_size.entry_height = 50; |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
998 } |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
999 |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1000 if (buddy_chat_size.width == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1001 buddy_chat_size.height == 0 && |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1002 buddy_chat_size.entry_height == 0) { |
3671 | 1003 buddy_chat_size.width = 410; |
2352
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1004 buddy_chat_size.height = 160; |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1005 buddy_chat_size.entry_height = 50; |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1006 } |
39e66e80bb31
[gaim-migrate @ 2365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2317
diff
changeset
|
1007 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1008 if (read_general) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1009 if (!read_logging) { |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1010 logging_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1011 if (general_options & OPT_GEN_LOG_ALL) |
4581 | 1012 logging_options |= OPT_LOG_CONVOS | OPT_LOG_CHATS; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1013 if (general_options & OPT_GEN_STRIP_HTML) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1014 logging_options |= OPT_LOG_STRIP_HTML; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1015 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1016 for (i = 0; gen_replace[i].val; i++) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1017 if (general_options & gen_replace[i].old) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1018 *gen_replace[i].val |= gen_replace[i].new; |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
1019 } |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1456
diff
changeset
|
1020 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1021 if (read_display) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1022 for (i = 0; disp_replace[i].val; i++) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1023 if (display_options & disp_replace[i].old) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1024 *disp_replace[i].val |= disp_replace[i].new; |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
1025 |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
1026 if (!away_resend) |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2777
diff
changeset
|
1027 away_resend = 120; |
3391 | 1028 |
1029 if (misc_options & OPT_MISC_BUDDY_TICKER) { | |
3438 | 1030 #ifdef GAIM_PLUGINS |
3630 | 1031 gchar* buf; |
1032 | |
1033 buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, | |
1034 #ifndef _WIN32 | |
1035 "ticker.so", | |
1036 #else | |
1037 "ticker.dll", | |
1038 #endif | |
1039 NULL); | |
1040 load_plugin(buf); | |
1041 g_free(buf); | |
3438 | 1042 #endif |
3391 | 1043 misc_options &= ~OPT_MISC_BUDDY_TICKER; |
1044 } | |
1 | 1045 } |
1046 | |
1047 static void gaimrc_write_options(FILE *f) | |
1048 { | |
1049 | |
1050 fprintf(f, "options {\n"); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1051 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1052 fprintf(f, "\tmisc_options { %u }\n", misc_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1053 fprintf(f, "\tlogging_options { %u }\n", logging_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1054 fprintf(f, "\tblist_options { %u }\n", blist_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1055 fprintf(f, "\tconvo_options { %u }\n", convo_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1056 fprintf(f, "\tim_options { %u }\n", im_options); |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
1057 fprintf(f, "\tconv_placement { %u }\n", conv_placement_option); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1058 fprintf(f, "\tchat_options { %u }\n", chat_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1059 fprintf(f, "\tfont_options { %u }\n", font_options); |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1060 fprintf(f, "\tsound_options { %u }\n", sound_options); |
2908
aa590ecc67a7
[gaim-migrate @ 2921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
1061 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
|
1062 fprintf(f, "\tfont_face { %s }\n", fontface); |
1441
5c67b8794991
[gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1420
diff
changeset
|
1063 fprintf(f, "\tfont_size { %d }\n", fontsize); |
697 | 1064 fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue); |
1065 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
|
1066 fprintf(f, "\treport_idle { %d }\n", report_idle); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1067 fprintf(f, "\tweb_browser { %d }\n", web_browser); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1068 fprintf(f, "\tweb_command { %s }\n", web_command); |
4288 | 1069 if (current_smiley_theme) |
1070 fprintf(f, "\tsmiley_theme { %s }\n", current_smiley_theme->path); | |
3541 | 1071 fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d }\n", |
1072 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
|
1073 fprintf(f, "\tconv_size { %d } { %d } { %d }\n", |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
1074 conv_size.width, conv_size.height, conv_size.entry_height); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
1075 fprintf(f, "\tbuddy_chat_size { %d } { %d } { %d }\n", |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
1076 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
|
1077 |
1 | 1078 fprintf(f, "}\n"); |
1079 } | |
1080 | |
1081 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1082 static void gaimrc_read_sounds(FILE *f) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1083 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1084 int i; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1085 char buf[2048]; |
3493 | 1086 struct parse parse_buffer; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1087 struct parse *p; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1088 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1089 buf[0] = 0; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1090 |
4561 | 1091 for(i=0; i<GAIM_NUM_SOUNDS; i++) |
1092 gaim_sound_set_event_file(i, NULL); | |
1093 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1094 while (buf[0] != '}') { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1095 if (buf[0] == '#') |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1096 continue; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1097 |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1098 if (!fgets(buf, sizeof(buf), f)) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1099 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1100 |
3493 | 1101 p = parse_line(buf, &parse_buffer); |
3630 | 1102 #ifndef _WIN32 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
1103 if (!strcmp(p->option, "sound_cmd")) { |
4561 | 1104 gaim_sound_set_command(p->value[0]); |
1105 } else | |
3630 | 1106 #endif |
1107 if (!strncmp(p->option, "sound", strlen("sound"))) { | |
2036
ab15b91b93d8
[gaim-migrate @ 2046]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1976
diff
changeset
|
1108 i = p->option[strlen("sound")] - 'A'; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1109 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
1110 if (p->value[0][0]) |
4561 | 1111 gaim_sound_set_event_file(i, p->value[0]); |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1209
diff
changeset
|
1112 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1113 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1114 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1115 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1116 static void gaimrc_write_sounds(FILE *f) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1117 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1118 int i; |
5084
a96653493416
[gaim-migrate @ 5439]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5080
diff
changeset
|
1119 #ifndef _WIN32 |
4561 | 1120 char *cmd; |
5084
a96653493416
[gaim-migrate @ 5439]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
5080
diff
changeset
|
1121 #endif |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1122 fprintf(f, "sound_files {\n"); |
4561 | 1123 for (i = 0; i < GAIM_NUM_SOUNDS; i++) { |
1124 char *file = gaim_sound_get_event_file(i); | |
1125 if (file) { | |
4405
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1126 #ifndef _WIN32 |
4561 | 1127 fprintf(f, "\tsound%c { %s }\n", i + 'A', file); |
4405
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1128 #else |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1129 /* Make sure windows dir speparators arn't swallowed up when |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1130 path is read back in from resource file */ |
4561 | 1131 char* tmp=wgaim_escape_dirsep(file); |
4405
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1132 fprintf(f, "\tsound%c { %s }\n", i + 'A', tmp); |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1133 g_free(tmp); |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1134 #endif |
cb629f3efee6
[gaim-migrate @ 4674]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4393
diff
changeset
|
1135 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1136 else |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1137 fprintf(f, "\tsound%c { }\n", i + 'A'); |
4561 | 1138 } |
3630 | 1139 #ifndef _WIN32 |
4561 | 1140 cmd = gaim_sound_get_command(); |
1141 if(cmd) | |
1142 fprintf(f, "\tsound_cmd { %s }\n", cmd); | |
1143 else | |
1144 fprintf(f, "\tsound_cmd { }\n"); | |
3630 | 1145 #endif |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1146 fprintf(f, "}\n"); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1147 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1148 |
3435 | 1149 static gboolean gaimrc_parse_proxy_uri(const char *proxy) |
1150 { | |
1151 char *c, *d; | |
1152 char buffer[2048]; | |
1153 | |
1154 char host[128]; | |
1155 char user[128]; | |
1156 char pass[128]; | |
1157 int port = 0; | |
1158 int len = 0; | |
1159 | |
4137 | 1160 host[0] = '\0'; |
1161 user[0] = '\0'; | |
1162 pass[0] = '\0'; | |
1163 | |
1164 debug_printf("gaimrc_parse_proxy_uri(%s)\n", proxy); | |
1165 | |
3435 | 1166 if ((c = strchr(proxy, ':')) == NULL) |
1167 { | |
4137 | 1168 debug_printf("no uri detected\n"); |
3435 | 1169 /* No URI detected. */ |
1170 return FALSE; | |
1171 } | |
1172 | |
1173 len = c - proxy; | |
1174 | |
4137 | 1175 if (!strncmp(proxy, "http://", len + 3)) |
4634 | 1176 global_proxy_info.proxytype = PROXY_HTTP; |
3435 | 1177 else |
1178 return FALSE; | |
1179 | |
4137 | 1180 debug_printf("found http proxy\n"); |
3435 | 1181 /* Get past "://" */ |
1182 c += 3; | |
1183 | |
4137 | 1184 debug_printf("looking at %s\n", c); |
1185 | |
3435 | 1186 for (;;) |
1187 { | |
1188 *buffer = '\0'; | |
1189 d = buffer; | |
1190 | |
1191 while (*c != '\0' && *c != '@' && *c != ':' && *c != '/') | |
1192 *d++ = *c++; | |
1193 | |
1194 *d = '\0'; | |
1195 | |
1196 if (*c == ':') | |
1197 { | |
1198 /* | |
1199 * If there is a '@' in there somewhere, we are in the auth part. | |
1200 * If not, host. | |
1201 */ | |
1202 if (strchr(c, '@') != NULL) | |
4137 | 1203 strcpy(user, buffer); |
3435 | 1204 else |
4137 | 1205 strcpy(host, buffer); |
3435 | 1206 } |
1207 else if (*c == '@') | |
1208 { | |
4137 | 1209 if (user[0] == '\0') |
1210 strcpy(user, buffer); | |
3435 | 1211 else |
4137 | 1212 strcpy(pass, buffer); |
3435 | 1213 } |
1214 else if (*c == '/' || *c == '\0') | |
1215 { | |
4137 | 1216 if (host[0] == '\0') |
1217 strcpy(host, buffer); | |
3435 | 1218 else |
1219 port = atoi(buffer); | |
1220 | |
1221 /* Done. */ | |
1222 break; | |
1223 } | |
1224 | |
1225 c++; | |
1226 } | |
1227 | |
1228 /* NOTE: HTTP_PROXY takes precendence. */ | |
4137 | 1229 if (host[0]) |
4634 | 1230 strcpy(global_proxy_info.proxyhost, host); |
3435 | 1231 else |
4634 | 1232 *global_proxy_info.proxyhost = '\0'; |
3435 | 1233 |
4137 | 1234 if (user[0]) |
4634 | 1235 strcpy(global_proxy_info.proxyuser, user); |
3435 | 1236 else |
4634 | 1237 *global_proxy_info.proxyuser = '\0'; |
3435 | 1238 |
4137 | 1239 if (pass[0]) |
4634 | 1240 strcpy(global_proxy_info.proxypass, pass); |
3435 | 1241 else |
4634 | 1242 *global_proxy_info.proxypass = '\0'; |
1243 | |
1244 global_proxy_info.proxyport = port; | |
3435 | 1245 |
4137 | 1246 debug_printf("host '%s'\nuser '%s'\npassword '%s'\nport %d\n", |
4634 | 1247 global_proxy_info.proxyhost, global_proxy_info.proxyuser, |
1248 global_proxy_info.proxypass, global_proxy_info.proxyport); | |
4137 | 1249 |
3435 | 1250 return TRUE; |
1251 } | |
1252 | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1253 static void gaimrc_read_proxy(FILE *f) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1254 { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1255 char buf[2048]; |
3493 | 1256 struct parse parse_buffer; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1257 struct parse *p; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1258 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1259 buf[0] = 0; |
4634 | 1260 global_proxy_info.proxyhost[0] = 0; |
4137 | 1261 debug_printf("gaimrc_read_proxy\n"); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1262 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1263 while (buf[0] != '}') { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1264 if (buf[0] == '#') |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1265 continue; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1266 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1267 if (!fgets(buf, sizeof(buf), f)) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1268 return; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1269 |
3493 | 1270 p = parse_line(buf, &parse_buffer); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1271 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1272 if (!strcmp(p->option, "host")) { |
4634 | 1273 g_snprintf(global_proxy_info.proxyhost, |
1274 sizeof(global_proxy_info.proxyhost), "%s", p->value[0]); | |
1275 debug_printf("set proxyhost %s\n", global_proxy_info.proxyhost); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1276 } else if (!strcmp(p->option, "port")) { |
4634 | 1277 global_proxy_info.proxyport = atoi(p->value[0]); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1278 } else if (!strcmp(p->option, "type")) { |
4634 | 1279 global_proxy_info.proxytype = atoi(p->value[0]); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1280 } else if (!strcmp(p->option, "user")) { |
4634 | 1281 g_snprintf(global_proxy_info.proxyuser, |
1282 sizeof(global_proxy_info.proxyuser), "%s", p->value[0]); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1283 } else if (!strcmp(p->option, "pass")) { |
4634 | 1284 g_snprintf(global_proxy_info.proxypass, |
1285 sizeof(global_proxy_info.proxypass), "%s", p->value[0]); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1286 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1287 } |
4634 | 1288 if (global_proxy_info.proxyhost[0]) |
4137 | 1289 proxy_info_is_from_gaimrc = 1; |
4634 | 1290 else { |
3435 | 1291 gboolean getVars = TRUE; |
4137 | 1292 proxy_info_is_from_gaimrc = 0; |
4634 | 1293 |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1294 if (g_getenv("HTTP_PROXY")) |
4634 | 1295 g_snprintf(global_proxy_info.proxyhost, |
1296 sizeof(global_proxy_info.proxyhost), "%s", | |
1297 g_getenv("HTTP_PROXY")); | |
1938
c9db54d8d8dc
[gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1936
diff
changeset
|
1298 else if (g_getenv("http_proxy")) |
4634 | 1299 g_snprintf(global_proxy_info.proxyhost, |
1300 sizeof(global_proxy_info.proxyhost), "%s", | |
1301 g_getenv("http_proxy")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1302 else if (g_getenv("HTTPPROXY")) |
4634 | 1303 g_snprintf(global_proxy_info.proxyhost, |
1304 sizeof(global_proxy_info.proxyhost), "%s", | |
1305 g_getenv("HTTPPROXY")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1306 |
4634 | 1307 if (*global_proxy_info.proxyhost != '\0') |
1308 getVars = !gaimrc_parse_proxy_uri(global_proxy_info.proxyhost); | |
3435 | 1309 |
1310 if (getVars) | |
1311 { | |
1312 if (g_getenv("HTTP_PROXY_PORT")) | |
4634 | 1313 global_proxy_info.proxyport = atoi(g_getenv("HTTP_PROXY_PORT")); |
3435 | 1314 else if (g_getenv("http_proxy_port")) |
4634 | 1315 global_proxy_info.proxyport = atoi(g_getenv("http_proxy_port")); |
3435 | 1316 else if (g_getenv("HTTPPROXYPORT")) |
4634 | 1317 global_proxy_info.proxyport = atoi(g_getenv("HTTPPROXYPORT")); |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1318 |
3435 | 1319 if (g_getenv("HTTP_PROXY_USER")) |
4634 | 1320 g_snprintf(global_proxy_info.proxyuser, |
1321 sizeof(global_proxy_info.proxyuser), "%s", | |
1322 g_getenv("HTTP_PROXY_USER")); | |
3435 | 1323 else if (g_getenv("http_proxy_user")) |
4634 | 1324 g_snprintf(global_proxy_info.proxyuser, |
1325 sizeof(global_proxy_info.proxyuser), "%s", | |
1326 g_getenv("http_proxy_user")); | |
3435 | 1327 else if (g_getenv("HTTPPROXYUSER")) |
4634 | 1328 g_snprintf(global_proxy_info.proxyuser, |
1329 sizeof(global_proxy_info.proxyuser), "%s", | |
1330 g_getenv("HTTPPROXYUSER")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1331 |
3435 | 1332 if (g_getenv("HTTP_PROXY_PASS")) |
4634 | 1333 g_snprintf(global_proxy_info.proxypass, |
1334 sizeof(global_proxy_info.proxypass), "%s", | |
1335 g_getenv("HTTP_PROXY_PASS")); | |
3435 | 1336 else if (g_getenv("http_proxy_pass")) |
4634 | 1337 g_snprintf(global_proxy_info.proxypass, |
1338 sizeof(global_proxy_info.proxypass), "%s", | |
1339 g_getenv("http_proxy_pass")); | |
3435 | 1340 else if (g_getenv("HTTPPROXYPASS")) |
4634 | 1341 g_snprintf(global_proxy_info.proxypass, |
1342 sizeof(global_proxy_info.proxypass), "%s", | |
1343 g_getenv("HTTPPROXYPASS")); | |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1344 |
4634 | 1345 if (global_proxy_info.proxyhost[0]) |
1346 global_proxy_info.proxytype = PROXY_HTTP; | |
3435 | 1347 } |
1936
f0b54f592486
[gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1921
diff
changeset
|
1348 } |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1349 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1350 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1351 static void gaimrc_write_proxy(FILE *f) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1352 { |
3309 | 1353 char *str; |
1354 | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1355 fprintf(f, "proxy {\n"); |
4137 | 1356 if (proxy_info_is_from_gaimrc) { |
4634 | 1357 fprintf(f, "\thost { %s }\n", global_proxy_info.proxyhost); |
1358 fprintf(f, "\tport { %d }\n", global_proxy_info.proxyport); | |
1359 fprintf(f, "\ttype { %d }\n", global_proxy_info.proxytype); | |
1360 fprintf(f, "\tuser { %s }\n", global_proxy_info.proxyuser); | |
1361 fprintf(f, "\tpass { %s }\n", | |
1362 (str = escape_text2(global_proxy_info.proxypass))); | |
4137 | 1363 free(str); |
1364 } else { | |
1365 fprintf(f, "\thost { %s }\n", ""); | |
1366 fprintf(f, "\tport { %d }\n", 0); | |
1367 fprintf(f, "\ttype { %d }\n", 0); | |
1368 fprintf(f, "\tuser { %s }\n", ""); | |
1369 fprintf(f, "\tpass { %s }\n", ""); | |
1370 } | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1371 fprintf(f, "}\n"); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1372 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1373 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1374 static void set_defaults() |
1 | 1375 { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1376 int i; |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1377 struct away_message *a; |
917 | 1378 |
4227 | 1379 misc_options = |
1380 OPT_MISC_USE_SERVER_ALIAS; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1381 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1382 logging_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1383 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1384 blist_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1385 OPT_BLIST_APP_BUDDY_SHOW | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1386 OPT_BLIST_SAVED_WINDOWS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1387 OPT_BLIST_NEAR_APPLET | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1388 OPT_BLIST_SHOW_GRPNUM | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1389 OPT_BLIST_SHOW_PIXMAPS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1390 OPT_BLIST_SHOW_IDLETIME | |
3367 | 1391 OPT_BLIST_GREY_IDLERS | |
4962 | 1392 OPT_BLIST_SHOW_BUTTON_XPM | |
1393 OPT_BLIST_SHOW_ICONS; | |
870 | 1394 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1395 convo_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1396 OPT_CONVO_ENTER_SENDS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1397 OPT_CONVO_SEND_LINKS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1398 OPT_CONVO_CTL_CHARS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1399 OPT_CONVO_CTL_SMILEYS | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1400 OPT_CONVO_SHOW_TIME | |
3919 | 1401 OPT_CONVO_SHOW_SMILEY | |
1402 OPT_CONVO_CHECK_SPELLING; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1403 |
4469
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
1404 conv_placement_option = 0; |
d76095396a0e
[gaim-migrate @ 4744]
Christian Hammond <chipx86@chipx86.com>
parents:
4430
diff
changeset
|
1405 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1406 im_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1407 OPT_IM_LOGON | |
3367 | 1408 OPT_IM_BUTTON_XPM | |
1409 OPT_IM_ONE_WINDOW ; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1410 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1411 chat_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1412 OPT_CHAT_LOGON | |
2388
5a7234d5e052
[gaim-migrate @ 2401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2383
diff
changeset
|
1413 OPT_CHAT_BUTTON_XPM | |
3367 | 1414 OPT_CHAT_TAB_COMPLETE | |
1415 OPT_CHAT_ONE_WINDOW; | |
870 | 1416 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1417 font_options = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1418 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1419 away_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1420 OPT_AWAY_BACK_ON_IM; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1421 |
4561 | 1422 for (i = 0; i < GAIM_NUM_SOUNDS; i++) |
1423 gaim_sound_set_event_file(i, NULL); | |
1424 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1425 font_options = 0; |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1426 /* 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
|
1427 available one will be used. */ |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1428 sound_options = |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1429 OPT_SOUND_LOGIN | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1430 OPT_SOUND_LOGOUT | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1431 OPT_SOUND_RECV | |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1432 OPT_SOUND_SEND | |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
1433 OPT_SOUND_SILENT_SIGNON | |
4581 | 1434 OPT_SOUND_NORMAL | |
1435 OPT_SOUND_NAS; | |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1436 |
2990 | 1437 #ifdef USE_SCREENSAVER |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1438 report_idle = IDLE_SCREENSAVER; |
2990 | 1439 #else |
1440 report_idle = IDLE_GAIM; | |
1441 #endif | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1442 web_browser = BROWSER_NETSCAPE; |
3434 | 1443 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
|
1444 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1445 auto_away = 10; |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1446 a = g_new0(struct away_message, 1); |
4589 | 1447 g_snprintf(a->name, sizeof(a->name), _("boring default")); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1448 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
|
1449 away_messages = g_slist_append(away_messages, a); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1450 default_away = a; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1451 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1452 blist_pos.width = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1453 blist_pos.height = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1454 blist_pos.x = 0; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1455 blist_pos.y = 0; |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1710
diff
changeset
|
1456 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1457 conv_size.width = 320; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1458 conv_size.height = 175; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1459 conv_size.entry_height = 50; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1460 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1461 buddy_chat_size.width = 320; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1462 buddy_chat_size.height = 160; |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1463 buddy_chat_size.entry_height = 50; |
1 | 1464 } |
1465 | |
1466 void load_prefs() | |
1467 { | |
1468 FILE *f; | |
1469 char buf[1024]; | |
1470 int ver = 0; | |
4137 | 1471 debug_printf("load_prefs\n"); |
1472 if (is_saving_prefs) { | |
1473 request_load_prefs = 1; | |
1474 debug_printf("currently saving, will request load\n"); | |
1475 return; | |
1476 } | |
570 | 1477 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1478 if (opt_rcfile_arg) |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1479 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg); |
3630 | 1480 else if (gaim_home_dir()) |
1481 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
|
1482 else { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1483 set_defaults(); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1484 return; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1485 } |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1486 |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1487 if ((f = fopen(buf, "r"))) { |
4137 | 1488 is_loading_prefs = 1; |
1489 debug_printf("start load_prefs\n"); | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1490 fgets(buf, sizeof(buf), f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1491 sscanf(buf, "# .gaimrc v%d", &ver); |
2389
021ba044ab0b
[gaim-migrate @ 2402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2388
diff
changeset
|
1492 if ((ver <= 3) || (buf[0] != '#')) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2286
diff
changeset
|
1493 set_defaults(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1494 |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1495 while (!feof(f)) { |
4137 | 1496 int tag = gaimrc_parse_tag(f); |
1497 debug_printf("starting read tag %d\n", tag); | |
1498 switch (tag) { | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1499 case -1: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1500 /* Let the loop end, EOF */ |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1501 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1502 case 0: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1503 gaimrc_read_users(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1504 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1505 case 1: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1506 gaimrc_read_options(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1507 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1508 case 2: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1509 gaimrc_read_away(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1510 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1511 #ifdef GAIM_PLUGINS |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1512 case 3: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1513 gaimrc_read_plugins(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1514 break; |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1515 #endif |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1516 case 4: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1517 gaimrc_read_pounce(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1518 break; |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1519 case 6: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1520 gaimrc_read_sounds(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1521 break; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1522 case 7: |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1523 gaimrc_read_proxy(f); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1524 break; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1525 default: |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1526 /* NOOP */ |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1527 break; |
1 | 1528 } |
4137 | 1529 debug_printf("ending read tag %d\n", tag); |
1 | 1530 } |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1531 fclose(f); |
4137 | 1532 is_loading_prefs = 0; |
1533 debug_printf("end load_prefs\n"); | |
1534 if (request_save_prefs) { | |
1535 debug_printf("saving prefs on request\n"); | |
1536 save_prefs(); | |
1537 request_save_prefs = 0; | |
1538 } | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1539 } else if (opt_rcfile_arg) { |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1540 g_snprintf(buf, sizeof(buf), _("Could not open config file %s."), opt_rcfile_arg); |
3427 | 1541 do_error_dialog(buf, NULL, GAIM_ERROR); |
2383
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1542 set_defaults(); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1543 } else { |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1544 set_defaults(); |
3d4bbadf4b8d
[gaim-migrate @ 2396]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
1545 save_prefs(); |
1 | 1546 } |
1547 } | |
1548 | |
1549 void save_prefs() | |
1550 { | |
1551 FILE *f; | |
4898 | 1552 gchar *filename; |
1553 gchar *filename_temp; | |
4393
bca8256a91a6
[gaim-migrate @ 4659]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4381
diff
changeset
|
1554 |
4381
af485b4bb8c1
[gaim-migrate @ 4647]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4349
diff
changeset
|
1555 debug_printf("enter save_prefs\n"); |
4137 | 1556 if (is_loading_prefs) { |
1557 request_save_prefs = 1; | |
1558 debug_printf("currently loading, will request save\n"); | |
1559 return; | |
1560 } | |
1 | 1561 |
4898 | 1562 if (opt_rcfile_arg) |
1563 filename = g_build_filename(opt_rcfile_arg, NULL); | |
1564 else if (gaim_home_dir()) | |
1565 filename = g_build_filename(gaim_home_dir(), ".gaimrc", NULL); | |
1566 else | |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1567 return; |
4898 | 1568 filename_temp = g_strdup_printf("%s.save", filename); |
1569 | |
1570 if ((f = fopen(filename_temp, "w"))) { | |
5080 | 1571 chmod(filename_temp, S_IRUSR | S_IWUSR); |
4137 | 1572 is_saving_prefs = 1; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1573 fprintf(f, "# .gaimrc v%d\n", 4); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1574 gaimrc_write_users(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1575 gaimrc_write_options(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1576 gaimrc_write_sounds(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1577 gaimrc_write_away(f); |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1578 gaimrc_write_pounce(f); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1579 #ifdef GAIM_PLUGINS |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1580 gaimrc_write_plugins(f); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
131
diff
changeset
|
1581 #endif |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
1582 gaimrc_write_proxy(f); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1525
diff
changeset
|
1583 fclose(f); |
4898 | 1584 if (rename(filename_temp, filename) < 0) |
1585 debug_printf("error renaming %s to %s\n", filename_temp, filename); | |
4137 | 1586 is_saving_prefs = 0; |
4898 | 1587 } else |
1588 debug_printf("error opening %s\n", filename_temp); | |
1589 | |
4137 | 1590 if (request_load_prefs) { |
1591 debug_printf("loading prefs on request\n"); | |
1592 load_prefs(); | |
1593 request_load_prefs = 0; | |
1594 } | |
4898 | 1595 |
1596 g_free(filename); | |
1597 g_free(filename_temp); | |
4137 | 1598 debug_printf("exit save_prefs\n"); |
1 | 1599 } |
1600 | |
1209 | 1601 |
1602 /* This function is called by g_slist_insert_sorted to compare the item | |
1603 * being compared to the rest of the items on the list. | |
1604 */ | |
1605 | |
1606 gint sort_awaymsg_list(gconstpointer a, gconstpointer b) | |
1607 { | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1608 struct away_message *msg_a; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1609 struct away_message *msg_b; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1610 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1611 msg_a = (struct away_message *)a; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1612 msg_b = (struct away_message *)b; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1613 |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1614 return (strcmp(msg_a->name, msg_b->name)); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1236
diff
changeset
|
1615 |
1209 | 1616 } |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1617 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1618 void |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1619 load_pounces() |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1620 { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1621 GList *l; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1622 struct pounce_placeholder *ph; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1623 struct gaim_pounce *pounce; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1624 struct gaim_account *account; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1625 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1626 debug_printf("*** Loading pounces...\n"); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1627 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1628 for (l = buddy_pounces; l != NULL; l = l->next) { |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1629 GaimPounceEvent events = GAIM_POUNCE_NONE; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1630 GaimGtkPounceAction actions = GAIM_GTKPOUNCE_NONE; |
5035 | 1631 ph = (struct pounce_placeholder *)l->data; |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1632 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1633 account = gaim_account_find(ph->pouncer, ph->protocol); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1634 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1635 old_pounce_opts_to_new(ph->options, &events, &actions); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1636 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1637 pounce = gaim_gtkpounce_new(account, ph->name, events, actions, |
5072
5078f765e3f9
[gaim-migrate @ 5425]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1638 (*ph->message == '\0' ? NULL : ph->message), |
5078f765e3f9
[gaim-migrate @ 5425]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1639 (*ph->command == '\0' ? NULL : ph->command), |
5078f765e3f9
[gaim-migrate @ 5425]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1640 (*ph->sound == '\0' ? NULL : ph->sound), |
5078f765e3f9
[gaim-migrate @ 5425]
Christian Hammond <chipx86@chipx86.com>
parents:
5054
diff
changeset
|
1641 (ph->options & 0x100)); |
5032
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1642 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1643 g_free(ph); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1644 } |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1645 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1646 g_list_free(buddy_pounces); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1647 buddy_pounces = NULL; |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1648 |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1649 /* |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1650 * < ChipX86|Coding> why do we save prefs just after reading them? |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1651 * < faceprint> ChipX86|Coding: because we're cool like that |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1652 * <SeanEgan|Coding> damn straight |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1653 */ |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1654 save_prefs(); |
cb700c07ee07
[gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents:
4985
diff
changeset
|
1655 } |