Mercurial > pidgin
annotate src/aim.c @ 3427:8fa61405af2b
[gaim-migrate @ 3453]
Who never commits anything *now*, Etan?
I changed most of the error message text around. If you think any of it
should be different, just let me know, or send a patch.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 25 Aug 2002 10:51:24 +0000 |
parents | 412d1035d666 |
children | d33ec392a5e1 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2083
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
342
diff
changeset
|
24 #endif |
1 | 25 #ifdef USE_APPLET |
1261
07f0bb41bbe1
[gaim-migrate @ 1271]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1254
diff
changeset
|
26 #include "applet.h" |
1 | 27 #include <gnome.h> |
730
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
28 #else |
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
29 #ifdef USE_GNOME |
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
30 #include <gnome.h> |
e46cc3c6ff26
[gaim-migrate @ 740]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
724
diff
changeset
|
31 #endif /* USE_GNOME */ |
1 | 32 #endif /* USE_APPLET */ |
395
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
33 #ifdef GAIM_PLUGINS |
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
34 #include <dlfcn.h> |
9a436c1d128d
[gaim-migrate @ 405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
392
diff
changeset
|
35 #endif /* GAIM_PLUGINS */ |
1 | 36 #include <gtk/gtk.h> |
37 #include <gdk/gdkx.h> | |
216
f7e17fb767eb
[gaim-migrate @ 226]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
38 #include <gdk/gdk.h> |
1 | 39 #include <unistd.h> |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
40 #include <sys/types.h> |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
41 #include <sys/socket.h> |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
42 #include <sys/stat.h> |
1 | 43 #include <netinet/in.h> |
44 #include <arpa/inet.h> | |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
45 #include <errno.h> |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
46 #include <sys/un.h> |
1 | 47 #include <sys/wait.h> |
48 #include <stdio.h> | |
49 #include <string.h> | |
50 #include <stdarg.h> | |
51 #include <stdlib.h> | |
228 | 52 #include <ctype.h> |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
989
diff
changeset
|
53 #include "prpl.h" |
1 | 54 #include "gaim.h" |
55 #include "pixmaps/logo.xpm" | |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
56 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
57 #include <signal.h> |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
58 #endif |
462 | 59 #include "locale.h" |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1093
diff
changeset
|
60 #include "gtkspell.h" |
2146
0feaa347a35b
[gaim-migrate @ 2156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2142
diff
changeset
|
61 #ifndef USE_APPLET |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
62 #include <getopt.h> |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
63 #endif |
430 | 64 |
3209 | 65 static gchar *aspell_cmd[] = { "aspell", "--sug-mode=fast","-a", NULL }; |
1128
418b1738a9a7
[gaim-migrate @ 1138]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1124
diff
changeset
|
66 static gchar *ispell_cmd[] = { "ispell", "-a", NULL }; |
418b1738a9a7
[gaim-migrate @ 1138]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1124
diff
changeset
|
67 |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
68 static GtkWidget *name; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
69 static GtkWidget *pass; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
70 |
1 | 71 GList *log_conversations = NULL; |
72 GList *buddy_pounces = NULL; | |
940 | 73 GSList *away_messages = NULL; |
1 | 74 GList *conversations = NULL; |
1768 | 75 GSList *message_queue = NULL; |
1774 | 76 GSList *away_time_queue = NULL; |
1 | 77 |
78 GtkWidget *mainwindow = NULL; | |
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; |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
84 |
3105 | 85 #if HAVE_SIGNAL_H |
86 /* | |
87 * Lists of signals we wish to catch and those we wish to ignore. | |
88 * Each list terminated with -1 | |
89 */ | |
90 static int catch_sig_list[] = { | |
91 SIGSEGV, | |
92 SIGHUP, | |
93 SIGINT, | |
94 SIGTERM, | |
95 SIGQUIT, | |
96 SIGCHLD, | |
97 -1 | |
98 }; | |
99 | |
100 static int ignore_sig_list[] = { | |
101 SIGPIPE, | |
102 -1 | |
103 }; | |
104 #endif | |
105 | |
106 | |
1 | 107 void cancel_logon(void) |
108 { | |
109 #ifdef USE_APPLET | |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
730
diff
changeset
|
110 applet_buddy_show = FALSE; |
941
0c3bdd59f983
[gaim-migrate @ 951]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
111 if (mainwindow) |
0c3bdd59f983
[gaim-migrate @ 951]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
112 gtk_widget_hide(mainwindow); |
1 | 113 #else |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
114 #ifdef GAIM_PLUGINS |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
115 /* first we tell those who have requested it we're quitting */ |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
997
diff
changeset
|
116 plugin_event(event_quit, 0, 0, 0, 0); |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
117 |
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
118 /* then we remove everyone in a mass suicide */ |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2121
diff
changeset
|
119 remove_all_plugins(); |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
120 #endif /* GAIM_PLUGINS */ |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
121 #ifdef USE_PERL |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
122 perl_end(); |
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
123 #endif |
392
df5127560034
[gaim-migrate @ 402]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
369
diff
changeset
|
124 |
1117
f3e0f41beddb
[gaim-migrate @ 1127]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1093
diff
changeset
|
125 gtk_main_quit(); |
1 | 126 #endif /* USE_APPLET */ |
127 } | |
128 | |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
129 static int snd_tmout; |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
130 int logins_not_muted = 1; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
131 static void sound_timeout() |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
132 { |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
109
diff
changeset
|
133 logins_not_muted = 1; |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
134 gtk_timeout_remove(snd_tmout); |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
135 } |
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
136 |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
137 /* 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
|
138 * 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
|
139 * 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
|
140 void gaim_setup(struct gaim_connection *gc) |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
141 { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
142 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
|
143 logins_not_muted = 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
144 snd_tmout = gtk_timeout_add(10000, (GtkFunction)sound_timeout, NULL); |
109
45bcfa3b584c
[gaim-migrate @ 119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
107
diff
changeset
|
145 } |
84 | 146 #ifdef USE_APPLET |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
730
diff
changeset
|
147 set_user_state(online); |
3285 | 148 applet_widget_unregister_callback(APPLET_WIDGET(applet), "autologin"); |
746
5a908dd5cfc4
[gaim-migrate @ 756]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
730
diff
changeset
|
149 applet_widget_register_callback(APPLET_WIDGET(applet), |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
150 "signoff", _("Signoff"), (AppletCallbackFunc)signoff_all, NULL); |
265
59f1748b09a6
[gaim-migrate @ 275]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
253
diff
changeset
|
151 #endif /* USE_APPLET */ |
1 | 152 } |
153 | |
154 | |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
155 static void dologin(GtkWidget *widget, GtkWidget *w) |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
156 { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
157 struct aim_user *u; |
1942
ba421d552093
[gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
158 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
|
159 const char *password = gtk_entry_get_text(GTK_ENTRY(pass)); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
160 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
161 if (!strlen(username)) { |
3427 | 162 do_error_dialog(_("Please enter your login."), NULL, GAIM_ERROR); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
163 return; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
164 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
165 |
2531 | 166 /* if there is more than one user of the same name, then fuck |
167 * them, they just have to use the account editor to sign in | |
168 * the second one */ | |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
169 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1026
diff
changeset
|
170 u = find_user(username, -1); |
1355
04874e92af24
[gaim-migrate @ 1365]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
171 if (!u) |
1878
75643b9f4261
[gaim-migrate @ 1888]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1820
diff
changeset
|
172 u = new_user(username, DEFAULT_PROTO, OPT_USR_REM_PASS); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
173 g_snprintf(u->password, sizeof u->password, "%s", password); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
174 save_prefs(); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
175 serv_login(u); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
176 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
177 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
178 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
179 static void doenter(GtkWidget *widget, GtkWidget *w) |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
180 { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
181 if (widget == name) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
182 gtk_entry_set_text(GTK_ENTRY(pass), ""); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
183 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
|
184 gtk_widget_grab_focus(pass); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
185 } else if (widget == pass) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
186 dologin(widget, w); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
187 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
188 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
189 |
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 static void combo_changed(GtkWidget *w, GtkWidget *combo) |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
192 { |
1942
ba421d552093
[gaim-migrate @ 1952]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1878
diff
changeset
|
193 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
|
194 struct aim_user *u; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
195 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1026
diff
changeset
|
196 u = find_user(txt, -1); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
197 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
198 if (u && u->options & OPT_USR_REM_PASS) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
199 gtk_entry_set_text(GTK_ENTRY(pass), u->password); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
200 } else { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
201 gtk_entry_set_text(GTK_ENTRY(pass), ""); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
202 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
203 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
204 |
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 static GList *combo_user_names() |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
207 { |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
208 GSList *usr = aim_users; |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
209 GList *tmp = NULL; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
210 struct aim_user *u; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
211 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
212 if (!usr) |
1409
17e544f8c7fb
[gaim-migrate @ 1419]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
213 return g_list_append(NULL, "<New User>"); |
989
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 while (usr) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
216 u = (struct aim_user *)usr->data; |
2257
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
217 tmp = g_list_append(tmp, u->username); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
218 usr = usr->next; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
219 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
220 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
221 return tmp; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
222 } |
1 | 223 |
224 | |
225 void show_login() | |
226 { | |
227 GtkWidget *options; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
228 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
229 GtkWidget *plugs; |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
230 #endif |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
989
diff
changeset
|
231 #ifndef NO_MULTI |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
941
diff
changeset
|
232 GtkWidget *accts; |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
989
diff
changeset
|
233 #endif |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
234 GtkWidget *signon; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
941
diff
changeset
|
235 GtkWidget *cancel; |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2823
diff
changeset
|
236 GtkWidget *reg; |
1 | 237 GtkWidget *bbox; |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
238 GtkWidget *hbox; |
1 | 239 GtkWidget *sbox; |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
240 GtkWidget *label; |
1 | 241 GtkWidget *table; |
242 | |
243 GtkWidget *pmw; | |
244 GdkPixmap *pm; | |
245 GtkStyle *style; | |
246 GdkBitmap *mask; | |
247 | |
2257
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
248 GList *tmp; |
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
249 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
250 if (mainwindow) { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
251 gtk_widget_show(mainwindow); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
252 return; |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
253 } |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
254 |
1 | 255 mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
256 gtk_window_set_wmclass(GTK_WINDOW(mainwindow), "login", "Gaim"); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
257 gtk_window_set_policy(GTK_WINDOW(mainwindow), FALSE, FALSE, TRUE); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
258 gtk_signal_connect(GTK_OBJECT(mainwindow), "delete_event", |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
259 GTK_SIGNAL_FUNC(cancel_logon), mainwindow); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
260 gtk_window_set_title(GTK_WINDOW(mainwindow), _("Gaim - Login")); |
621 | 261 gtk_widget_realize(mainwindow); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
262 aol_icon(mainwindow->window); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
263 gdk_window_set_group(mainwindow->window, mainwindow->window); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
264 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
265 table = gtk_table_new(8, 2, FALSE); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
266 gtk_container_add(GTK_CONTAINER(mainwindow), table); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
267 gtk_widget_show(table); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
268 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
269 style = gtk_widget_get_style(mainwindow); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
270 pm = gdk_pixmap_create_from_xpm_d(mainwindow->window, &mask, |
2533 | 271 &style->bg[GTK_STATE_NORMAL], (gchar **)gaim_logo_xpm); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
272 pmw = gtk_pixmap_new(pm, mask); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
273 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
|
274 gtk_widget_show(pmw); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
275 gdk_pixmap_unref(pm); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
276 gdk_bitmap_unref(mask); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
277 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
278 label = gtk_label_new(_("Screen Name: ")); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
279 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
|
280 gtk_widget_show(label); |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
281 |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
282 name = gtk_combo_new(); |
2257
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
283 tmp = combo_user_names(); |
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
284 gtk_combo_set_popdown_strings(GTK_COMBO(name), tmp); |
eae25a0309c1
[gaim-migrate @ 2267]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
285 g_list_free(tmp); |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
286 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "activate", |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
287 GTK_SIGNAL_FUNC(doenter), mainwindow); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
288 gtk_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed", |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
289 GTK_SIGNAL_FUNC(combo_changed), name); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
290 gtk_widget_set_usize(name, 100, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
291 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
|
292 gtk_widget_show(name); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
293 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
294 label = gtk_label_new(_("Password: ")); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
295 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
|
296 gtk_widget_show(label); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
297 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
298 pass = gtk_entry_new(); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
299 gtk_widget_set_usize(pass, 100, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
300 gtk_entry_set_visibility(GTK_ENTRY(pass), FALSE); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
301 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
|
302 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
|
303 gtk_widget_show(pass); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
304 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
305 sbox = gtk_vbox_new(TRUE, 5); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
306 gtk_container_border_width(GTK_CONTAINER(sbox), 10); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
307 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
|
308 gtk_widget_show(sbox); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
309 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
310 bbox = gtk_hbox_new(TRUE, 10); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
311 gtk_box_pack_start(GTK_BOX(sbox), bbox, TRUE, TRUE, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
312 gtk_widget_show(bbox); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
313 |
1400
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
314 #ifndef USE_APPLET |
1391
d606da211acb
[gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1361
diff
changeset
|
315 cancel = gtk_button_new_with_label(_("Quit")); |
1400
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
316 #else |
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
317 cancel = gtk_button_new_with_label(_("Close")); |
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1391
diff
changeset
|
318 #endif |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
989
diff
changeset
|
319 #ifndef NO_MULTI |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
320 accts = gtk_button_new_with_label(_("Accounts")); |
991
3dbc2cd326e2
[gaim-migrate @ 1001]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
989
diff
changeset
|
321 #endif |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
322 signon = gtk_button_new_with_label(_("Signon")); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
323 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2307
diff
changeset
|
324 if (misc_options & OPT_MISC_COOL_LOOK) { |
1360
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
325 gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
326 #ifndef NO_MULTI |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
327 gtk_button_set_relief(GTK_BUTTON(accts), GTK_RELIEF_NONE); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
328 #endif |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
329 gtk_button_set_relief(GTK_BUTTON(signon), GTK_RELIEF_NONE); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
330 } |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
331 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
332 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
|
333 #ifndef NO_MULTI |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
334 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
|
335 #endif |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
336 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
|
337 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
338 gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
339 #ifndef NO_MULTI |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
340 gtk_box_pack_start(GTK_BOX(bbox), accts, TRUE, TRUE, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
341 #endif |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
342 gtk_box_pack_start(GTK_BOX(bbox), signon, TRUE, TRUE, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
343 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
344 gtk_widget_show(cancel); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
345 #ifndef NO_MULTI |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
346 gtk_widget_show(accts); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
347 #endif |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
348 gtk_widget_show(signon); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
349 |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
350 hbox = gtk_hbox_new(TRUE, 10); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
351 gtk_box_pack_start(GTK_BOX(sbox), hbox, TRUE, TRUE, 0); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
352 gtk_widget_show(hbox); |
ed8b24a73764
[gaim-migrate @ 1370]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1355
diff
changeset
|
353 |
2902
8aa879023839
[gaim-migrate @ 2915]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
354 reg = gtk_button_new_with_label(_("About")); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
355 options = gtk_button_new_with_label(_("Options")); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
356 #ifdef GAIM_PLUGINS |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
357 plugs = gtk_button_new_with_label(_("Plugins")); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
358 #endif |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2307
diff
changeset
|
359 if (misc_options & OPT_MISC_COOL_LOOK) { |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2823
diff
changeset
|
360 gtk_button_set_relief(GTK_BUTTON(reg), GTK_RELIEF_NONE); |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
361 gtk_button_set_relief(GTK_BUTTON(options), GTK_RELIEF_NONE); |
600
01777a942034
[gaim-migrate @ 610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
583
diff
changeset
|
362 #ifdef GAIM_PLUGINS |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
363 gtk_button_set_relief(GTK_BUTTON(plugs), GTK_RELIEF_NONE); |
600
01777a942034
[gaim-migrate @ 610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
583
diff
changeset
|
364 #endif |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
365 } |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
508
diff
changeset
|
366 |
2902
8aa879023839
[gaim-migrate @ 2915]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2827
diff
changeset
|
367 gtk_signal_connect(GTK_OBJECT(reg), "clicked", GTK_SIGNAL_FUNC(show_about), NULL); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
368 gtk_signal_connect(GTK_OBJECT(options), "clicked", GTK_SIGNAL_FUNC(show_prefs), NULL); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
369 #ifdef GAIM_PLUGINS |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
370 gtk_signal_connect(GTK_OBJECT(plugs), "clicked", GTK_SIGNAL_FUNC(show_plugins), NULL); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
371 #endif |
1 | 372 |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2823
diff
changeset
|
373 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
|
374 gtk_box_pack_start(GTK_BOX(hbox), options, TRUE, TRUE, 0); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
375 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
376 gtk_box_pack_start(GTK_BOX(hbox), plugs, TRUE, TRUE, 0); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
377 #endif |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
378 |
2827
51999a36c0b1
[gaim-migrate @ 2840]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2823
diff
changeset
|
379 gtk_widget_show(reg); |
1 | 380 gtk_widget_show(options); |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
381 #ifdef GAIM_PLUGINS |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
382 gtk_widget_show(plugs); |
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
383 #endif |
989
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
384 |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
385 if (aim_users) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
386 struct aim_user *c = (struct aim_user *)aim_users->data; |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
387 if (c->options & OPT_USR_REM_PASS) { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
388 combo_changed(NULL, name); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
389 gtk_widget_grab_focus(signon); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
390 } else { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
391 gtk_widget_grab_focus(pass); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
392 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
393 } else { |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
394 gtk_widget_grab_focus(name); |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
395 } |
bd8eb3efe14e
[gaim-migrate @ 999]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
396 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
397 gtk_widget_show(mainwindow); |
1 | 398 } |
399 | |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
400 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
401 void sighandler(int sig) |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
402 { |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
403 switch (sig) { |
2083
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
404 case SIGHUP: |
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
405 debug_printf("caught signal %d\n", sig); |
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
406 signoff_all(NULL, NULL); |
f5659096bcd6
[gaim-migrate @ 2093]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2075
diff
changeset
|
407 break; |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
408 case SIGSEGV: |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
409 core_quit(); |
2755
adbda5d9b50c
[gaim-migrate @ 2768]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
410 #ifndef DEBUG |
1697
23ad4f7b644f
[gaim-migrate @ 1707]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1560
diff
changeset
|
411 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
|
412 "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
|
413 "no fault of your own.\n\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
414 "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
|
415 "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
|
416 WEBSITE "gaim-CVS.tar.gz.\n\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
417 "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
|
418 "using the CVS version, please notify the gaim maintainers\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
419 "by reporting a bug at\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
420 WEBSITE "bug.php3\n\n" |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
421 "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
|
422 "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
|
423 "how to get the backtrace, please get instructions at\n" |
2554
7f312efd287f
[gaim-migrate @ 2567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2533
diff
changeset
|
424 WEBSITE "gdb.php. If you need further\n" |
2993 | 425 "assistance, please IM either RobFlynn or SeanEgn and\n" |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
426 "they can help you.\n"); |
2755
adbda5d9b50c
[gaim-migrate @ 2768]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2591
diff
changeset
|
427 #endif |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
428 abort(); |
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
429 break; |
3076 | 430 case SIGCHLD: |
431 clean_pid(); | |
3105 | 432 #if HAVE_SIGNAL_H |
433 signal(SIGCHLD, sighandler); /* restore signal catching on this one! */ | |
434 #endif | |
3076 | 435 break; |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
436 default: |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2121
diff
changeset
|
437 debug_printf("caught signal %d\n", sig); |
1820
73bb4244165f
[gaim-migrate @ 1830]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
438 gtkspell_stop(); |
2591
b771cbe7e161
[gaim-migrate @ 2604]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2554
diff
changeset
|
439 signoff_all(NULL, NULL); |
2140
66a84ff0445a
[gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2130
diff
changeset
|
440 #ifdef GAIM_PLUGINS |
2125
af59d854de29
[gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2121
diff
changeset
|
441 remove_all_plugins(); |
2140
66a84ff0445a
[gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2130
diff
changeset
|
442 #endif |
1792
de88617f542c
[gaim-migrate @ 1802]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
443 if (gtk_main_level()) |
de88617f542c
[gaim-migrate @ 1802]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1774
diff
changeset
|
444 gtk_main_quit(); |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
445 core_quit(); |
1415
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
446 exit(0); |
3dfd2a83fb5e
[gaim-migrate @ 1425]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1409
diff
changeset
|
447 } |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
448 } |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
449 #endif |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
450 |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
451 static gboolean socket_readable(GIOChannel *source, GIOCondition cond, gpointer ud) |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
452 { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
453 guchar type; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
454 guchar subtype; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
455 guint32 len; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
456 guchar *data; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
457 guint32 x; |
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("Core says: "); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
460 g_io_channel_read(source, &type, sizeof(type), &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 ", type); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
467 g_io_channel_read(source, &subtype, sizeof(subtype), &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 ", subtype); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
474 g_io_channel_read(source, (guchar *)&len, sizeof(len), &x); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
475 if (x == 0) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
476 debug_printf("CORE IS GONE!\n"); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
477 g_io_channel_close(source); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
478 return FALSE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
479 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
480 debug_printf("(%d bytes)\n", len); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
481 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
482 data = g_malloc(len); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
483 g_io_channel_read(source, data, len, &x); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
484 if (x != len) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
485 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
|
486 g_free(data); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
487 g_io_channel_close(source); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
488 return FALSE; |
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 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
491 g_free(data); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
492 return TRUE; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
493 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
494 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
495 static int open_socket(char *name) |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
496 { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
497 struct sockaddr_un saddr; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
498 gint fd; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
499 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
500 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
501 saddr.sun_family = AF_UNIX; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
502 g_snprintf(saddr.sun_path, 108, "%s", name); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
503 if (connect(fd, (struct sockaddr *)&saddr, sizeof(saddr)) != -1) |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
504 return fd; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
505 else |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
506 debug_printf("Failed to assign %s to a socket (Error: %s)", |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
507 saddr.sun_path, strerror(errno)); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
508 } else |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
509 debug_printf("Unable to open socket: %s", strerror(errno)); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
510 close(fd); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
511 return -1; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
512 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
513 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
514 static int ui_main() |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
515 { |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
516 GIOChannel *channel; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
517 int UI_fd; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
518 char name[256]; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
519 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
520 g_snprintf(name, sizeof(name), "%s/gaim_%s.%d", g_get_tmp_dir(), g_get_user_name(), getpid()); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
521 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
522 UI_fd = open_socket(name); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
523 if (UI_fd < 0) |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
524 return 1; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
525 |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
526 channel = g_io_channel_unix_new(UI_fd); |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
527 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
|
528 return 0; |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
529 } |
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
530 |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
531 static void set_first_user(char *name) |
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 struct aim_user *u; |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
534 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
535 u = find_user(name, -1); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
536 |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
537 if (!u) { /* new user */ |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
538 u = g_new0(struct aim_user, 1); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
539 g_snprintf(u->username, sizeof(u->username), "%s", name); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
540 u->protocol = DEFAULT_PROTO; |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
541 aim_users = g_slist_prepend(aim_users, u); |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
542 } else { /* user already exists */ |
2397
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
543 aim_users = g_slist_remove(aim_users, u); |
520257562955
[gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2379
diff
changeset
|
544 aim_users = g_slist_prepend(aim_users, u); |
2379
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
545 } |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
546 save_prefs(); |
cacaf7ace3a5
[gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
547 } |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
548 |
2500
1697ecbf1bcc
[gaim-migrate @ 2513]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2484
diff
changeset
|
549 /* FUCKING GET ME A TOWEL! */ |
1 | 550 int main(int argc, char *argv[]) |
551 { | |
3360 | 552 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
|
553 char *opt_user_arg = NULL, *opt_login_arg = NULL; |
3105 | 554 #if HAVE_SIGNAL_H |
555 int sig_indx; /* for setting up signal catching */ | |
3138 | 556 sigset_t sigset; |
3105 | 557 void (*prev_sig_disp)(); |
558 #endif | |
2307
64dd9e99884c
[gaim-migrate @ 2317]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2257
diff
changeset
|
559 #ifndef USE_APPLET |
64dd9e99884c
[gaim-migrate @ 2317]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2257
diff
changeset
|
560 int opt, opt_user = 0; |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
561 int i; |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
562 |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
563 #ifdef USE_GNOME |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
564 struct poptOption popt_options[] = { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
565 {"acct", 'a', POPT_ARG_NONE, &opt_acct, 'a', |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
566 "Display account editor window", NULL}, |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
567 {"away", 'w', POPT_ARG_STRING, NULL, 'w', |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
568 "Make away on signon (optional argument MESG specifies name of away message to use)", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
569 "[MESG]"}, |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
570 {"login", 'l', POPT_ARG_STRING, NULL, 'l', |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
571 "Automatically login (optional argument NAME specifies account(s) to use)", "[NAME]"}, |
3360 | 572 {"loginwin", 'n', POPT_ARG_NONE, &opt_nologin, 'n', |
573 "Don't automatically login; show login window", NULL}, | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
574 {"user", 'u', POPT_ARG_STRING, &opt_user_arg, 'u', |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
575 "Use account NAME", "NAME"}, |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
576 {"file", 'f', POPT_ARG_STRING, &opt_rcfile_arg, 'f', |
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
577 "Use FILE as config", "FILE"}, |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
578 {"debug", 'd', POPT_ARG_NONE, &opt_debug, 'd', |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
579 "Print debugging messages to stdout", NULL}, |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
580 {0, 0, 0, 0, 0, 0, 0} |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
581 }; |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
582 #endif /* USE_GNOME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
583 struct option long_options[] = { |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
584 {"acct", no_argument, NULL, 'a'}, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
585 /*{"away", optional_argument, NULL, 'w'}, */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
586 {"help", no_argument, NULL, 'h'}, |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
587 /*{"login", optional_argument, NULL, 'l'}, */ |
3360 | 588 {"loginwin", no_argument, NULL, 'n'}, |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
589 {"user", required_argument, NULL, 'u'}, |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
590 {"file", required_argument, NULL, 'f'}, |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
591 {"debug", no_argument, NULL, 'd'}, |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
592 {"version", no_argument, NULL, 'v'}, |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
593 {0, 0, 0, 0} |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
594 }; |
2307
64dd9e99884c
[gaim-migrate @ 2317]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2257
diff
changeset
|
595 #endif |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
596 |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
597 #ifdef DEBUG |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
598 opt_debug = 1; |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
599 #endif |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
600 |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
601 #ifdef ENABLE_NLS |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
602 bindtextdomain(PACKAGE, LOCALEDIR); |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
603 textdomain(PACKAGE); |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
604 #endif |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
357
diff
changeset
|
605 |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
606 #if HAVE_SIGNAL_H |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
607 /* Let's not violate any PLA's!!!! */ |
3105 | 608 /* jseymour: whatever the fsck that means */ |
3138 | 609 /* Robot101: for some reason things like gdm like to block * |
610 * useful signals like SIGCHLD, so we unblock all the ones we * | |
611 * declare a handler for. thanks JSeymour and Vann. */ | |
612 if (sigemptyset(&sigset)) { | |
613 char errmsg[BUFSIZ]; | |
614 sprintf(errmsg, "Warning: couldn't initialise empty signal set"); | |
615 perror(errmsg); | |
616 } | |
3105 | 617 for(sig_indx = 0; catch_sig_list[sig_indx] != -1; ++sig_indx) { |
618 if((prev_sig_disp = signal(catch_sig_list[sig_indx], sighandler)) == SIG_ERR) { | |
619 char errmsg[BUFSIZ]; | |
620 sprintf(errmsg, "Warning: couldn't set signal %d for catching", | |
621 catch_sig_list[sig_indx]); | |
622 perror(errmsg); | |
623 } | |
3138 | 624 if(sigaddset(&sigset, catch_sig_list[sig_indx])) { |
625 char errmsg[BUFSIZ]; | |
626 sprintf(errmsg, "Warning: couldn't include signal %d for unblocking", | |
627 catch_sig_list[sig_indx]); | |
628 perror(errmsg); | |
629 } | |
3105 | 630 } |
631 for(sig_indx = 0; ignore_sig_list[sig_indx] != -1; ++sig_indx) { | |
632 if((prev_sig_disp = signal(ignore_sig_list[sig_indx], SIG_IGN)) == SIG_ERR) { | |
633 char errmsg[BUFSIZ]; | |
634 sprintf(errmsg, "Warning: couldn't set signal %d to ignore", | |
635 ignore_sig_list[sig_indx]); | |
636 perror(errmsg); | |
637 } | |
638 } | |
3138 | 639 |
640 if (sigprocmask(SIG_UNBLOCK, &sigset, NULL)) { | |
641 char errmsg[BUFSIZ]; | |
642 sprintf(errmsg, "Warning: couldn't unblock signals"); | |
643 perror(errmsg); | |
644 } | |
614
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
645 #endif |
a3e32af35b30
[gaim-migrate @ 624]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
600
diff
changeset
|
646 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
647 |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
648 #ifdef USE_APPLET |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
649 init_applet_mgr(argc, argv); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
650 #else |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
651 for (i = 0; i < argc; i++) { |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
652 /* --login option */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
653 if (strstr(argv[i], "--l") == argv[i]) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
654 char *equals; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
655 opt_login = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
656 if ((equals = strchr(argv[i], '=')) != NULL) { |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
657 /* --login=NAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
658 opt_login_arg = g_strdup(equals + 1); |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
659 if (strlen(opt_login_arg) == 0) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
660 g_free(opt_login_arg); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
661 opt_login_arg = NULL; |
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
662 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
663 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
664 /* --login NAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
665 opt_login_arg = g_strdup(argv[i + 1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
666 strcpy(argv[i + 1], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
667 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
668 strcpy(argv[i], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
669 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
670 /* -l option */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
671 else if (strstr(argv[i], "-l") == argv[i]) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
672 opt_login = 1; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
673 if (strlen(argv[i]) > 2) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
674 /* -lNAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
675 opt_login_arg = g_strdup(argv[i] + 2); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
676 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
677 /* -l NAME */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
678 opt_login_arg = g_strdup(argv[i + 1]); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
679 strcpy(argv[i + 1], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
680 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
681 strcpy(argv[i], " "); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
682 } |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
683 /* --away option */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
684 else if (strstr(argv[i], "--aw") == argv[i]) { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
685 char *equals; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
686 opt_away = 1; |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
687 if ((equals = strchr(argv[i], '=')) != NULL) { |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
688 /* --away=MESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
689 opt_away_arg = g_strdup(equals + 1); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
690 if (strlen(opt_away_arg) == 0) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
691 g_free(opt_away_arg); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
692 opt_away_arg = NULL; |
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
693 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
694 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
695 /* --away MESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
696 opt_away_arg = g_strdup(argv[i + 1]); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
697 strcpy(argv[i + 1], " "); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
698 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
699 strcpy(argv[i], " "); |
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 /* -w option */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
702 else if (strstr(argv[i], "-w") == argv[i]) { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
703 opt_away = 1; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
704 if (strlen(argv[i]) > 2) { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
705 /* -wMESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
706 opt_away_arg = g_strdup(argv[i] + 2); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
707 } else if (i + 1 < argc && argv[i + 1][0] != '-') { |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
708 /* -w MESG */ |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
709 opt_away_arg = g_strdup(argv[i + 1]); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
710 strcpy(argv[i + 1], " "); |
1254
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
711 } |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
712 strcpy(argv[i], " "); |
9da444224f0e
[gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
713 } |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
714 } |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
715 /* |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
716 if (opt_login) { |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
717 printf ("--login given with arg %s\n", |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
718 opt_login_arg ? opt_login_arg : "NULL"); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
719 exit(0); |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
720 } |
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
721 */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
722 |
2075
75c06bcb022e
[gaim-migrate @ 2085]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2068
diff
changeset
|
723 gtk_set_locale(); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
724 #ifdef USE_GNOME |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
725 gnome_init_with_popt_table(PACKAGE, VERSION, argc, argv, popt_options, 0, NULL); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
726 #else |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
727 gtk_init(&argc, &argv); |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
728 #endif |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
729 |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
730 /* scan command-line options */ |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
731 #ifdef USE_GNOME |
2119
02cbc4f76b77
[gaim-migrate @ 2129]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
732 opterr = 0; |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
733 #else |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
734 opterr = 1; |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
735 #endif |
3360 | 736 while ((opt = getopt_long(argc, argv, "adhu:f:vn", long_options, NULL)) != -1) { |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
737 switch (opt) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
738 case 'u': /* set user */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
739 opt_user = 1; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
740 opt_user_arg = g_strdup(optarg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
741 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
742 case 'a': /* account editor */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
743 opt_acct = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
744 break; |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
745 case 'd': /* debug */ |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
746 opt_debug = 1; |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2755
diff
changeset
|
747 break; |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
748 case 'f': |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2329
diff
changeset
|
749 opt_rcfile_arg = g_strdup(optarg); |
1560
72235e3fcff6
[gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1555
diff
changeset
|
750 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
751 case 'v': /* version */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
752 opt_version = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
753 break; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
754 case 'h': /* help */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
755 opt_help = 1; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
756 break; |
3360 | 757 case 'n': /* don't autologin */ |
758 opt_nologin = 1; | |
759 break; | |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
760 #ifndef USE_GNOME |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
761 case '?': |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
762 default: |
2121
388b2d23442a
[gaim-migrate @ 2131]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2120
diff
changeset
|
763 show_usage(1, argv[0]); |
2120
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
764 return 0; |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
765 break; |
9e2475cb0010
[gaim-migrate @ 2130]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2119
diff
changeset
|
766 #endif |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
767 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
768 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
769 |
2068
e38eb507b261
[gaim-migrate @ 2078]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2006
diff
changeset
|
770 #endif /* USE_APPLET */ |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
771 |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
772 /* show help message */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
773 if (opt_help) { |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
774 show_usage(0, argv[0]); |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
775 return 0; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
776 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
777 /* show version window */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
778 if (opt_version) { |
546
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
779 gtk_init(&argc, &argv); |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
780 load_prefs(); |
1142
4593153a956c
[gaim-migrate @ 1152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1137
diff
changeset
|
781 show_about(0, (void *)2); |
546
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
782 gtk_main(); |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
783 return 0; |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
784 } |
e312b8b9bee5
[gaim-migrate @ 556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
785 |
1 | 786 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
787 load_prefs(); |
180 | 788 |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
789 core_main(); |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
790 ui_main(); |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
791 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
792 /* set the default username */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
793 if (opt_user_arg != NULL) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
794 set_first_user(opt_user_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
795 #ifndef USE_GNOME |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
796 g_free(opt_user_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
797 opt_user_arg = NULL; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
798 #endif /* USE_GNOME */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
799 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
800 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2307
diff
changeset
|
801 if (misc_options & OPT_MISC_DEBUG) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2307
diff
changeset
|
802 show_debug(); |
3209 | 803 /*If ispell fails to start, try using aspell in ispell compatibitity mode. |
804 Gabber does this the same way -- lorien420@myrealbox.com*/ | |
805 if (convo_options & OPT_CONVO_CHECK_SPELLING){ | |
806 if (gtkspell_start(NULL, ispell_cmd)<0){ | |
807 debug_printf("gtkspell failed to start when using ispell\n"); | |
808 if (gtkspell_start(NULL, aspell_cmd)<0){ | |
809 debug_printf("gtkspell failed to start when using aspell\n"); | |
810 } else | |
811 debug_printf("gtkspell started with aspell\n"); | |
812 } else { | |
813 debug_printf("gtkspell started with ispell\n"); | |
814 } | |
815 } | |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
816 #ifdef USE_PERL |
800
022048cde898
[gaim-migrate @ 810]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
792
diff
changeset
|
817 perl_autoload(); |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
818 #endif |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
819 static_proto_init(); |
784
4c292b3f74ea
[gaim-migrate @ 794]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
820 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
821 /* deal with --login */ |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
822 if (opt_login) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
823 do_login_ret = do_auto_login(opt_login_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
824 if (opt_login_arg != NULL) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
825 g_free(opt_login_arg); |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
826 opt_login_arg = NULL; |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
827 } |
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
828 } |
1 | 829 #ifdef USE_APPLET |
830 applet_widget_register_callback(APPLET_WIDGET(applet), | |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
831 "prefs", _("Preferences"), show_prefs, NULL); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
832 applet_widget_register_callback(APPLET_WIDGET(applet), |
966
f7886476f9d9
[gaim-migrate @ 976]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
964
diff
changeset
|
833 "accounts", |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
834 _("Accounts"), (AppletCallbackFunc)account_editor, (void *)1); |
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
835 #ifdef GAIM_PLUGINS |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
836 applet_widget_register_callback(APPLET_WIDGET(applet), |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
837 "plugins", _("Plugins"), GTK_SIGNAL_FUNC(show_plugins), NULL); |
97
5b4b7aa8dd9a
[gaim-migrate @ 107]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
838 #endif /* GAIM_PLUGINS */ |
1 | 839 |
3285 | 840 applet_widget_register_callback(APPLET_WIDGET(applet), |
841 "autologin", _("Auto-login"), (AppletCallbackFunc)auto_login, NULL); | |
842 | |
1326
3d82e8f8b786
[gaim-migrate @ 1336]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1320
diff
changeset
|
843 if (!opt_acct) |
3d82e8f8b786
[gaim-migrate @ 1336]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1320
diff
changeset
|
844 auto_login(); |
3d82e8f8b786
[gaim-migrate @ 1336]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1320
diff
changeset
|
845 |
1 | 846 applet_widget_gtk_main(); |
847 #else | |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
975
diff
changeset
|
848 |
3360 | 849 if (!opt_acct && !opt_nologin) |
1361
5d4464379703
[gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1360
diff
changeset
|
850 auto_login(); |
5d4464379703
[gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1360
diff
changeset
|
851 |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
852 if (opt_acct) { |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
853 account_editor(NULL, NULL); |
1361
5d4464379703
[gaim-migrate @ 1371]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1360
diff
changeset
|
854 } else if ((do_login_ret == -1) && !connections) |
1009
d496fe2614a6
[gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
855 show_login(); |
1137 | 856 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
857 gtk_main(); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
858 |
1 | 859 #endif /* USE_APPLET */ |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
860 |
2460
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2416
diff
changeset
|
861 if (convo_options & OPT_CONVO_CHECK_SPELLING) |
049822b93239
[gaim-migrate @ 2473]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2416
diff
changeset
|
862 gtkspell_stop(); |
2416
61b816a7b467
[gaim-migrate @ 2429]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2397
diff
changeset
|
863 core_quit(); |
2482
7e4757801725
[gaim-migrate @ 2495]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2460
diff
changeset
|
864 /* 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
|
865 |
1 | 866 return 0; |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1142
diff
changeset
|
867 |
1 | 868 } |