annotate src/gaimrc.c @ 2188:98c434792ab7

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