Mercurial > pidgin
annotate finch/finch.c @ 18883:0ca629db64a4
Use a list when updating the blocklist when removing the buddy, since
msim_postprocess_outgoing() can now replace uids in MSIM_TYPE_LISTs.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Tue, 07 Aug 2007 03:06:43 +0000 |
parents | 0e8b2bb66a7d |
children | f8b22b11a126 |
rev | line source |
---|---|
15822 | 1 /** |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
2 * finch |
15822 | 3 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
4 * Finch is the legal property of its developers, whose names are too numerous |
15822 | 5 * to list here. Please refer to the COPYRIGHT file distributed with this |
6 * source distribution. | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18013
diff
changeset
|
22 #include "finch.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18013
diff
changeset
|
23 |
15822 | 24 #include "account.h" |
25 #include "conversation.h" | |
26 #include "core.h" | |
27 #include "debug.h" | |
28 #include "eventloop.h" | |
29 #include "ft.h" | |
30 #include "log.h" | |
31 #include "notify.h" | |
32 #include "prefs.h" | |
33 #include "prpl.h" | |
34 #include "pounce.h" | |
35 #include "savedstatuses.h" | |
36 #include "sound.h" | |
37 #include "status.h" | |
38 #include "util.h" | |
39 #include "whiteboard.h" | |
40 | |
41 #include "gntdebug.h" | |
42 #include "gntprefs.h" | |
43 #include "gntui.h" | |
44 #include "gntidle.h" | |
45 | |
46 #define _GNU_SOURCE | |
47 #include <getopt.h> | |
48 | |
49 #include "config.h" | |
50 | |
51 static void | |
52 debug_init() | |
53 { | |
54 finch_debug_init(); | |
55 purple_debug_set_ui_ops(finch_debug_get_ui_ops()); | |
56 } | |
57 | |
18293
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
58 /* XXX: this "leaks" a hashtable on shutdown. I'll let |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
59 * the finch guys decide if they want to go through the trouble |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
60 * of properly freeing it, since their quit function doesn't |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
61 * live in this file */ |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
62 |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
63 static GHashTable *ui_info = NULL; |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
64 |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
65 static GHashTable *finch_ui_get_info() |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
66 { |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
67 if(NULL == ui_info) { |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
68 ui_info = g_hash_table_new(g_str_hash, g_str_equal); |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
69 |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
70 g_hash_table_insert(ui_info, "name", (char*)_("Finch")); |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
71 g_hash_table_insert(ui_info, "version", VERSION); |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
72 } |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
73 |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
74 return ui_info; |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
75 } |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
76 |
15822 | 77 static PurpleCoreUiOps core_ops = |
78 { | |
79 finch_prefs_init, | |
80 debug_init, | |
81 gnt_ui_init, | |
16669
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
82 gnt_ui_uninit, |
18293
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18210
diff
changeset
|
83 finch_ui_get_info, |
16669
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
84 |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
85 /* padding */ |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
86 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
87 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
88 NULL |
15822 | 89 }; |
90 | |
91 static PurpleCoreUiOps * | |
92 gnt_core_get_ui_ops() | |
93 { | |
94 return &core_ops; | |
95 } | |
96 | |
97 /* Anything IO-related is directly copied from gtkpurple's source tree */ | |
98 | |
99 #define FINCH_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) | |
100 #define FINCH_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) | |
101 | |
102 typedef struct _PurpleGntIOClosure { | |
103 PurpleInputFunction function; | |
104 guint result; | |
105 gpointer data; | |
106 | |
107 } PurpleGntIOClosure; | |
108 | |
109 static void purple_gnt_io_destroy(gpointer data) | |
110 { | |
111 g_free(data); | |
112 } | |
113 | |
114 static gboolean purple_gnt_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data) | |
115 { | |
116 PurpleGntIOClosure *closure = data; | |
117 PurpleInputCondition purple_cond = 0; | |
118 | |
119 if (condition & FINCH_READ_COND) | |
120 purple_cond |= PURPLE_INPUT_READ; | |
121 if (condition & FINCH_WRITE_COND) | |
122 purple_cond |= PURPLE_INPUT_WRITE; | |
123 | |
124 #if 0 | |
125 purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop", | |
126 "CLOSURE: callback for %d, fd is %d\n", | |
127 closure->result, g_io_channel_unix_get_fd(source)); | |
128 #endif | |
129 | |
130 #ifdef _WIN32 | |
131 if(! purple_cond) { | |
132 #if DEBUG | |
133 purple_debug_misc("gnt_eventloop", | |
134 "CLOSURE received GIOCondition of 0x%x, which does not" | |
135 " match 0x%x (READ) or 0x%x (WRITE)\n", | |
136 condition, FINCH_READ_COND, FINCH_WRITE_COND); | |
137 #endif /* DEBUG */ | |
138 | |
139 return TRUE; | |
140 } | |
141 #endif /* _WIN32 */ | |
142 | |
143 closure->function(closure->data, g_io_channel_unix_get_fd(source), | |
144 purple_cond); | |
145 | |
146 return TRUE; | |
147 } | |
148 | |
149 static guint gnt_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function, | |
150 gpointer data) | |
151 { | |
152 PurpleGntIOClosure *closure = g_new0(PurpleGntIOClosure, 1); | |
153 GIOChannel *channel; | |
154 GIOCondition cond = 0; | |
155 | |
156 closure->function = function; | |
157 closure->data = data; | |
158 | |
159 if (condition & PURPLE_INPUT_READ) | |
160 cond |= FINCH_READ_COND; | |
161 if (condition & PURPLE_INPUT_WRITE) | |
162 cond |= FINCH_WRITE_COND; | |
163 | |
164 channel = g_io_channel_unix_new(fd); | |
165 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond, | |
166 purple_gnt_io_invoke, closure, purple_gnt_io_destroy); | |
167 | |
168 g_io_channel_unref(channel); | |
169 return closure->result; | |
170 } | |
171 | |
172 static PurpleEventLoopUiOps eventloop_ops = | |
173 { | |
174 g_timeout_add, | |
175 g_source_remove, | |
176 gnt_input_add, | |
177 g_source_remove, | |
16669
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
178 NULL, /* input_get_error */ |
18013
58e82c3b697e
It's GLIB_CHECK_VERSION, not GLIB_VERSION_CHECK.
Richard Laager <rlaager@wiktel.com>
parents:
18009
diff
changeset
|
179 #if GLIB_CHECK_VERSION(2,14,0) |
18009
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17049
diff
changeset
|
180 g_timeout_add_seconds, |
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17049
diff
changeset
|
181 #else |
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17049
diff
changeset
|
182 NULL, |
9ffa9af32854
Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents:
17049
diff
changeset
|
183 #endif |
16669
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
184 |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
185 /* padding */ |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
186 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
187 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16565
diff
changeset
|
188 NULL |
15822 | 189 }; |
190 | |
191 static PurpleEventLoopUiOps * | |
192 gnt_eventloop_get_ui_ops(void) | |
193 { | |
194 return &eventloop_ops; | |
195 } | |
196 | |
197 /* This is mostly copied from gtkpurple's source tree */ | |
198 static void | |
199 show_usage(const char *name, gboolean terse) | |
200 { | |
201 char *text; | |
202 | |
203 if (terse) { | |
204 text = g_strdup_printf(_("%s. Try `%s -h' for more information.\n"), VERSION, name); | |
205 } else { | |
206 text = g_strdup_printf(_("%s\n" | |
207 "Usage: %s [OPTION]...\n\n" | |
208 " -c, --config=DIR use DIR for config files\n" | |
209 " -d, --debug print debugging messages to stdout\n" | |
210 " -h, --help display this help and exit\n" | |
211 " -n, --nologin don't automatically login\n" | |
212 " -v, --version display the current version and exit\n"), VERSION, name); | |
213 } | |
214 | |
215 purple_print_utf8_to_console(stdout, text); | |
216 g_free(text); | |
217 } | |
218 | |
219 static int | |
220 init_libpurple(int argc, char **argv) | |
221 { | |
222 char *path; | |
223 int opt; | |
224 gboolean opt_help = FALSE; | |
225 gboolean opt_nologin = FALSE; | |
226 gboolean opt_version = FALSE; | |
227 char *opt_config_dir_arg = NULL; | |
228 char *opt_session_arg = NULL; | |
229 gboolean debug_enabled = FALSE; | |
230 | |
231 struct option long_options[] = { | |
232 {"config", required_argument, NULL, 'c'}, | |
233 {"debug", no_argument, NULL, 'd'}, | |
234 {"help", no_argument, NULL, 'h'}, | |
235 {"nologin", no_argument, NULL, 'n'}, | |
236 {"session", required_argument, NULL, 's'}, | |
237 {"version", no_argument, NULL, 'v'}, | |
238 {0, 0, 0, 0} | |
239 }; | |
240 | |
241 #ifdef ENABLE_NLS | |
242 bindtextdomain(PACKAGE, LOCALEDIR); | |
243 bind_textdomain_codeset(PACKAGE, "UTF-8"); | |
244 textdomain(PACKAGE); | |
245 #endif | |
246 | |
247 #ifdef HAVE_SETLOCALE | |
248 setlocale(LC_ALL, ""); | |
249 #endif | |
250 | |
251 /* scan command-line options */ | |
252 opterr = 1; | |
253 while ((opt = getopt_long(argc, argv, | |
254 #ifndef _WIN32 | |
255 "c:dhn::s:v", | |
256 #else | |
257 "c:dhn::v", | |
258 #endif | |
259 long_options, NULL)) != -1) { | |
260 switch (opt) { | |
261 case 'c': /* config dir */ | |
262 g_free(opt_config_dir_arg); | |
263 opt_config_dir_arg = g_strdup(optarg); | |
264 break; | |
265 case 'd': /* debug */ | |
266 debug_enabled = TRUE; | |
267 break; | |
268 case 'h': /* help */ | |
269 opt_help = TRUE; | |
270 break; | |
271 case 'n': /* no autologin */ | |
272 opt_nologin = TRUE; | |
273 break; | |
274 case 's': /* use existing session ID */ | |
275 g_free(opt_session_arg); | |
276 opt_session_arg = g_strdup(optarg); | |
277 break; | |
278 case 'v': /* version */ | |
279 opt_version = TRUE; | |
280 break; | |
281 case '?': /* show terse help */ | |
282 default: | |
283 show_usage(argv[0], TRUE); | |
284 return 0; | |
285 break; | |
286 } | |
287 } | |
288 | |
289 /* show help message */ | |
290 if (opt_help) { | |
291 show_usage(argv[0], FALSE); | |
292 return 0; | |
293 } | |
294 /* show version message */ | |
295 if (opt_version) { | |
16943
816759ae9644
Clarify the comments on the names for translators.
Richard Laager <rlaager@wiktel.com>
parents:
16931
diff
changeset
|
296 /* Translators may want to transliterate the name. |
816759ae9644
Clarify the comments on the names for translators.
Richard Laager <rlaager@wiktel.com>
parents:
16931
diff
changeset
|
297 It is not to be translated. */ |
16931
dd768c576ab2
disapproval of revision 'e9933d653551beb8b5f477dcf2c6bd1f3d239c55'
Richard Laager <rlaager@wiktel.com>
parents:
16929
diff
changeset
|
298 printf("%s %s\n", _("Finch"), VERSION); |
15822 | 299 return 0; |
300 } | |
301 | |
302 /* set a user-specified config directory */ | |
303 if (opt_config_dir_arg != NULL) { | |
304 purple_util_set_user_dir(opt_config_dir_arg); | |
305 g_free(opt_config_dir_arg); | |
306 } | |
307 | |
308 /* | |
309 * We're done piddling around with command line arguments. | |
310 * Fire up this baby. | |
311 */ | |
312 | |
16380
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
313 /* We don't want debug-messages to show up and corrupt the display */ |
15822 | 314 purple_debug_set_enabled(debug_enabled); |
315 | |
16380
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
316 /* If we're using a custom configuration directory, we |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
317 * do NOT want to migrate, or weird things will happen. */ |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
318 if (opt_config_dir_arg == NULL) |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
319 { |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
320 if (!purple_core_migrate()) |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
321 { |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
322 char *old = g_strconcat(purple_home_dir(), |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
323 G_DIR_SEPARATOR_S ".gaim", NULL); |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
324 char *text = g_strdup_printf(_( |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
325 "%s encountered errors migrating your settings " |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
326 "from %s to %s. Please investigate and complete the " |
16931
dd768c576ab2
disapproval of revision 'e9933d653551beb8b5f477dcf2c6bd1f3d239c55'
Richard Laager <rlaager@wiktel.com>
parents:
16929
diff
changeset
|
327 "migration by hand. Please report this error at http://developer.pidgin.im"), _("Finch"), |
16380
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
328 old, purple_user_dir()); |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
329 |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
330 g_free(old); |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
331 |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
332 purple_print_utf8_to_console(stderr, text); |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
333 g_free(text); |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
334 |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
335 return 0; |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
336 } |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
337 } |
6c97924af83b
Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents:
16098
diff
changeset
|
338 |
15822 | 339 purple_core_set_ui_ops(gnt_core_get_ui_ops()); |
340 purple_eventloop_set_ui_ops(gnt_eventloop_get_ui_ops()); | |
341 purple_idle_set_ui_ops(finch_idle_get_ui_ops()); | |
342 | |
343 path = g_build_filename(purple_user_dir(), "plugins", NULL); | |
344 purple_plugins_add_search_path(path); | |
345 g_free(path); | |
346 | |
347 purple_plugins_add_search_path(LIBDIR); | |
348 | |
349 if (!purple_core_init(FINCH_UI)) | |
350 { | |
351 fprintf(stderr, | |
352 "Initialization of the Purple core failed. Dumping core.\n" | |
353 "Please report this!\n"); | |
354 abort(); | |
355 } | |
356 | |
357 /* TODO: Move blist loading into purple_blist_init() */ | |
358 purple_set_blist(purple_blist_new()); | |
359 purple_blist_load(); | |
360 | |
361 /* TODO: Move prefs loading into purple_prefs_init() */ | |
362 purple_prefs_load(); | |
363 purple_prefs_update_old(); | |
16565
ac0d07c7fd90
Pref migration for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16525
diff
changeset
|
364 finch_prefs_update_old(); |
15822 | 365 |
366 /* load plugins we had when we quit */ | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16098
diff
changeset
|
367 purple_plugins_load_saved("/finch/plugins/loaded"); |
15822 | 368 |
369 /* TODO: Move pounces loading into purple_pounces_init() */ | |
370 purple_pounces_load(); | |
371 | |
372 if (opt_nologin) | |
373 { | |
374 /* Set all accounts to "offline" */ | |
375 PurpleSavedStatus *saved_status; | |
376 | |
377 /* If we've used this type+message before, lookup the transient status */ | |
378 saved_status = purple_savedstatus_find_transient_by_type_and_message( | |
379 PURPLE_STATUS_OFFLINE, NULL); | |
380 | |
381 /* If this type+message is unique then create a new transient saved status */ | |
382 if (saved_status == NULL) | |
383 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE); | |
384 | |
385 /* Set the status for each account */ | |
386 purple_savedstatus_activate(saved_status); | |
387 } | |
388 else | |
389 { | |
390 /* Everything is good to go--sign on already */ | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16098
diff
changeset
|
391 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) |
15822 | 392 purple_savedstatus_activate(purple_savedstatus_get_startup()); |
393 purple_accounts_restore_current_statuses(); | |
394 } | |
395 | |
396 return 1; | |
397 } | |
398 | |
399 int main(int argc, char **argv) | |
400 { | |
401 signal(SIGPIPE, SIG_IGN); | |
402 | |
18361
9b5b0cbde65f
Let's use g_set_prgname too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18329
diff
changeset
|
403 g_set_prgname("Finch"); |
18329
477dd067bdc1
Use g_set_application_name here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
404 g_set_application_name(_("Finch")); |
477dd067bdc1
Use g_set_application_name here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
405 |
15822 | 406 /* Initialize the libpurple stuff */ |
407 if (!init_libpurple(argc, argv)) | |
408 return 0; | |
18329
477dd067bdc1
Use g_set_application_name here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
409 |
15822 | 410 purple_blist_show(); |
411 gnt_main(); | |
412 | |
413 #ifdef STANDALONE | |
414 purple_core_quit(); | |
415 #endif | |
416 | |
417 return 0; | |
418 } | |
419 |