Mercurial > pidgin.yaz
annotate src/aim.c @ 4283:cbcbfdb8a485
[gaim-migrate @ 4534]
I thought it was funny.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 10 Jan 2003 23:18:27 +0000 |
parents | 74f65a3d2a1f |
children | a723d060620a |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2083
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
395
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
25 #ifdef GAIM_PLUGINS |
3630 | 26 #ifndef _WIN32 |
395
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
27 #include <dlfcn.h> |
3630 | 28 #endif |
395
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
29 #endif /* GAIM_PLUGINS */ |
1 | 30 #include <gtk/gtk.h> |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3652
diff
changeset
|
31 #ifndef _WIN32 |
1 | 32 #include <gdk/gdkx.h> |
33 #include <unistd.h> | |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
34 #include <sys/socket.h> |
1 | 35 #include <netinet/in.h> |
36 #include <arpa/inet.h> | |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
37 #include <sys/un.h> |
1 | 38 #include <sys/wait.h> |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3652
diff
changeset
|
39 #endif /* !_WIN32 */ |
3630 | 40 #include <gdk/gdk.h> |
41 #include <sys/types.h> | |
42 #include <sys/stat.h> | |
43 #include <errno.h> | |
1 | 44 #include <stdio.h> |
45 #include <string.h> | |
46 #include <stdarg.h> | |
47 #include <stdlib.h> | |
228 | 48 #include <ctype.h> |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
989
diff
changeset
|
49 #include "prpl.h" |
1 | 50 #include "gaim.h" |
3867 | 51 #include "gaim-socket.h" |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
52 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
53 #include <signal.h> |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
54 #endif |
462 | 55 #include "locale.h" |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
56 #include <getopt.h> |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3652
diff
changeset
|
57 |
3630 | 58 #ifdef _WIN32 |
59 #include "win32dep.h" | |
60 #endif | |
430 | 61 |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
62 static GtkWidget *name; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
63 static GtkWidget *pass; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
64 |
1 | 65 GList *log_conversations = NULL; |
66 GList *buddy_pounces = NULL; | |
940 | 67 GSList *away_messages = NULL; |
1 | 68 GList *conversations = NULL; |
1768 | 69 GSList *message_queue = NULL; |
3517 | 70 GSList *unread_message_queue = NULL; |
1774 | 71 GSList *away_time_queue = NULL; |
1 | 72 |
73 GtkWidget *mainwindow = NULL; | |
74 | |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
75 int opt_away = 0; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
76 char *opt_away_arg = NULL; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
77 char *opt_rcfile_arg = NULL; |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
78 int opt_debug = 0; |
3630 | 79 #ifdef _WIN32 |
80 int opt_gdebug = 0; | |
81 #endif | |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
82 |
3105 | 83 #if HAVE_SIGNAL_H |
84 /* | |
85 * Lists of signals we wish to catch and those we wish to ignore. | |
86 * Each list terminated with -1 | |
87 */ | |
88 static int catch_sig_list[] = { | |
89 SIGSEGV, | |
90 SIGHUP, | |
91 SIGINT, | |
92 SIGTERM, | |
93 SIGQUIT, | |
94 SIGCHLD, | |
95 -1 | |
96 }; | |
97 | |
98 static int ignore_sig_list[] = { | |
99 SIGPIPE, | |
100 -1 | |
101 }; | |
102 #endif | |
103 | |
4082 | 104 void do_quit() |
1 | 105 { |
4082 | 106 /* captain's log, stardate... */ |
107 system_log(log_quit, NULL, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON); | |
108 | |
109 /* the self destruct sequence has been initiated */ | |
3517 | 110 plugin_event(event_quit); |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
111 |
4082 | 112 /* transmission ends */ |
113 signoff_all(); | |
114 | |
115 /* record what we have before we blow it away... */ | |
116 save_prefs(); | |
117 | |
118 #ifdef GAIM_PLUGINS | |
119 /* jettison cargo */ | |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2121
diff
changeset
|
120 remove_all_plugins(); |
4082 | 121 #endif |
122 | |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
123 #ifdef USE_PERL |
4082 | 124 /* yup, perl too */ |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
125 perl_end(); |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
126 #endif |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
127 |
4157 | 128 #ifdef USE_SM |
129 /* unplug */ | |
130 session_end(); | |
131 #endif | |
132 | |
4082 | 133 /* and end it all... */ |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1093
diff
changeset
|
134 gtk_main_quit(); |
1 | 135 } |
136 | |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
137 static int snd_tmout; |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
138 int logins_not_muted = 1; |
4168 | 139 static gboolean sound_timeout(gpointer data) |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
140 { |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
141 logins_not_muted = 1; |
4168 | 142 g_source_remove(snd_tmout); |
143 return FALSE; | |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
144 } |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
145 |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
146 /* we need to do this for Oscar because serv_login only starts the login |
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
147 * process, it doesn't end there. gaim_setup will be called later from |
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
148 * oscar.c, after the buddy list is made and serv_finish_login is called */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
149 void gaim_setup(struct gaim_connection *gc) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
150 { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
151 if ((sound_options & OPT_SOUND_LOGIN) && (sound_options & OPT_SOUND_SILENT_SIGNON)) { |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
152 logins_not_muted = 0; |
4168 | 153 snd_tmout = g_timeout_add(10000, sound_timeout, NULL); |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
154 } |
1 | 155 } |
156 | |
157 | |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
158 static void dologin(GtkWidget *widget, GtkWidget *w) |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
159 { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
160 struct aim_user *u; |
1942
ba421d552093
[gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
161 const char *username = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(name)->entry)); |
ba421d552093
[gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
162 const char *password = gtk_entry_get_text(GTK_ENTRY(pass)); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
163 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
164 if (!strlen(username)) { |
3427 | 165 do_error_dialog(_("Please enter your login."), NULL, GAIM_ERROR); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
166 return; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
167 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
168 |
2531 | 169 /* if there is more than one user of the same name, then fuck |
170 * them, they just have to use the account editor to sign in | |
171 * the second one */ | |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
172 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1026
diff
changeset
|
173 u = find_user(username, -1); |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
174 if (!u) |
1878
75643b9f4261
[gaim-migrate @ 1888]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1820
diff
changeset
|
175 u = new_user(username, DEFAULT_PROTO, OPT_USR_REM_PASS); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
176 g_snprintf(u->password, sizeof u->password, "%s", password); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
177 save_prefs(); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
178 serv_login(u); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
179 } |
3726 | 180 |
181 /* <name> is a comma-separated list of names, or NULL | |
182 if NULL and there is at least one user defined in .gaimrc, try to login. | |
183 if not NULL, parse <name> into separate strings, look up each one in | |
184 .gaimrc and, if it's there, try to login. | |
185 returns: 0 if successful | |
186 -1 if no user was found that had a saved password | |
187 */ | |
188 static int dologin_named(char *name) | |
3483 | 189 { |
190 struct aim_user *u; | |
3726 | 191 char **names, **n; |
192 int retval = -1; | |
3483 | 193 |
3726 | 194 if (name !=NULL) { /* list of names given */ |
195 names = g_strsplit(name, ",", 32); | |
196 for (n = names; *n != NULL; n++) { | |
197 u = find_user(*n, -1); | |
198 if (u) { /* found a user */ | |
199 if (u->options & OPT_USR_REM_PASS) { | |
200 retval = 0; | |
201 serv_login(u); | |
202 } | |
203 } | |
204 } | |
205 g_strfreev(names); | |
206 } else { /* no name given, use default */ | |
207 u = (struct aim_user *)aim_users->data; | |
208 if (u->options & OPT_USR_REM_PASS) { | |
209 retval = 0; | |
3483 | 210 serv_login(u); |
3726 | 211 } |
3483 | 212 } |
3726 | 213 |
214 return retval; | |
3483 | 215 } |
3726 | 216 |
217 | |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
218 static void doenter(GtkWidget *widget, GtkWidget *w) |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
219 { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
220 if (widget == name) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
221 gtk_entry_set_text(GTK_ENTRY(pass), ""); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
222 gtk_entry_select_region(GTK_ENTRY(GTK_COMBO(name)->entry), 0, 0); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
223 gtk_widget_grab_focus(pass); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
224 } else if (widget == pass) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
225 dologin(widget, w); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
226 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
227 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
228 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
229 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
230 static void combo_changed(GtkWidget *w, GtkWidget *combo) |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
231 { |
1942
ba421d552093
[gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
232 const char *txt = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
233 struct aim_user *u; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
234 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1026
diff
changeset
|
235 u = find_user(txt, -1); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
236 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
237 if (u && u->options & OPT_USR_REM_PASS) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
238 gtk_entry_set_text(GTK_ENTRY(pass), u->password); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
239 } else { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
240 gtk_entry_set_text(GTK_ENTRY(pass), ""); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
241 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
242 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
243 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
244 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
245 static GList *combo_user_names() |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
246 { |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
247 GSList *usr = aim_users; |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
248 GList *tmp = NULL; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
249 struct aim_user *u; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
250 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
251 if (!usr) |
1409
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
252 return g_list_append(NULL, "<New User>"); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
253 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
254 while (usr) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
255 u = (struct aim_user *)usr->data; |
2257
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
256 tmp = g_list_append(tmp, u->username); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
257 usr = usr->next; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
258 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
259 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
260 return tmp; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
261 } |
1 | 262 |
263 void show_login() | |
264 { | |
3649 | 265 GdkPixbuf *icon; |
266 GtkWidget *image; | |
267 GtkWidget *vbox; | |
268 GtkWidget *button; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
269 GtkWidget *hbox; |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
270 GtkWidget *label; |
3652 | 271 GtkWidget *vbox2; |
2257
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
272 GList *tmp; |
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
273 |
3649 | 274 /* Do we already have a main window opened? If so, bring it back, baby... ribs... yeah */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
275 if (mainwindow) { |
3649 | 276 gtk_window_present(GTK_WINDOW(mainwindow)); |
277 return; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
278 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
279 |
1 | 280 mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
3630 | 281 |
4074 | 282 gtk_window_set_role(GTK_WINDOW(mainwindow), "login"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
283 gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
284 gtk_window_set_title(GTK_WINDOW(mainwindow), _("Gaim - Login")); |
621 | 285 gtk_widget_realize(mainwindow); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
286 gdk_window_set_group(mainwindow->window, mainwindow->window); |
3649 | 287 gtk_container_set_border_width(GTK_CONTAINER(mainwindow), 5); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
288 g_signal_connect(G_OBJECT(mainwindow), "delete_event", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
289 G_CALLBACK(do_quit), mainwindow); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
290 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
291 |
3649 | 292 icon = gaim_pixbuf(NULL, "gaim.png"); |
293 if (icon) { | |
294 gtk_window_set_icon(GTK_WINDOW(mainwindow), icon); | |
295 gdk_pixbuf_unref(icon); | |
296 } | |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
297 |
3649 | 298 vbox = gtk_vbox_new(FALSE, 0); |
299 gtk_container_add(GTK_CONTAINER(mainwindow), vbox); | |
300 | |
301 image = gaim_pixmap(NULL, "logo.png"); | |
302 gtk_box_pack_start(GTK_BOX(vbox), image, FALSE, FALSE, 0); | |
303 | |
3652 | 304 vbox2 = gtk_vbox_new(FALSE, 0); |
305 gtk_container_set_border_width(GTK_CONTAINER(vbox2), 5); | |
306 | |
3649 | 307 label = gtk_label_new(_("Screen Name:")); |
308 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
3652 | 309 gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
310 |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
311 name = gtk_combo_new(); |
2257
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
312 tmp = combo_user_names(); |
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
313 gtk_combo_set_popdown_strings(GTK_COMBO(name), tmp); |
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
314 g_list_free(tmp); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
315 g_signal_connect(G_OBJECT(GTK_COMBO(name)->entry), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
316 G_CALLBACK(doenter), mainwindow); |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
317 g_signal_connect(G_OBJECT(GTK_COMBO(name)->entry), "changed", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
318 G_CALLBACK(combo_changed), name); |
3652 | 319 gtk_box_pack_start(GTK_BOX(vbox2), name, FALSE, TRUE, 0); |
320 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, TRUE, 0); | |
321 | |
322 vbox2 = gtk_vbox_new(FALSE, 0); | |
323 gtk_container_set_border_width(GTK_CONTAINER(vbox2), 5); | |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
324 |
3649 | 325 label = gtk_label_new(_("Password:")); |
326 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
3652 | 327 gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 0); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
328 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
329 pass = gtk_entry_new(); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
330 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
331 g_signal_connect(G_OBJECT(pass), "activate", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
332 G_CALLBACK(doenter), mainwindow); |
3652 | 333 gtk_box_pack_start(GTK_BOX(vbox2), pass, FALSE, TRUE, 0); |
334 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, TRUE, 0); | |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
335 |
3649 | 336 /* Now for the button box */ |
337 hbox = gtk_hbox_new(TRUE, 0); | |
338 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 5); | |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
339 |
3649 | 340 /* And now for the buttons */ |
341 button = gaim_pixbuf_button("Accounts", "accounts.png", GAIM_BUTTON_VERTICAL); | |
342 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
343 g_signal_connect(G_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
344 G_CALLBACK(account_editor), mainwindow); |
3649 | 345 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
346 |
3649 | 347 #ifdef NO_MULTI |
348 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); | |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
349 #endif |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
350 |
3649 | 351 button = gaim_pixbuf_button("Settings", "preferences.png", GAIM_BUTTON_VERTICAL); |
352 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
353 g_signal_connect(G_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
354 G_CALLBACK(show_prefs), mainwindow); |
3649 | 355 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
356 |
3649 | 357 button = gaim_pixbuf_button("Sign On", "signon.png", GAIM_BUTTON_VERTICAL); |
358 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); | |
4162
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
359 g_signal_connect(G_OBJECT(button), "clicked", |
d3c8d2b40494
[gaim-migrate @ 4391]
Christian Hammond <chipx86@chipx86.com>
parents:
4157
diff
changeset
|
360 G_CALLBACK(dologin), mainwindow); |
3649 | 361 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1 | 362 |
3948
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
363 #ifdef _WIN32 |
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
364 /* Register newly created window with systray module */ |
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
365 wgaim_created_loginwin(GTK_WIDGET(mainwindow)); |
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
366 #endif |
40258b6b5ecf
[gaim-migrate @ 4127]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3907
diff
changeset
|
367 |
3649 | 368 /* Now grab the focus that we need */ |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
369 if (aim_users) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
370 struct aim_user *c = (struct aim_user *)aim_users->data; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
371 if (c->options & OPT_USR_REM_PASS) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
372 combo_changed(NULL, name); |
3649 | 373 gtk_widget_grab_focus(button); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
374 } else { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
375 gtk_widget_grab_focus(pass); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
376 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
377 } else { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
378 gtk_widget_grab_focus(name); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
379 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
380 |
3649 | 381 /* And raise the curtain! */ |
382 gtk_widget_show_all(mainwindow); | |
383 | |
1 | 384 } |
385 | |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
386 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
387 void sighandler(int sig) |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
388 { |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
389 switch (sig) { |
2083
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
390 case SIGHUP: |
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
391 debug_printf("caught signal %d\n", sig); |
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
392 signoff_all(NULL, NULL); |
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
393 break; |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
394 case SIGSEGV: |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
395 core_quit(); |
2755
adbda5d9b50c
[gaim-migrate @ 2768]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
396 #ifndef DEBUG |
1697
23ad4f7b644f
[gaim-migrate @ 1707]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1560
diff
changeset
|
397 fprintf(stderr, "Gaim has segfaulted and attempted to dump a core file.\n" |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
398 "This is a bug in the software and has happened through\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
399 "no fault of your own.\n\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
400 "It is possible that this bug is already fixed in CVS.\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
401 "You can get a tarball of CVS from the Gaim website, at\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
402 WEBSITE "gaim-CVS.tar.gz.\n\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
403 "If you are already using CVS, or can reproduce the crash\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
404 "using the CVS version, please notify the gaim maintainers\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
405 "by reporting a bug at\n" |
3808 | 406 WEBSITE "bug.php\n\n" |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
407 "Please make sure to specify what you were doing at the time,\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
408 "and post the backtrace from the core file. If you do not know\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
409 "how to get the backtrace, please get instructions at\n" |
2554
7f312efd287f
[gaim-migrate @ 2567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2533
diff
changeset
|
410 WEBSITE "gdb.php. If you need further\n" |
2993 | 411 "assistance, please IM either RobFlynn or SeanEgn and\n" |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
412 "they can help you.\n"); |
3481 | 413 #else |
414 fprintf(stderr, "Oh no! Segmentation fault!\n"); | |
3528 | 415 g_on_error_query (g_get_prgname()); |
3525 | 416 exit(1); |
2755
adbda5d9b50c
[gaim-migrate @ 2768]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
417 #endif |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
418 abort(); |
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
419 break; |
3806 | 420 case SIGCHLD: |
421 clean_pid(); | |
422 #if HAVE_SIGNAL_H | |
423 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */ | |
424 #endif | |
425 break; | |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
426 default: |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2121
diff
changeset
|
427 debug_printf("caught signal %d\n", sig); |
2591
b771cbe7e161
[gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2554
diff
changeset
|
428 signoff_all(NULL, NULL); |
2140
66a84ff0445a
[gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2130
diff
changeset
|
429 #ifdef GAIM_PLUGINS |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2121
diff
changeset
|
430 remove_all_plugins(); |
2140
66a84ff0445a
[gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2130
diff
changeset
|
431 #endif |
1792
de88617f542c
[gaim-migrate @ 1802]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
432 if (gtk_main_level()) |
de88617f542c
[gaim-migrate @ 1802]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
433 gtk_main_quit(); |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
434 core_quit(); |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
435 exit(0); |
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
436 } |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
437 } |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
438 #endif |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
439 |
3630 | 440 #ifndef _WIN32 |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
441 static gboolean socket_readable(GIOChannel *source, GIOCondition cond, gpointer ud) |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
442 { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
443 guchar type; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
444 guchar subtype; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
445 guint32 len; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
446 guchar *data; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
447 guint32 x; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
448 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
449 debug_printf("Core says: "); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
450 g_io_channel_read(source, &type, sizeof(type), &x); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
451 if (x == 0) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
452 debug_printf("CORE IS GONE!\n"); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
453 g_io_channel_close(source); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
454 return FALSE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
455 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
456 debug_printf("%d ", type); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
457 g_io_channel_read(source, &subtype, sizeof(subtype), &x); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
458 if (x == 0) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
459 debug_printf("CORE IS GONE!\n"); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
460 g_io_channel_close(source); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
461 return FALSE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
462 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
463 debug_printf("%d ", subtype); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
464 g_io_channel_read(source, (guchar *)&len, sizeof(len), &x); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
465 if (x == 0) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
466 debug_printf("CORE IS GONE!\n"); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
467 g_io_channel_close(source); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
468 return FALSE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
469 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
470 debug_printf("(%d bytes)\n", len); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
471 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
472 data = g_malloc(len); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
473 g_io_channel_read(source, data, len, &x); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
474 if (x != len) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
475 debug_printf("CORE IS GONE! (read %d/%d bytes)\n", x, len); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
476 g_free(data); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
477 g_io_channel_close(source); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
478 return FALSE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
479 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
480 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
481 g_free(data); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
482 return TRUE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
483 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
484 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
485 static int ui_main() |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
486 { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
487 GIOChannel *channel; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
488 int UI_fd; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
489 char name[256]; |
3474 | 490 GList *icons = NULL; |
491 GdkPixbuf *icon = NULL; | |
492 | |
4263 | 493 smiley_theme_probe(); |
494 | |
3474 | 495 /* use the nice PNG icon for all the windows */ |
3630 | 496 icon = gdk_pixbuf_new_from_file(DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "gaim.png",NULL); |
3474 | 497 if (icon) { |
498 icons = g_list_append(icons,icon); | |
499 gtk_window_set_default_icon_list(icons); | |
500 g_object_unref(G_OBJECT(icon)); | |
501 } else { | |
3630 | 502 debug_printf("Failed to load icon from %s" G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "gaim.png\n",DATADIR); |
3474 | 503 } |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
504 |
3630 | 505 g_snprintf(name, sizeof(name), "%s" G_DIR_SEPARATOR_S "gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), gaim_session); |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
506 |
3533 | 507 UI_fd = gaim_connect_to_session(0); |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
508 if (UI_fd < 0) |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
509 return 1; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
510 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
511 channel = g_io_channel_unix_new(UI_fd); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
512 g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, socket_readable, NULL); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
513 return 0; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
514 } |
3630 | 515 #endif /* _WIN32 */ |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
516 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
517 static void set_first_user(char *name) |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
518 { |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
519 struct aim_user *u; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
520 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
521 u = find_user(name, -1); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
522 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
523 if (!u) { /* new user */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
524 u = g_new0(struct aim_user, 1); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
525 g_snprintf(u->username, sizeof(u->username), "%s", name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
526 u->protocol = DEFAULT_PROTO; |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
527 aim_users = g_slist_prepend(aim_users, u); |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
528 } else { /* user already exists */ |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
529 aim_users = g_slist_remove(aim_users, u); |
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
530 aim_users = g_slist_prepend(aim_users, u); |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
531 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
532 save_prefs(); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
533 } |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
534 |
3630 | 535 #ifdef _WIN32 |
536 /* WIN32 print and log handlers */ | |
537 | |
538 static void gaim_dummy_print( const gchar* string ) { | |
539 return; | |
540 } | |
541 | |
542 static void gaim_dummy_log_handler (const gchar *domain, | |
543 GLogLevelFlags flags, | |
544 const gchar *msg, | |
545 gpointer user_data) { | |
546 return; | |
547 } | |
548 | |
549 static void gaim_log_handler (const gchar *domain, | |
550 GLogLevelFlags flags, | |
551 const gchar *msg, | |
552 gpointer user_data) { | |
553 debug_printf("%s - %s\n", domain, msg); | |
554 g_log_default_handler(domain, flags, msg, user_data); | |
555 } | |
3716
d7e83b4db191
[gaim-migrate @ 3849]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3652
diff
changeset
|
556 #endif /* _WIN32 */ |
3630 | 557 |
2500
1697ecbf1bcc
[gaim-migrate @ 2513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2484
diff
changeset
|
558 /* FUCKING GET ME A TOWEL! */ |
3630 | 559 #ifdef _WIN32 |
560 int gaim_main(int argc, char *argv[]) | |
561 #else | |
1 | 562 int main(int argc, char *argv[]) |
3630 | 563 #endif |
1 | 564 { |
3726 | 565 int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1; |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
566 char *opt_user_arg = NULL, *opt_login_arg = NULL; |
4157 | 567 char *opt_session_arg = NULL; |
3105 | 568 #if HAVE_SIGNAL_H |
569 int sig_indx; /* for setting up signal catching */ | |
3138 | 570 sigset_t sigset; |
3105 | 571 void (*prev_sig_disp)(); |
572 #endif | |
2307
64dd9e99884c
[gaim-migrate @ 2317]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2257
diff
changeset
|
573 int opt, opt_user = 0; |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
574 int i; |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
575 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
576 struct option long_options[] = { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
577 {"acct", no_argument, NULL, 'a'}, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
578 /*{"away", optional_argument, NULL, 'w'}, */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
579 {"help", no_argument, NULL, 'h'}, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
580 /*{"login", optional_argument, NULL, 'l'}, */ |
3360 | 581 {"loginwin", no_argument, NULL, 'n'}, |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
582 {"user", required_argument, NULL, 'u'}, |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
583 {"file", required_argument, NULL, 'f'}, |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
584 {"debug", no_argument, NULL, 'd'}, |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
585 {"version", no_argument, NULL, 'v'}, |
4157 | 586 {"session", required_argument, NULL, 's'}, |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
587 {0, 0, 0, 0} |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
588 }; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
589 |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
590 #ifdef DEBUG |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
591 opt_debug = 1; |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
592 #endif |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
593 |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
594 #ifdef ENABLE_NLS |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
595 bindtextdomain(PACKAGE, LOCALEDIR); |
3531 | 596 bind_textdomain_codeset(PACKAGE, "UTF-8"); |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
597 textdomain(PACKAGE); |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
598 #endif |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
599 |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
600 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
601 /* Let's not violate any PLA's!!!! */ |
3105 | 602 /* jseymour: whatever the fsck that means */ |
3138 | 603 /* Robot101: for some reason things like gdm like to block * |
604 * useful signals like SIGCHLD, so we unblock all the ones we * | |
605 * declare a handler for. thanks JSeymour and Vann. */ | |
606 if (sigemptyset(&sigset)) { | |
607 char errmsg[BUFSIZ]; | |
608 sprintf(errmsg, "Warning: couldn't initialise empty signal set"); | |
609 perror(errmsg); | |
610 } | |
3105 | 611 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { |
612 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { | |
613 char errmsg[BUFSIZ]; | |
614 sprintf(errmsg, "Warning: couldn't set signal %d for catching", | |
615 catch_sig_list[sig_indx]); | |
616 perror(errmsg); | |
617 } | |
3138 | 618 if(sigaddset(&sigset, catch_sig_list[sig_indx])) { |
619 char errmsg[BUFSIZ]; | |
620 sprintf(errmsg, "Warning: couldn't include signal %d for unblocking", | |
621 catch_sig_list[sig_indx]); | |
622 perror(errmsg); | |
623 } | |
3105 | 624 } |
625 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { | |
626 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { | |
627 char errmsg[BUFSIZ]; | |
628 sprintf(errmsg, "Warning: couldn't set signal %d to ignore", | |
629 ignore_sig_list[sig_indx]); | |
630 perror(errmsg); | |
631 } | |
632 } | |
3138 | 633 |
634 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { | |
635 char errmsg[BUFSIZ]; | |
636 sprintf(errmsg, "Warning: couldn't unblock signals"); | |
637 perror(errmsg); | |
638 } | |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
639 #endif |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
640 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
641 for (i = 0; i < argc; i++) { |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
642 /* --login option */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
643 if (strstr(argv[i], "--l") == argv[i]) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
644 char *equals; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
645 opt_login = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
646 if ((equals = strchr(argv[i], '=')) != NULL) { |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
647 /* --login=NAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
648 opt_login_arg = g_strdup(equals + 1); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
649 if (strlen(opt_login_arg) == 0) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
650 g_free(opt_login_arg); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
651 opt_login_arg = NULL; |
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
652 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
653 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
654 /* --login NAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
655 opt_login_arg = g_strdup(argv[i + 1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
656 strcpy(argv[i + 1], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
657 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
658 strcpy(argv[i], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
659 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
660 /* -l option */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
661 else if (strstr(argv[i], "-l") == argv[i]) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
662 opt_login = 1; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
663 if (strlen(argv[i]) > 2) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
664 /* -lNAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
665 opt_login_arg = g_strdup(argv[i] + 2); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
666 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
667 /* -l NAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
668 opt_login_arg = g_strdup(argv[i + 1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
669 strcpy(argv[i + 1], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
670 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
671 strcpy(argv[i], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
672 } |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
673 /* --away option */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
674 else if (strstr(argv[i], "--aw") == argv[i]) { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
675 char *equals; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
676 opt_away = 1; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
677 if ((equals = strchr(argv[i], '=')) != NULL) { |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
678 /* --away=MESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
679 opt_away_arg = g_strdup(equals + 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
680 if (strlen(opt_away_arg) == 0) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
681 g_free(opt_away_arg); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
682 opt_away_arg = NULL; |
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
683 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
684 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 /* --away MESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
686 opt_away_arg = g_strdup(argv[i + 1]); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
687 strcpy(argv[i + 1], " "); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
688 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
689 strcpy(argv[i], " "); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
690 } |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
691 /* -w option */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
692 else if (strstr(argv[i], "-w") == argv[i]) { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
693 opt_away = 1; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
694 if (strlen(argv[i]) > 2) { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
695 /* -wMESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
696 opt_away_arg = g_strdup(argv[i] + 2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
697 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
698 /* -w MESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
699 opt_away_arg = g_strdup(argv[i + 1]); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
700 strcpy(argv[i + 1], " "); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
701 } |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
702 strcpy(argv[i], " "); |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
703 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
704 } |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
705 /* |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
706 if (opt_login) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
707 printf ("--login given with arg %s\n", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
708 opt_login_arg ? opt_login_arg : "NULL"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
709 exit(0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
710 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
711 */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
712 |
2075
75c06bcb022e
[gaim-migrate @ 2085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2068
diff
changeset
|
713 gtk_set_locale(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
714 gtk_init(&argc, &argv); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
715 |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
716 /* scan command-line options */ |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
717 opterr = 1; |
3630 | 718 while ((opt = getopt_long(argc, argv, |
719 #ifndef _WIN32 | |
4157 | 720 "adhu:f:vns:", |
3630 | 721 #else |
722 "adghu:f:vn", | |
723 #endif | |
724 long_options, NULL)) != -1) { | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
725 switch (opt) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
726 case 'u': /* set user */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
727 opt_user = 1; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
728 opt_user_arg = g_strdup(optarg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
729 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
730 case 'a': /* account editor */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
731 opt_acct = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
732 break; |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
733 case 'd': /* debug */ |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
734 opt_debug = 1; |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
735 break; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
736 case 'f': |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
737 opt_rcfile_arg = g_strdup(optarg); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
738 break; |
4157 | 739 case 's': /* use existing session ID */ |
740 opt_session_arg = g_strdup(optarg); | |
741 break; | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
742 case 'v': /* version */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
743 opt_version = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
744 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
745 case 'h': /* help */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
746 opt_help = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
747 break; |
3360 | 748 case 'n': /* don't autologin */ |
749 opt_nologin = 1; | |
750 break; | |
3630 | 751 #ifdef _WIN32 |
752 case 'g': /* debug GTK and GLIB */ | |
753 opt_gdebug = 1; | |
754 break; | |
755 #endif | |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
756 case '?': |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
757 default: |
2121
388b2d23442a
[gaim-migrate @ 2131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2120
diff
changeset
|
758 show_usage(1, argv[0]); |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
759 return 0; |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
760 break; |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
761 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
762 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
763 |
3630 | 764 #ifdef _WIN32 |
765 /* We don't want a console window.. */ | |
766 /* | |
767 * Any calls to the glib logging functions, result in a call to AllocConsole(). | |
768 * ME and 98 will in such cases produce a console window (2000 not), despite | |
769 * being built as a windows app rather than a console app. So we should either | |
770 * ignore messages by setting dummy log handlers, or redirect messages. | |
771 * This requires setting handlers for all domains (any lib which uses g_logging). | |
772 */ | |
773 | |
774 g_log_set_handler ("Gdk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | |
775 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), | |
776 NULL); | |
777 g_log_set_handler ("Gtk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | |
778 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), | |
779 NULL); | |
780 g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | |
781 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), | |
782 NULL); | |
783 g_log_set_handler ("GModule", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | |
784 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), | |
785 NULL); | |
786 g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | |
787 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), | |
788 NULL); | |
789 g_log_set_handler ("GThread", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, | |
790 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler), | |
791 NULL); | |
792 | |
793 /* g_print also makes a call to AllocConsole(), therefore a handler needs to be | |
794 set here aswell */ | |
795 if(!opt_debug) | |
796 g_set_print_handler( gaim_dummy_print ); | |
797 | |
798 #endif | |
799 | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
800 /* show help message */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
801 if (opt_help) { |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
802 show_usage(0, argv[0]); |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
803 return 0; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
804 } |
3474 | 805 /* show version message */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
806 if (opt_version) { |
3474 | 807 printf("Gaim %s\n",VERSION); |
546
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
808 return 0; |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
809 } |
3551 | 810 |
811 #if GAIM_PLUGINS || USE_PERL | |
812 gaim_probe_plugins(); | |
813 #endif | |
4263 | 814 |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
815 #ifdef _WIN32 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
816 /* Various win32 initializations */ |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
817 wgaim_init(); |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
818 #endif |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
819 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
820 load_prefs(); |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
821 core_main(); |
3630 | 822 #ifndef _WIN32 |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
823 ui_main(); |
3630 | 824 #endif |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
825 |
4157 | 826 #ifdef USE_SM |
827 session_init(argv[0], opt_session_arg); | |
828 #endif | |
829 if (opt_session_arg != NULL) { | |
830 g_free(opt_session_arg); | |
831 opt_session_arg = NULL; | |
832 }; | |
833 | |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
834 /* set the default username */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
835 if (opt_user_arg != NULL) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
836 set_first_user(opt_user_arg); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
837 g_free(opt_user_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
838 opt_user_arg = NULL; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
839 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
840 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2307
diff
changeset
|
841 if (misc_options & OPT_MISC_DEBUG) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2307
diff
changeset
|
842 show_debug(); |
3802 | 843 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
844 static_proto_init(); |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
845 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
846 /* deal with --login */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
847 if (opt_login) { |
3726 | 848 dologin_ret = dologin_named(opt_login_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
849 if (opt_login_arg != NULL) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
850 g_free(opt_login_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
851 opt_login_arg = NULL; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
852 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
853 } |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
975
diff
changeset
|
854 |
3478 | 855 if (!opt_acct && !opt_nologin && gaim_session == 0) |
1361
5d4464379703
[gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1360
diff
changeset
|
856 auto_login(); |
5d4464379703
[gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1360
diff
changeset
|
857 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
858 if (opt_acct) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
859 account_editor(NULL, NULL); |
3726 | 860 } else if ((dologin_ret == -1) && !connections) |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
861 show_login(); |
1137 | 862 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
863 gtk_main(); |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
864 core_quit(); |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
865 /* don't need ui_quit here because ui doesn't create anything */ |
3907
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
866 #ifdef _WIN32 |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
867 wgaim_cleanup(); |
41e7544a9c67
[gaim-migrate @ 4060]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3867
diff
changeset
|
868 #endif |
1 | 869 return 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
870 |
1 | 871 } |