Mercurial > pidgin.yaz
annotate pidgin/gtkmain.c @ 32827:4a34689eeb33 default tip
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 19 Nov 2011 14:42:54 +0900 |
parents | 142429bcb4c8 |
children |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
2 * pidgin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
4 * Pidgin is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19661
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "internal.h" |
15514 | 25 #include "pidgin.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "core.h" |
22724
de58bebea31a
Include dbus-maybe.h rather than conditionally including dbus-server.h
Will Thompson <will.thompson@collabora.co.uk>
parents:
22723
diff
changeset
|
30 #include "dbus-maybe.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "eventloop.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "ft.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "log.h" |
18753
2cc872f4f620
Fix stun to work on startup (this is is a temporary hack until purple_prefs_load() happens in the core). Fixes #2334
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18456
diff
changeset
|
35 #include "network.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "pounce.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "sound.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "status.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include "whiteboard.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include "gtkaccount.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 #include "gtkblist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #include "gtkconn.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 #include "gtkconv.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 #include "gtkdebug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 #include "gtkdialogs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 #include "gtkdocklet.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 #include "gtkeventloop.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 #include "gtkft.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 #include "gtkidle.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 #include "gtklog.h" |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24308
diff
changeset
|
56 #include "gtkmedia.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 #include "gtknotify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 #include "gtkplugin.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 #include "gtkpounce.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 #include "gtkprefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 #include "gtkprivacy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 #include "gtkrequest.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 #include "gtkroomlist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 #include "gtksavedstatuses.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 #include "gtksession.h" |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22066
diff
changeset
|
66 #include "gtksmiley.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 #include "gtksound.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 #include "gtkthemes.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 #include "gtkutils.h" |
15822
84b0f9b23ede
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents:
15745
diff
changeset
|
70 #include "pidginstock.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 #include "gtkwhiteboard.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 #ifdef HAVE_SIGNAL_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 # include <signal.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 #include <getopt.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 #ifdef HAVE_SIGNAL_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 * Lists of signals we wish to catch and those we wish to ignore. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 * Each list terminated with -1 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 */ |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20740
diff
changeset
|
86 static const int catch_sig_list[] = { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 SIGSEGV, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 SIGINT, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 SIGTERM, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 SIGQUIT, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 SIGCHLD, |
22484
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
92 #if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING) |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
93 SIGALRM, |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
94 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 -1 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20740
diff
changeset
|
98 static const int ignore_sig_list[] = { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 SIGPIPE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 -1 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
17850
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
104 static void |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 dologin_named(const char *name) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 { |
15823 | 107 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 char **names; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 if (name != NULL) { /* list of names given */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 names = g_strsplit(name, ",", 64); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 for (i = 0; names[i] != NULL; i++) { |
15823 | 114 account = purple_accounts_find(names[i], NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 if (account != NULL) { /* found a user */ |
17850
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
116 purple_account_set_enabled(account, PIDGIN_UI, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 g_strfreev(names); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 } else { /* no name given, use the first account */ |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
121 GList *accounts; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 |
15823 | 123 accounts = purple_accounts_get_all(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 if (accounts != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 { |
15823 | 126 account = (PurpleAccount *)accounts->data; |
17850
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
127 purple_account_set_enabled(account, PIDGIN_UI, TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 #ifdef HAVE_SIGNAL_H |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
133 static char *segfault_message; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
134 |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
135 static int signal_sockets[2]; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
136 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 static void sighandler(int sig); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
22417
eab5bc54e163
Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <will.thompson@collabora.co.uk>
parents:
22403
diff
changeset
|
139 /* |
eab5bc54e163
Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <will.thompson@collabora.co.uk>
parents:
22403
diff
changeset
|
140 * This child process reaping stuff is currently only used for processes that |
eab5bc54e163
Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <will.thompson@collabora.co.uk>
parents:
22403
diff
changeset
|
141 * were forked to play sounds. It's not needed for forked DNS child, which |
eab5bc54e163
Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <will.thompson@collabora.co.uk>
parents:
22403
diff
changeset
|
142 * have their own waitpid() call. It might be wise to move this code into |
eab5bc54e163
Tell gstreamer not to fork; remove the SIGCHLD -> SIGALRM hack, which made
Will Thompson <will.thompson@collabora.co.uk>
parents:
22403
diff
changeset
|
143 * gtksound.c. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 static void |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21865
diff
changeset
|
146 clean_pid(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 int status; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 pid_t pid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 do { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 pid = waitpid(-1, &status, WNOHANG); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 } while (pid != 0 && pid != (pid_t)-1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 if ((pid == (pid_t) - 1) && (errno != ECHILD)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 char errmsg[BUFSIZ]; |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
157 snprintf(errmsg, sizeof(errmsg), "Warning: waitpid() returned %d", pid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 perror(errmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
162 static void sighandler(int sig) |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
163 { |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
164 ssize_t written; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
165 |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
166 /* |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
167 * We won't do any of the heavy lifting for the signal handling here |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
168 * because we have no idea what was interrupted. Previously this signal |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
169 * handler could result in some calls to malloc/free, which can cause |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
170 * deadlock in libc when the signal handler was interrupting a previous |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
171 * malloc or free. So instead we'll do an ugly hack where we write the |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
172 * signal number to one end of a socket pair. The other half of the |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
173 * socket pair is watched by our main loop. When the main loop sees new |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
174 * data on the socket it reads in the signal and performs the appropriate |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
175 * action without fear of interrupting stuff. |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
176 */ |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
177 if (sig == SIGSEGV) { |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
178 fprintf(stderr, "%s", segfault_message); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
179 abort(); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
180 return; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
181 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
183 written = write(signal_sockets[0], &sig, sizeof(int)); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
184 if (written < 0 || written != sizeof(int)) { |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
185 /* This should never happen */ |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
186 purple_debug_error("sighandler", "Received signal %d but only " |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
187 "wrote %" G_GSSIZE_FORMAT " bytes out of %" |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
188 G_GSIZE_FORMAT ": %s\n", |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
189 sig, written, sizeof(int), g_strerror(errno)); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
190 exit(1); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
191 } |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
192 } |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
193 |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
194 static gboolean |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
195 mainloop_sighandler(GIOChannel *source, GIOCondition cond, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 { |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
197 GIOStatus stat; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
198 int sig; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
199 gsize bytes_read; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
200 GError *error = NULL; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
201 |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
202 /* read the signal number off of the io channel */ |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
203 stat = g_io_channel_read_chars(source, (gchar *)&sig, sizeof(int), |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
204 &bytes_read, &error); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
205 if (stat != G_IO_STATUS_NORMAL) { |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
206 purple_debug_error("sighandler", "Signal callback failed to read " |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
207 "from signal socket: %s", error->message); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
208 purple_core_quit(); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
209 return FALSE; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
210 } |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
211 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 switch (sig) { |
22484
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
213 #if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING) |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
214 /* By default, gstreamer forks when you initialize it, and waitpids for the |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
215 * child. But if libpurple reaps the child rather than leaving it to |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
216 * gstreamer, gstreamer's initialization fails. So, we wait a second before |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
217 * reaping child processes, to give gst a chance to reap it if it wants to. |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
218 * |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
219 * This is not needed in later gstreamers, which let us disable the forking. |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
220 * And, it breaks the world on some Real Unices. |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
221 */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 case SIGCHLD: |
22484
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
223 /* Restore signal catching */ |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
224 signal(SIGCHLD, sighandler); |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
225 alarm(1); |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
226 break; |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
227 case SIGALRM: |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
228 #else |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
229 case SIGCHLD: |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
230 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 clean_pid(); |
22484
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
232 /* Restore signal catching */ |
5c216e2c5405
Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM
Will Thompson <will.thompson@collabora.co.uk>
parents:
22475
diff
changeset
|
233 signal(SIGCHLD, sighandler); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 default: |
15823 | 236 purple_debug_warning("sighandler", "Caught signal %d\n", sig); |
23191
849c3d109a38
Use purple_core_quit() in the sighandler instead of duplicating part of it.
Richard Laager <rlaager@wiktel.com>
parents:
23126
diff
changeset
|
237 purple_core_quit(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 } |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
239 |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
240 return TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 static int |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21865
diff
changeset
|
245 ui_main(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 #ifndef _WIN32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 GList *icons = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 GdkPixbuf *icon = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 char *icon_path; |
15991
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
251 int i; |
16457
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
252 struct { |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
253 const char *dir; |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
254 const char *filename; |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
255 } icon_sizes[] = { |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
256 {"16x16", "pidgin.png"}, |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
257 {"24x24", "pidgin.png"}, |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
258 {"32x32", "pidgin.png"}, |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
259 {"48x48", "pidgin.png"}, |
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
260 {"scalable", "pidgin.svg"} |
15991
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
261 }; |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
262 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16131
diff
changeset
|
265 pidgin_themes_init(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
267 pidgin_blist_setup_sort_methods(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 #ifndef _WIN32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 /* use the nice PNG icon for all the windows */ |
15991
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
271 for(i=0; i<G_N_ELEMENTS(icon_sizes); i++) { |
16457
2b106533b077
Add the SVG to the default window icon list for really big window icons
Sean Egan <seanegan@gmail.com>
parents:
16452
diff
changeset
|
272 icon_path = g_build_filename(DATADIR, "icons", "hicolor", icon_sizes[i].dir, "apps", icon_sizes[i].filename, NULL); |
32138
e2c6e4fc3c84
Start looking at the GError parameter every time we call these functions:
Mark Doliner <mark@kingant.net>
parents:
32128
diff
changeset
|
273 icon = pidgin_pixbuf_new_from_file(icon_path); |
15991
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
274 g_free(icon_path); |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
275 if (icon) { |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
276 icons = g_list_append(icons,icon); |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
277 } else { |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
278 purple_debug_error("ui_main", |
22475
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
22417
diff
changeset
|
279 "Failed to load the default window icon (%spx version)!\n", icon_sizes[i].dir); |
15991
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
280 } |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
281 } |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
282 if(NULL == icons) { |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
283 purple_debug_error("ui_main", "Unable to load any size of default window icon!\n"); |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
284 } else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 gtk_window_set_default_icon_list(icons); |
15991
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
286 |
5db7909331fa
new icon goodness (i may have screwed this up, someone check)
Nathan Walp <nwalp@pidgin.im>
parents:
15871
diff
changeset
|
287 g_list_foreach(icons, (GFunc)g_object_unref, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 g_list_free(icons); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 debug_init(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 { |
15823 | 298 purple_debug_set_ui_ops(pidgin_debug_get_ui_ops()); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
299 pidgin_debug_init(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 static void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
303 pidgin_ui_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 { |
22339
143091589795
Initialize the stock stuff before doing anything else so that stock items used in error messages are ready to be used. Fixes #4917.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22066
diff
changeset
|
305 pidgin_stock_init(); |
143091589795
Initialize the stock stuff before doing anything else so that stock items used in error messages are ready to be used. Fixes #4917.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22066
diff
changeset
|
306 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 /* Set the UI operation structures. */ |
15823 | 308 purple_accounts_set_ui_ops(pidgin_accounts_get_ui_ops()); |
309 purple_xfers_set_ui_ops(pidgin_xfers_get_ui_ops()); | |
310 purple_blist_set_ui_ops(pidgin_blist_get_ui_ops()); | |
311 purple_notify_set_ui_ops(pidgin_notify_get_ui_ops()); | |
312 purple_privacy_set_ui_ops(pidgin_privacy_get_ui_ops()); | |
313 purple_request_set_ui_ops(pidgin_request_get_ui_ops()); | |
314 purple_sound_set_ui_ops(pidgin_sound_get_ui_ops()); | |
315 purple_connections_set_ui_ops(pidgin_connections_get_ui_ops()); | |
316 purple_whiteboard_set_ui_ops(pidgin_whiteboard_get_ui_ops()); | |
22631
487105d73907
Patch from Jeffery Brown to set the idle uiops on OS X when IOKit is available.
Will Thompson <will.thompson@collabora.co.uk>
parents:
22484
diff
changeset
|
317 #if defined(USE_SCREENSAVER) || defined(HAVE_IOKIT) |
15823 | 318 purple_idle_set_ui_ops(pidgin_idle_get_ui_ops()); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
321 pidgin_account_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
322 pidgin_connection_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
323 pidgin_blist_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
324 pidgin_status_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
325 pidgin_conversations_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
326 pidgin_pounces_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
327 pidgin_privacy_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
328 pidgin_xfers_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
329 pidgin_roomlist_init(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
330 pidgin_log_init(); |
16726
130d72ab7e25
Initialize docklet from pidgin_ui_init. This ensures docklet prefs are
Casey Harkins <charkins@pidgin.im>
parents:
16700
diff
changeset
|
331 pidgin_docklet_init(); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22066
diff
changeset
|
332 pidgin_smileys_init(); |
24396
38a2f78f80a7
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24308
diff
changeset
|
333 pidgin_utils_init(); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
24308
diff
changeset
|
334 pidgin_medias_init(); |
27325
ecdc58da4cdd
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
335 pidgin_notify_init(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 |
18293
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
338 static GHashTable *ui_info = NULL; |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
339 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 static void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
341 pidgin_quit(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 #ifdef USE_SM |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 /* unplug */ |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
345 pidgin_session_end(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 /* Uninit */ |
24396
38a2f78f80a7
Allow plugins to specify custom link types to the GtkIMHtml widget.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24308
diff
changeset
|
349 pidgin_utils_uninit(); |
27325
ecdc58da4cdd
Clear the notifications via a signal instead of pidgin_close_notify.
Paul Aurich <paul@darkrain42.org>
parents:
27219
diff
changeset
|
350 pidgin_notify_uninit(); |
22874
02eda4bd2b22
Apply the custom smiley patches from #1187, from Jorge Villaseo (Masca) and
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22066
diff
changeset
|
351 pidgin_smileys_uninit(); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
352 pidgin_conversations_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
353 pidgin_status_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
354 pidgin_docklet_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
355 pidgin_blist_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
356 pidgin_connection_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
357 pidgin_account_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
358 pidgin_xfers_uninit(); |
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
359 pidgin_debug_uninit(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 |
18293
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
361 if(NULL != ui_info) |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
362 g_hash_table_destroy(ui_info); |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
363 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 /* and end it all... */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 gtk_main_quit(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 |
22007
c38d72677c8a
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents:
21865
diff
changeset
|
368 static GHashTable *pidgin_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:
18184
diff
changeset
|
369 { |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
370 if(NULL == ui_info) { |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
371 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:
18184
diff
changeset
|
372 |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
373 g_hash_table_insert(ui_info, "name", (char*)PIDGIN_NAME); |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
374 g_hash_table_insert(ui_info, "version", VERSION); |
23404
c6b29adc22d1
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23202
diff
changeset
|
375 g_hash_table_insert(ui_info, "website", "http://pidgin.im"); |
c6b29adc22d1
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23202
diff
changeset
|
376 g_hash_table_insert(ui_info, "dev_website", "http://developer.pidgin.im"); |
25837
a95eed74fdd7
Changed "type" to "client_type" for the hash value specifying client type
Marcus Lundblad <ml@update.uu.se>
parents:
25836
diff
changeset
|
377 g_hash_table_insert(ui_info, "client_type", "pc"); |
27503
88ef8c38a639
Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents:
27325
diff
changeset
|
378 |
88ef8c38a639
Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents:
27325
diff
changeset
|
379 /* |
88ef8c38a639
Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents:
27325
diff
changeset
|
380 * This is the client key for "Pidgin." 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:
27325
diff
changeset
|
381 * 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:
27325
diff
changeset
|
382 * 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:
27325
diff
changeset
|
383 * which case the default "libpurple" key will be used, or you |
32128
d82d402c39fb
Change Finch to use Pidgin's clientkey/devid when connecting to ICQ.
Mark Doliner <mark@kingant.net>
parents:
31752
diff
changeset
|
384 * 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:
31752
diff
changeset
|
385 * (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:
31752
diff
changeset
|
386 * 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:
31752
diff
changeset
|
387 * page is http://developer.aim.com/manageKeys.jsp |
27503
88ef8c38a639
Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents:
27325
diff
changeset
|
388 */ |
88ef8c38a639
Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents:
27325
diff
changeset
|
389 g_hash_table_insert(ui_info, "prpl-aim-clientkey", "ma1cSASNCKFtrdv9"); |
88ef8c38a639
Use a custom clientkey for AIM and ICQ for Pidgin and Finch
Mark Doliner <mark@kingant.net>
parents:
27325
diff
changeset
|
390 g_hash_table_insert(ui_info, "prpl-icq-clientkey", "ma1cSASNCKFtrdv9"); |
27506
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27503
diff
changeset
|
391 |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27503
diff
changeset
|
392 /* |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27503
diff
changeset
|
393 * This is the distid for Pidgin, 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:
27503
diff
changeset
|
394 * 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:
27503
diff
changeset
|
395 * 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:
27503
diff
changeset
|
396 */ |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27503
diff
changeset
|
397 g_hash_table_insert(ui_info, "prpl-aim-distid", GINT_TO_POINTER(1550)); |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27503
diff
changeset
|
398 g_hash_table_insert(ui_info, "prpl-icq-distid", GINT_TO_POINTER(1550)); |
18293
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
399 } |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
400 |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
401 return ui_info; |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
402 } |
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
403 |
15823 | 404 static PurpleCoreUiOps core_ops = |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
406 pidgin_prefs_init, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 debug_init, |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
408 pidgin_ui_init, |
16681
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16483
diff
changeset
|
409 pidgin_quit, |
18293
5aae8608e1c6
UI info for finch and pidgin (finch guys probably want to take a look
Nathan Walp <nwalp@pidgin.im>
parents:
18184
diff
changeset
|
410 pidgin_ui_get_info, |
16681
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16483
diff
changeset
|
411 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16483
diff
changeset
|
412 NULL, |
fbf111436896
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
16483
diff
changeset
|
413 NULL |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 |
15823 | 416 static PurpleCoreUiOps * |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
417 pidgin_core_get_ui_ops(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 return &core_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 show_usage(const char *name, gboolean terse) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 char *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 if (terse) { |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
21015
diff
changeset
|
428 text = g_strdup_printf(_("%s %s. Try `%s -h' for more information.\n"), PIDGIN_NAME, DISPLAY_VERSION, name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 } else { |
28340
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
430 GString *str = g_string_new(NULL); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
431 g_string_append_printf(str, "%s %s\n", PIDGIN_NAME, DISPLAY_VERSION); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
432 g_string_append_printf(str, _("Usage: %s [OPTION]...\n\n"), name); |
28543
36a7950bba8f
Make DIR and NAME localizable
Mark Doliner <mark@kingant.net>
parents:
28340
diff
changeset
|
433 g_string_append_printf(str, " -c, --config=%s %s\n", |
36a7950bba8f
Make DIR and NAME localizable
Mark Doliner <mark@kingant.net>
parents:
28340
diff
changeset
|
434 _("DIR"), _("use DIR for config files")); |
28340
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
435 g_string_append_printf(str, " -d, --debug %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
436 _("print debugging messages to stdout")); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
437 g_string_append_printf(str, " -f, --force-online %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
438 _("force online, regardless of network status")); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
439 g_string_append_printf(str, " -h, --help %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
440 _("display this help and exit")); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
441 g_string_append_printf(str, " -m, --multiple %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
442 _("allow multiple instances")); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
443 g_string_append_printf(str, " -n, --nologin %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
444 _("don't automatically login")); |
28543
36a7950bba8f
Make DIR and NAME localizable
Mark Doliner <mark@kingant.net>
parents:
28340
diff
changeset
|
445 g_string_append_printf(str, " -l, --login[=%s] %s\n", |
36a7950bba8f
Make DIR and NAME localizable
Mark Doliner <mark@kingant.net>
parents:
28340
diff
changeset
|
446 _("NAME"), |
28340
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
447 _("enable specified account(s) (optional argument NAME\n" |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
448 " " |
28581
5dd7acd3d3cc
Comebine two separate strings into one, thus restoring balance to the
Mark Doliner <mark@kingant.net>
parents:
28543
diff
changeset
|
449 "specifies account(s) to use, separated by commas.\n" |
5dd7acd3d3cc
Comebine two separate strings into one, thus restoring balance to the
Mark Doliner <mark@kingant.net>
parents:
28543
diff
changeset
|
450 " " |
5dd7acd3d3cc
Comebine two separate strings into one, thus restoring balance to the
Mark Doliner <mark@kingant.net>
parents:
28543
diff
changeset
|
451 "Without this only the first account will be enabled).")); |
21865
886fa5f83f91
Ye Olde Compiler complained about this:
Stu Tomlinson <stu@nosnilmot.com>
parents:
21735
diff
changeset
|
452 #ifndef WIN32 |
28340
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
453 g_string_append_printf(str, " --display=DISPLAY %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
454 _("X display to use")); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
455 #endif /* !WIN32 */ |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
456 g_string_append_printf(str, " -v, --version %s\n", |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
457 _("display the current version and exit")); |
ea3e672e356b
Split the descriptions of our --help text up into multiple smaller
Mark Doliner <mark@kingant.net>
parents:
27506
diff
changeset
|
458 text = g_string_free(str, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 |
15823 | 461 purple_print_utf8_to_console(stdout, text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 /* FUCKING GET ME A TOWEL! */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 #ifdef _WIN32 |
15638
026f9c6cc942
winpidgin warning fixes
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15516
diff
changeset
|
467 /* suppress gcc "no previous prototype" warning */ |
026f9c6cc942
winpidgin warning fixes
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15516
diff
changeset
|
468 int pidgin_main(HINSTANCE hint, int argc, char *argv[]); |
15515
75ffc646647f
Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15506
diff
changeset
|
469 int pidgin_main(HINSTANCE hint, int argc, char *argv[]) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 #else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 int main(int argc, char *argv[]) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 { |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
474 gboolean opt_force_online = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 gboolean opt_help = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 gboolean opt_login = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 gboolean opt_nologin = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 gboolean opt_version = FALSE; |
18135
5114739a4169
Allow disabling check for single instance.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18119
diff
changeset
|
479 gboolean opt_si = TRUE; /* Check for single instance? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 char *opt_config_dir_arg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 char *opt_login_arg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 char *opt_session_arg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 char *search_path; |
18063
926ccb104da0
disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents:
18058
diff
changeset
|
484 GList *accounts; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
485 #ifdef HAVE_SIGNAL_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 int sig_indx; /* for setting up signal catching */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 sigset_t sigset; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 RETSIGTYPE (*prev_sig_disp)(int); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 char errmsg[BUFSIZ]; |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
490 GIOChannel *signal_channel; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
491 GIOStatus signal_status; |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
492 guint signal_channel_watcher; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 #ifndef DEBUG |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 char *segfault_message_tmp; |
28898
2302022ff8f1
Fix compile with debugging enabled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28880
diff
changeset
|
495 #endif |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
496 GError *error; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
497 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 int opt; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 gboolean gui_check; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 gboolean debug_enabled; |
18058
4ca97b26a8fb
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@wiktel.com>
parents:
18032
diff
changeset
|
501 GList *active_accounts; |
30651
f30a02140f74
Create the ~/.purple/plugins directory on startup if it does not exist
Stu Tomlinson <stu@nosnilmot.com>
parents:
30121
diff
changeset
|
502 struct stat st; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
503 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 struct option long_options[] = { |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
505 {"config", required_argument, NULL, 'c'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
506 {"debug", no_argument, NULL, 'd'}, |
31038
db41f73ac3b6
Fix typoed short option for "force-online".
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30651
diff
changeset
|
507 {"force-online", no_argument, NULL, 'f'}, |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
508 {"help", no_argument, NULL, 'h'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
509 {"login", optional_argument, NULL, 'l'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
510 {"multiple", no_argument, NULL, 'm'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
511 {"nologin", no_argument, NULL, 'n'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
512 {"session", required_argument, NULL, 's'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
513 {"version", no_argument, NULL, 'v'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
514 {"display", required_argument, NULL, 'D'}, |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
515 {"sync", no_argument, NULL, 'S'}, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 {0, 0, 0, 0} |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 #ifdef DEBUG |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 debug_enabled = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
521 #else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 debug_enabled = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 #endif |
17544
57e81bfeab3d
disapproval of revision '3ac5981b26be545a8c546e09b6689c2359fad1bb'
Sean Egan <seanegan@gmail.com>
parents:
17073
diff
changeset
|
524 |
22066
542d35f101ff
Allow --sync to reach gtk initialization. This is basically the same as
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
525 /* Initialize GThread before calling any Glib or GTK+ functions. */ |
17544
57e81bfeab3d
disapproval of revision '3ac5981b26be545a8c546e09b6689c2359fad1bb'
Sean Egan <seanegan@gmail.com>
parents:
17073
diff
changeset
|
526 g_thread_init(NULL); |
18160
428bea8235cb
Use g_set_application_name() so unnamed dialogs get given a name, my
Stu Tomlinson <stu@nosnilmot.com>
parents:
18136
diff
changeset
|
527 |
28981
c84a82b014ec
Set prgname for pidgin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28898
diff
changeset
|
528 g_set_prgname("Pidgin"); |
c84a82b014ec
Set prgname for pidgin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28898
diff
changeset
|
529 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 #ifdef ENABLE_NLS |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 bindtextdomain(PACKAGE, LOCALEDIR); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 bind_textdomain_codeset(PACKAGE, "UTF-8"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 textdomain(PACKAGE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 #ifdef HAVE_SETLOCALE |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 /* Locale initialization is not complete here. See gtk_init_check() */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 setlocale(LC_ALL, ""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 #ifdef HAVE_SIGNAL_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 #ifndef DEBUG |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 /* We translate this here in case the crash breaks gettext. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
545 segfault_message_tmp = g_strdup_printf(_( |
20167
d5d0a5b88104
Include the version in the segfault message - enough people blindly copy
Stu Tomlinson <stu@nosnilmot.com>
parents:
20093
diff
changeset
|
546 "%s %s has segfaulted and attempted to dump a core file.\n" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 "This is a bug in the software and has happened through\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 "no fault of your own.\n\n" |
16932
b668951121d8
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@wiktel.com>
parents:
16909
diff
changeset
|
549 "If you can reproduce the crash, please notify the developers\n" |
b668951121d8
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@wiktel.com>
parents:
16909
diff
changeset
|
550 "by reporting a bug at:\n" |
18184
f54f83b20929
I believe the great unwashed should be using simpleticket for submitting
Stu Tomlinson <stu@nosnilmot.com>
parents:
18160
diff
changeset
|
551 "%ssimpleticket/\n\n" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 "Please make sure to specify what you were doing at the time\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 "and post the backtrace from the core file. If you do not know\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 "how to get the backtrace, please read the instructions at\n" |
24308
0bf04bded747
kluge pointed out that the segfault message still recommends people IM
Richard Laager <rlaager@wiktel.com>
parents:
23404
diff
changeset
|
555 "%swiki/GetABacktrace\n"), |
0bf04bded747
kluge pointed out that the segfault message still recommends people IM
Richard Laager <rlaager@wiktel.com>
parents:
23404
diff
changeset
|
556 PIDGIN_NAME, DISPLAY_VERSION, PURPLE_DEVEL_WEBSITE, PURPLE_DEVEL_WEBSITE |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 ); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 /* we have to convert the message (UTF-8 to console |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 charset) early because after a segmentation fault |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 it's not a good practice to allocate memory */ |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
562 error = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 segfault_message = g_locale_from_utf8(segfault_message_tmp, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 -1, NULL, NULL, &error); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 if (segfault_message != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 g_free(segfault_message_tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 /* use 'segfault_message_tmp' (UTF-8) as a fallback */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 g_warning("%s\n", error->message); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 g_error_free(error); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 segfault_message = segfault_message_tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 #else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 /* Don't mark this for translation. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 segfault_message = g_strdup( |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 "Hi, user. We need to talk.\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 "I think something's gone wrong here. It's probably my fault.\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 "No, really, it's not you... it's me... no no no, I think we get along well\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 "it's just that.... well, I want to see other people. I... what?!? NO! I \n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 "haven't been cheating on you!! How many times do you want me to tell you?! And\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 "for the last time, it's just a rash!\n" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 ); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
586 /* |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
587 * Create a socket pair for receiving unix signals from a signal |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
588 * handler. |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
589 */ |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
590 if (socketpair(AF_UNIX, SOCK_STREAM, 0, signal_sockets) < 0) { |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
591 perror("Failed to create sockets for GLib signal handling"); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
592 exit(1); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
593 } |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
594 signal_channel = g_io_channel_unix_new(signal_sockets[1]); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
595 |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
596 /* |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
597 * Set the channel encoding to raw binary instead of the default of |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
598 * UTF-8, because we'll be sending integers across instead of strings. |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
599 */ |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
600 error = NULL; |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
601 signal_status = g_io_channel_set_encoding(signal_channel, NULL, &error); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
602 if (signal_status != G_IO_STATUS_NORMAL) { |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
603 fprintf(stderr, "Failed to set the signal channel to raw " |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
604 "binary: %s", error->message); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
605 exit(1); |
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
606 } |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
607 signal_channel_watcher = g_io_add_watch(signal_channel, G_IO_IN, mainloop_sighandler, NULL); |
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
608 g_io_channel_unref(signal_channel); |
28880
5063f721de6d
We really shouldn't be doing a whole lot in our signal handler. The
Mark Doliner <mark@kingant.net>
parents:
28859
diff
changeset
|
609 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 /* Let's not violate any PLA's!!!! */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 /* jseymour: whatever the fsck that means */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 /* Robot101: for some reason things like gdm like to block * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 * useful signals like SIGCHLD, so we unblock all the ones we * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 * declare a handler for. thanks JSeymour and Vann. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 if (sigemptyset(&sigset)) { |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
616 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't initialise empty signal set"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 perror(errmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
621 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d for catching", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 catch_sig_list[sig_indx]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 perror(errmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 if(sigaddset(&sigset, catch_sig_list[sig_indx])) { |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
626 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't include signal %d for unblocking", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 catch_sig_list[sig_indx]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 perror(errmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
633 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't set signal %d to ignore", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 ignore_sig_list[sig_indx]); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 perror(errmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
640 snprintf(errmsg, sizeof(errmsg), "Warning: couldn't unblock signals"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 perror(errmsg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 /* scan command-line options */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 opterr = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 while ((opt = getopt_long(argc, argv, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 #ifndef _WIN32 |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
649 "c:dfhmnl::s:v", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 #else |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
651 "c:dfhmnl::v", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 long_options, NULL)) != -1) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 switch (opt) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 case 'c': /* config dir */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 g_free(opt_config_dir_arg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 opt_config_dir_arg = g_strdup(optarg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 case 'd': /* debug */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 debug_enabled = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 break; |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
662 case 'f': /* force-online */ |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
663 opt_force_online = TRUE; |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
664 break; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 case 'h': /* help */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 opt_help = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 case 'n': /* no autologin */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 opt_nologin = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 case 'l': /* login, option username */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 opt_login = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 g_free(opt_login_arg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 if (optarg != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 opt_login_arg = g_strdup(optarg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 case 's': /* use existing session ID */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 g_free(opt_session_arg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 opt_session_arg = g_strdup(optarg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 case 'v': /* version */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 opt_version = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 break; |
18135
5114739a4169
Allow disabling check for single instance.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18119
diff
changeset
|
684 case 'm': /* do not ensure single instance. */ |
5114739a4169
Allow disabling check for single instance.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18119
diff
changeset
|
685 opt_si = FALSE; |
5114739a4169
Allow disabling check for single instance.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18119
diff
changeset
|
686 break; |
20093
df2961ce0714
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
687 case 'D': /* --display */ |
22066
542d35f101ff
Allow --sync to reach gtk initialization. This is basically the same as
Richard Laager <rlaager@wiktel.com>
parents:
22007
diff
changeset
|
688 case 'S': /* --sync */ |
20093
df2961ce0714
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
689 /* handled by gtk_init_check below */ |
df2961ce0714
Accept --display as an argument, to be passed to Gtk+.
Ethan Blanton <elb@pidgin.im>
parents:
19680
diff
changeset
|
690 break; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 case '?': /* show terse help */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 default: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 show_usage(argv[0], TRUE); |
16131
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
694 #ifdef HAVE_SIGNAL_H |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
695 g_free(segfault_message); |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
696 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 /* show help message */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 if (opt_help) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 show_usage(argv[0], FALSE); |
16131
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
705 #ifdef HAVE_SIGNAL_H |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
706 g_free(segfault_message); |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
707 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 /* show version message */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 if (opt_version) { |
25847
2a34a3f5da2e
applied changes from 20269e8849976ad6a0996f79ccbc0a12a311484f
Ethan Blanton <elb@pidgin.im>
parents:
24990
diff
changeset
|
712 printf("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION, |
2a34a3f5da2e
applied changes from 20269e8849976ad6a0996f79ccbc0a12a311484f
Ethan Blanton <elb@pidgin.im>
parents:
24990
diff
changeset
|
713 purple_core_get_version()); |
16131
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
714 #ifdef HAVE_SIGNAL_H |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
715 g_free(segfault_message); |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
716 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 /* set a user-specified config directory */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 if (opt_config_dir_arg != NULL) { |
15823 | 722 purple_util_set_user_dir(opt_config_dir_arg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
723 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 * We're done piddling around with command line arguments. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 * Fire up this baby. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 |
15823 | 730 purple_debug_set_enabled(debug_enabled); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
731 |
15823 | 732 search_path = g_build_filename(purple_user_dir(), "gtkrc-2.0", NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 gtk_rc_add_default_file(search_path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 g_free(search_path); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
735 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 gui_check = gtk_init_check(&argc, &argv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 if (!gui_check) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 char *display = gdk_get_display(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
21030
3cc856ca2338
Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents:
21015
diff
changeset
|
740 printf("%s %s\n", PIDGIN_NAME, DISPLAY_VERSION); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 g_warning("cannot open display: %s", display ? display : "unset"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
743 g_free(display); |
16131
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
744 #ifdef HAVE_SIGNAL_H |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
745 g_free(segfault_message); |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
746 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 return 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
749 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 |
28859
f7e78a9f7e50
Use PIDGIN_NAME here, rather than duplicate it.
Richard Laager <rlaager@wiktel.com>
parents:
28581
diff
changeset
|
751 g_set_application_name(PIDGIN_NAME); |
18283
6f5e6efd2241
Move g_set_application_name to a point before the pidgin UI is created
Gabriel Schulhof <nix@go-nix.ca>
parents:
18184
diff
changeset
|
752 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 #ifdef _WIN32 |
15515
75ffc646647f
Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15506
diff
changeset
|
754 winpidgin_init(hint); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
756 |
15823 | 757 purple_core_set_ui_ops(pidgin_core_get_ui_ops()); |
758 purple_eventloop_set_ui_ops(pidgin_eventloop_get_ui_ops()); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 * Set plugin search directories. Give priority to the plugins |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 * in user's home directory. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 */ |
15823 | 764 search_path = g_build_filename(purple_user_dir(), "plugins", NULL); |
30651
f30a02140f74
Create the ~/.purple/plugins directory on startup if it does not exist
Stu Tomlinson <stu@nosnilmot.com>
parents:
30121
diff
changeset
|
765 if (!g_stat(search_path, &st)) |
f30a02140f74
Create the ~/.purple/plugins directory on startup if it does not exist
Stu Tomlinson <stu@nosnilmot.com>
parents:
30121
diff
changeset
|
766 g_mkdir(search_path, S_IRUSR | S_IWUSR | S_IXUSR); |
15823 | 767 purple_plugins_add_search_path(search_path); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 g_free(search_path); |
15823 | 769 purple_plugins_add_search_path(LIBDIR); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 |
15823 | 771 if (!purple_core_init(PIDGIN_UI)) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
772 fprintf(stderr, |
16932
b668951121d8
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@wiktel.com>
parents:
16909
diff
changeset
|
773 "Initialization of the libpurple core failed. Dumping core.\n" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 "Please report this!\n"); |
16131
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
775 #ifdef HAVE_SIGNAL_H |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
776 g_free(segfault_message); |
f0c6a91bfd67
Free segfault_message when Pidgin exits abnormally
Mark Doliner <mark@kingant.net>
parents:
16098
diff
changeset
|
777 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 abort(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 |
18135
5114739a4169
Allow disabling check for single instance.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18119
diff
changeset
|
781 if (opt_si && !purple_core_ensure_single_instance()) { |
22712
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
782 #ifdef HAVE_DBUS |
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
783 DBusConnection *conn = purple_dbus_get_connection(); |
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
784 DBusMessage *message = dbus_message_new_method_call(DBUS_SERVICE_PURPLE, DBUS_PATH_PURPLE, |
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
785 DBUS_INTERFACE_PURPLE, "PurpleBlistSetVisible"); |
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
786 gboolean tr = TRUE; |
25870
3ebd399dd81e
*** Plucked rev 079a5ca1 (paul@darkrain42.org):
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25847
diff
changeset
|
787 dbus_message_append_args(message, DBUS_TYPE_INT32, &tr, DBUS_TYPE_INVALID); |
22712
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
788 dbus_connection_send_with_reply_and_block(conn, message, -1, NULL); |
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
789 dbus_message_unref(message); |
4c731c4dcc0b
Pop up the buddylist of the running instance instead of exiting quietly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22631
diff
changeset
|
790 #endif |
31752
e81c1e7ed278
Remove the dependency on libstartup-notification. Our use of it had some bugs
davidben@mit.edu
parents:
31038
diff
changeset
|
791 gdk_notify_startup_complete(); |
17126
b5935a854ccb
Added purple_core_quit to cleanup.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17124
diff
changeset
|
792 purple_core_quit(); |
24990
b539aaa728b3
Display rather than log the error when another instance is running.
Richard Laager <rlaager@wiktel.com>
parents:
24975
diff
changeset
|
793 g_printerr(_("Exiting because another libpurple client is already running.\n")); |
17123
176d0fc8bc16
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17073
diff
changeset
|
794 #ifdef HAVE_SIGNAL_H |
176d0fc8bc16
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17073
diff
changeset
|
795 g_free(segfault_message); |
176d0fc8bc16
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17073
diff
changeset
|
796 #endif |
17129
60ca4431f867
Whitespace fix in the dbus_uniq code.
Richard Laager <rlaager@wiktel.com>
parents:
17124
diff
changeset
|
797 return 0; |
17124
601594a64190
Style changes + removed unnecessary NULL checks.
Gabriel Schulhof <nix@go-nix.ca>
parents:
17123
diff
changeset
|
798 } |
17123
176d0fc8bc16
Alternative dbus_uniq implementation
Gabriel Schulhof <nix@go-nix.ca>
parents:
17073
diff
changeset
|
799 |
15823 | 800 /* TODO: Move blist loading into purple_blist_init() */ |
801 purple_set_blist(purple_blist_new()); | |
802 purple_blist_load(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
803 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
804 /* load plugins we had when we quit */ |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
16010
diff
changeset
|
805 purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
806 |
15823 | 807 /* TODO: Move pounces loading into purple_pounces_init() */ |
808 purple_pounces_load(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
809 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 ui_main(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
811 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
812 #ifdef USE_SM |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
813 pidgin_session_init(argv[0], opt_session_arg, opt_config_dir_arg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 if (opt_session_arg != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
816 g_free(opt_session_arg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
817 opt_session_arg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
818 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
819 if (opt_config_dir_arg != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
820 g_free(opt_config_dir_arg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 opt_config_dir_arg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
823 |
25343
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
824 /* This needs to be before purple_blist_show() so the |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
825 * statusbox gets the forced online status. */ |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
826 if (opt_force_online) |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
827 purple_network_force_online(); |
b38cbefca6ad
Add a -f/--force-online option to Pidgin which tells libpurple to claim the
Richard Laager <rlaager@wiktel.com>
parents:
24396
diff
changeset
|
828 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
829 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
830 * We want to show the blist early in the init process so the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 * user feels warm and fuzzy (not cold and prickley). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
832 */ |
15823 | 833 purple_blist_show(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
16010
diff
changeset
|
835 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled")) |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
836 pidgin_debug_window_show(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
838 if (opt_login) { |
17850
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
839 /* disable all accounts */ |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
840 for (accounts = purple_accounts_get_all(); accounts != NULL; accounts = accounts->next) { |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
841 PurpleAccount *account = accounts->data; |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
842 purple_account_set_enabled(account, PIDGIN_UI, FALSE); |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
843 } |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
844 /* honor the startup status preference */ |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
845 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
846 purple_savedstatus_activate(purple_savedstatus_get_startup()); |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
847 /* now enable the requested ones */ |
1f060ef64f77
Make -l do something slightly more sane than it does now, even though it
Stu Tomlinson <stu@nosnilmot.com>
parents:
17544
diff
changeset
|
848 dologin_named(opt_login_arg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 if (opt_login_arg != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 g_free(opt_login_arg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
851 opt_login_arg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 } |
19512
c88e64f1ed76
Move purple_prefs_load() to purple_prefs_init() - there's been a TODO for this for a long time. I have no idea why this wasn't done sooner; it seems to work just fine and fixes some bugs where stuff isn't loaded before being used. Fixes #1848 (and I'm sure others). Yell at me if this breaks anything.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18826
diff
changeset
|
853 } else if (opt_nologin) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 /* Set all accounts to "offline" */ |
15823 | 855 PurpleSavedStatus *saved_status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
857 /* If we've used this type+message before, lookup the transient status */ |
15823 | 858 saved_status = purple_savedstatus_find_transient_by_type_and_message( |
859 PURPLE_STATUS_OFFLINE, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
860 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 /* If this type+message is unique then create a new transient saved status */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 if (saved_status == NULL) |
15823 | 863 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 /* Set the status for each account */ |
15823 | 866 purple_savedstatus_activate(saved_status); |
19512
c88e64f1ed76
Move purple_prefs_load() to purple_prefs_init() - there's been a TODO for this for a long time. I have no idea why this wasn't done sooner; it seems to work just fine and fixes some bugs where stuff isn't loaded before being used. Fixes #1848 (and I'm sure others). Yell at me if this breaks anything.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18826
diff
changeset
|
867 } else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
868 /* Everything is good to go--sign on already */ |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16202
diff
changeset
|
869 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) |
15823 | 870 purple_savedstatus_activate(purple_savedstatus_get_startup()); |
871 purple_accounts_restore_current_statuses(); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
872 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
873 |
18058
4ca97b26a8fb
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@wiktel.com>
parents:
18032
diff
changeset
|
874 if ((active_accounts = purple_accounts_get_all_active()) == NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
875 { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15437
diff
changeset
|
876 pidgin_accounts_window_show(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 { |
18058
4ca97b26a8fb
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@wiktel.com>
parents:
18032
diff
changeset
|
880 g_list_free(active_accounts); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
882 |
31752
e81c1e7ed278
Remove the dependency on libstartup-notification. Our use of it had some bugs
davidben@mit.edu
parents:
31038
diff
changeset
|
883 /* GTK clears the notification for us when opening the first window, |
e81c1e7ed278
Remove the dependency on libstartup-notification. Our use of it had some bugs
davidben@mit.edu
parents:
31038
diff
changeset
|
884 * but we may have launched with only a status icon, so clear the it |
e81c1e7ed278
Remove the dependency on libstartup-notification. Our use of it had some bugs
davidben@mit.edu
parents:
31038
diff
changeset
|
885 * just in case. */ |
e81c1e7ed278
Remove the dependency on libstartup-notification. Our use of it had some bugs
davidben@mit.edu
parents:
31038
diff
changeset
|
886 gdk_notify_startup_complete(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
888 #ifdef _WIN32 |
15515
75ffc646647f
Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15506
diff
changeset
|
889 winpidgin_post_init(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
890 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
891 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
892 gtk_main(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
893 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
894 #ifdef HAVE_SIGNAL_H |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
895 g_free(segfault_message); |
30121
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
896 g_source_remove(signal_channel_watcher); |
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
897 close(signal_sockets[0]); |
ac49f12cddeb
Try to be polite and free stuff associated with our signal watcher pipes
Mark Doliner <mark@kingant.net>
parents:
29720
diff
changeset
|
898 close(signal_sockets[1]); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
899 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
901 #ifdef _WIN32 |
15515
75ffc646647f
Win32 de-gaimification of pidgin
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15506
diff
changeset
|
902 winpidgin_cleanup(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
904 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
905 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
906 } |