annotate src/aim.c @ 3630:9682c0e022c6

[gaim-migrate @ 3753] Yeah this will probably break a lot of shit knowing my luck. But hey, I really don't care what people thnk. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 11 Oct 2002 03:14:01 +0000
parents cd938f18f3f8
children f09193608fd3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
26 #ifndef _WIN32
395
9a436c1d128d [gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 392
diff changeset
27 #include <dlfcn.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
28 #endif
395
9a436c1d128d [gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 392
diff changeset
29 #endif /* GAIM_PLUGINS */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <gtk/gtk.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
31 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
32 #include <winsock.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
33 #else
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <gdk/gdkx.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <unistd.h>
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
36 #include <sys/socket.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <netinet/in.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <arpa/inet.h>
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
39 #include <sys/un.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include <sys/wait.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
41 #endif /* _WIN32 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
42 #include <gdk/gdk.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
43 #include <sys/types.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
44 #include <sys/stat.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
45 #include <errno.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 #include <stdarg.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 #include <stdlib.h>
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 216
diff changeset
50 #include <ctype.h>
991
3dbc2cd326e2 [gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 989
diff changeset
51 #include "prpl.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
52 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
53 #include "pixmaps/logo.xpm"
614
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
54 #if HAVE_SIGNAL_H
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
55 #include <signal.h>
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
56 #endif
462
9a5da5b17722 [gaim-migrate @ 472]
Rob Flynn <gaim@robflynn.com>
parents: 436
diff changeset
57 #include "locale.h"
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1093
diff changeset
58 #include "gtkspell.h"
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
59 #include <getopt.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
60 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
61 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
62 #endif
430
0cd2ba801eb4 [gaim-migrate @ 440]
Syd Logan <slogan>
parents: 423
diff changeset
63
3209
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
64 static gchar *aspell_cmd[] = { "aspell", "--sug-mode=fast","-a", NULL };
1128
418b1738a9a7 [gaim-migrate @ 1138]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1124
diff changeset
65 static gchar *ispell_cmd[] = { "ispell", "-a", NULL };
418b1738a9a7 [gaim-migrate @ 1138]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1124
diff changeset
66
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
67 static GtkWidget *name;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
68 static GtkWidget *pass;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
69
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
70 GList *log_conversations = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 GList *buddy_pounces = NULL;
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 917
diff changeset
72 GSList *away_messages = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
73 GList *conversations = NULL;
1768
9aae465eeb6e [gaim-migrate @ 1778]
Rob Flynn <gaim@robflynn.com>
parents: 1750
diff changeset
74 GSList *message_queue = NULL;
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
75 GSList *unread_message_queue = NULL;
1774
9d0c91c705b7 [gaim-migrate @ 1784]
Rob Flynn <gaim@robflynn.com>
parents: 1768
diff changeset
76 GSList *away_time_queue = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78 GtkWidget *mainwindow = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
79
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
80 int opt_away = 0;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
81 char *opt_away_arg = NULL;
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1555
diff changeset
82 char *opt_rcfile_arg = NULL;
2823
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
83 int opt_debug = 0;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
84 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
85 int opt_gdebug = 0;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
86 #endif
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
87
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
88 #if HAVE_SIGNAL_H
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
89 /*
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
90 * Lists of signals we wish to catch and those we wish to ignore.
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
91 * Each list terminated with -1
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
92 */
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
93 static int catch_sig_list[] = {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
94 SIGSEGV,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
95 SIGHUP,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
96 SIGINT,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
97 SIGTERM,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
98 SIGQUIT,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
99 SIGCHLD,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
100 -1
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
101 };
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
102
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
103 static int ignore_sig_list[] = {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
104 SIGPIPE,
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
105 -1
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
106 };
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
107 #endif
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
108
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
109
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
110 void cancel_logon(void)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
111 {
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 369
diff changeset
112 #ifdef GAIM_PLUGINS
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 369
diff changeset
113 /* first we tell those who have requested it we're quitting */
3517
6b0cb60162f4 [gaim-migrate @ 3590]
Sean Egan <seanegan@gmail.com>
parents: 3510
diff changeset
114 plugin_event(event_quit);
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 369
diff changeset
115
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 369
diff changeset
116 /* then we remove everyone in a mass suicide */
2125
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2121
diff changeset
117 remove_all_plugins();
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 369
diff changeset
118 #endif /* GAIM_PLUGINS */
784
4c292b3f74ea [gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
119 #ifdef USE_PERL
4c292b3f74ea [gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
120 perl_end();
4c292b3f74ea [gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
121 #endif
392
df5127560034 [gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 369
diff changeset
122
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1093
diff changeset
123 gtk_main_quit();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
124 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
125
109
45bcfa3b584c [gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 107
diff changeset
126 static int snd_tmout;
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 109
diff changeset
127 int logins_not_muted = 1;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
128 static void sound_timeout()
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
129 {
133
e277d5f0c1dd [gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 109
diff changeset
130 logins_not_muted = 1;
109
45bcfa3b584c [gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 107
diff changeset
131 gtk_timeout_remove(snd_tmout);
45bcfa3b584c [gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 107
diff changeset
132 }
45bcfa3b584c [gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 107
diff changeset
133
265
59f1748b09a6 [gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 253
diff changeset
134 /* 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
135 * 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
136 * 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
137 void gaim_setup(struct gaim_connection *gc)
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
138 {
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
139 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
140 logins_not_muted = 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
141 snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, NULL);
109
45bcfa3b584c [gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 107
diff changeset
142 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
143 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
144
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
145
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
146 static void dologin(GtkWidget *widget, GtkWidget *w)
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
147 {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
148 struct aim_user *u;
1942
ba421d552093 [gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
149 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
150 const char *password = gtk_entry_get_text(GTK_ENTRY(pass));
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
151
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
152 if (!strlen(username)) {
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3391
diff changeset
153 do_error_dialog(_("Please enter your login."), NULL, GAIM_ERROR);
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
154 return;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
155 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
156
2531
93b50fa8f410 [gaim-migrate @ 2544]
Rob Flynn <gaim@robflynn.com>
parents: 2511
diff changeset
157 /* if there is more than one user of the same name, then fuck
93b50fa8f410 [gaim-migrate @ 2544]
Rob Flynn <gaim@robflynn.com>
parents: 2511
diff changeset
158 * them, they just have to use the account editor to sign in
93b50fa8f410 [gaim-migrate @ 2544]
Rob Flynn <gaim@robflynn.com>
parents: 2511
diff changeset
159 * the second one */
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
160
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1026
diff changeset
161 u = find_user(username, -1);
1355
04874e92af24 [gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1333
diff changeset
162 if (!u)
1878
75643b9f4261 [gaim-migrate @ 1888]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1820
diff changeset
163 u = new_user(username, DEFAULT_PROTO, OPT_USR_REM_PASS);
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
164 g_snprintf(u->password, sizeof u->password, "%s", password);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
165 save_prefs();
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
166 serv_login(u);
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
3483
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
169 static void dologin_all(GtkWidget *widget, GtkWidget *w)
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
170 {
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
171 struct aim_user *u;
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
172 GSList *users = aim_users;
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
173
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
174 while (users) {
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
175 u = users->data;
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
176 if (u->options & OPT_USR_AUTO)
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
177 serv_login(u);
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
178 users = users->next;
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
179 }
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
180 }
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
181
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
182 static void doenter(GtkWidget *widget, GtkWidget *w)
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
183 {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
184 if (widget == name) {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
185 gtk_entry_set_text(GTK_ENTRY(pass), "");
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
186 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
187 gtk_widget_grab_focus(pass);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
188 } else if (widget == pass) {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
189 dologin(widget, w);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
190 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
191 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
192
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
193
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
194 static void combo_changed(GtkWidget *w, GtkWidget *combo)
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
195 {
1942
ba421d552093 [gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
196 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
197 struct aim_user *u;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
198
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1026
diff changeset
199 u = find_user(txt, -1);
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
200
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
201 if (u && u->options & OPT_USR_REM_PASS) {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
202 gtk_entry_set_text(GTK_ENTRY(pass), u->password);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
203 } else {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
204 gtk_entry_set_text(GTK_ENTRY(pass), "");
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
205 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
206 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
207
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
208
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
209 static GList *combo_user_names()
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
210 {
2397
520257562955 [gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
211 GSList *usr = aim_users;
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
212 GList *tmp = NULL;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
213 struct aim_user *u;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
214
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
215 if (!usr)
1409
17e544f8c7fb [gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1400
diff changeset
216 return g_list_append(NULL, "<New User>");
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
217
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
218 while (usr) {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
219 u = (struct aim_user *)usr->data;
2257
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
220 tmp = g_list_append(tmp, u->username);
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
221 usr = usr->next;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
222 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
223
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
224 return tmp;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
225 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
226
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
227
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228 void show_login()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229 {
3483
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
230 GtkWidget *signon_all;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
231 GtkWidget *options;
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
232 GtkWidget *plugs;
991
3dbc2cd326e2 [gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 989
diff changeset
233 #ifndef NO_MULTI
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 941
diff changeset
234 GtkWidget *accts;
991
3dbc2cd326e2 [gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 989
diff changeset
235 #endif
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
236 GtkWidget *signon;
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 941
diff changeset
237 GtkWidget *cancel;
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2823
diff changeset
238 GtkWidget *reg;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
239 GtkWidget *bbox;
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
240 GtkWidget *hbox;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
241 GtkWidget *sbox;
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
242 GtkWidget *label;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243 GtkWidget *table;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
244
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
245 GtkWidget *pmw;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
246 GdkPixmap *pm;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
247 GtkStyle *style;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
248 GdkBitmap *mask;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
249
2257
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
250 GList *tmp;
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
251
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
252 if (mainwindow) {
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
253 gtk_window_present(GTK_WINDOW(mainwindow));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
254 return;
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
255 }
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
256
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257 mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
258
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
259 gtk_window_set_wmclass(GTK_WINDOW(mainwindow), "login", "Gaim");
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
260 gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE);
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
261 gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event",
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
262 GTK_SIGNAL_FUNC(cancel_logon), mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
263 gtk_window_set_title(GTK_WINDOW(mainwindow), _("Gaim - Login"));
621
991bf4e3c9fe [gaim-migrate @ 631]
Todd Kulesza <fflewddur>
parents: 614
diff changeset
264 gtk_widget_realize(mainwindow);
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
265 gdk_window_set_group(mainwindow->window, mainwindow->window);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
266
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
267 table = gtk_table_new(8, 2, FALSE);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
268 gtk_container_add(GTK_CONTAINER(mainwindow), table);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
269 gtk_widget_show(table);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
270
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
271 style = gtk_widget_get_style(mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
272 pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask,
2533
5639484fccc9 [gaim-migrate @ 2546]
Rob Flynn <gaim@robflynn.com>
parents: 2531
diff changeset
273 &style->bg[GTK_STATE_NORMAL], (gchar **)gaim_logo_xpm);
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
274 pmw = gtk_pixmap_new(pm, mask);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
275 gtk_table_attach(GTK_TABLE(table), pmw, 0, 2, 0, 1, 0, 0, 5, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
276 gtk_widget_show(pmw);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
277 gdk_pixmap_unref(pm);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
278 gdk_bitmap_unref(mask);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
279
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
280 label = gtk_label_new(_("Screen Name: "));
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
281 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, 0, 0, 5, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
282 gtk_widget_show(label);
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
283
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
284 name = gtk_combo_new();
2257
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
285 tmp = combo_user_names();
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
286 gtk_combo_set_popdown_strings(GTK_COMBO(name), tmp);
eae25a0309c1 [gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2232
diff changeset
287 g_list_free(tmp);
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
288 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate",
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
289 GTK_SIGNAL_FUNC(doenter), mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
290 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed",
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
291 GTK_SIGNAL_FUNC(combo_changed), name);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
292 gtk_widget_set_usize(name, 100, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
293 gtk_table_attach(GTK_TABLE(table), name, 1, 2, 2, 3, 0, 0, 5, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
294 gtk_widget_show(name);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
295
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
296 label = gtk_label_new(_("Password: "));
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
297 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, 0, 0, 5, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
298 gtk_widget_show(label);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
299
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
300 pass = gtk_entry_new();
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
301 gtk_widget_set_usize(pass, 100, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
302 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
303 gtk_signal_connect(GTK_OBJECT(pass), "activate", GTK_SIGNAL_FUNC(doenter), mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
304 gtk_table_attach(GTK_TABLE(table), pass, 1, 2, 3, 4, 0, 0, 5, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
305 gtk_widget_show(pass);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
306
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
307 sbox = gtk_vbox_new(TRUE, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
308 gtk_container_border_width(GTK_CONTAINER(sbox), 10);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
309 gtk_table_attach(GTK_TABLE(table), sbox, 0, 2, 7, 8, 0, 0, 5, 5);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
310 gtk_widget_show(sbox);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
311
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
312 bbox = gtk_hbox_new(TRUE, 10);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
313 gtk_box_pack_start(GTK_BOX(sbox), bbox, TRUE, TRUE, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
314 gtk_widget_show(bbox);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
315
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1361
diff changeset
316 cancel = gtk_button_new_with_label(_("Quit"));
991
3dbc2cd326e2 [gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 989
diff changeset
317 #ifndef NO_MULTI
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
318 accts = gtk_button_new_with_label(_("Accounts"));
991
3dbc2cd326e2 [gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 989
diff changeset
319 #endif
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
320 signon = gtk_button_new_with_label(_("Signon"));
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
321
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2307
diff changeset
322 if (misc_options & OPT_MISC_COOL_LOOK) {
1360
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
323 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
324 #ifndef NO_MULTI
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
325 gtk_button_set_relief(GTK_BUTTON(accts), GTK_RELIEF_NONE);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
326 #endif
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
327 gtk_button_set_relief(GTK_BUTTON(signon), GTK_RELIEF_NONE);
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
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
330 gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(cancel_logon), mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
331 #ifndef NO_MULTI
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
332 gtk_signal_connect(GTK_OBJECT(accts), "clicked", GTK_SIGNAL_FUNC(account_editor), mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
333 #endif
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
334 gtk_signal_connect(GTK_OBJECT(signon), "clicked", GTK_SIGNAL_FUNC(dologin), mainwindow);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
335
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
336 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
337 #ifndef NO_MULTI
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
338 gtk_box_pack_start(GTK_BOX(bbox), accts, TRUE, TRUE, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
339 #endif
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
340 gtk_box_pack_start(GTK_BOX(bbox), signon, TRUE, TRUE, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
341
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
342 gtk_widget_show(cancel);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
343 #ifndef NO_MULTI
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
344 gtk_widget_show(accts);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
345 #endif
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
346 gtk_widget_show(signon);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
347
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
348 hbox = gtk_hbox_new(TRUE, 10);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
349 gtk_box_pack_start(GTK_BOX(sbox), hbox, TRUE, TRUE, 0);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
350 gtk_widget_show(hbox);
ed8b24a73764 [gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1355
diff changeset
351
3483
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
352 reg = gtk_button_new_with_label(_("Auto-login"));
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
353 options = gtk_button_new_with_label(_("Options"));
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3533
diff changeset
354 plugs = gtk_button_new_with_label(_("About"));
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2307
diff changeset
355 if (misc_options & OPT_MISC_COOL_LOOK) {
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2823
diff changeset
356 gtk_button_set_relief(GTK_BUTTON(reg), GTK_RELIEF_NONE);
535
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 508
diff changeset
357 gtk_button_set_relief(GTK_BUTTON(options), GTK_RELIEF_NONE);
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 508
diff changeset
358 gtk_button_set_relief(GTK_BUTTON(plugs), GTK_RELIEF_NONE);
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 508
diff changeset
359 }
f03f041c1aa9 [gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 508
diff changeset
360
3483
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
361 gtk_signal_connect(GTK_OBJECT(reg), "clicked", GTK_SIGNAL_FUNC(dologin_all), NULL);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
362 gtk_signal_connect(GTK_OBJECT(options), "clicked", GTK_SIGNAL_FUNC(show_prefs), NULL);
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3533
diff changeset
363 gtk_signal_connect(GTK_OBJECT(plugs), "clicked", GTK_SIGNAL_FUNC(show_about), NULL);
3495
adaa8cbf79e9 [gaim-migrate @ 3556]
Luke Schierer <lschiere@pidgin.im>
parents: 3489
diff changeset
364 gtk_box_pack_start(GTK_BOX(hbox), plugs, TRUE, TRUE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
366 gtk_box_pack_start(GTK_BOX(hbox), options, TRUE, TRUE, 0);
3483
abaee81fdea2 [gaim-migrate @ 3537]
Sean Egan <seanegan@gmail.com>
parents: 3481
diff changeset
367 gtk_box_pack_start(GTK_BOX(hbox), reg, TRUE, TRUE, 0);
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
368
2827
51999a36c0b1 [gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2823
diff changeset
369 gtk_widget_show(reg);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370 gtk_widget_show(options);
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
371 gtk_widget_show(plugs);
989
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
372
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
373 if (aim_users) {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
374 struct aim_user *c = (struct aim_user *)aim_users->data;
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
375 if (c->options & OPT_USR_REM_PASS) {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
376 combo_changed(NULL, name);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
377 gtk_widget_grab_focus(signon);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
378 } else {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
379 gtk_widget_grab_focus(pass);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
380 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
381 } else {
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
382 gtk_widget_grab_focus(name);
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
383 }
bd8eb3efe14e [gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
384
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
385 gtk_widget_show(mainwindow);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
386 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
387
614
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
388 #if HAVE_SIGNAL_H
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
389 void sighandler(int sig)
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
390 {
1415
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
391 switch (sig) {
2083
f5659096bcd6 [gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2075
diff changeset
392 case SIGHUP:
f5659096bcd6 [gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2075
diff changeset
393 debug_printf("caught signal %d\n", sig);
f5659096bcd6 [gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2075
diff changeset
394 signoff_all(NULL, NULL);
f5659096bcd6 [gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2075
diff changeset
395 break;
1415
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
396 case SIGSEGV:
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
397 core_quit();
2755
adbda5d9b50c [gaim-migrate @ 2768]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
398 #ifndef DEBUG
1697
23ad4f7b644f [gaim-migrate @ 1707]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
399 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
400 "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
401 "no fault of your own.\n\n"
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
402 "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
403 "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
404 WEBSITE "gaim-CVS.tar.gz.\n\n"
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
405 "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
406 "using the CVS version, please notify the gaim maintainers\n"
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
407 "by reporting a bug at\n"
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
408 WEBSITE "bug.php3\n\n"
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
409 "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
410 "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
411 "how to get the backtrace, please get instructions at\n"
2554
7f312efd287f [gaim-migrate @ 2567]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2533
diff changeset
412 WEBSITE "gdb.php. If you need further\n"
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2902
diff changeset
413 "assistance, please IM either RobFlynn or SeanEgn and\n"
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
414 "they can help you.\n");
3481
443b3311871d [gaim-migrate @ 3535]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
415 #else
443b3311871d [gaim-migrate @ 3535]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
416 fprintf(stderr, "Oh no! Segmentation fault!\n");
3528
aa5bb19435ce [gaim-migrate @ 3601]
Sean Egan <seanegan@gmail.com>
parents: 3525
diff changeset
417 g_on_error_query (g_get_prgname());
3525
1c5d35f767c5 [gaim-migrate @ 3598]
Sean Egan <seanegan@gmail.com>
parents: 3517
diff changeset
418 exit(1);
2755
adbda5d9b50c [gaim-migrate @ 2768]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2591
diff changeset
419 #endif
1415
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
420 abort();
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
421 break;
3076
a7e03c5d2205 [gaim-migrate @ 3090]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
422 case SIGCHLD:
a7e03c5d2205 [gaim-migrate @ 3090]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
423 clean_pid();
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
424 #if HAVE_SIGNAL_H
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
425 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
426 #endif
3076
a7e03c5d2205 [gaim-migrate @ 3090]
Rob Flynn <gaim@robflynn.com>
parents: 2993
diff changeset
427 break;
1415
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
428 default:
2125
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2121
diff changeset
429 debug_printf("caught signal %d\n", sig);
1820
73bb4244165f [gaim-migrate @ 1830]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
430 gtkspell_stop();
2591
b771cbe7e161 [gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2554
diff changeset
431 signoff_all(NULL, NULL);
2140
66a84ff0445a [gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2130
diff changeset
432 #ifdef GAIM_PLUGINS
2125
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2121
diff changeset
433 remove_all_plugins();
2140
66a84ff0445a [gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2130
diff changeset
434 #endif
1792
de88617f542c [gaim-migrate @ 1802]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
435 if (gtk_main_level())
de88617f542c [gaim-migrate @ 1802]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1774
diff changeset
436 gtk_main_quit();
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
437 core_quit();
1415
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
438 exit(0);
3dfd2a83fb5e [gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1409
diff changeset
439 }
614
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
440 }
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
441 #endif
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
442
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
443 #ifndef _WIN32
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
444 static gboolean socket_readable(GIOChannel *source, GIOCondition cond, gpointer ud)
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
445 {
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
446 guchar type;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
447 guchar subtype;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
448 guint32 len;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
449 guchar *data;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
450 guint32 x;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
451
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
452 debug_printf("Core says: ");
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
453 g_io_channel_read(source, &type, sizeof(type), &x);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
454 if (x == 0) {
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
455 debug_printf("CORE IS GONE!\n");
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
456 g_io_channel_close(source);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
457 return FALSE;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
458 }
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
459 debug_printf("%d ", type);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
460 g_io_channel_read(source, &subtype, sizeof(subtype), &x);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
461 if (x == 0) {
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
462 debug_printf("CORE IS GONE!\n");
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
463 g_io_channel_close(source);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
464 return FALSE;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
465 }
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
466 debug_printf("%d ", subtype);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
467 g_io_channel_read(source, (guchar *)&len, sizeof(len), &x);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
468 if (x == 0) {
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
469 debug_printf("CORE IS GONE!\n");
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
470 g_io_channel_close(source);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
471 return FALSE;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
472 }
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
473 debug_printf("(%d bytes)\n", len);
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 data = g_malloc(len);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
476 g_io_channel_read(source, data, len, &x);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
477 if (x != len) {
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
478 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
479 g_free(data);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
480 g_io_channel_close(source);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
481 return FALSE;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
482 }
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 g_free(data);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
485 return TRUE;
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
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
488 static int ui_main()
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
489 {
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
490 GIOChannel *channel;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
491 int UI_fd;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
492 char name[256];
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
493 GList *icons = NULL;
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
494 GdkPixbuf *icon = NULL;
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
495
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
496 /* use the nice PNG icon for all the windows */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
497 icon = gdk_pixbuf_new_from_file(DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "gaim.png",NULL);
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
498 if (icon) {
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
499 icons = g_list_append(icons,icon);
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
500 gtk_window_set_default_icon_list(icons);
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
501 g_object_unref(G_OBJECT(icon));
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
502 } else {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
503 debug_printf("Failed to load icon from %s" G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "gaim.png\n",DATADIR);
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
504 }
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
505
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
506 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
507
3533
6c32036050cf [gaim-migrate @ 3607]
Sean Egan <seanegan@gmail.com>
parents: 3531
diff changeset
508 UI_fd = gaim_connect_to_session(0);
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
509 if (UI_fd < 0)
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
510 return 1;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
511
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
512 channel = g_io_channel_unix_new(UI_fd);
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
513 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
514 return 0;
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
515 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
516 #endif /* _WIN32 */
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
517
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
518 static void set_first_user(char *name)
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
519 {
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
520 struct aim_user *u;
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
521
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
522 u = find_user(name, -1);
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
523
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
524 if (!u) { /* new user */
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
525 u = g_new0(struct aim_user, 1);
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
526 g_snprintf(u->username, sizeof(u->username), "%s", name);
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
527 u->protocol = DEFAULT_PROTO;
2397
520257562955 [gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
528 aim_users = g_slist_prepend(aim_users, u);
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
529 } else { /* user already exists */
2397
520257562955 [gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
530 aim_users = g_slist_remove(aim_users, u);
520257562955 [gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2379
diff changeset
531 aim_users = g_slist_prepend(aim_users, u);
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
532 }
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
533 save_prefs();
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
534 }
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
535
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
536 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
537 /* WIN32 print and log handlers */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
538
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
539 static void gaim_dummy_print( const gchar* string ) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
540 return;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
541 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
542
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
543 static void gaim_dummy_log_handler (const gchar *domain,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
544 GLogLevelFlags flags,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
545 const gchar *msg,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
546 gpointer user_data) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
547 return;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
548 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
549
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
550 static void gaim_log_handler (const gchar *domain,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
551 GLogLevelFlags flags,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
552 const gchar *msg,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
553 gpointer user_data) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
554 debug_printf("%s - %s\n", domain, msg);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
555 g_log_default_handler(domain, flags, msg, user_data);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
556 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
557 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
558
2500
1697ecbf1bcc [gaim-migrate @ 2513]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2484
diff changeset
559 /* FUCKING GET ME A TOWEL! */
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
560 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
561 int gaim_main(int argc, char *argv[])
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
562 #else
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
563 int main(int argc, char *argv[])
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
564 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
565 {
3360
f06c87748d91 [gaim-migrate @ 3379]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
566 int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, do_login_ret = -1;
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
567 char *opt_user_arg = NULL, *opt_login_arg = NULL;
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
568 #if HAVE_SIGNAL_H
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
569 int sig_indx; /* for setting up signal catching */
3138
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
570 sigset_t sigset;
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
571 void (*prev_sig_disp)();
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
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
f06c87748d91 [gaim-migrate @ 3379]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
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'},
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
586 {0, 0, 0, 0}
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
587 };
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
588
2823
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
589 #ifdef DEBUG
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
590 opt_debug = 1;
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
591 #endif
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
592
369
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 357
diff changeset
593 #ifdef ENABLE_NLS
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 357
diff changeset
594 bindtextdomain(PACKAGE, LOCALEDIR);
3531
84d2cd1d0ec9 [gaim-migrate @ 3605]
Sean Egan <seanegan@gmail.com>
parents: 3528
diff changeset
595 bind_textdomain_codeset(PACKAGE, "UTF-8");
369
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 357
diff changeset
596 textdomain(PACKAGE);
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 357
diff changeset
597 #endif
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 357
diff changeset
598
614
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
599 #if HAVE_SIGNAL_H
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
600 /* Let's not violate any PLA's!!!! */
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
601 /* jseymour: whatever the fsck that means */
3138
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
602 /* Robot101: for some reason things like gdm like to block *
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
603 * useful signals like SIGCHLD, so we unblock all the ones we *
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
604 * declare a handler for. thanks JSeymour and Vann. */
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
605 if (sigemptyset(&sigset)) {
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
606 char errmsg[BUFSIZ];
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
607 sprintf(errmsg, "Warning: couldn't initialise empty signal set");
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
608 perror(errmsg);
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
609 }
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
610 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
611 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
612 char errmsg[BUFSIZ];
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
613 sprintf(errmsg, "Warning: couldn't set signal %d for catching",
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
614 catch_sig_list[sig_indx]);
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
615 perror(errmsg);
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
616 }
3138
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
617 if(sigaddset(&sigset, catch_sig_list[sig_indx])) {
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
618 char errmsg[BUFSIZ];
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
619 sprintf(errmsg, "Warning: couldn't include signal %d for unblocking",
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
620 catch_sig_list[sig_indx]);
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
621 perror(errmsg);
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
622 }
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
623 }
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
624 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
625 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
626 char errmsg[BUFSIZ];
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
627 sprintf(errmsg, "Warning: couldn't set signal %d to ignore",
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
628 ignore_sig_list[sig_indx]);
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
629 perror(errmsg);
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
630 }
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
631 }
3138
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
632
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
633 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) {
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
634 char errmsg[BUFSIZ];
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
635 sprintf(errmsg, "Warning: couldn't unblock signals");
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
636 perror(errmsg);
e970fccae757 [gaim-migrate @ 3153]
Rob Flynn <gaim@robflynn.com>
parents: 3105
diff changeset
637 }
614
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
638 #endif
a3e32af35b30 [gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 600
diff changeset
639
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
640 for (i = 0; i < argc; i++) {
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
641 /* --login option */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
642 if (strstr(argv[i], "--l") == argv[i]) {
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
643 char *equals;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
644 opt_login = 1;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
645 if ((equals = strchr(argv[i], '=')) != NULL) {
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
646 /* --login=NAME */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
647 opt_login_arg = g_strdup(equals + 1);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
648 if (strlen(opt_login_arg) == 0) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
649 g_free(opt_login_arg);
2068
e38eb507b261 [gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2006
diff changeset
650 opt_login_arg = NULL;
e38eb507b261 [gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2006
diff changeset
651 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
652 } else if (i + 1 < argc && argv[i + 1][0] != '-') {
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
653 /* --login NAME */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
654 opt_login_arg = g_strdup(argv[i + 1]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
655 strcpy(argv[i + 1], " ");
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
656 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
657 strcpy(argv[i], " ");
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
658 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
659 /* -l option */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
660 else if (strstr(argv[i], "-l") == argv[i]) {
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
661 opt_login = 1;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
662 if (strlen(argv[i]) > 2) {
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
663 /* -lNAME */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
664 opt_login_arg = g_strdup(argv[i] + 2);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
665 } else if (i + 1 < argc && argv[i + 1][0] != '-') {
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
666 /* -l NAME */
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
667 opt_login_arg = g_strdup(argv[i + 1]);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
668 strcpy(argv[i + 1], " ");
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
669 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
670 strcpy(argv[i], " ");
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
671 }
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
672 /* --away option */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
673 else if (strstr(argv[i], "--aw") == argv[i]) {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
674 char *equals;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
675 opt_away = 1;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
676 if ((equals = strchr(argv[i], '=')) != NULL) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
677 /* --away=MESG */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
678 opt_away_arg = g_strdup(equals + 1);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
679 if (strlen(opt_away_arg) == 0) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
680 g_free(opt_away_arg);
2068
e38eb507b261 [gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2006
diff changeset
681 opt_away_arg = NULL;
e38eb507b261 [gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2006
diff changeset
682 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
683 } else if (i + 1 < argc && argv[i + 1][0] != '-') {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
684 /* --away MESG */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
685 opt_away_arg = g_strdup(argv[i + 1]);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
686 strcpy(argv[i + 1], " ");
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
687 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
688 strcpy(argv[i], " ");
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
689 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
690 /* -w option */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
691 else if (strstr(argv[i], "-w") == argv[i]) {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
692 opt_away = 1;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
693 if (strlen(argv[i]) > 2) {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
694 /* -wMESG */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
695 opt_away_arg = g_strdup(argv[i] + 2);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
696 } else if (i + 1 < argc && argv[i + 1][0] != '-') {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
697 /* -w MESG */
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
698 opt_away_arg = g_strdup(argv[i + 1]);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
699 strcpy(argv[i + 1], " ");
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
700 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
701 strcpy(argv[i], " ");
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
702 }
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
703 }
2068
e38eb507b261 [gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2006
diff changeset
704 /*
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
705 if (opt_login) {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
706 printf ("--login given with arg %s\n",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
707 opt_login_arg ? opt_login_arg : "NULL");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
708 exit(0);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
709 }
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
710 */
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
711
2075
75c06bcb022e [gaim-migrate @ 2085]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2068
diff changeset
712 gtk_set_locale();
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
713 gtk_init(&argc, &argv);
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
714
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
715 /* scan command-line options */
2120
9e2475cb0010 [gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2119
diff changeset
716 opterr = 1;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
717 while ((opt = getopt_long(argc, argv,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
718 #ifndef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
719 "adhu:f:vn",
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
720 #else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
721 "adghu:f:vn",
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
722 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
723 long_options, NULL)) != -1) {
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
724 switch (opt) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
725 case 'u': /* set user */
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
726 opt_user = 1;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
727 opt_user_arg = g_strdup(optarg);
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
728 break;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
729 case 'a': /* account editor */
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
730 opt_acct = 1;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
731 break;
2823
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
732 case 'd': /* debug */
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
733 opt_debug = 1;
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2755
diff changeset
734 break;
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1555
diff changeset
735 case 'f':
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2329
diff changeset
736 opt_rcfile_arg = g_strdup(optarg);
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1555
diff changeset
737 break;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
738 case 'v': /* version */
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
739 opt_version = 1;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
740 break;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
741 case 'h': /* help */
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
742 opt_help = 1;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
743 break;
3360
f06c87748d91 [gaim-migrate @ 3379]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
744 case 'n': /* don't autologin */
f06c87748d91 [gaim-migrate @ 3379]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
745 opt_nologin = 1;
f06c87748d91 [gaim-migrate @ 3379]
Sean Egan <seanegan@gmail.com>
parents: 3285
diff changeset
746 break;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
747 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
748 case 'g': /* debug GTK and GLIB */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
749 opt_gdebug = 1;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
750 break;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
751 #endif
2120
9e2475cb0010 [gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2119
diff changeset
752 case '?':
9e2475cb0010 [gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2119
diff changeset
753 default:
2121
388b2d23442a [gaim-migrate @ 2131]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2120
diff changeset
754 show_usage(1, argv[0]);
2120
9e2475cb0010 [gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2119
diff changeset
755 return 0;
9e2475cb0010 [gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2119
diff changeset
756 break;
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
757 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
758 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
759
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
760 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
761 /* We don't want a console window.. */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
762 /*
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
763 * Any calls to the glib logging functions, result in a call to AllocConsole().
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
764 * ME and 98 will in such cases produce a console window (2000 not), despite
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
765 * being built as a windows app rather than a console app. So we should either
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
766 * ignore messages by setting dummy log handlers, or redirect messages.
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
767 * This requires setting handlers for all domains (any lib which uses g_logging).
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
768 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
769
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
770 g_log_set_handler ("Gdk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
771 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
772 NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
773 g_log_set_handler ("Gtk", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
774 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
775 NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
776 g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
777 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
778 NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
779 g_log_set_handler ("GModule", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
780 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
781 NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
782 g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
783 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
784 NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
785 g_log_set_handler ("GThread", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
786 (opt_gdebug ? gaim_log_handler : gaim_dummy_log_handler),
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
787 NULL);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
788
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
789 /* g_print also makes a call to AllocConsole(), therefore a handler needs to be
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
790 set here aswell */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
791 if(!opt_debug)
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
792 g_set_print_handler( gaim_dummy_print );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
793
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
794 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
795
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
796 /* show help message */
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
797 if (opt_help) {
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
798 show_usage(0, argv[0]);
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
799 return 0;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
800 }
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
801 /* show version message */
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
802 if (opt_version) {
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3472
diff changeset
803 printf("Gaim %s\n",VERSION);
546
e312b8b9bee5 [gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
804 return 0;
e312b8b9bee5 [gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 535
diff changeset
805 }
3551
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3533
diff changeset
806
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3533
diff changeset
807 #if GAIM_PLUGINS || USE_PERL
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3533
diff changeset
808 gaim_probe_plugins();
cd938f18f3f8 [gaim-migrate @ 3626]
Sean Egan <seanegan@gmail.com>
parents: 3533
diff changeset
809 #endif
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
810 load_prefs();
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
811 core_main();
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
812 #ifndef _WIN32
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
813 ui_main();
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
814 #endif
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
815
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
816 /* set the default username */
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
817 if (opt_user_arg != NULL) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
818 set_first_user(opt_user_arg);
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
819 g_free(opt_user_arg);
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
820 opt_user_arg = NULL;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
821 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
822
2313
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2307
diff changeset
823 if (misc_options & OPT_MISC_DEBUG)
bd9d403fb15b [gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2307
diff changeset
824 show_debug();
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
825 #ifndef _WIN32
3209
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
826 /*If ispell fails to start, try using aspell in ispell compatibitity mode.
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
827 Gabber does this the same way -- lorien420@myrealbox.com*/
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
828 if (convo_options & OPT_CONVO_CHECK_SPELLING){
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
829 if (gtkspell_start(NULL, ispell_cmd)<0){
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
830 debug_printf("gtkspell failed to start when using ispell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
831 if (gtkspell_start(NULL, aspell_cmd)<0){
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
832 debug_printf("gtkspell failed to start when using aspell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
833 } else
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
834 debug_printf("gtkspell started with aspell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
835 } else {
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
836 debug_printf("gtkspell started with ispell\n");
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
837 }
265a3c9d0557 [gaim-migrate @ 3226]
Sean Egan <seanegan@gmail.com>
parents: 3138
diff changeset
838 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
839 #endif
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
840 static_proto_init();
784
4c292b3f74ea [gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
841
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
842 /* deal with --login */
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
843 if (opt_login) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
844 do_login_ret = do_auto_login(opt_login_arg);
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
845 if (opt_login_arg != NULL) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
846 g_free(opt_login_arg);
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
847 opt_login_arg = NULL;
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
848 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
849 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 975
diff changeset
850
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3477
diff changeset
851 if (!opt_acct && !opt_nologin && gaim_session == 0)
1361
5d4464379703 [gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1360
diff changeset
852 auto_login();
5d4464379703 [gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1360
diff changeset
853
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
854 if (opt_acct) {
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
855 account_editor(NULL, NULL);
1361
5d4464379703 [gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1360
diff changeset
856 } else if ((do_login_ret == -1) && !connections)
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
857 show_login();
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
858 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
859 /* Various win32 initializations */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
860 wgaim_init();
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
861 #endif
1137
5b5d03dfa48a [gaim-migrate @ 1147]
Rob Flynn <gaim@robflynn.com>
parents: 1128
diff changeset
862
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
863 gtk_main();
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
864 #ifndef _WIN32
2460
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2416
diff changeset
865 if (convo_options & OPT_CONVO_CHECK_SPELLING)
049822b93239 [gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2416
diff changeset
866 gtkspell_stop();
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3551
diff changeset
867 #endif
2416
61b816a7b467 [gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
868 core_quit();
2482
7e4757801725 [gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2460
diff changeset
869 /* don't need ui_quit here because ui doesn't create anything */
1117
f3e0f41beddb [gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1093
diff changeset
870
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
871 return 0;
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1142
diff changeset
872
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
873 }