annotate src/gaimrc.c @ 1970:43a55969523f

[gaim-migrate @ 1980] this doesn't change anything, this just helps with gtk2 stuff. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 07 Jun 2001 03:12:45 +0000
parents c9db54d8d8dc
children 24aed1c31342
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
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 340
diff changeset
23 #include "../config.h"
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 340
diff changeset
24 #endif
1
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) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
81 // if ((*c < 'a' || *c > 'z') && *c != '_') {
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]);
b9cc0a3a68b2 [gaim-migrate @ 24]
Rob Flynn <gaim@robflynn.com>
parents: 1
diff changeset
214 filter_break(a->message);
1209
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
215 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
216 }
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
217 /* auto { time } { default message } */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
218 else if (!strcmp(p->option, "auto")) {
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
219 auto_away = atoi(p->value[0]);
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
220 default_away = g_slist_nth_data(away_messages,
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
221 atoi(p->value[1]));
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
222 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
223 }
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 static void gaimrc_write_away(FILE *f)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227 {
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 917
diff changeset
228 GSList *awy = away_messages;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229 struct away_message *a;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
230
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
231 fprintf(f, "away {\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
232
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
233 if (awy) {
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
234 while (awy) {
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
235 char *str1, *str2;
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 15
diff changeset
236
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
237 a = (struct away_message *)awy->data;
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 15
diff changeset
238
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
239 str1 = escape_text2(a->name);
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
240 str2 = escape_text2(a->message);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
241
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
242 fprintf(f, "\tmessage { %s } { %s }\n", str1, str2);
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 15
diff changeset
243
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
244 /* 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
245 free(str1);
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
246 free(str2);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
247
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 917
diff changeset
248 awy = g_slist_next(awy);
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
249 }
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
250 fprintf(f, "\tauto { %d } { %d }\n", auto_away,
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
251 g_slist_index(away_messages, default_away));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
252 } else {
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
253 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
254 fprintf(f, "\tauto { 0 } { 0 }\n");
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
255 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
256
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257 fprintf(f, "}\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
258 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
259
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
260 static void gaimrc_read_pounce(FILE *f)
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
261 {
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
262 struct parse *p;
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
263 char buf[4096];
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
264 struct buddy_pounce *b;
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
265
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
266 buf[0] = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
267
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
268 while (buf[0] != '}') {
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
269 if (!fgets(buf, sizeof(buf), f))
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
270 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
271
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
272 if (buf[0] == '}')
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
273 return;
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
274
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
275 p = parse_line(buf);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
276 if (!strcmp(p->option, "entry")) {
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
277 b = g_new0(struct buddy_pounce, 1);
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
278
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
279 g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]);
1155
f4d4a14752ee [gaim-migrate @ 1165]
Rob Flynn <gaim@robflynn.com>
parents: 1139
diff changeset
280 g_snprintf(b->message, sizeof(b->message), "%s", p->value[1]);
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
281 g_snprintf(b->command, sizeof(b->command), "%s", p->value[2]);
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
282
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
283 b->options = atoi(p->value[3]);
1137
5b5d03dfa48a [gaim-migrate @ 1147]
Rob Flynn <gaim@robflynn.com>
parents: 1109
diff changeset
284
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
285 g_snprintf(b->pouncer, sizeof(b->pouncer), "%s", p->value[4]);
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
286 b->protocol = atoi(p->value[5]);
1137
5b5d03dfa48a [gaim-migrate @ 1147]
Rob Flynn <gaim@robflynn.com>
parents: 1109
diff changeset
287
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
288 g_snprintf(b->sound, sizeof(b->sound), "%s", p->value[6]);
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
289
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
290 filter_break(b->message);
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
291 buddy_pounces = g_list_append(buddy_pounces, b);
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
292 }
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
293 }
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
294 }
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
295
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
296 static void gaimrc_write_pounce(FILE *f)
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 GList *pnc = buddy_pounces;
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
299 struct buddy_pounce *b;
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 fprintf(f, "pounce {\n");
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
302
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
303 while (pnc) {
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
304 char *str1, *str2, *str3, *str4;
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
305
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
306 b = (struct buddy_pounce *)pnc->data;
673
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 str1 = escape_text2(b->name);
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
309 if (strlen(b->message))
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
310 str2 = escape_text2(b->message);
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
311 else {
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
312 str2 = malloc(1);
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
313 str2[0] = 0;
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
314 }
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
315 if (strlen(b->command))
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
316 str3 = escape_text2(b->command);
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
317 else {
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
318 str3 = malloc(1);
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
319 str3[0] = 0;
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
320 }
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
321 if (strlen(b->sound))
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
322 str4 = escape_text2(b->sound);
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
323 else {
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
324 str4 = malloc(1);
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
325 str4[0] = 0;
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
326 }
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
327
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
328 fprintf(f, "\tentry { %s } { %s } { %s } { %d } { %s } { %d } { %s }\n",
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
329 str1, str2, str3, b->options, b->pouncer, b->protocol, str4);
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
330
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
331 /* 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
332 free(str1);
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
333 free(str2);
1235
a9cf2f61a7b1 [gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1229
diff changeset
334 free(str3);
1694
bea407767ac1 [gaim-migrate @ 1704]
Rob Flynn <gaim@robflynn.com>
parents: 1560
diff changeset
335 free(str4);
1229
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
336
229bf438c591 [gaim-migrate @ 1239]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1214
diff changeset
337 pnc = pnc->next;
673
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
338 }
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
339
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
340 fprintf(f, "}\n");
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
341 }
ddc3fd0dcd51 [gaim-migrate @ 683]
Rob Flynn <gaim@robflynn.com>
parents: 666
diff changeset
342
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
343 static void gaimrc_read_chat(FILE *f)
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
344 {
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
345 struct parse *p;
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
346 char buf[4096];
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
347 struct chat_room *b;
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
348
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
349 buf[0] = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
350
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
351 while (buf[0] != '}') {
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
352 if (!fgets(buf, sizeof(buf), f))
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
353 return;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
354
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
355 if (buf[0] == '}')
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
356 return;
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
357
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
358 p = parse_line(buf);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
359 if (!strcmp(p->option, "entry")) {
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
360 b = g_new0(struct chat_room, 1);
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
361
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
362 g_snprintf(b->name, sizeof(b->name), "%s", p->value[0]);
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
363
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
364 b->exchange = atoi(p->value[1]);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
365
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
366 chat_rooms = g_list_append(chat_rooms, b);
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
367 }
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
368 }
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
369 }
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
370
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
371 static void gaimrc_write_chat(FILE *f)
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
372 {
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
373 GList *pnc = chat_rooms;
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
374 struct chat_room *b;
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 fprintf(f, "chat {\n");
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
377
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
378 if (pnc) {
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
379 while (pnc) {
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
380 char *str1;
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 b = (struct chat_room *)pnc->data;
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
383
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
384 str1 = escape_text2(b->name);
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
385
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
386 fprintf(f, "\tentry { %s } { %d }\n", str1, b->exchange);
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 /* 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
389 free(str1);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
390
774
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
391 pnc = pnc->next;
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
392 }
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
393 }
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
394
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
395 fprintf(f, "}\n");
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
396 }
b61607d6c2af [gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 697
diff changeset
397
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
398 #ifdef GAIM_PLUGINS
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
399 static void gaimrc_write_plugins(FILE *f)
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
400 {
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
401 GList *pl = plugins;
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
402 struct gaim_plugin *p;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
404 fprintf(f, "plugins {\n");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
406 while (pl) {
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
407 char *path;
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
408
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
409 p = (struct gaim_plugin *)pl->data;
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
410
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1026
diff changeset
411 path = escape_text2(g_module_name(p->handle));
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
412
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
413 fprintf(f, "\tplugin { %s }\n", 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 free(path);
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
416
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
417 pl = pl->next;
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
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
420 fprintf(f, "}\n");
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
421 }
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 static void gaimrc_read_plugins(FILE *f)
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 struct parse *p;
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
426 char buf[4096];
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
427 GSList *load = NULL;
142
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 buf[0] = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
430
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
431 while (buf[0] != '}') {
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
432 if (!fgets(buf, sizeof(buf), f))
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
433 break;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
434
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
435 if (buf[0] == '}')
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
436 break;
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
437
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
438 p = parse_line(buf);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
439 if (!strcmp(p->option, "plugin")) {
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
440 load = g_slist_append(load, g_strdup(p->value[0]));
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
441 }
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
442 }
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
443 /* 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
444 * 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
445 * which ones to load before loading them. */
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
446 while (load) {
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
447 if (load->data)
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1694
diff changeset
448 load_plugin(load->data);
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
449 g_free(load->data);
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
450 load = g_slist_remove(load, load->data);
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1235
diff changeset
451 }
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
452 }
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
453 #endif /* GAIM_PLUGINS */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
454
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
455 static struct aim_user *gaimrc_read_user(FILE *f)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
456 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
457 struct parse *p;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
458 struct aim_user *u;
1051
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
459 int i;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
460 char buf[4096];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
462 if (!fgets(buf, sizeof(buf), f))
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
463 return NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
464
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
465 p = parse_line(buf);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
466
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
467 if (strcmp(p->option, "ident"))
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
468 return NULL;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
469
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
470 u = g_new0(struct aim_user, 1);
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 strcpy(u->username, p->value[0]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
473 strcpy(u->password, p->value[1]);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
474
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
475 u->user_info[0] = 0;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
476 u->options = OPT_USR_REM_PASS;
1878
75643b9f4261 [gaim-migrate @ 1888]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1843
diff changeset
477 u->protocol = DEFAULT_PROTO;
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 if (!fgets(buf, sizeof(buf), f))
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
480 return u;
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 if (strcmp(buf, "\t\tuser_info {\n")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
483 return u;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
484 }
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 while (strncmp(buf, "\t\t}", 3)) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
490 if (strlen(buf) > 3)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
491 strcat(u->user_info, &buf[3]);
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;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
495 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
496 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
497
1456
6650776468b3 [gaim-migrate @ 1466]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1441
diff changeset
498 if ((i = strlen(u->user_info))) {
1292
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1264
diff changeset
499 u->user_info[i-1] = '\0';
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1264
diff changeset
500 }
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1264
diff changeset
501
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
502 if (!fgets(buf, sizeof(buf), f)) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
503 return u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
504 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
505
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
506 if (!strcmp(buf, "\t}")) {
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
507 return u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
508 }
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
509
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
510 p = parse_line(buf);
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 if (strcmp(p->option, "user_opts"))
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
513 return u;
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
514
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
515 u->options = atoi(p->value[0]);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
516 u->protocol = atoi(p->value[1]);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
517
1051
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
518 if (!fgets(buf, sizeof(buf), f))
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
519 return u;
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
520
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
521 if (!strcmp(buf, "\t}"))
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
522 return u;
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
523
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
524 p = parse_line(buf);
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
525
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
526 if (strcmp(p->option, "proto_opts"))
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
527 return u;
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
528
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1813
diff changeset
529 for (i = 0; i < 7; i++)
1051
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
530 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
531
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
532 return u;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
533
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
534 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
535
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
536 static void gaimrc_write_user(FILE *f, struct aim_user *u)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
537 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
538 char *c;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
539 int nl = 1, i;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
540 if (u->options & OPT_USR_REM_PASS)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
541 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
542 else
350d88f043b6 [gaim-migrate @ 141]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 84
diff changeset
543 fprintf(f, "\t\tident { %s } { }\n", u->username);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
544 fprintf(f, "\t\tuser_info {");
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
545 c = u->user_info;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
546 while (*c) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
547 /* This is not as silly as it looks. */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
548 if (*c == '\n') {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
549 nl++;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
550 } else {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
551 if (nl) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
552 while (nl) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
553 fprintf(f, "\n\t\t\t");
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
554 nl--;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
555 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
556 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
557 fprintf(f, "%c", *c);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
558 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
559 c++;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
560 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
561 fprintf(f, "\n\t\t}\n");
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
562 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
563 fprintf(f, "\t\tproto_opts");
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1813
diff changeset
564 for (i = 0; i < 7; i++)
1051
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
565 fprintf(f, " { %s }", u->proto_opt[i]);
713b0e14e0a9 [gaim-migrate @ 1061]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1047
diff changeset
566 fprintf(f, "\n");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
567 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
568
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
569
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
570 static void gaimrc_read_users(FILE *f)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
571 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
572 char buf[2048];
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
573 struct aim_user *u;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
574 struct parse *p;
1
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 buf[0] = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
577
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
578 while (buf[0] != '}') {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
579 if (buf[0] == '#')
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
580 continue;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
581
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
582 if (!fgets(buf, sizeof(buf), f))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
583 return;
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
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
586
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
587 p = parse_line(buf);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
588
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
589 if (!strcmp(p->option, "current_user")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
590 } else if (strcmp(p->option, "user")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
591 continue;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
592 } else {
159
d56878f647fb [gaim-migrate @ 169]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 158
diff changeset
593 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
594
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
595 u = gaimrc_read_user(f);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
596
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
597 aim_users = g_list_append(aim_users, u);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
598 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
599 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
600
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
601 static void gaimrc_write_users(FILE *f)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
602 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
603 GList *usr = aim_users;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
604 struct aim_user *u;
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 fprintf(f, "users {\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
607
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
608 while (usr) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
609 u = (struct aim_user *)usr->data;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
610 fprintf(f, "\tuser {\n");
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
611 gaimrc_write_user(f, u);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
612
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
613 fprintf(f, "\t}\n");
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
614
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
615 usr = usr->next;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
616 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
617
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
618 fprintf(f, "}\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
619 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
620
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
621
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
622
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
624 static void gaimrc_read_options(FILE *f)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
625 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
626 char buf[2048];
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
627 struct parse *p;
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
628 gboolean read_logging = FALSE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
630 buf[0] = 0;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
631
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
632 while (buf[0] != '}') {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633 if (buf[0] == '#')
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634 continue;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
635
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
636 if (!fgets(buf, sizeof(buf), f))
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
637 return;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
638
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
639 p = parse_line(buf);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
640
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
641 if (!strcmp(p->option, "general_options")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
642 general_options = atoi(p->value[0]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
643 } else if (!strcmp(p->option, "display_options")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
644 display_options = atoi(p->value[0]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
645 } else if (!strcmp(p->option, "sound_options")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
646 sound_options = atoi(p->value[0]);
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
647 } else if (!strcmp(p->option, "font_options")) {
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
648 font_options = atoi(p->value[0]);
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
649 } else if (!strcmp(p->option, "logging_options")) {
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
650 logging_options = atoi(p->value[0]);
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
651 read_logging = TRUE;
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
652 } else if (!strcmp(p->option, "font_face")) {
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
653 if (p->value[0] != NULL)
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
654 g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]);
1441
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1420
diff changeset
655 } else if (!strcmp(p->option, "font_size")) {
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1420
diff changeset
656 fontsize = atoi(p->value[0]);
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
657 } else if (!strcmp(p->option, "foreground")) {
697
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
658 fgcolor.red = atoi(p->value[0]);
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
659 fgcolor.green = atoi(p->value[1]);
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
660 fgcolor.blue = atoi(p->value[2]);
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
661 } else if (!strcmp(p->option, "background")) {
697
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
662 bgcolor.red = atoi(p->value[0]);
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
663 bgcolor.green = atoi(p->value[1]);
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
664 bgcolor.blue = atoi(p->value[2]);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
665 } else if (!strcmp(p->option, "report_idle")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
666 report_idle = atoi(p->value[0]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
667 } else if (!strcmp(p->option, "web_browser")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
668 web_browser = atoi(p->value[0]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
669 } else if (!strcmp(p->option, "web_command")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
670 strcpy(web_command, p->value[0]);
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
671 } else if (!strcmp(p->option, "conv_size")) {
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
672 conv_size.width = atoi(p->value[0]);
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
673 conv_size.height = atoi(p->value[1]);
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
674 conv_size.entry_height = atoi(p->value[2]);
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
675 } else if (!strcmp(p->option, "buddy_chat_size")) {
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
676 buddy_chat_size.width = atoi(p->value[0]);
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
677 buddy_chat_size.height = atoi(p->value[1]);
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
678 buddy_chat_size.entry_height = atoi(p->value[2]);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
679 } else if (!strcmp(p->option, "blist_pos")) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
680 blist_pos.x = atoi(p->value[0]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
681 blist_pos.y = atoi(p->value[1]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
682 blist_pos.width = atoi(p->value[2]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
683 blist_pos.height = atoi(p->value[3]);
1420
9be6790092dc [gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1413
diff changeset
684 blist_pos.xoff = atoi(p->value[4]);
9be6790092dc [gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1413
diff changeset
685 blist_pos.yoff = atoi(p->value[5]);
82
05077cb276d4 [gaim-migrate @ 92]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 44
diff changeset
686 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
687
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
688 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
689
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
690 if (!read_logging) {
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
691 logging_options = 0;
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
692 if (general_options & OPT_GEN_LOG_ALL)
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
693 logging_options |= OPT_LOG_ALL;
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
694 if (general_options & OPT_GEN_STRIP_HTML)
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
695 logging_options |= OPT_LOG_STRIP_HTML;
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
696 }
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
697
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
698 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
699
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
700 static void gaimrc_write_options(FILE *f)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
701 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
702
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
703 fprintf(f, "options {\n");
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
704 fprintf(f, "\tgeneral_options { %d }\n", general_options);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
705 fprintf(f, "\tdisplay_options { %d }\n", display_options);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
706 fprintf(f, "\tsound_options { %d }\n", sound_options);
666
71ea550c22ac [gaim-migrate @ 676]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 570
diff changeset
707 fprintf(f, "\tfont_options { %d }\n", font_options);
1525
ba8e6e211af5 [gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1456
diff changeset
708 fprintf(f, "\tlogging_options { %d }\n", logging_options);
232
f930b55a7367 [gaim-migrate @ 242]
Rob Flynn <gaim@robflynn.com>
parents: 230
diff changeset
709 if (fontface)
230
83dd297aa363 [gaim-migrate @ 240]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 180
diff changeset
710 fprintf(f, "\tfont_face { %s }\n", fontface);
1441
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1420
diff changeset
711 fprintf(f, "\tfont_size { %d }\n", fontsize);
697
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
712 fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue);
c7c0d2590681 [gaim-migrate @ 707]
Todd Kulesza <fflewddur>
parents: 690
diff changeset
713 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
714 fprintf(f, "\treport_idle { %d }\n", report_idle);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
715 fprintf(f, "\tweb_browser { %d }\n", web_browser);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
716 fprintf(f, "\tweb_command { %s }\n", web_command);
1420
9be6790092dc [gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1413
diff changeset
717 fprintf(f, "\tblist_pos { %d } { %d } { %d } { %d } { %d } { %d }\n",
9be6790092dc [gaim-migrate @ 1430]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1413
diff changeset
718 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
719 blist_pos.xoff, blist_pos.yoff);
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
720 fprintf(f, "\tconv_size { %d } { %d } { %d }\n",
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
721 conv_size.width, conv_size.height, conv_size.entry_height);
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
722 fprintf(f, "\tbuddy_chat_size { %d } { %d } { %d }\n",
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
723 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
724 fprintf(f, "}\n");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
725 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
726
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
727
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
728 static void gaimrc_read_sounds(FILE *f)
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
729 {
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
730 int i;
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
731 char buf[2048];
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
732 struct parse *p;
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
733
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
734 buf[0] = 0;
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
735
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
736 for (i = 0; i < NUM_SOUNDS; i++)
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
737 sound_file[i] = NULL;
1214
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
738 sound_cmd[0] = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
739
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
740 while (buf[0] != '}') {
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
741 if (buf[0] == '#')
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
742 continue;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
743
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
744 if (!fgets(buf, sizeof(buf), f))
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
745 return;
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
746
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
747 p = parse_line(buf);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
748
1214
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
749 if (!strcmp(p->option, "sound_cmd")) {
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
750 g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", p->value[0]);
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
751 } else if (!strncmp(p->option, "sound", strlen("sound"))) {
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
752 sscanf(p->option, "sound%c", (char *)&i);
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
753 i -= 'A';
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
754
1214
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
755 if (p->value[0][0])
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
756 sound_file[i] = g_strdup(p->value[0]);
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
757 }
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
758 }
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
759 }
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
760
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
761 static void gaimrc_write_sounds(FILE *f)
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
762 {
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
763 int i;
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
764 fprintf(f, "sound_files {\n");
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
765 for (i = 0; i < NUM_SOUNDS; i++)
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
766 if (sound_file[i])
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
767 fprintf(f, "\tsound%c { %s }\n", i + 'A', sound_file[i]);
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
768 else
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
769 fprintf(f, "\tsound%c { }\n", i + 'A');
1214
0baf39dc5437 [gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1209
diff changeset
770 fprintf(f, "\tsound_cmd { %s }\n", sound_cmd);
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
771 fprintf(f, "}\n");
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
772 }
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
773
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
774 static void gaimrc_read_proxy(FILE *f)
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
775 {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
776 char buf[2048];
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
777 struct parse *p;
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
778
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
779 buf[0] = 0;
1936
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
780 proxyhost[0] = 0;
1881
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 while (buf[0] != '}') {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
783 if (buf[0] == '#')
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
784 continue;
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
785
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
786 if (!fgets(buf, sizeof(buf), f))
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
787 return;
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
788
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
789 p = parse_line(buf);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
790
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
791 if (!strcmp(p->option, "host")) {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
792 g_snprintf(proxyhost, sizeof(proxyhost), "%s", p->value[0]);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
793 } else if (!strcmp(p->option, "port")) {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
794 proxyport = atoi(p->value[0]);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
795 } else if (!strcmp(p->option, "type")) {
1921
a84a41ecf380 [gaim-migrate @ 1931]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1886
diff changeset
796 proxytype = atoi(p->value[0]);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
797 } else if (!strcmp(p->option, "user")) {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
798 g_snprintf(proxyuser, sizeof(proxyuser), "%s", p->value[0]);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
799 } else if (!strcmp(p->option, "pass")) {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
800 g_snprintf(proxypass, sizeof(proxypass), "%s", p->value[0]);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
801 }
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
802 }
1936
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
803 if (!proxyhost[0]) {
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
804 if (g_getenv("HTTP_PROXY"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
805 g_snprintf(proxyhost, sizeof(proxyhost), "%s", g_getenv("HTTP_PROXY"));
1938
c9db54d8d8dc [gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1936
diff changeset
806 else if (g_getenv("http_proxy"))
c9db54d8d8dc [gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1936
diff changeset
807 g_snprintf(proxyhost, sizeof(proxyhost), "%s", g_getenv("http_proxy"));
1936
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
808 else if (g_getenv("HTTPPROXY"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
809 g_snprintf(proxyhost, sizeof(proxyhost), "%s", g_getenv("HTTPPROXY"));
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
810
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
811 if (g_getenv("HTTP_PROXY_PORT"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
812 proxyport = atoi(g_getenv("HTTP_PROXY_PORT"));
1938
c9db54d8d8dc [gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1936
diff changeset
813 else if (g_getenv("http_proxy_port"))
c9db54d8d8dc [gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1936
diff changeset
814 proxyport = atoi(g_getenv("http_proxy_port"));
1936
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
815 else if (g_getenv("HTTPPROXYPORT"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
816 proxyport = atoi(g_getenv("HTTPPROXYPORT"));
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
817
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
818 if (g_getenv("HTTP_PROXY_USER"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
819 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
820 else if (g_getenv("http_proxy_user"))
c9db54d8d8dc [gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1936
diff changeset
821 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
822 else if (g_getenv("HTTPPROXYUSER"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
823 g_snprintf(proxyuser, sizeof(proxyuser), "%s", g_getenv("HTTPPROXYUSER"));
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
824
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
825 if (g_getenv("HTTP_PROXY_PASS"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
826 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
827 else if (g_getenv("http_proxy_pass"))
c9db54d8d8dc [gaim-migrate @ 1948]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1936
diff changeset
828 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
829 else if (g_getenv("HTTPPROXYPASS"))
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
830 g_snprintf(proxypass, sizeof(proxypass), "%s", g_getenv("HTTPPROXYPASS"));
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
831
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
832 if (proxyhost[0])
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
833 proxytype = PROXY_HTTP;
f0b54f592486 [gaim-migrate @ 1946]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1921
diff changeset
834 }
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
835 }
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
836
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
837 static void gaimrc_write_proxy(FILE *f)
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
838 {
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
839 fprintf(f, "proxy {\n");
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
840 fprintf(f, "\thost { %s }\n", proxyhost);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
841 fprintf(f, "\tport { %d }\n", proxyport);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
842 fprintf(f, "\ttype { %d }\n", proxytype);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
843 fprintf(f, "\tuser { %s }\n", proxyuser);
1921
a84a41ecf380 [gaim-migrate @ 1931]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1886
diff changeset
844 fprintf(f, "\tpass { %s }\n", proxypass);
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
845 fprintf(f, "}\n");
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
846 }
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
847
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
848
917
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
849 void set_defaults(int saveinfo)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
850 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
851 if (!saveinfo) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
852 if (aim_users) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
853 g_list_free(aim_users);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
854 aim_users = NULL;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
855 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
856 if (away_messages) {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
857 g_slist_free(away_messages);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
858 away_messages = NULL;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
859 }
917
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
860 }
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
861
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
862 general_options =
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
863 OPT_GEN_SEND_LINKS |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
864 OPT_GEN_ENTER_SENDS |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
865 OPT_GEN_SAVED_WINDOWS |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
866 /* OPT_GEN_REMEMBER_PASS | */
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
867 OPT_GEN_REGISTERED |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
868 OPT_GEN_NEAR_APPLET |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
869 OPT_GEN_CTL_SMILEYS |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
870 OPT_GEN_CTL_CHARS;
870
9b8b83592bb6 [gaim-migrate @ 880]
Rob Flynn <gaim@robflynn.com>
parents: 774
diff changeset
871
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
872 display_options =
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
873 OPT_DISP_SHOW_IDLETIME |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
874 OPT_DISP_SHOW_TIME |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
875 OPT_DISP_SHOW_PIXMAPS |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
876 OPT_DISP_SHOW_BUDDYTICKER |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
877 OPT_DISP_SHOW_BUTTON_XPM |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
878 OPT_DISP_SHOW_SMILEY |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
879 OPT_DISP_COOL_LOOK |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
880 OPT_DISP_CONV_BUTTON_XPM |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
881 OPT_DISP_CHAT_BUTTON_TEXT;
870
9b8b83592bb6 [gaim-migrate @ 880]
Rob Flynn <gaim@robflynn.com>
parents: 774
diff changeset
882
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
883 if (!saveinfo) {
1006
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
884 int i;
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
885 for (i = 0; i < 7; i++)
0a4d0ed65e17 [gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
886 sound_file[i] = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
887 font_options = 0;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
888 sound_options =
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
889 OPT_SOUND_LOGIN |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
890 OPT_SOUND_LOGOUT |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
891 OPT_SOUND_RECV |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
892 OPT_SOUND_SEND |
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
893 OPT_SOUND_SILENT_SIGNON;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
894 report_idle = IDLE_SCREENSAVER;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
895 web_browser = BROWSER_NETSCAPE;
1109
c73736fa0b7c [gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
896 auto_away = 10;
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
897 default_away = NULL;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
898
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
899 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
900
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
901 blist_pos.width = 0;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
902 blist_pos.height = 0;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
903 blist_pos.x = 0;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
904 blist_pos.y = 0;
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
905
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
906 conv_size.width = 320;
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
907 conv_size.height = 175;
1886
318d6240ffe3 [gaim-migrate @ 1896]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
908 conv_size.entry_height = 50;
1813
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
909
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
910 buddy_chat_size.width = 320;
998a6a032874 [gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
911 buddy_chat_size.height = 160;
1886
318d6240ffe3 [gaim-migrate @ 1896]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1881
diff changeset
912 buddy_chat_size.entry_height = 50;
917
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
913 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
914 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
915
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
916
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
917 void load_prefs()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
918 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
919 FILE *f;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
920 char buf[1024];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
921 int ver = 0;
570
93c65fbaa622 [gaim-migrate @ 580]
Todd Kulesza <fflewddur>
parents: 453
diff changeset
922
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
923 if (opt_rcfile_arg)
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
924 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
925 else if (getenv("HOME"))
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
926 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME"));
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
927 else {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
928 set_defaults(TRUE);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
929 return;
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
930 }
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
931
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
932 if ((f = fopen(buf, "r"))) {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
933 fgets(buf, sizeof(buf), f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
934 sscanf(buf, "# .gaimrc v%d", &ver);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
935 if ((ver <= 1) || (buf[0] != '#')) {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
936 fclose(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
937 set_defaults(FALSE);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
938 save_prefs();
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
939 load_prefs();
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
940 return;
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
941 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
942
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
943 while (!feof(f)) {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
944 switch (gaimrc_parse_tag(f)) {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
945 case -1:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
946 /* Let the loop end, EOF */
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
947 break;
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
948 case 0:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
949 gaimrc_read_users(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
950 break;
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 gaimrc_read_options(f);
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 2:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
955 gaimrc_read_away(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
956 break;
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
957 #ifdef GAIM_PLUGINS
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
958 case 3:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
959 gaimrc_read_plugins(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
960 break;
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
961 #endif
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
962 case 4:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
963 gaimrc_read_pounce(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
964 break;
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
965 case 5:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
966 gaimrc_read_chat(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
967 break;
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
968 case 6:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
969 gaimrc_read_sounds(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
970 break;
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
971 case 7:
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
972 gaimrc_read_proxy(f);
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
973 break;
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
974 default:
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
975 /* NOOP */
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
976 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
977 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
978 }
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
979 fclose(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
980 } else if (opt_rcfile_arg) {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
981 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
982 do_error_dialog(buf, _("Preferences Error"));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
983 }
917
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
984
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
985 if ((ver == 2) || (buf[0] != '#')) {
917
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
986 set_defaults(TRUE);
f3c23b3c1ed7 [gaim-migrate @ 927]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
987 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
988 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
989
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
990 void save_prefs()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
991 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
992 FILE *f;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
993 char buf[BUF_LONG];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
994
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
995 if (opt_rcfile_arg)
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
996 g_snprintf(buf, sizeof(buf), "%s", opt_rcfile_arg);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
997 else if (getenv("HOME"))
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
998 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME"));
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
999 else
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1000 return;
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1001
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1002 if ((f = fopen(buf, "w"))) {
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1003 fprintf(f, "# .gaimrc v%d\n", 4);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1004 gaimrc_write_users(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1005 gaimrc_write_options(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1006 gaimrc_write_sounds(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1007 gaimrc_write_away(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1008 gaimrc_write_pounce(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1009 gaimrc_write_chat(f);
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
1010 #ifdef GAIM_PLUGINS
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1011 gaimrc_write_plugins(f);
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 131
diff changeset
1012 #endif
1881
a02584b98823 [gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
1013 gaimrc_write_proxy(f);
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1014 fclose(f);
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
1015 chmod(buf, S_IRUSR | S_IWUSR);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1016 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1017 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1018
1209
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1019
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1020
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1021 /* 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
1022 * being compared to the rest of the items on the list.
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1023 */
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1024
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1025 gint sort_awaymsg_list(gconstpointer a, gconstpointer b)
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1026 {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1027 struct away_message *msg_a;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1028 struct away_message *msg_b;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1029
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1030 msg_a = (struct away_message *)a;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1031 msg_b = (struct away_message *)b;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1032
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1033 return (strcmp(msg_a->name, msg_b->name));
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
1034
1209
7aec3f881c98 [gaim-migrate @ 1219]
Rob Flynn <gaim@robflynn.com>
parents: 1155
diff changeset
1035 }