finch/libfinch.c

Fri, 13 Mar 2020 22:57:27 +0000

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 13 Mar 2020 22:57:27 +0000
changeset 40309
913a68cbf8b9
parent 40195
fb4b0ae193c0
child 40312
956745ff3ee8
permissions
-rw-r--r--

Merged in default (pull request #673)

A few tweaks to severely limit the warnings that are spit out when libpurple is compiled

Approved-by: Richard Laager
Approved-by: Elliott Sales de Andrade

39887
9c8f874c74a0 Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents: 39411
diff changeset
1 /*
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15914
diff changeset
2 * finch
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
3 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15914
diff changeset
4 * Finch is the legal property of its developers, whose names are too numerous
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
6 * source distribution.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
7 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
8 * This program is free software; you can redistribute it and/or modify
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
9 * it under the terms of the GNU General Public License as published by
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
11 * (at your option) any later version.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
12 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
13 * This program is distributed in the hope that it will be useful,
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
16 * GNU General Public License for more details.
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
17 *
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
18 * You should have received a copy of the GNU General Public License
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
19 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19733
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
14620
90d599495d65 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14413
diff changeset
21 */
39887
9c8f874c74a0 Clean up all of the license headers
Gary Kramlich <grim@reaperworld.com>
parents: 39411
diff changeset
22
29106
51c7b2177e42 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <darkrain42@pidgin.im>
parents: 27945
diff changeset
23 #include <internal.h>
39372
43e3da39daf6 Include 'locale.h' directly in files which use setlocale()
Mike Ruprecht <cmaiku@gmail.com>
parents: 39121
diff changeset
24 #include <locale.h>
18273
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18075
diff changeset
25 #include "finch.h"
e61c53184c52 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 18075
diff changeset
26
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
27 #include "account.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
28 #include "conversation.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
29 #include "core.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
30 #include "debug.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
31 #include "log.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
32 #include "notify.h"
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38800
diff changeset
33 #include "options.h"
36510
c00f65ba575f Refactored finch to report plugin load/unload errors
Ankit Vani <a@nevitus.org>
parents: 36485
diff changeset
34 #include "plugins.h"
36543
a8c3fecee2d3 Renamed prpl.[ch] to protocol.[ch]
Ankit Vani <a@nevitus.org>
parents: 36510
diff changeset
35 #include "protocol.h"
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
36 #include "pounce.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
37 #include "savedstatuses.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
38 #include "sound.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
39 #include "status.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
40 #include "util.h"
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
41 #include "whiteboard.h"
35191
e884b8670dc2 finch: Fix build and warnings with glib 2.24
Ankit Vani <a@nevitus.org>
parents: 35024
diff changeset
42 #include "xfer.h"
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
43
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14028
diff changeset
44 #include "gntdebug.h"
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14028
diff changeset
45 #include "gntprefs.h"
13958
bd1c3bb3f33d [gaim-migrate @ 16381]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13931
diff changeset
46 #include "gntui.h"
15802
1e124a68997e gntgaim idle reporting, this fixes idle return
Richard Nelson <wabz@pidgin.im>
parents: 15746
diff changeset
47 #include "gntidle.h"
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
48
14253
b63ebf84c42b This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents: 14078
diff changeset
49 #include "config.h"
27945
93ece0c6a9ad Add the MTN revision in the Pidgin About and finch --version dialogs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27829
diff changeset
50 #include "package_revision.h"
14253
b63ebf84c42b This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents: 14078
diff changeset
51
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14028
diff changeset
52 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21720
diff changeset
53 debug_init(void)
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14028
diff changeset
54 {
38644
8ba616e7c69c Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38421
diff changeset
55 FinchDebugUi *ui = finch_debug_ui_new();
8ba616e7c69c Convert Finch debug into a GObject.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 38421
diff changeset
56 purple_debug_set_ui(PURPLE_DEBUG_UI(ui));
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14028
diff changeset
57 }
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
58
18442
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
59 static GHashTable *ui_info = NULL;
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21720
diff changeset
60 static GHashTable *finch_ui_get_info(void)
18442
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
61 {
19239
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
62 if (ui_info == NULL) {
18442
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
63 ui_info = g_hash_table_new(g_str_hash, g_str_equal);
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
64
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
65 g_hash_table_insert(ui_info, "name", (char*)_("Finch"));
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
66 g_hash_table_insert(ui_info, "version", VERSION);
33955
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 33940
diff changeset
67 g_hash_table_insert(ui_info, "website", "https://pidgin.im");
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 33940
diff changeset
68 g_hash_table_insert(ui_info, "dev_website", "https://developer.pidgin.im");
25578
c0c1b73f4fb1 Changed "type" to "client_type" for the hash value specifying client type
Marcus Lundblad <malu@pidgin.im>
parents: 25577
diff changeset
69 g_hash_table_insert(ui_info, "client_type", "console");
27685
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 25578
diff changeset
70
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 25578
diff changeset
71 /*
38208
31ecbdda7ff3 aim: Switch to new libpurple/finch distid/devids provided by AOL
dx <dx@dxzone.com.ar>
parents: 35995
diff changeset
72 * This is the client key for "Finch." Please don't use this
31ecbdda7ff3 aim: Switch to new libpurple/finch distid/devids provided by AOL
dx <dx@dxzone.com.ar>
parents: 35995
diff changeset
73 * key for other applications. You can not specify a client
31ecbdda7ff3 aim: Switch to new libpurple/finch distid/devids provided by AOL
dx <dx@dxzone.com.ar>
parents: 35995
diff changeset
74 * key, in which case the default "libpurple" key will be used
27685
6e8ce73aa4a4 Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <markdoliner@pidgin.im>
parents: 25578
diff changeset
75 */
38208
31ecbdda7ff3 aim: Switch to new libpurple/finch distid/devids provided by AOL
dx <dx@dxzone.com.ar>
parents: 35995
diff changeset
76 g_hash_table_insert(ui_info, "prpl-aim-clientkey", "ma18nmEklXMR7Cj_");
31881
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
77
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
78 /*
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
79 * This is the client key for "Pidgin." It is owned by the AIM
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
80 * account "markdoliner." Please don't use this key for other
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
81 * applications. You can either not specify a client key, in
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
82 * which case the default "libpurple" key will be used, or you
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
83 * can try to register your own at the AIM or ICQ web sites
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
84 * (although this functionality was removed at some point, it's
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
85 * possible it has been re-added). AOL's old key management
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
86 * page is http://developer.aim.com/manageKeys.jsp
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
87 *
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
88 * We used to have a Finch-specific devId/clientkey
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
89 * (ma19sqWV9ymU6UYc), but it stopped working, so we switched
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
90 * to this one.
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
91 */
fb4435d51439 Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <markdoliner@pidgin.im>
parents: 31294
diff changeset
92 g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ma1cSASNCKFtrdv9");
27688
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
93
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
94 /*
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
95 * This is the distid for Finch, given to us by AOL. Please
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
96 * don't use this for other applications. You can just not
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
97 * specify a distid and libpurple will use a default.
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
98 */
38208
31ecbdda7ff3 aim: Switch to new libpurple/finch distid/devids provided by AOL
dx <dx@dxzone.com.ar>
parents: 35995
diff changeset
99 g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1718));
27688
8c89470bfe9d Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents: 27685
diff changeset
100 g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1552));
18442
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
101 }
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
102
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
103 return ui_info;
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
104 }
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
105
19239
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
106 static void
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
107 finch_quit(void)
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
108 {
35494
e631108a5464 Fix namespace issues in libgnt and finch.
Ankit Vani <a@nevitus.org>
parents: 35387
diff changeset
109 finch_ui_uninit();
19239
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
110 if (ui_info)
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
111 g_hash_table_destroy(ui_info);
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
112 }
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
113
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
114 static PurpleCoreUiOps core_ops =
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
115 {
15878
f52832b611fe renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents: 15802
diff changeset
116 finch_prefs_init,
14045
12b8c2bfd3fb [gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14028
diff changeset
117 debug_init,
35494
e631108a5464 Fix namespace issues in libgnt and finch.
Ankit Vani <a@nevitus.org>
parents: 35387
diff changeset
118 finch_ui_init,
19239
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
119 finch_quit,
18442
99c6a0271b1d UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents: 18273
diff changeset
120 finch_ui_get_info,
16748
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16629
diff changeset
121
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16629
diff changeset
122 /* padding */
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16629
diff changeset
123 NULL,
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16629
diff changeset
124 NULL,
35024
eb3afb7643ce Added /*< private >*/ for padding members, clean them up and add missing ones
Ankit Vani <a@nevitus.org>
parents: 34910
diff changeset
125 NULL,
16748
f8e1573bfde0 And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents: 16629
diff changeset
126 NULL
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
127 };
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
128
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
129 static PurpleCoreUiOps *
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21720
diff changeset
130 gnt_core_get_ui_ops(void)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
131 {
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
132 return &core_ops;
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
133 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
134
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
135 static int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
136 init_libpurple(int argc, char **argv)
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
137 {
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
138 char *path;
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
139 gboolean opt_nologin = FALSE;
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
140 gboolean opt_version = FALSE;
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
141 char *opt_config_dir_arg = NULL;
13990
e4b3d88b1b1b [gaim-migrate @ 16448]
Sean Egan <seanegan@pidgin.im>
parents: 13989
diff changeset
142 gboolean debug_enabled = FALSE;
38596
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
143 GOptionContext *context;
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
144 gchar **args;
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
145 GError *error = NULL;
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
146
38596
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
147 GOptionEntry option_entries[] = {
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
148 {"config", 'c', 0,
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
149 G_OPTION_ARG_FILENAME, &opt_config_dir_arg,
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
150 _("use DIR for config files"), _("DIR")},
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
151 {"nologin", 'n', 0,
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
152 G_OPTION_ARG_NONE, &opt_nologin,
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
153 _("don't automatically login"), NULL},
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
154 {"version", 'v', 0,
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
155 G_OPTION_ARG_NONE, &opt_version,
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
156 _("display the current version and exit"), NULL},
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
157 {NULL}
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
158 };
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
159
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35494
diff changeset
160 bindtextdomain(PACKAGE, PURPLE_LOCALEDIR);
15098
e4f3eb20c4e3 [gaim-migrate @ 17819]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15097
diff changeset
161 bind_textdomain_codeset(PACKAGE, "UTF-8");
e4f3eb20c4e3 [gaim-migrate @ 17819]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15097
diff changeset
162 textdomain(PACKAGE);
e4f3eb20c4e3 [gaim-migrate @ 17819]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15097
diff changeset
163
e4f3eb20c4e3 [gaim-migrate @ 17819]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15097
diff changeset
164 setlocale(LC_ALL, "");
e4f3eb20c4e3 [gaim-migrate @ 17819]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15097
diff changeset
165
38596
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
166 context = g_option_context_new(NULL);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
167 g_option_context_set_summary(context, DISPLAY_VERSION);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
168 g_option_context_add_main_entries(context, option_entries, PACKAGE);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
169
38802
afb1c8302e49 The start of the libpurple option group
Gary Kramlich <grim@reaperworld.com>
parents: 38800
diff changeset
170 g_option_context_add_group(context, purple_get_option_group());
38800
8a2ea9672bcb Add the gplugin GOptionGroup to the GOptionContext of both Pidgin and Finch
Gary Kramlich <grim@reaperworld.com>
parents: 38647
diff changeset
171 g_option_context_add_group(context, gplugin_get_option_group());
8a2ea9672bcb Add the gplugin GOptionGroup to the GOptionContext of both Pidgin and Finch
Gary Kramlich <grim@reaperworld.com>
parents: 38647
diff changeset
172
38596
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
173 #ifdef G_OS_WIN32
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
174 /* Handle Unicode filenames on Windows. See GOptionContext docs. */
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
175 args = g_win32_get_command_line();
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
176 #else
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
177 args = g_strdupv(argv);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
178 #endif
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
179
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
180 if (!g_option_context_parse_strv(context, &args, &error)) {
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
181 g_strfreev(args);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
182 g_printerr(_("%s: %s\nTry `%s -h' for more information.\n"),
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
183 DISPLAY_VERSION, error->message, argv[0]);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
184 g_clear_error(&error);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
185 return 1;
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
186 }
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
187
38596
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
188 g_strfreev(args);
0504444b6c25 libfinch: Port to use GOptionContext for parsing command line args
Mike Ruprecht <cmaiku@gmail.com>
parents: 38421
diff changeset
189
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
190 /* show version message */
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
191 if (opt_version) {
17001
09ceabd6b129 Clarify the comments on the names for translators.
Richard Laager <rlaager@pidgin.im>
parents: 16987
diff changeset
192 /* Translators may want to transliterate the name.
09ceabd6b129 Clarify the comments on the names for translators.
Richard Laager <rlaager@pidgin.im>
parents: 16987
diff changeset
193 It is not to be translated. */
27945
93ece0c6a9ad Add the MTN revision in the Pidgin About and finch --version dialogs.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27829
diff changeset
194 printf("%s %s (%s)\n", _("Finch"), DISPLAY_VERSION, REVISION);
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
195 return 0;
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
196 }
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
197
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
198 /* set a user-specified config directory */
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
199 if (opt_config_dir_arg != NULL) {
32785
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
200 if (g_path_is_absolute(opt_config_dir_arg)) {
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
201 purple_util_set_user_dir(opt_config_dir_arg);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
202 } else {
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
203 /* Make an absolute (if not canonical) path */
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
204 char *cwd = g_get_current_dir();
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
205 char *path = g_build_path(G_DIR_SEPARATOR_S, cwd, opt_config_dir_arg, NULL);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
206 purple_util_set_user_dir(path);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
207 g_free(path);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
208 g_free(cwd);
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
209 }
5e08d5a41442 pidgin/finch: Make relative paths absolute with -c
Paul Aurich <darkrain42@pidgin.im>
parents: 31992
diff changeset
210
14786
5dcd5187f20d [gaim-migrate @ 17478]
Richard Nelson <wabz@pidgin.im>
parents: 14647
diff changeset
211 g_free(opt_config_dir_arg);
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
212 }
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
213
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
214 /*
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
215 * We're done piddling around with command line arguments.
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
216 * Fire up this baby.
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
217 */
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
218
16445
634622ab1c7b Call the migrate code from Finch.
Richard Laager <rlaager@pidgin.im>
parents: 16158
diff changeset
219 /* We don't want debug-messages to show up and corrupt the display */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
220 purple_debug_set_enabled(debug_enabled);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
221
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
222 purple_core_set_ui_ops(gnt_core_get_ui_ops());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
223 purple_idle_set_ui_ops(finch_idle_get_ui_ops());
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
224
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
225 if (!purple_core_init(FINCH_UI))
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
226 {
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
227 fprintf(stderr,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
228 "Initialization of the Purple core failed. Dumping core.\n"
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
229 "Please report this!\n");
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
230 abort();
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
231 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
232
39954
e843e8fab70c Move Pidgin/Finch plugins to XDG data directory.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39887
diff changeset
233 path = g_build_filename(purple_data_dir(), "plugins", NULL);
35995
d0bbb2dad7f3 Fix some CWE-367 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35991
diff changeset
234 if (g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0 && errno != EEXIST)
d0bbb2dad7f3 Fix some CWE-367 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35991
diff changeset
235 fprintf(stderr, "Couldn't create plugins dir\n");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
236 purple_plugins_add_search_path(path);
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
237 g_free(path);
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
238
35850
1abeda205d6c cross-win32: make dirs more flexible, add them to the config.h
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35494
diff changeset
239 purple_plugins_add_search_path(FINCH_LIBDIR);
36431
ea007725fd4d Refactored the codebase to use the plugin wrapper functions
Ankit Vani <a@nevitus.org>
parents: 36393
diff changeset
240 purple_plugins_refresh();
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
241
19681
8399d8f69f1b 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 <datallah@pidgin.im>
parents: 19239
diff changeset
242 /* TODO: should this be moved into finch_prefs_init() ? */
16629
781a662d1fc3 Pref migration for finch.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 16593
diff changeset
243 finch_prefs_update_old();
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
244
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
245 /* load plugins we had when we quit */
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 16158
diff changeset
246 purple_plugins_load_saved("/finch/plugins/loaded");
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
247
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
248 if (opt_nologin)
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
249 {
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
250 /* Set all accounts to "offline" */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
251 PurpleSavedStatus *saved_status;
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
252
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
253 /* If we've used this type+message before, lookup the transient status */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
254 saved_status = purple_savedstatus_find_transient_by_type_and_message(
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
255 PURPLE_STATUS_OFFLINE, NULL);
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
256
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
257 /* If this type+message is unique then create a new transient saved status */
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
258 if (saved_status == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
259 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE);
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
260
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
261 /* Set the status for each account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
262 purple_savedstatus_activate(saved_status);
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
263 }
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
264 else
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
265 {
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
266 /* Everything is good to go--sign on already */
16478
19107605c565 Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@pidgin.im>
parents: 16158
diff changeset
267 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
268 purple_savedstatus_activate(purple_savedstatus_get_startup());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15878
diff changeset
269 purple_accounts_restore_current_statuses();
13973
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
270 }
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
271
99603d7e2662 [gaim-migrate @ 16410]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13969
diff changeset
272 return 1;
13852
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
273 }
1d3ae9f34d42 [gaim-migrate @ 16308]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
274
35494
e631108a5464 Fix namespace issues in libgnt and finch.
Ankit Vani <a@nevitus.org>
parents: 35387
diff changeset
275 gboolean finch_start(int *argc, char ***argv)
19239
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
276 {
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
277 /* Initialize the libpurple stuff */
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
278 if (!init_libpurple(*argc, *argv))
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
279 return FALSE;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30477
diff changeset
280
19239
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
281 purple_blist_show();
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
282 return TRUE;
a6866f1419c4 Fix a memory leak from not freeing the ui-info hashtable on exit.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19124
diff changeset
283 }

mercurial