annotate finch/finch.c @ 32785:f911cdafdcd8

changelog WHO fix
author Ethan Blanton <elb@pidgin.im>
date Thu, 03 May 2012 13:14:51 +0000
parents d82d402c39fb
children 142429bcb4c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * source distribution.
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19567
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
28770
259bbfb423d4 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents: 27682
diff changeset
22 #include <internal.h>
18210
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 18013
diff changeset
23 #include "finch.h"
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 18013
diff changeset
24
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #include "account.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "conversation.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "core.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "debug.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "eventloop.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "ft.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "log.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "notify.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "prefs.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "prpl.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "pounce.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "savedstatuses.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "sound.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "status.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "util.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include "whiteboard.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 #include "gntdebug.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "gntprefs.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "gntui.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "gntidle.h"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #define _GNU_SOURCE
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include <getopt.h>
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "config.h"
27682
cc8f641d2fde Add the MTN revision in the Pidgin About and finch --version dialogs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27587
diff changeset
51 #include "package_revision.h"
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 static void
22007
c38d72677c8a Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents: 21669
diff changeset
54 debug_init(void)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 finch_debug_init();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 purple_debug_set_ui_ops(finch_debug_get_ui_ops());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
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
60 static GHashTable *ui_info = NULL;
22007
c38d72677c8a Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents: 21669
diff changeset
61 static GHashTable *finch_ui_get_info(void)
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
62 {
18877
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
63 if (ui_info == NULL) {
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
64 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
65
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 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
67 g_hash_table_insert(ui_info, "version", VERSION);
23403
2ccda8e9046d Added website and dev_website items to Finch's ui_get_info hash table
Evan Schoenberg <evan.s@dreskin.net>
parents: 22007
diff changeset
68 g_hash_table_insert(ui_info, "website", "http://pidgin.im");
2ccda8e9046d Added website and dev_website items to Finch's ui_get_info hash table
Evan Schoenberg <evan.s@dreskin.net>
parents: 22007
diff changeset
69 g_hash_table_insert(ui_info, "dev_website", "http://developer.pidgin.im");
25513
a95eed74fdd7 Changed "type" to "client_type" for the hash value specifying client type
Marcus Lundblad <ml@update.uu.se>
parents: 25512
diff changeset
70 g_hash_table_insert(ui_info, "client_type", "console");
27426
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
71
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
72 /*
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
73 * This is the client key for "Finch." It is owned by the AIM
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
74 * account "markdoliner." Please don't use this key for other
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
75 * applications. You can either not specify a client key, in
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
76 * which case the default "libpurple" key will be used, or you
31672
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
77 * can try to register your own at the AIM or ICQ web sites
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
78 * (although this functionality was removed at some point, it's
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
79 * possible it has been re-added). AOL's old key management
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
80 * page is http://developer.aim.com/manageKeys.jsp
27426
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
81 */
88ef8c38a639 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents: 25513
diff changeset
82 g_hash_table_insert(ui_info, "prpl-aim-clientkey", "ma19sqWV9ymU6UYc");
31672
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
83
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
84 /*
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
85 * This is the client key for "Pidgin." It is owned by the AIM
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
86 * account "markdoliner." Please don't use this key for other
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
87 * applications. You can either not specify a client key, in
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
88 * which case the default "libpurple" key will be used, or you
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
89 * can try to register your own at the AIM or ICQ web sites
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
90 * (although this functionality was removed at some point, it's
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
91 * possible it has been re-added). AOL's old key management
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
92 * page is http://developer.aim.com/manageKeys.jsp
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
93 *
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
94 * We used to have a Finch-specific devId/clientkey
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
95 * (ma19sqWV9ymU6UYc), but it stopped working, so we switched
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
96 * to this one.
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
97 */
d82d402c39fb Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents: 31086
diff changeset
98 g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ma1cSASNCKFtrdv9");
27429
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
99
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
100 /*
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
101 * This is the distid for Finch, given to us by AOL. Please
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
102 * don't use this for other applications. You can just not
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
103 * specify a distid and libpurple will use a default.
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
104 */
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
105 g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1552));
74e487f82f39 Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents: 27426
diff changeset
106 g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1552));
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
107 }
5aae8608e1c6 UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18210
diff changeset
108
5aae8608e1c6 UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18210
diff changeset
109 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
110 }
5aae8608e1c6 UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18210
diff changeset
111
18877
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
112 static void
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
113 finch_quit(void)
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
114 {
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
115 gnt_ui_uninit();
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
116 if (ui_info)
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
117 g_hash_table_destroy(ui_info);
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
118 }
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
119
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 static PurpleCoreUiOps core_ops =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 finch_prefs_init,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 debug_init,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 gnt_ui_init,
18877
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
125 finch_quit,
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
126 finch_ui_get_info,
16669
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
127
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
128 /* padding */
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
129 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
130 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
131 NULL
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 };
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 static PurpleCoreUiOps *
22007
c38d72677c8a Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents: 21669
diff changeset
135 gnt_core_get_ui_ops(void)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 return &core_ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 /* Anything IO-related is directly copied from gtkpurple's source tree */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 #define FINCH_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 #define FINCH_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 typedef struct _PurpleGntIOClosure {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 PurpleInputFunction function;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 guint result;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 gpointer data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 } PurpleGntIOClosure;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 static void purple_gnt_io_destroy(gpointer data)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 g_free(data);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 static gboolean purple_gnt_io_invoke(GIOChannel *source, GIOCondition condition, gpointer data)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 PurpleGntIOClosure *closure = data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 PurpleInputCondition purple_cond = 0;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 if (condition & FINCH_READ_COND)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 purple_cond |= PURPLE_INPUT_READ;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 if (condition & FINCH_WRITE_COND)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 purple_cond |= PURPLE_INPUT_WRITE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 #if 0
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 purple_debug(PURPLE_DEBUG_MISC, "gtk_eventloop",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 "CLOSURE: callback for %d, fd is %d\n",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 closure->result, g_io_channel_unix_get_fd(source));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 #endif
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 #ifdef _WIN32
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 if(! purple_cond) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 #if DEBUG
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 purple_debug_misc("gnt_eventloop",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 "CLOSURE received GIOCondition of 0x%x, which does not"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 " match 0x%x (READ) or 0x%x (WRITE)\n",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 condition, FINCH_READ_COND, FINCH_WRITE_COND);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 #endif /* DEBUG */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 return TRUE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 #endif /* _WIN32 */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 closure->function(closure->data, g_io_channel_unix_get_fd(source),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 purple_cond);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 return TRUE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 static guint gnt_input_add(gint fd, PurpleInputCondition condition, PurpleInputFunction function,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 gpointer data)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 PurpleGntIOClosure *closure = g_new0(PurpleGntIOClosure, 1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 GIOChannel *channel;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 GIOCondition cond = 0;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 closure->function = function;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 closure->data = data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 if (condition & PURPLE_INPUT_READ)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 cond |= FINCH_READ_COND;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 if (condition & PURPLE_INPUT_WRITE)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 cond |= FINCH_WRITE_COND;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 channel = g_io_channel_unix_new(fd);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 closure->result = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, cond,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 purple_gnt_io_invoke, closure, purple_gnt_io_destroy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 g_io_channel_unref(channel);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 return closure->result;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 static PurpleEventLoopUiOps eventloop_ops =
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 g_timeout_add,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 g_source_remove,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 gnt_input_add,
19567
b99a158ea85e disapproval of revision 'c672802b647f1230fbd9b0edf383fb3d558cf719'
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19566
diff changeset
220 g_source_remove,
16669
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
221 NULL, /* input_get_error */
18013
58e82c3b697e It's GLIB_CHECK_VERSION, not GLIB_VERSION_CHECK.
Richard Laager <rlaager@wiktel.com>
parents: 18009
diff changeset
222 #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
223 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
224 #else
9ffa9af32854 Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents: 17049
diff changeset
225 NULL,
9ffa9af32854 Wire in g_timeout_add_seconds for Finch and nullclient as well.
Richard Laager <rlaager@wiktel.com>
parents: 17049
diff changeset
226 #endif
16669
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
227
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
228 /* padding */
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
229 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
230 NULL,
30829e806dae And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16565
diff changeset
231 NULL
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 };
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 static PurpleEventLoopUiOps *
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 gnt_eventloop_get_ui_ops(void)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 return &eventloop_ops;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 /* This is mostly copied from gtkpurple's source tree */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 static void
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 show_usage(const char *name, gboolean terse)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 char *text;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 if (terse) {
21030
3cc856ca2338 Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents: 20204
diff changeset
247 text = g_strdup_printf(_("%s. Try `%s -h' for more information.\n"), DISPLAY_VERSION, name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 } else {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 text = g_strdup_printf(_("%s\n"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 "Usage: %s [OPTION]...\n\n"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 " -c, --config=DIR use DIR for config files\n"
25421
49d51dbcb799 Debug log is sent to stderr. Thanks to whoever noticed it in IRC the other day.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24884
diff changeset
252 " -d, --debug print debugging messages to stderr\n"
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 " -h, --help display this help and exit\n"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 " -n, --nologin don't automatically login\n"
21030
3cc856ca2338 Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents: 20204
diff changeset
255 " -v, --version display the current version and exit\n"), DISPLAY_VERSION, name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 purple_print_utf8_to_console(stdout, text);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 g_free(text);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 static int
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 init_libpurple(int argc, char **argv)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 char *path;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 int opt;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 gboolean opt_help = FALSE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 gboolean opt_nologin = FALSE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 gboolean opt_version = FALSE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 char *opt_config_dir_arg = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 gboolean debug_enabled = FALSE;
30223
f30a02140f74 Create the ~/.purple/plugins directory on startup if it does not exist
Stu Tomlinson <stu@nosnilmot.com>
parents: 29377
diff changeset
272 struct stat st;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 struct option long_options[] = {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 {"config", required_argument, NULL, 'c'},
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 {"debug", no_argument, NULL, 'd'},
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 {"help", no_argument, NULL, 'h'},
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 {"nologin", no_argument, NULL, 'n'},
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 {"version", no_argument, NULL, 'v'},
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 {0, 0, 0, 0}
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 };
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 #ifdef ENABLE_NLS
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 bindtextdomain(PACKAGE, LOCALEDIR);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 bind_textdomain_codeset(PACKAGE, "UTF-8");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 textdomain(PACKAGE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 #endif
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 #ifdef HAVE_SETLOCALE
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 setlocale(LC_ALL, "");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 #endif
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 /* scan command-line options */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 opterr = 1;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 while ((opt = getopt_long(argc, argv,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 #ifndef _WIN32
24884
b2f8b1e1e7cc Remove unused option, thanks to KuSh. Closes #7856.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23403
diff changeset
297 "c:dhn::v",
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 #else
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 "c:dhn::v",
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 #endif
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 long_options, NULL)) != -1) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 switch (opt) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303 case 'c': /* config dir */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 g_free(opt_config_dir_arg);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 opt_config_dir_arg = g_strdup(optarg);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 break;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 case 'd': /* debug */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 debug_enabled = TRUE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 break;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 case 'h': /* help */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 opt_help = TRUE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 break;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 case 'n': /* no autologin */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 opt_nologin = TRUE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
315 break;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316 case 'v': /* version */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 opt_version = TRUE;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 break;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 case '?': /* show terse help */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 default:
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 show_usage(argv[0], TRUE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322 return 0;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 break;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 /* show help message */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 if (opt_help) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 show_usage(argv[0], FALSE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 return 0;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 /* show version message */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 if (opt_version) {
16943
816759ae9644 Clarify the comments on the names for translators.
Richard Laager <rlaager@wiktel.com>
parents: 16931
diff changeset
334 /* 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
335 It is not to be translated. */
27682
cc8f641d2fde Add the MTN revision in the Pidgin About and finch --version dialogs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27587
diff changeset
336 printf("%s %s (%s)\n", _("Finch"), DISPLAY_VERSION, REVISION);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337 return 0;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
338 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 /* set a user-specified config directory */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 if (opt_config_dir_arg != NULL) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 purple_util_set_user_dir(opt_config_dir_arg);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 g_free(opt_config_dir_arg);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 /*
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 * We're done piddling around with command line arguments.
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 * Fire up this baby.
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350
16380
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
351 /* We don't want debug-messages to show up and corrupt the display */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 purple_debug_set_enabled(debug_enabled);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353
16380
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
354 /* 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
355 * 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
356 if (opt_config_dir_arg == NULL)
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
357 {
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
358 if (!purple_core_migrate())
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
359 {
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
360 char *old = g_strconcat(purple_home_dir(),
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
361 G_DIR_SEPARATOR_S ".gaim", NULL);
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
362 char *text = g_strdup_printf(_(
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
363 "%s encountered errors migrating your settings "
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
364 "from %s to %s. Please investigate and complete the "
16931
dd768c576ab2 disapproval of revision 'e9933d653551beb8b5f477dcf2c6bd1f3d239c55'
Richard Laager <rlaager@wiktel.com>
parents: 16929
diff changeset
365 "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
366 old, purple_user_dir());
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
367
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
368 g_free(old);
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
369
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
370 purple_print_utf8_to_console(stderr, text);
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
371 g_free(text);
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
372
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
373 return 0;
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
374 }
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
375 }
6c97924af83b Call the migrate code from Finch.
Richard Laager <rlaager@wiktel.com>
parents: 16098
diff changeset
376
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 purple_core_set_ui_ops(gnt_core_get_ui_ops());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 purple_eventloop_set_ui_ops(gnt_eventloop_get_ui_ops());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 purple_idle_set_ui_ops(finch_idle_get_ui_ops());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 path = g_build_filename(purple_user_dir(), "plugins", NULL);
30223
f30a02140f74 Create the ~/.purple/plugins directory on startup if it does not exist
Stu Tomlinson <stu@nosnilmot.com>
parents: 29377
diff changeset
382 if (!g_stat(path, &st))
f30a02140f74 Create the ~/.purple/plugins directory on startup if it does not exist
Stu Tomlinson <stu@nosnilmot.com>
parents: 29377
diff changeset
383 g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 purple_plugins_add_search_path(path);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 g_free(path);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 purple_plugins_add_search_path(LIBDIR);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389 if (!purple_core_init(FINCH_UI))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 fprintf(stderr,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 "Initialization of the Purple core failed. Dumping core.\n"
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 "Please report this!\n");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 abort();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 /* TODO: Move blist loading into purple_blist_init() */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 purple_set_blist(purple_blist_new());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 purple_blist_load();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
19520
098c04602065 Make a note about purple_prefs_load no longer needing to be called by the UI and update finch accordingly. There doesn't appear to be any negative effects of having the purple_prefs_load called twice.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18877
diff changeset
401 /* TODO: should this be moved into finch_prefs_init() ? */
16565
ac0d07c7fd90 Pref migration for finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16525
diff changeset
402 finch_prefs_update_old();
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 /* 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
405 purple_plugins_load_saved("/finch/plugins/loaded");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 /* TODO: Move pounces loading into purple_pounces_init() */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 purple_pounces_load();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
410 if (opt_nologin)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 /* Set all accounts to "offline" */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 PurpleSavedStatus *saved_status;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 /* If we've used this type+message before, lookup the transient status */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 saved_status = purple_savedstatus_find_transient_by_type_and_message(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 PURPLE_STATUS_OFFLINE, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 /* If this type+message is unique then create a new transient saved status */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 if (saved_status == NULL)
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 /* Set the status for each account */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 purple_savedstatus_activate(saved_status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 else
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 /* 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
429 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status"))
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430 purple_savedstatus_activate(purple_savedstatus_get_startup());
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 purple_accounts_restore_current_statuses();
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 return 1;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
18877
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
437 static gboolean gnt_start(int *argc, char ***argv)
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
438 {
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
439 /* Initialize the libpurple stuff */
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
440 if (!init_libpurple(*argc, *argv))
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
441 return FALSE;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30223
diff changeset
442
18877
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
443 purple_blist_show();
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
444 return TRUE;
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
445 }
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
446
8988a205112b Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18828
diff changeset
447 int main(int argc, char *argv[])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 signal(SIGPIPE, SIG_IGN);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
19772
7dbeede6da97 Duplicate the fix from 33d699ec: do g_thread_init before using any other
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
451 g_thread_init(NULL);
7dbeede6da97 Duplicate the fix from 33d699ec: do g_thread_init before using any other
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
452
18361
9b5b0cbde65f Let's use g_set_prgname too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18329
diff changeset
453 g_set_prgname("Finch");
18329
477dd067bdc1 Use g_set_application_name here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
454 g_set_application_name(_("Finch"));
477dd067bdc1 Use g_set_application_name here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
455
20204
de68625c4c04 applied changes from 1cb036aecbbe359226e69874379d39ce74c8daf6
Richard Laager <rlaager@wiktel.com>
parents: 19772
diff changeset
456 if (gnt_start(&argc, &argv)) {
de68625c4c04 applied changes from 1cb036aecbbe359226e69874379d39ce74c8daf6
Richard Laager <rlaager@wiktel.com>
parents: 19772
diff changeset
457 gnt_main();
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 #ifdef STANDALONE
20204
de68625c4c04 applied changes from 1cb036aecbbe359226e69874379d39ce74c8daf6
Richard Laager <rlaager@wiktel.com>
parents: 19772
diff changeset
460 purple_core_quit();
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 #endif
20204
de68625c4c04 applied changes from 1cb036aecbbe359226e69874379d39ce74c8daf6
Richard Laager <rlaager@wiktel.com>
parents: 19772
diff changeset
462 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 return 0;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 }
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466