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