annotate src/core.c @ 11464:610a243b4504

[gaim-migrate @ 13704] Fix Gaim's crash-on-exit bug in CVS HEAD committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 07 Sep 2005 04:37:02 +0000
parents e1ab173ef3b5
children bf6ba37db13b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
1 /**
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
2 * @file core.c Gaim Core API
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
3 * @ingroup core
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
4 *
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * gaim
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7646
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7646
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7646
diff changeset
9 * source distribution.
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 *
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * (at your option) any later version.
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 *
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * GNU General Public License for more details.
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 *
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24 */
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
25 #include "internal.h"
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10504
diff changeset
26 #include "cipher.h"
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
27 #include "connection.h"
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
28 #include "conversation.h"
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
29 #include "core.h"
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
30 #include "debug.h"
11281
920a37a4c1be [gaim-migrate @ 13478]
Gary Kramlich <grim@reaperworld.com>
parents: 11256
diff changeset
31 #include "ft.h"
8231
f50c059b6384 [gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
32 #include "network.h"
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
33 #include "plugin.h"
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
34 #include "pounce.h"
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
35 #include "prefs.h"
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6266
diff changeset
36 #include "privacy.h"
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
37 #include "proxy.h"
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
38 #include "savedstatuses.h"
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
39 #include "signals.h"
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6612
diff changeset
40 #include "sslconn.h"
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9649
diff changeset
41 #include "status.h"
11424
e1ab173ef3b5 [gaim-migrate @ 13661]
Thomas Butter <tbutter>
parents: 11281
diff changeset
42 #include "stun.h"
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
43 #include "sound.h"
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
44
11171
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
45 #ifdef HAVE_DBUS
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
46 # include "dbus-server.h"
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
47 #endif
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
48
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
49
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
50 struct GaimCore
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
51 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
52 char *ui;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
53
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
54 void *reserved;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
55 };
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
56
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
57 static GaimCoreUiOps *_ops = NULL;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
58 static GaimCore *_core = NULL;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
59
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
60 STATIC_PROTO_INIT
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
61
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
62 gboolean
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
63 gaim_core_init(const char *ui)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
64 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
65 GaimCoreUiOps *ops;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
66 GaimCore *core;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
67
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
68 g_return_val_if_fail(ui != NULL, FALSE);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
69 g_return_val_if_fail(gaim_get_core() == NULL, FALSE);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
70
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
71 _core = core = g_new0(GaimCore, 1);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
72 core->ui = g_strdup(ui);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
73 core->reserved = NULL;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
74
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6846
diff changeset
75 ops = gaim_core_get_ui_ops();
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
76
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
77 /* The signals subsystem is important and should be first. */
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
78 gaim_signals_init();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
79
6564
800ef4a51096 [gaim-migrate @ 7086]
Christian Hammond <chipx86@chipx86.com>
parents: 6485
diff changeset
80 gaim_signal_register(core, "quitting", gaim_marshal_VOID, NULL, 0);
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
81
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9944
diff changeset
82 /* The prefs subsystem needs to be initialized before static protocols
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9944
diff changeset
83 * for protocol prefs to work. */
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9944
diff changeset
84 gaim_prefs_init();
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 9944
diff changeset
85
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
86 gaim_debug_init();
10448
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
87
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9649
diff changeset
88 if (ops != NULL)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9649
diff changeset
89 {
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
90 if (ops->ui_prefs_init != NULL)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
91 ops->ui_prefs_init();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
92
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
93 if (ops->debug_ui_init != NULL)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
94 ops->debug_ui_init();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
95 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
96
11171
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
97 #ifdef HAVE_DBUS
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
98 gaim_dbus_init();
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
99 #endif
ebb02ea3c789 [gaim-migrate @ 13272]
Piotr Zielinski <zielaj>
parents: 11033
diff changeset
100
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
101 /* Initialize all static protocols. */
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
102 static_proto_init();
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
103
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
104 /* Since plugins get probed so early we should probably initialize their
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
105 * subsystem right away too.
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
106 */
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
107 gaim_plugins_init();
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
108 gaim_plugins_probe(GAIM_PLUGIN_EXT);
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
109
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
110 gaim_status_init();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
111 gaim_savedstatuses_init();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
112 gaim_accounts_init();
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10504
diff changeset
113 gaim_ciphers_init();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
114 gaim_connections_init();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
115 gaim_conversations_init();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
116 gaim_blist_init();
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7082
diff changeset
117 gaim_log_init();
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
118 gaim_buddy_icons_init();
8231
f50c059b6384 [gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents: 8046
diff changeset
119 gaim_network_init();
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6266
diff changeset
120 gaim_privacy_init();
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6266
diff changeset
121 gaim_pounces_init();
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
122 gaim_proxy_init();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
123 gaim_sound_init();
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6612
diff changeset
124 gaim_ssl_init();
11424
e1ab173ef3b5 [gaim-migrate @ 13661]
Thomas Butter <tbutter>
parents: 11281
diff changeset
125 gaim_stun_init();
11281
920a37a4c1be [gaim-migrate @ 13478]
Gary Kramlich <grim@reaperworld.com>
parents: 11256
diff changeset
126 gaim_xfers_init();
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
127
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
128 if (ops != NULL && ops->ui_init != NULL)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
129 ops->ui_init();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
130
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
131 return TRUE;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
132 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
133
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
134 void
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
135 gaim_core_quit(void)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
136 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
137 GaimCoreUiOps *ops;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
138 GaimCore *core = gaim_get_core();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
139
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
140 g_return_if_fail(core != NULL);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
141
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
142 /* The self destruct sequence has been initiated */
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
143 gaim_signal_emit(gaim_get_core(), "quitting");
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
144
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
145 /* Transmission ends */
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
146 gaim_connections_disconnect_all();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
147
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8231
diff changeset
148 /* Save .xml files, remove signals, etc. */
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 6612
diff changeset
149 gaim_ssl_uninit();
6837
f098765ac919 [gaim-migrate @ 7382]
Christian Hammond <chipx86@chipx86.com>
parents: 6701
diff changeset
150 gaim_pounces_uninit();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
151 gaim_blist_uninit();
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10504
diff changeset
152 gaim_ciphers_uninit();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
153 gaim_conversations_uninit();
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
154 gaim_connections_uninit();
6846
8ab95f4c9800 [gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents: 6837
diff changeset
155 gaim_buddy_icons_uninit();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
156 gaim_accounts_uninit();
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
157 gaim_savedstatuses_uninit();
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10322
diff changeset
158 gaim_status_uninit();
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8231
diff changeset
159 gaim_prefs_uninit();
11281
920a37a4c1be [gaim-migrate @ 13478]
Gary Kramlich <grim@reaperworld.com>
parents: 11256
diff changeset
160 gaim_xfers_uninit();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
161
10448
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
162 gaim_debug_info("main", "Unloading all plugins\n");
9649
ce434e22edf2 [gaim-migrate @ 10497]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
163 gaim_plugins_destroy_all();
6485
70d5122bc3ff [gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
164
9649
ce434e22edf2 [gaim-migrate @ 10497]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
165 ops = gaim_core_get_ui_ops();
ce434e22edf2 [gaim-migrate @ 10497]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
166 if (ops != NULL && ops->quit != NULL)
ce434e22edf2 [gaim-migrate @ 10497]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
167 ops->quit();
ce434e22edf2 [gaim-migrate @ 10497]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
168
11464
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
169 /*
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
170 * gaim_sound_uninit() should be called as close to
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
171 * shutdown as possible. This is because the call
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
172 * to ao_shutdown() can sometimes leave our
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
173 * environment variables in an unusable state, which
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
174 * can cause a crash when getenv is called (by gettext
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
175 * for example). See the complete bug report at
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
176 * http://trac.xiph.org/cgi-bin/trac.cgi/ticket/701
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
177 *
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
178 * TODO: Eventually move this call higher up with the others.
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
179 */
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
180 gaim_sound_uninit();
610a243b4504 [gaim-migrate @ 13704]
Mark Doliner <mark@kingant.net>
parents: 11424
diff changeset
181
10479
12460aa2c820 [gaim-migrate @ 11766]
Nathan Walp <nwalp@pidgin.im>
parents: 10448
diff changeset
182 gaim_plugins_uninit();
9649
ce434e22edf2 [gaim-migrate @ 10497]
Mark Doliner <mark@kingant.net>
parents: 9633
diff changeset
183 gaim_signals_uninit();
9633
81b31af2752d [gaim-migrate @ 10477]
Sean Egan <seanegan@gmail.com>
parents: 8273
diff changeset
184
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
185 if (core->ui != NULL) {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
186 g_free(core->ui);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
187 core->ui = NULL;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
188 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
189
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
190 g_free(core);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
191
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
192 _core = NULL;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
193 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
194
7646
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
195 gboolean
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
196 gaim_core_quit_cb(gpointer unused)
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
197 {
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
198 gaim_core_quit();
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
199
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
200 return FALSE;
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
201 }
c8337162c712 [gaim-migrate @ 8289]
Mark Doliner <mark@kingant.net>
parents: 7431
diff changeset
202
6612
0f78db521e70 [gaim-migrate @ 7136]
Christian Hammond <chipx86@chipx86.com>
parents: 6564
diff changeset
203 const char *
0f78db521e70 [gaim-migrate @ 7136]
Christian Hammond <chipx86@chipx86.com>
parents: 6564
diff changeset
204 gaim_core_get_version(void)
0f78db521e70 [gaim-migrate @ 7136]
Christian Hammond <chipx86@chipx86.com>
parents: 6564
diff changeset
205 {
0f78db521e70 [gaim-migrate @ 7136]
Christian Hammond <chipx86@chipx86.com>
parents: 6564
diff changeset
206 return VERSION;
0f78db521e70 [gaim-migrate @ 7136]
Christian Hammond <chipx86@chipx86.com>
parents: 6564
diff changeset
207 }
0f78db521e70 [gaim-migrate @ 7136]
Christian Hammond <chipx86@chipx86.com>
parents: 6564
diff changeset
208
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
209 const char *
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
210 gaim_core_get_ui(void)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
211 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
212 GaimCore *core = gaim_get_core();
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
213
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
214 g_return_val_if_fail(core != NULL, NULL);
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
215
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
216 return core->ui;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
217 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
218
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
219 GaimCore *
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
220 gaim_get_core(void)
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
221 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
222 return _core;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
223 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
224
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
225 void
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6846
diff changeset
226 gaim_core_set_ui_ops(GaimCoreUiOps *ops)
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
227 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
228 _ops = ops;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
229 }
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
230
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
231 GaimCoreUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6846
diff changeset
232 gaim_core_get_ui_ops(void)
6179
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
233 {
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
234 return _ops;
16e384bb7fbf [gaim-migrate @ 6664]
Christian Hammond <chipx86@chipx86.com>
parents: 6168
diff changeset
235 }