Mercurial > pidgin.yaz
annotate libgaim/core.c @ 15000:82d1a2fc6d25
[gaim-migrate @ 17778]
SF Patch #1598994 from lexande
Fixes SF Bug #1581999
Original Description:
"The gaim 2.0.0beta5 log reader plugin uses the "Date" XML field in MSN logs, the format of which varies between locales, leading to logs being displayed on incorrect/future dates in locales that do not use the MM/DD/YYYY format. This patch fixes the plugin to use the "DateTime" field which has YYYY-MM-DD date in all locales."
I totally Warmenhovened this patch. My approach:
"I'm using the Date, Time, and DateTime fields. If I can determine that the log matches the current timezone, it'll display 100% properly in the log viewer. If it has a reasonable offset, it'll display as the original time, sort in the right place, but not have a timezone abbreviation. If the offset is bogus or I can't parse the Date or Time field, it'll display in UTC, but still sort properly. I think this is as ideal as is possible, given the data we have to work with."
You don't have to understand this. ;)
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 19 Nov 2006 06:54:38 +0000 |
parents | f189327b9968 |
children | f58283ce58ea |
rev | line source |
---|---|
14192 | 1 /** |
2 * @file core.c Gaim Core API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
7 * Gaim is the legal property of its developers, whose names are too numerous | |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #include "internal.h" | |
26 #include "cipher.h" | |
27 #include "connection.h" | |
28 #include "conversation.h" | |
29 #include "core.h" | |
30 #include "debug.h" | |
14238 | 31 #include "dnsquery.h" |
14192 | 32 #include "ft.h" |
33 #include "idle.h" | |
34 #include "network.h" | |
35 #include "notify.h" | |
36 #include "plugin.h" | |
37 #include "pounce.h" | |
38 #include "prefs.h" | |
39 #include "privacy.h" | |
40 #include "proxy.h" | |
41 #include "savedstatuses.h" | |
42 #include "signals.h" | |
14238 | 43 #include "sound.h" |
14192 | 44 #include "sslconn.h" |
45 #include "status.h" | |
46 #include "stun.h" | |
47 | |
48 #ifdef HAVE_DBUS | |
49 # include "dbus-server.h" | |
50 #endif | |
51 | |
52 struct GaimCore | |
53 { | |
54 char *ui; | |
55 | |
56 void *reserved; | |
57 }; | |
58 | |
59 static GaimCoreUiOps *_ops = NULL; | |
60 static GaimCore *_core = NULL; | |
61 | |
62 STATIC_PROTO_INIT | |
63 | |
64 gboolean | |
65 gaim_core_init(const char *ui) | |
66 { | |
67 GaimCoreUiOps *ops; | |
68 GaimCore *core; | |
69 | |
70 g_return_val_if_fail(ui != NULL, FALSE); | |
71 g_return_val_if_fail(gaim_get_core() == NULL, FALSE); | |
72 | |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
73 #ifdef _WIN32 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
74 wgaim_init(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
75 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
76 |
14192 | 77 _core = core = g_new0(GaimCore, 1); |
78 core->ui = g_strdup(ui); | |
79 core->reserved = NULL; | |
80 | |
81 ops = gaim_core_get_ui_ops(); | |
82 | |
83 /* The signals subsystem is important and should be first. */ | |
84 gaim_signals_init(); | |
85 | |
86 gaim_signal_register(core, "quitting", gaim_marshal_VOID, NULL, 0); | |
87 | |
88 /* The prefs subsystem needs to be initialized before static protocols | |
89 * for protocol prefs to work. */ | |
90 gaim_prefs_init(); | |
91 | |
92 gaim_debug_init(); | |
93 | |
94 if (ops != NULL) | |
95 { | |
96 if (ops->ui_prefs_init != NULL) | |
97 ops->ui_prefs_init(); | |
98 | |
99 if (ops->debug_ui_init != NULL) | |
100 ops->debug_ui_init(); | |
101 } | |
102 | |
103 #ifdef HAVE_DBUS | |
104 gaim_dbus_init(); | |
105 #endif | |
106 | |
107 /* Initialize all static protocols. */ | |
108 static_proto_init(); | |
109 | |
110 /* Since plugins get probed so early we should probably initialize their | |
111 * subsystem right away too. | |
112 */ | |
113 gaim_plugins_init(); | |
114 gaim_plugins_probe(G_MODULE_SUFFIX); | |
115 | |
116 /* Accounts use status and buddy icons, so initialize these before accounts */ | |
117 gaim_status_init(); | |
118 gaim_buddy_icons_init(); | |
119 | |
120 gaim_accounts_init(); | |
121 gaim_savedstatuses_init(); | |
122 gaim_ciphers_init(); | |
123 gaim_notify_init(); | |
124 gaim_connections_init(); | |
125 gaim_conversations_init(); | |
126 gaim_blist_init(); | |
127 gaim_log_init(); | |
128 gaim_network_init(); | |
129 gaim_privacy_init(); | |
130 gaim_pounces_init(); | |
131 gaim_proxy_init(); | |
14238 | 132 gaim_dnsquery_init(); |
14192 | 133 gaim_sound_init(); |
134 gaim_ssl_init(); | |
135 gaim_stun_init(); | |
136 gaim_xfers_init(); | |
137 gaim_idle_init(); | |
138 | |
139 /* Call this early on to try to auto-detect our IP address */ | |
140 gaim_network_get_my_ip(-1); | |
141 | |
142 if (ops != NULL && ops->ui_init != NULL) | |
143 ops->ui_init(); | |
144 | |
145 return TRUE; | |
146 } | |
147 | |
148 void | |
149 gaim_core_quit(void) | |
150 { | |
151 GaimCoreUiOps *ops; | |
152 GaimCore *core = gaim_get_core(); | |
153 | |
154 g_return_if_fail(core != NULL); | |
155 | |
156 /* The self destruct sequence has been initiated */ | |
157 gaim_signal_emit(gaim_get_core(), "quitting"); | |
158 | |
159 /* Transmission ends */ | |
160 gaim_connections_disconnect_all(); | |
161 | |
162 /* Save .xml files, remove signals, etc. */ | |
163 gaim_idle_uninit(); | |
164 gaim_ssl_uninit(); | |
165 gaim_pounces_uninit(); | |
166 gaim_blist_uninit(); | |
167 gaim_ciphers_uninit(); | |
168 gaim_notify_uninit(); | |
169 gaim_conversations_uninit(); | |
170 gaim_connections_uninit(); | |
171 gaim_buddy_icons_uninit(); | |
172 gaim_accounts_uninit(); | |
173 gaim_savedstatuses_uninit(); | |
174 gaim_status_uninit(); | |
175 gaim_prefs_uninit(); | |
176 gaim_xfers_uninit(); | |
14238 | 177 gaim_proxy_uninit(); |
178 gaim_dnsquery_uninit(); | |
14192 | 179 |
180 gaim_debug_info("main", "Unloading all plugins\n"); | |
181 gaim_plugins_destroy_all(); | |
182 | |
183 ops = gaim_core_get_ui_ops(); | |
184 if (ops != NULL && ops->quit != NULL) | |
185 ops->quit(); | |
186 | |
187 /* | |
188 * gaim_sound_uninit() should be called as close to | |
189 * shutdown as possible. This is because the call | |
190 * to ao_shutdown() can sometimes leave our | |
191 * environment variables in an unusable state, which | |
192 * can cause a crash when getenv is called (by gettext | |
193 * for example). See the complete bug report at | |
194 * http://trac.xiph.org/cgi-bin/trac.cgi/ticket/701 | |
195 * | |
196 * TODO: Eventually move this call higher up with the others. | |
197 */ | |
198 gaim_sound_uninit(); | |
199 | |
200 gaim_plugins_uninit(); | |
201 gaim_signals_uninit(); | |
202 | |
203 #ifdef HAVE_DBUS | |
204 gaim_dbus_uninit(); | |
205 #endif | |
206 | |
207 g_free(core->ui); | |
208 g_free(core); | |
209 | |
14224
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
210 #ifdef _WIN32 |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
211 wgaim_cleanup(); |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
212 #endif |
ab8a105eff62
[gaim-migrate @ 16905]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
213 |
14192 | 214 _core = NULL; |
215 } | |
216 | |
217 gboolean | |
218 gaim_core_quit_cb(gpointer unused) | |
219 { | |
220 gaim_core_quit(); | |
221 | |
222 return FALSE; | |
223 } | |
224 | |
225 const char * | |
226 gaim_core_get_version(void) | |
227 { | |
228 return VERSION; | |
229 } | |
230 | |
231 const char * | |
232 gaim_core_get_ui(void) | |
233 { | |
234 GaimCore *core = gaim_get_core(); | |
235 | |
236 g_return_val_if_fail(core != NULL, NULL); | |
237 | |
238 return core->ui; | |
239 } | |
240 | |
241 GaimCore * | |
242 gaim_get_core(void) | |
243 { | |
244 return _core; | |
245 } | |
246 | |
247 void | |
248 gaim_core_set_ui_ops(GaimCoreUiOps *ops) | |
249 { | |
250 _ops = ops; | |
251 } | |
252 | |
253 GaimCoreUiOps * | |
254 gaim_core_get_ui_ops(void) | |
255 { | |
256 return _ops; | |
257 } |