Mercurial > pidgin
annotate src/toc.c @ 1626:59c7e7831ccd
[gaim-migrate @ 1636]
ari pollak told me that there were problems
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 22 Mar 2001 01:37:44 +0000 |
parents | 8684c0315818 |
children | e001fb1b9418 |
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 | |
22 | |
23 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
25 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
26 #endif |
1 | 27 #include <netdb.h> |
28 #include <gtk/gtk.h> | |
29 #include <unistd.h> | |
30 #include <errno.h> | |
31 #include <netinet/in.h> | |
32 #include <arpa/inet.h> | |
33 #include <string.h> | |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 #include <sys/socket.h> | |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
38 #include <sys/types.h> |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
39 #include <sys/stat.h> |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
40 #include "prpl.h" |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
41 #include "multi.h" |
1 | 42 #include "gaim.h" |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
43 #include "proxy.h" |
1 | 44 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
45 #include "pixmaps/admin_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
46 #include "pixmaps/aol_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
47 #include "pixmaps/away_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
48 #include "pixmaps/dt_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
49 #include "pixmaps/free_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
50 |
1623
8684c0315818
[gaim-migrate @ 1633]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1615
diff
changeset
|
51 #define REVISION "penguin" |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
52 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
53 #define TYPE_SIGNON 1 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
54 #define TYPE_DATA 2 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
55 #define TYPE_ERROR 3 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
56 #define TYPE_SIGNOFF 4 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
57 #define TYPE_KEEPALIVE 5 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
58 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
59 #define FLAPON "FLAPON\r\n\r\n" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
60 #define ROAST "Tic/Toc" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
61 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
62 #define TOC_HOST "toc.oscar.aol.com" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
63 #define TOC_PORT 9898 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
64 #define AUTH_HOST "login.oscar.aol.com" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
65 #define AUTH_PORT 5190 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
66 #define LANGUAGE "english" |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
67 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
68 #define STATE_OFFLINE 0 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
69 #define STATE_FLAPON 1 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
70 #define STATE_SIGNON_REQUEST 2 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
71 #define STATE_ONLINE 3 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
72 #define STATE_PAUSE 4 |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
73 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
74 #define VOICE_UID "09461341-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
75 #define FILE_SEND_UID "09461343-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
76 #define IMAGE_UID "09461345-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
77 #define B_ICON_UID "09461346-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
78 #define STOCKS_UID "09461347-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
79 #define FILE_GET_UID "09461348-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
80 #define GAMES_UID "0946134a-4C7F-11D1-8222-444553540000" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
81 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
82 struct ft_request { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
83 struct gaim_connection *gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
84 char *user; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
85 char UID[2048]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
86 char *cookie; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
87 char *ip; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
88 int port; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
89 char *message; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
90 char *filename; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
91 int files; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
92 int size; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
93 }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
94 |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
95 struct toc_data { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
96 int toc_fd; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
97 int seqno; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
98 int state; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
99 }; |
1 | 100 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
101 struct sflap_hdr { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
102 unsigned char ast; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
103 unsigned char type; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
104 unsigned short seqno; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
105 unsigned short len; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
106 }; |
1 | 107 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
108 struct signon { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
109 unsigned int ver; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
110 unsigned short tag; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
111 unsigned short namelen; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
112 char username[80]; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
113 }; |
1 | 114 |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
115 /* constants to identify proto_opts */ |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
116 #define USEROPT_AUTH 0 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
117 #define USEROPT_AUTHPORT 1 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
118 #define USEROPT_SOCKSHOST 2 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
119 #define USEROPT_SOCKSPORT 3 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
120 #define USEROPT_PROXYTYPE 4 |
1 | 121 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
122 static void toc_callback(gpointer, gint, GdkInputCondition); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
123 static unsigned char *roast_password(char *); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
124 static void accept_file_dialog(struct ft_request *); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
125 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
126 /* ok. this function used to take username/password, and return 0 on success. |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
127 * now, it takes username/password, and returns NULL on error or a new gaim_connection |
976
2586b2a3725e
[gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
975
diff
changeset
|
128 * on success. */ |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
129 static void toc_login(struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
130 { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
131 struct gaim_connection *gc; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
132 struct toc_data *tdt; |
1 | 133 char buf[80]; |
134 | |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
135 gc = new_gaim_conn(user); |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
136 gc->proto_data = tdt = g_new0(struct toc_data, 1); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
137 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
138 g_snprintf(buf, sizeof buf, "Lookin up %s", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
139 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
140 /* this is such a hack */ |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
141 set_login_progress(gc, 1, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
142 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
143 gtk_main_iteration(); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
144 if (!g_slist_find(connections, gc)) |
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
145 return; |
1 | 146 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
147 tdt->toc_fd = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
148 proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
149 user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user-> |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
150 proto_opt[USEROPT_AUTHPORT]) : |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
151 TOC_PORT, user->proto_opt[USEROPT_SOCKSHOST], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
152 atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
153 atoi(user->proto_opt[USEROPT_PROXYTYPE])); |
1 | 154 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
155 debug_printf("* Client connects to TOC\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
156 if (tdt->toc_fd < 0) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
157 g_snprintf(buf, sizeof(buf), "Connect to %s failed", user->proto_opt[USEROPT_AUTH]); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
158 hide_login_progress(gc, buf); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
159 signoff(gc); |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
160 return; |
1 | 161 } |
162 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
163 debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
164 if (write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
165 hide_login_progress(gc, "Disconnected."); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
166 signoff(gc); |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1088
diff
changeset
|
167 return; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
168 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
169 tdt->state = STATE_FLAPON; |
1 | 170 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
171 /* i know a lot of people like to look at gaim to see how TOC works. so i'll comment |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
172 * on what this does. it's really simple. when there's data ready to be read from the |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
173 * toc_fd file descriptor, toc_callback is called, with gc passed as its data arg. */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
174 gc->inpa = gdk_input_add(tdt->toc_fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_callback, gc); |
1 | 175 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
176 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
177 set_login_progress(gc, 2, buf); |
1 | 178 } |
179 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
180 static void toc_close(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
181 { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
182 if (gc->inpa > 0) |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
183 gdk_input_remove(gc->inpa); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
184 gc->inpa = -1; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
185 close(((struct toc_data *)gc->proto_data)->toc_fd); |
1 | 186 } |
187 | |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
188 static int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
189 { |
1 | 190 int len; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
191 int slen = 0; |
1 | 192 struct sflap_hdr hdr; |
193 char obuf[MSG_LEN]; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
194 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1 | 195 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
196 if (tdt->state == STATE_PAUSE) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
197 /* TOC has given us the PAUSE message; sending could cause a disconnect |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
198 * so we just return here like everything went through fine */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
199 return 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
200 |
970 | 201 /* One _last_ 2048 check here! This shouldn't ever |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
202 * get hit though, hopefully. If it gets hit on an IM |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
203 * It'll lose the last " and the message won't go through, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
204 * but this'll stop a segfault. */ |
970 | 205 if (strlen(buf) > (MSG_LEN - sizeof(hdr))) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
206 debug_printf("message too long, truncating\n"); |
970 | 207 buf[MSG_LEN - sizeof(hdr) - 3] = '"'; |
208 buf[MSG_LEN - sizeof(hdr) - 2] = '\0'; | |
209 } | |
1 | 210 |
211 if (olen < 0) | |
212 len = escape_message(buf); | |
213 else | |
214 len = olen; | |
215 hdr.ast = '*'; | |
216 hdr.type = type; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
217 hdr.seqno = htons(tdt->seqno++ & 0xffff); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
218 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1)); |
1 | 219 |
220 memcpy(obuf, &hdr, sizeof(hdr)); | |
221 slen += sizeof(hdr); | |
222 memcpy(&obuf[slen], buf, len); | |
223 slen += len; | |
224 if (type != TYPE_SIGNON) { | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
225 obuf[slen] = '\0'; |
1 | 226 slen += 1; |
227 } | |
228 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
229 return write(tdt->toc_fd, obuf, slen); |
1 | 230 } |
231 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
232 static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
233 { |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
234 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
235 struct sflap_hdr *hdr; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
236 int ret; |
1 | 237 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
238 if (read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
239 debug_printf("error, couldn't read flap header\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
240 return -1; |
79 | 241 } |
242 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
243 hdr = (struct sflap_hdr *)buffer; |
1 | 244 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
245 if (buflen < ntohs(hdr->len)) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
246 /* fake like there's a read error */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
247 debug_printf("buffer too small (have %d, need %d)\n", buflen, ntohs(hdr->len)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
248 return -1; |
1 | 249 } |
250 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
251 if (ntohs(hdr->len) > 0) { |
1234
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
252 int count = 0; |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
253 ret = 0; |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
254 do { |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
255 count += ret; |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
256 ret = read(tdt->toc_fd, |
1533
b6fe5cab70d6
[gaim-migrate @ 1543]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1521
diff
changeset
|
257 buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len) - count); |
1234
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
258 } while (count + ret < ntohs(hdr->len) && ret > 0); |
cedf7047081e
[gaim-migrate @ 1244]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1208
diff
changeset
|
259 buffer[sizeof(struct sflap_hdr) + count + ret] = '\0'; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
260 return ret; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
261 } else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
262 return 0; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
263 } |
1 | 264 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
265 static unsigned char *roast_password(char *pass) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
266 { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
267 /* Trivial "encryption" */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
268 static char rp[256]; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
269 static char *roast = ROAST; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
270 int pos = 2; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
271 int x; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
272 strcpy(rp, "0x"); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
273 for (x = 0; (x < 150) && pass[x]; x++) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
274 pos += sprintf(&rp[pos], "%02x", pass[x] ^ roast[x % strlen(roast)]); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
275 rp[pos] = '\0'; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
276 return rp; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
277 } |
1 | 278 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
279 static void toc_callback(gpointer data, gint source, GdkInputCondition condition) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
280 { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
281 struct gaim_connection *gc = (struct gaim_connection *)data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
282 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
283 struct sflap_hdr *hdr; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
284 struct signon so; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
285 char buf[8 * 1024], *c; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
286 char snd[BUF_LEN * 2]; |
1 | 287 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
288 if (condition & GDK_INPUT_EXCEPTION) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
289 debug_printf("gdk_input exception! check internet connection\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
290 hide_login_progress(gc, _("Connection Closed")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
291 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
292 return; |
79 | 293 } |
1 | 294 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
295 /* there's data waiting to be read, so read it. */ |
1412
47413c49bbee
[gaim-migrate @ 1422]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
296 if (wait_reply(gc, buf, 8 * 1024) <= 0) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
297 hide_login_progress(gc, _("Connection Closed")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
298 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
299 return; |
1 | 300 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
301 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
302 if (tdt->state == STATE_FLAPON) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
303 hdr = (struct sflap_hdr *)buf; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
304 if (hdr->type != TYPE_SIGNON) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
305 debug_printf("problem, hdr->type != TYPE_SIGNON\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
306 else |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
307 debug_printf("* TOC sends Client FLAP SIGNON\n"); |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
308 tdt->seqno = ntohs(hdr->seqno); |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
309 tdt->state = STATE_SIGNON_REQUEST; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
310 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
311 debug_printf("* Client sends TOC FLAP SIGNON\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
312 g_snprintf(so.username, sizeof(so.username), "%s", gc->username); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
313 so.ver = htonl(1); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
314 so.tag = htons(1); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
315 so.namelen = htons(strlen(so.username)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
316 if (sflap_send(gc, (char *)&so, ntohs(so.namelen) + 8, TYPE_SIGNON) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
317 hide_login_progress(gc, _("Disconnected.")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
318 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
319 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
320 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
321 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
322 debug_printf("* Client sends TOC \"toc_signon\" message\n"); |
1491
5a5284be5d66
[gaim-migrate @ 1501]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1469
diff
changeset
|
323 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
324 AUTH_HOST, AUTH_PORT, normalize(gc->username), |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
325 roast_password(gc->password), LANGUAGE, REVISION); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
326 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
327 hide_login_progress(gc, _("Disconnected.")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
328 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
329 return; |
1 | 330 } |
331 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
332 set_login_progress(gc, 3, _("Waiting for reply...")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
333 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
334 } |
1 | 335 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
336 if (tdt->state == STATE_SIGNON_REQUEST) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
337 debug_printf("* TOC sends client SIGN_ON reply\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
338 if (strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
339 debug_printf("Didn't get SIGN_ON! buf was: %s\n", |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
340 buf + sizeof(struct sflap_hdr)); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
341 hide_login_progress(gc, _("Authentication Failed")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
342 signoff(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
343 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
344 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
345 /* we're supposed to check that it's really TOC v1 here but we know it is ;) */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
346 debug_printf("TOC version: %s\n", buf + sizeof(struct sflap_hdr) + 4); |
1 | 347 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
348 /* we used to check for the CONFIG here, but we'll wait until we've sent our |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
349 * version of the config and then the toc_init_done message. we'll come back to |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
350 * the callback in a better state if we get CONFIG anyway */ |
1 | 351 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
352 tdt->state = STATE_ONLINE; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
353 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
354 account_online(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
355 serv_finish_login(gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
356 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
357 do_import(0, gc); |
1 | 358 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
359 /* Client sends TOC toc_init_done message */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
360 debug_printf("* Client sends TOC toc_init_done message\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
361 g_snprintf(snd, sizeof snd, "toc_init_done"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
362 sflap_send(gc, snd, -1, TYPE_DATA); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
363 |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
364 g_snprintf(snd, sizeof snd, "toc_set_caps %s %s", FILE_SEND_UID, FILE_GET_UID); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
365 sflap_send(gc, snd, -1, TYPE_DATA); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
366 |
1 | 367 return; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
368 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
369 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
370 debug_printf("From TOC server: %s\n", buf + sizeof(struct sflap_hdr)); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
371 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
372 c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */ |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
373 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
374 if (!strcasecmp(c, "SIGN_ON")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
375 /* we should only get here after a PAUSE */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
376 if (tdt->state != STATE_PAUSE) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
377 debug_printf("got SIGN_ON but not PAUSE!\n"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
378 else { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
379 tdt->state = STATE_ONLINE; |
1146
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
380 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
381 AUTH_HOST, AUTH_PORT, normalize(gc->username), |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
382 roast_password(gc->password), LANGUAGE, REVISION); |
1146
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
383 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) { |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
384 hide_login_progress(gc, _("Disconnected.")); |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
385 signoff(gc); |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
386 return; |
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
387 } |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
388 do_import(0, gc); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
389 g_snprintf(snd, sizeof snd, "toc_init_done"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
390 sflap_send(gc, snd, -1, TYPE_DATA); |
1146
22f3c32a28f6
[gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
391 do_error_dialog(_("TOC has come back from its pause. You may now send" |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
392 " messages again."), _("TOC Resume")); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
393 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
394 } else if (!strcasecmp(c, "CONFIG")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
395 c = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
396 parse_toc_buddy_list(gc, c, 0); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
397 } else if (!strcasecmp(c, "NICK")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
398 c = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
399 g_snprintf(gc->username, sizeof(gc->username), "%s", c); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
400 } else if (!strcasecmp(c, "IM_IN")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
401 char *away, *message; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
402 int a = 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
403 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
404 c = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
405 away = strtok(NULL, ":"); |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
406 |
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
407 message = away; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
408 while (*message && (*message != ':')) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
409 message++; |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
410 message++; |
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
411 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
412 a = (away && (*away == 'T')) ? 1 : 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
413 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
414 serv_got_im(gc, c, message, a); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
415 } else if (!strcasecmp(c, "UPDATE_BUDDY")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
416 char *l, *uc; |
1 | 417 int logged, evil, idle, type = 0; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
418 time_t signon, time_idle; |
1 | 419 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
420 c = strtok(NULL, ":"); /* name */ |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
421 l = strtok(NULL, ":"); /* online */ |
1 | 422 sscanf(strtok(NULL, ":"), "%d", &evil); |
1114
c61f9c384413
[gaim-migrate @ 1124]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1113
diff
changeset
|
423 sscanf(strtok(NULL, ":"), "%ld", &signon); |
1 | 424 sscanf(strtok(NULL, ":"), "%d", &idle); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
425 uc = strtok(NULL, ":"); |
1 | 426 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
427 logged = (l && (*l == 'T')) ? 1 : 0; |
1 | 428 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
429 if (uc[0] == 'A') |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
430 type |= UC_AOL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
431 switch (uc[1]) { |
1 | 432 case 'A': |
433 type |= UC_ADMIN; | |
434 break; | |
435 case 'U': | |
436 type |= UC_UNCONFIRMED; | |
437 break; | |
438 case 'O': | |
439 type |= UC_NORMAL; | |
440 break; | |
441 default: | |
442 break; | |
443 } | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
444 if (uc[2] == 'U') |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
445 type |= UC_UNAVAILABLE; |
1 | 446 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
447 if (idle) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
448 time(&time_idle); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
449 time_idle -= idle * 60; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
450 } else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
451 time_idle = 0; |
1 | 452 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
453 serv_got_update(gc, c, logged, evil, signon, time_idle, type, 0); |
1 | 454 } else if (!strcasecmp(c, "ERROR")) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
455 c = strtok(NULL, ":"); |
1 | 456 show_error_dialog(c); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
457 } else if (!strcasecmp(c, "EVILED")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
458 int lev; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
459 char *name; |
1 | 460 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
461 sscanf(strtok(NULL, ":"), "%d", &lev); |
1 | 462 name = strtok(NULL, ":"); |
463 | |
1100
f168625b63fe
[gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1089
diff
changeset
|
464 serv_got_eviled(gc, name, lev); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
465 } else if (!strcasecmp(c, "CHAT_JOIN")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
466 char *name; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
467 int id; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
468 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
469 sscanf(strtok(NULL, ":"), "%d", &id); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
470 name = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
471 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
472 serv_got_joined_chat(gc, id, name); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
473 } else if (!strcasecmp(c, "CHAT_IN")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
474 int id, w; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
475 char *m, *who, *whisper; |
1 | 476 |
477 sscanf(strtok(NULL, ":"), "%d", &id); | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
478 who = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
479 whisper = strtok(NULL, ":"); |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
480 m = whisper; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
481 while (*m && (*m != ':')) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
482 m++; |
1112
3f56704a09bd
[gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1106
diff
changeset
|
483 m++; |
1 | 484 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
485 w = (whisper && (*whisper == 'T')) ? 1 : 0; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
486 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
487 serv_got_chat_in(gc, id, who, w, m); |
1 | 488 } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) { |
489 int id; | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
490 char *in, *buddy; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
491 GSList *bcs = gc->buddy_chats; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
492 struct conversation *b = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
493 |
1 | 494 sscanf(strtok(NULL, ":"), "%d", &id); |
495 in = strtok(NULL, ":"); | |
496 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
497 while (bcs) { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
498 b = (struct conversation *)bcs->data; |
1 | 499 if (id == b->id) |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
500 break; |
1 | 501 bcs = bcs->next; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
502 b = NULL; |
44 | 503 } |
1 | 504 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
505 if (!b) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
506 return; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
507 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
508 if (in && (*in == 'T')) |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
509 while ((buddy = strtok(NULL, ":")) != NULL) |
1 | 510 add_chat_buddy(b, buddy); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
511 else |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
512 while ((buddy = strtok(NULL, ":")) != NULL) |
1 | 513 remove_chat_buddy(b, buddy); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
514 } else if (!strcasecmp(c, "CHAT_INVITE")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
515 char *name, *who, *message; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
516 int id; |
1 | 517 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
518 name = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
519 sscanf(strtok(NULL, ":"), "%d", &id); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
520 who = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
521 message = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
522 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
523 serv_got_chat_invite(gc, name, id, who, message); |
1 | 524 } else if (!strcasecmp(c, "CHAT_LEFT")) { |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
525 GSList *bcs = gc->buddy_chats; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
526 struct conversation *b = NULL; |
1 | 527 int id; |
528 | |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
529 sscanf(strtok(NULL, ":"), "%d", &id); |
1 | 530 |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
531 while (bcs) { |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
532 b = (struct conversation *)bcs->data; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
533 if (id == b->id) |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
534 break; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
535 b = NULL; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
536 bcs = bcs->next; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
537 } |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
538 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
539 if (!b) |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
540 return; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
541 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
542 if (b->window) { |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
543 char error_buf[BUF_LONG]; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
544 b->gc = NULL; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
545 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected" |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
546 " from chat room %s."), b->name); |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
547 } else |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
548 serv_got_chat_left(gc, id); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
549 } else if (!strcasecmp(c, "GOTO_URL")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
550 char *name, *url, tmp[256]; |
1 | 551 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
552 name = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
553 url = strtok(NULL, ":"); |
1 | 554 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
555 g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", TOC_HOST, TOC_PORT, url); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
556 g_show_info(gc->user, tmp); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
557 } else if (!strcasecmp(c, "DIR_STATUS")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
558 } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
559 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
560 do_error_dialog(_("Password Change Successeful"), _("Gaim - Password Change")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
561 } else if (!strcasecmp(c, "PAUSE")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
562 tdt->state = STATE_PAUSE; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
563 do_error_dialog(_("TOC has sent a PAUSE command. When this happens, TOC ignores" |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
564 " any messages sent to it, and may kick you off if you send a" |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
565 " message. Gaim will prevent anything from going through. This" |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
566 " is only temporary, please be patient."), _("TOC Pause")); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
567 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
568 char *user, *uuid, *cookie; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
569 int seq; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
570 char *rip, *pip, *vip; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
571 int port; |
1 | 572 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
573 user = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
574 uuid = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
575 cookie = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
576 sscanf(strtok(NULL, ":"), "%d", &seq); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
577 rip = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
578 pip = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
579 vip = strtok(NULL, ":"); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
580 sscanf(strtok(NULL, ":"), "%d", &port); |
1 | 581 |
197
24f0fef56a73
[gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
196
diff
changeset
|
582 if (!strcmp(uuid, FILE_SEND_UID)) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
583 /* they want us to get a file */ |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
584 int unk[4], i; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
585 char *messages[4], *tmp, *name; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
586 int subtype, files, totalsize = 0; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
587 struct ft_request *ft; |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
588 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
589 for (i = 0; i < 4; i++) { |
1113
4efa1ca61a2a
[gaim-migrate @ 1123]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1112
diff
changeset
|
590 sscanf(strtok(NULL, ":"), "%d", &unk[i]); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
591 if (unk[i] == 10001) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
592 break; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
593 messages[i] = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
594 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
595 tmp = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
596 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
597 subtype = tmp[1]; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
598 files = tmp[3]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
599 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
600 totalsize |= (tmp[4] << 24) & 0xff000000; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
601 totalsize |= (tmp[5] << 16) & 0x00ff0000; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
602 totalsize |= (tmp[6] << 8) & 0x0000ff00; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
603 totalsize |= (tmp[7] << 0) & 0x000000ff; |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
604 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
605 if (!totalsize) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
606 g_free(tmp); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
607 for (i--; i >= 0; i--) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
608 g_free(messages[i]); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
609 return; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
610 } |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
611 |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
612 name = tmp + 8; |
1 | 613 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
614 ft = g_new0(struct ft_request, 1); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
615 ft->cookie = g_strdup(cookie); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
616 ft->ip = g_strdup(pip); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
617 ft->port = port; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
618 if (i) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
619 ft->message = g_strdup(messages[0]); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
620 else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
621 ft->message = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
622 ft->filename = g_strdup(name); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
623 ft->user = g_strdup(user); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
624 ft->size = totalsize; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
625 ft->files = files; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
626 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_SEND_UID); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
627 ft->gc = gc; |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
628 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
629 g_free(tmp); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
630 for (i--; i >= 0; i--) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
631 g_free(messages[i]); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
632 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
633 debug_printf("English translation of RVOUS_PROPOSE: %s requests Send File (i.e." |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
634 " send a file to you); %s:%d (verified_ip:port), %d files at" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
635 " total size of %ld bytes.\n", user, vip, port, files, totalsize); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
636 accept_file_dialog(ft); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
637 } else if (!strcmp(uuid, FILE_GET_UID)) { |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
638 /* they want us to send a file */ |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
639 int unk[4], i; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
640 char *messages[4], *tmp; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
641 struct ft_request *ft; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
642 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
643 for (i = 0; i < 4; i++) { |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
644 sscanf(strtok(NULL, ":"), "%d", unk + i); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
645 if (unk[i] == 10001) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
646 break; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
647 messages[i] = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
648 } |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
649 tmp = frombase64(strtok(NULL, ":")); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
650 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
651 ft = g_new0(struct ft_request, 1); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
652 ft->cookie = g_strdup(cookie); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
653 ft->ip = g_strdup(pip); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
654 ft->port = port; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
655 if (i) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
656 ft->message = g_strdup(messages[0]); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
657 else |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
658 ft->message = NULL; |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
659 ft->user = g_strdup(user); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
660 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
661 ft->gc = gc; |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
662 |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
663 g_free(tmp); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
664 for (i--; i >= 0; i--) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
665 g_free(messages[i]); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
666 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
667 accept_file_dialog(ft); |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
668 } else if (!strcmp(uuid, VOICE_UID)) { |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
669 /* oh goody. voice over ip. fun stuff. */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
670 } else if (!strcmp(uuid, B_ICON_UID)) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
671 /* buddy icon... */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
672 } else if (!strcmp(uuid, IMAGE_UID)) { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
673 /* aka Direct IM */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
674 } else { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
675 debug_printf("Don't know what to do with RVOUS UUID %s\n", uuid); |
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
676 /* do we have to do anything here? i think it just times out */ |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
677 } |
1 | 678 } else { |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
679 debug_printf("don't know what to do with %s\n", c); |
1 | 680 } |
681 } | |
682 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
683 static char *toc_name() |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
684 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
685 return "TOC"; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
686 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
687 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
688 static void toc_send_im(struct gaim_connection *gc, char *name, char *message, int away) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
689 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
690 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
691 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
692 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
693 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
694 message, ((away) ? " auto" : "")); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
695 sflap_send(gc, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
696 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
697 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
698 static void toc_set_config(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
699 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
700 char buf[MSG_LEN], snd[BUF_LEN * 2]; |
1118
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
701 toc_build_config(gc, buf, MSG_LEN, FALSE); |
1412
47413c49bbee
[gaim-migrate @ 1422]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
702 g_snprintf(snd, MSG_LEN, "toc_set_config {%s}", buf); |
1118
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
703 sflap_send(gc, snd, -1, TYPE_DATA); |
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
704 } |
e1078ee286ba
[gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1114
diff
changeset
|
705 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
706 static void toc_get_info(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
707 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
708 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
709 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
710 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
711 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
712 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
713 static void toc_get_dir(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
714 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
715 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
716 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
717 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
718 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
719 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
720 static void toc_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
721 char *maiden, char *city, char *state, char *country, int web) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
722 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
723 char buf2[BUF_LEN * 4], buf[BUF_LEN]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
724 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
725 middle, last, maiden, city, state, country, (web == 1) ? "Y" : ""); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
726 escape_text(buf2); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
727 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
728 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
729 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
730 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
731 static void toc_dir_search(struct gaim_connection *g, char *first, char *middle, char *last, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
732 char *maiden, char *city, char *state, char *country, char *email) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
733 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
734 char buf[BUF_LONG]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
735 g_snprintf(buf, sizeof(buf) / 2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
736 last, maiden, city, state, country, email); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
737 debug_printf("Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
738 city, state, country); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
739 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
740 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
741 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
742 static void toc_set_away(struct gaim_connection *g, char *state, char *message) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
743 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
744 char buf[BUF_LEN * 2]; |
1521
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
745 if (g->away) |
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
746 g_free (g->away); |
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
747 g->away = NULL; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
748 if (message) { |
1521
ba83e9e2fd9b
[gaim-migrate @ 1531]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
749 g->away = g_strdup (message); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
750 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
751 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
752 } else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
753 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
754 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
755 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
756 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
757 static void toc_set_info(struct gaim_connection *g, char *info) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
758 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
759 char buf[BUF_LEN * 2], buf2[BUF_LEN * 2]; |
1368
12365cb601cb
[gaim-migrate @ 1378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
760 g_snprintf(buf2, sizeof buf2, "%s", info); |
12365cb601cb
[gaim-migrate @ 1378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
761 escape_text(buf2); |
12365cb601cb
[gaim-migrate @ 1378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1333
diff
changeset
|
762 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", buf2); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
763 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
764 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
765 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
766 static void toc_change_passwd(struct gaim_connection *g, char *orig, char *new) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
767 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
768 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
769 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
770 sflap_send(g, buf, strlen(buf), TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
771 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
772 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
773 static void toc_add_buddy(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
774 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
775 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
776 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
777 sflap_send(g, buf, -1, TYPE_DATA); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
778 toc_set_config(g); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
779 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
780 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
781 static void toc_add_buddies(struct gaim_connection *g, GList * buddies) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
782 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
783 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
784 int n; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
785 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
786 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
787 while (buddies) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
788 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 16) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
789 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
790 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
791 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
792 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
793 buddies = buddies->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
794 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
795 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
796 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
797 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
798 static void toc_remove_buddy(struct gaim_connection *g, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
799 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
800 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
801 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
802 sflap_send(g, buf, -1, TYPE_DATA); |
1106
5bc8fdacd2cb
[gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1100
diff
changeset
|
803 toc_set_config(g); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
804 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
805 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
806 static void toc_set_idle(struct gaim_connection *g, int time) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
807 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
808 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
809 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
810 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
811 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
812 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
813 static void toc_warn(struct gaim_connection *g, char *name, int anon) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
814 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
815 char send[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
816 g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm")); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
817 sflap_send(g, send, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
818 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
819 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
820 static void toc_accept_chat(struct gaim_connection *g, int i) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
821 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
822 char buf[BUF_LEN * 2]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
823 g_snprintf(buf, 255, "toc_chat_accept %d", i); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
824 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
825 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
826 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
827 static void toc_join_chat(struct gaim_connection *g, int exchange, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
828 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
829 char buf[BUF_LONG]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
830 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", exchange, name); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
831 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
832 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
833 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
834 static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
835 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
836 char buf[BUF_LONG]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
837 g_snprintf(buf, sizeof(buf) / 2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
838 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
839 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
840 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
841 static void toc_chat_leave(struct gaim_connection *g, int id) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
842 { |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
843 GSList *bcs = g->buddy_chats; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
844 struct conversation *b = NULL; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
845 char buf[BUF_LEN * 2]; |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
846 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
847 while (bcs) { |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
848 b = (struct conversation *)bcs->data; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
849 if (id == b->id) |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
850 break; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
851 b = NULL; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
852 bcs = bcs->next; |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
853 } |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
854 |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
855 if (!b) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
856 return; /* can this happen? */ |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
857 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
858 if (!b->gc) /* TOC already kicked us out of this room */ |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
859 serv_got_chat_left(g, id); |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
860 else { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
861 g_snprintf(buf, 255, "toc_chat_leave %d", id); |
1182
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
862 sflap_send(g, buf, -1, TYPE_DATA); |
bab9f3dc07f8
[gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1153
diff
changeset
|
863 } |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
864 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
865 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
866 static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
867 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
868 char buf2[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
869 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
870 sflap_send(g, buf2, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
871 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
872 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
873 static void toc_chat_send(struct gaim_connection *g, int id, char *message) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
874 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
875 char buf[BUF_LEN * 2]; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
876 escape_text(message); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
877 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"", id, message); |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
878 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
879 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
880 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
881 static void toc_keepalive(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
882 { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
883 sflap_send(gc, "", 0, TYPE_KEEPALIVE); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
884 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
885 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
886 static char **toc_list_icon(int uc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
887 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
888 if (uc & UC_UNAVAILABLE) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
889 return (char **)away_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
890 if (uc & UC_AOL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
891 return (char **)aol_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
892 if (uc & UC_NORMAL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
893 return (char **)free_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
894 if (uc & UC_ADMIN) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
895 return (char **)admin_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
896 if (uc & UC_UNCONFIRMED) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
897 return (char **)dt_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
898 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
899 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
900 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
901 static void toc_info(GtkObject * obj, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
902 { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
903 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
904 serv_get_info(gc, who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
905 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
906 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
907 static void toc_dir_info(GtkObject * obj, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
908 { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
909 struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
910 serv_get_dir(gc, who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
911 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
912 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
913 static void toc_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
914 { |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
915 GtkWidget *button; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
916 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
917 button = gtk_menu_item_new_with_label(_("Get Info")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
918 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(toc_info), who); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
919 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
920 gtk_menu_append(GTK_MENU(menu), button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
921 gtk_widget_show(button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
922 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
923 button = gtk_menu_item_new_with_label(_("Get Dir Info")); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
924 gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(toc_dir_info), who); |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
925 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
926 gtk_menu_append(GTK_MENU(menu), button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
927 gtk_widget_show(button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
928 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
929 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
930 static void toc_print_option(GtkEntry * entry, struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
931 { |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
932 int entrynum; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
933 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
934 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
935 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
936 if (entrynum == USEROPT_AUTH) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
937 g_snprintf(user->proto_opt[USEROPT_AUTH], |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
938 sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
939 } else if (entrynum == USEROPT_AUTHPORT) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
940 g_snprintf(user->proto_opt[USEROPT_AUTHPORT], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
941 sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
942 } else if (entrynum == USEROPT_SOCKSHOST) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
943 g_snprintf(user->proto_opt[USEROPT_SOCKSHOST], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
944 sizeof(user->proto_opt[USEROPT_SOCKSHOST]), "%s", gtk_entry_get_text(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
945 } else if (entrynum == USEROPT_SOCKSPORT) { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
946 g_snprintf(user->proto_opt[USEROPT_SOCKSPORT], |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
947 sizeof(user->proto_opt[USEROPT_SOCKSPORT]), "%s", gtk_entry_get_text(entry)); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
948 } |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
949 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
950 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
951 static void toc_print_optionrad(GtkRadioButton * entry, struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
952 { |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
953 int entrynum; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
954 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
955 entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry)); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
956 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
957 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE], |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
958 sizeof(user->proto_opt[USEROPT_PROXYTYPE]), "%d", entrynum); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
959 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
960 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
961 static void toc_user_opts(GtkWidget *book, struct aim_user *user) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
962 { |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
963 /* so here, we create the new notebook page */ |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
964 GtkWidget *vbox; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
965 GtkWidget *hbox; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
966 GtkWidget *label; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
967 GtkWidget *entry; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
968 GtkWidget *first, *opt; |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
969 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
970 vbox = gtk_vbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
971 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
972 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("TOC Options")); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
973 gtk_widget_show(vbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
974 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
975 |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
976 hbox = gtk_hbox_new(FALSE, 5); |
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
977 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
978 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
979 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
980 label = gtk_label_new("TOC Host:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
981 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
982 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
983 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
984 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
985 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
986 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
987 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
988 if (user->proto_opt[USEROPT_AUTH][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
989 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
990 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
991 } else |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
992 gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
993 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
994 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
995 hbox = gtk_hbox_new(FALSE, 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
996 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
997 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
998 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
999 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1000 label = gtk_label_new("TOC Port:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1001 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1002 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1003 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1004 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1005 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1006 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1007 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1008 if (user->proto_opt[USEROPT_AUTHPORT][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1009 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1010 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1011 } else |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1012 gtk_entry_set_text(GTK_ENTRY(entry), "9898"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1013 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1014 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1015 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1016 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1017 hbox = gtk_hbox_new(FALSE, 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1018 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1019 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1020 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1021 label = gtk_label_new("Proxy Host:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1022 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1023 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1024 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1025 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1026 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1027 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1028 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1029 if (user->proto_opt[USEROPT_SOCKSHOST][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1030 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSHOST]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1031 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSHOST]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1032 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1033 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1034 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1035 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1036 hbox = gtk_hbox_new(FALSE, 0); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1037 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1038 gtk_widget_show(hbox); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1039 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1040 label = gtk_label_new("Proxy Port:"); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1041 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1042 gtk_widget_show(label); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1043 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1044 entry = gtk_entry_new(); |
1250
b5783215b245
[gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1234
diff
changeset
|
1045 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1046 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1047 gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1048 if (user->proto_opt[USEROPT_SOCKSPORT][0]) { |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1049 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1050 gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSPORT]); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1051 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1052 gtk_widget_show(entry); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1053 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1054 |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1055 first = gtk_radio_button_new_with_label(NULL, "No proxy"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1056 gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1057 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1058 gtk_signal_connect(GTK_OBJECT(first), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1059 gtk_widget_show(first); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1060 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1061 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1062 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1063 opt = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1064 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4"); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1065 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1066 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1067 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1068 gtk_widget_show(opt); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1069 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1070 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1071 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1072 opt = |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1073 gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5"); |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1074 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1075 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1076 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1077 gtk_widget_show(opt); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1078 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1079 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1080 |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1081 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "HTTP"); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1082 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1083 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1084 gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1085 gtk_widget_show(opt); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1086 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP) |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1087 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1088 } |
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1089 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1090 static void toc_add_permit(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1091 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1092 char buf2[BUF_LEN * 2]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1093 if (gc->permdeny != 3) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1094 return; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1095 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who)); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1096 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1097 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1098 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1099 static void toc_add_deny(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1100 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1101 char buf2[BUF_LEN * 2]; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1102 if (gc->permdeny != 4) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1103 return; |
1208
66a70fbb2b09
[gaim-migrate @ 1218]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1182
diff
changeset
|
1104 g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", normalize(who)); |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1105 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1106 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1107 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1108 static void toc_set_permit_deny(struct gaim_connection *gc) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1109 { |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1110 char buf2[BUF_LEN * 2]; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1111 GSList *list; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1112 int at; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1113 |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1114 switch (gc->permdeny) { |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1115 case 1: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1116 /* permit all, deny none. to get here reliably we need to have been in permit |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1117 * mode, and send an empty toc_add_deny message, which will switch us to deny none */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1118 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1119 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1120 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1121 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1122 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1123 case 2: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1124 /* deny all, permit none. to get here reliably we need to have been in deny |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1125 * mode, and send an empty toc_add_permit message, which will switch us to permit none */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1126 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1127 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1128 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1129 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1130 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1131 case 3: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1132 /* permit some. we want to switch to deny mode first, then send the toc_add_permit |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1133 * message, which will clear and set our permit list. toc sucks. */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1134 g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1135 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1136 |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1137 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1138 list = gc->permit; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1139 while (list) { |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1140 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1141 if (at > MSG_LEN + 32) { /* from out my ass comes greatness */ |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1142 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1143 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1144 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1145 list = list->next; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1146 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1147 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1148 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1149 case 4: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1150 /* deny some. we want to switch to permit mode first, then send the toc_add_deny |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1151 * message, which will clear and set our deny list. toc sucks. */ |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1152 g_snprintf(buf2, sizeof(buf2), "toc_add_permit "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1153 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1154 |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1155 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1156 list = gc->deny; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1157 while (list) { |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1158 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data)); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1159 if (at > MSG_LEN + 32) { /* from out my ass comes greatness */ |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1160 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1161 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny "); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1162 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1163 list = list->next; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1164 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1165 sflap_send(gc, buf2, -1, TYPE_DATA); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1166 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1167 default: |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1168 break; |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1169 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1170 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1171 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1172 static void toc_rem_permit(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1173 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1174 if (gc->permdeny != 3) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1175 return; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1176 toc_set_permit_deny(gc); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1177 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1178 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1179 static void toc_rem_deny(struct gaim_connection *gc, char *who) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1180 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1181 if (gc->permdeny != 4) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1182 return; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1183 toc_set_permit_deny(gc); |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1184 } |
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1185 |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1186 static void toc_draw_new_user(GtkWidget *box) |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1187 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1188 GtkWidget *label; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1189 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1190 label = gtk_label_new(_("Unfortunately, currently TOC only allows new user registration by " |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1191 "going to http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no" |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1192 ". Clicking the Register button will open the URL for you.")); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1193 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1194 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1195 gtk_widget_show(label); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1196 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1197 |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1198 static void toc_do_new_user() |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1199 { |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1200 open_url(NULL, "http://aim.aol.com/aimnew/Aim/register.adp?promo=106723&pageset=Aim&client=no"); |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1201 } |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1202 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1203 static GList *toc_away_states() |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1204 { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1205 return g_list_append(NULL, GAIM_AWAY_CUSTOM); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1206 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1207 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1208 static void toc_do_action(struct gaim_connection *gc, char *act) |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1209 { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1210 if (!strcmp(act, "Set User Info")) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1211 show_set_info(gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1212 } else if (!strcmp(act, "Set Dir Info")) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1213 show_set_dir(gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1214 } else if (!strcmp(act, "Change Password")) { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1215 show_change_passwd(gc); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1216 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1217 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1218 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1219 static GList *toc_actions() |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1220 { |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1221 GList *m = NULL; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1222 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1223 m = g_list_append(m, "Set User Info"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1224 m = g_list_append(m, "Set Dir Info"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1225 m = g_list_append(m, "Change Password"); |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1226 |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1227 return m; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1228 } |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1229 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1230 void toc_init(struct prpl *ret) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1231 { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1232 ret->protocol = PROTO_TOC; |
1435
f16e17d42b43
[gaim-migrate @ 1445]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1412
diff
changeset
|
1233 ret->options = OPT_PROTO_HTML | OPT_PROTO_CORRECT_TIME; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1234 ret->name = toc_name; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1235 ret->list_icon = toc_list_icon; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1383
diff
changeset
|
1236 ret->away_states = toc_away_states; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1237 ret->actions = toc_actions; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1238 ret->do_action = toc_do_action; |
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1491
diff
changeset
|
1239 ret->buddy_menu = toc_buddy_menu; |
1087
56c7ceb986a8
[gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1051
diff
changeset
|
1240 ret->user_opts = toc_user_opts; |
1333
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1241 ret->draw_new_user = toc_draw_new_user; |
b332d8f46b84
[gaim-migrate @ 1343]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1310
diff
changeset
|
1242 ret->do_new_user = toc_do_new_user; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1243 ret->login = toc_login; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1244 ret->close = toc_close; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1245 ret->send_im = toc_send_im; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1246 ret->set_info = toc_set_info; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1247 ret->get_info = toc_get_info; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1248 ret->set_away = toc_set_away; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1249 ret->get_away_msg = NULL; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1250 ret->set_dir = toc_set_dir; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1251 ret->get_dir = toc_get_dir; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1252 ret->dir_search = toc_dir_search; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1253 ret->set_idle = toc_set_idle; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1254 ret->change_passwd = toc_change_passwd; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1255 ret->add_buddy = toc_add_buddy; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1256 ret->add_buddies = toc_add_buddies; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1257 ret->remove_buddy = toc_remove_buddy; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1258 ret->add_permit = toc_add_permit; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1259 ret->add_deny = toc_add_deny; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1260 ret->rem_permit = toc_rem_permit; |
1208
66a70fbb2b09
[gaim-migrate @ 1218]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1182
diff
changeset
|
1261 ret->rem_deny = toc_rem_deny; |
1145
cd96ca1aed02
[gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1132
diff
changeset
|
1262 ret->set_permit_deny = toc_set_permit_deny; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1263 ret->warn = toc_warn; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1264 ret->accept_chat = toc_accept_chat; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1265 ret->join_chat = toc_join_chat; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1266 ret->chat_invite = toc_chat_invite; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1267 ret->chat_leave = toc_chat_leave; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1268 ret->chat_whisper = toc_chat_whisper; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1269 ret->chat_send = toc_chat_send; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1270 ret->keepalive = toc_keepalive; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1271 } |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1272 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1273 /********* |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1274 * RVOUS ACTIONS |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1275 ********/ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1276 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1277 struct file_header { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1278 char magic[4]; /* 0 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1279 short hdrlen; /* 4 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1280 short hdrtype; /* 6 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1281 char bcookie[8]; /* 8 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1282 short encrypt; /* 16 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1283 short compress; /* 18 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1284 short totfiles; /* 20 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1285 short filesleft; /* 22 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1286 short totparts; /* 24 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1287 short partsleft; /* 26 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1288 long totsize; /* 28 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1289 long size; /* 32 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1290 long modtime; /* 36 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1291 long checksum; /* 40 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1292 long rfrcsum; /* 44 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1293 long rfsize; /* 48 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1294 long cretime; /* 52 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1295 long rfcsum; /* 56 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1296 long nrecvd; /* 60 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1297 long recvcsum; /* 64 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1298 char idstring[32]; /* 68 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1299 char flags; /* 100 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1300 char lnameoffset; /* 101 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1301 char lsizeoffset; /* 102 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1302 char dummy[69]; /* 103 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1303 char macfileinfo[16]; /* 172 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1304 short nencode; /* 188 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1305 short nlanguage; /* 190 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1306 char name[64]; /* 192 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1307 /* 256 */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1308 }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1309 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1310 struct file_transfer { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1311 struct file_header hdr; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1312 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1313 struct gaim_connection *gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1314 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1315 char *user; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1316 char *cookie; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1317 char *ip; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1318 int port; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1319 long size; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1320 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1321 GtkWidget *window; |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1322 int files; |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1323 char *filename; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1324 FILE *file; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1325 int recvsize; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1326 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1327 gint inpa; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1328 }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1329 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1330 static void debug_header(struct file_transfer *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1331 struct file_header *f = (struct file_header *)ft; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1332 debug_printf("TOC FT HEADER:\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1333 "\t%s %d 0x%04x\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1334 "\t%s %d %d\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1335 "\t%d %d %d %d %ld %ld\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1336 "\t%ld %ld %ld %ld %ld %ld %ld %ld\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1337 "\t%s\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1338 "\t0x%02x, 0x%02x, 0x%02x\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1339 "\t%s %s\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1340 "\t%d %d\n" |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1341 "\t%s\n", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1342 f->magic, ntohs(f->hdrlen), f->hdrtype, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1343 f->bcookie, ntohs(f->encrypt), ntohs(f->compress), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1344 ntohs(f->totfiles), ntohs(f->filesleft), ntohs(f->totparts), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1345 ntohs(f->partsleft), ntohl(f->totsize), ntohl(f->size), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1346 ntohl(f->modtime), ntohl(f->checksum), ntohl(f->rfrcsum), ntohl(f->rfsize), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1347 ntohl(f->cretime), ntohl(f->rfcsum), ntohl(f->nrecvd), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1348 ntohl(f->recvcsum), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1349 f->idstring, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1350 f->flags, f->lnameoffset, f->lsizeoffset, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1351 f->dummy, f->macfileinfo, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1352 ntohs(f->nencode), ntohs(f->nlanguage), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1353 f->name); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1354 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1355 |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1356 static void toc_send_file_callback(gpointer data, gint source, GdkInputCondition cond) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1357 { |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1358 char buf[BUF_LONG]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1359 int rt, i; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1360 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1361 struct file_transfer *ft = data; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1362 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1363 if (cond & GDK_INPUT_EXCEPTION) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1364 gdk_input_remove(ft->inpa); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1365 close(source); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1366 g_free(ft->filename); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1367 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1368 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1369 g_free(ft->cookie); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1370 if (ft->file) |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1371 fclose(ft->file); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1372 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1373 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1374 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1375 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1376 if (ft->hdr.hdrtype != 0x202) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1377 char *buf = frombase64(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1378 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1379 read(source, ft, 8); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1380 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1381 debug_header(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1382 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1383 ft->hdr.hdrtype = 0x202; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1384 memcpy(ft->hdr.bcookie, buf, 8); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1385 g_free(buf); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1386 ft->hdr.encrypt = 0; ft->hdr.compress = 0; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1387 debug_header(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1388 write(source, ft, 256); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1389 |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1390 if (ft->files == 1) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1391 ft->file = fopen(ft->filename, "w"); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1392 if (!ft->file) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1393 buf = g_strdup_printf("Could not open %s for writing!", ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1394 do_error_dialog(buf, _("Error")); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1395 g_free(buf); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1396 gdk_input_remove(ft->inpa); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1397 close(source); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1398 g_free(ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1399 g_free(ft->user); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1400 g_free(ft->ip); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1401 g_free(ft->cookie); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1402 g_free(ft); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1403 } |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1404 } else { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1405 buf = g_strdup_printf("%s/%s", ft->filename, ft->hdr.name); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1406 ft->file = fopen(buf, "w"); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1407 g_free(buf); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1408 if (!ft->file) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1409 buf = g_strdup_printf("Could not open %s/%s for writing!", ft->filename, |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1410 ft->hdr.name); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1411 do_error_dialog(buf, _("Error")); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1412 g_free(buf); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1413 gdk_input_remove(ft->inpa); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1414 close(source); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1415 g_free(ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1416 g_free(ft->user); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1417 g_free(ft->ip); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1418 g_free(ft->cookie); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1419 g_free(ft); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1420 } |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1421 } |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1422 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1423 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1424 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1425 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1426 rt = read(source, buf, MIN(ntohl(ft->hdr.size) - ft->recvsize, 1024)); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1427 if (rt < 0) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1428 do_error_dialog("File transfer failed; other side probably canceled.", "Error"); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1429 gdk_input_remove(ft->inpa); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1430 close(source); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1431 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1432 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1433 g_free(ft->cookie); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1434 if (ft->file) |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1435 fclose(ft->file); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1436 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1437 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1438 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1439 ft->recvsize += rt; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1440 for (i = 0; i < rt; i++) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1441 fprintf(ft->file, "%c", buf[i]); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1442 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1443 if (ft->recvsize == ntohl(ft->hdr.size)) { |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1444 ft->hdr.hdrtype = htons(0x0204); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1445 ft->hdr.filesleft = htons(ntohs(ft->hdr.filesleft) - 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1446 ft->hdr.partsleft = htons(ntohs(ft->hdr.partsleft) - 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1447 ft->hdr.recvcsum = ft->hdr.checksum; /* uh... */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1448 ft->hdr.nrecvd = htons(ntohs(ft->hdr.nrecvd) + 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1449 ft->hdr.flags = 0; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1450 write(source, ft, 256); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1451 debug_header(ft); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1452 ft->recvsize = 0; |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1453 fclose(ft->file); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1454 if (ft->hdr.filesleft == 0) { |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1455 gdk_input_remove(ft->inpa); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1456 close(source); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1457 g_free(ft->filename); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1458 g_free(ft->user); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1459 g_free(ft->ip); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1460 g_free(ft->cookie); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1461 g_free(ft); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1462 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1463 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1464 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1465 |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1466 static void toc_send_file(gpointer a, struct file_transfer *old_ft) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1467 { |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1468 struct file_transfer *ft; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1469 char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1470 int fd; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1471 struct aim_user *user; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1472 char buf[BUF_LEN * 2]; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1473 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1474 if (file_is_dir(dirname, old_ft->window)) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1475 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1476 ft = g_new0(struct file_transfer, 1); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1477 if (old_ft->files == 1) |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1478 ft->filename = g_strdup(dirname); |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1479 else |
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1480 ft->filename = g_dirname(dirname); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1481 ft->cookie = g_strdup(old_ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1482 ft->user = g_strdup(old_ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1483 ft->ip = g_strdup(old_ft->ip); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1484 ft->files = old_ft->files; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1485 ft->port = old_ft->port; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1486 ft->gc = old_ft->gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1487 user = ft->gc->user; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1488 gtk_widget_destroy(old_ft->window); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1489 |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1490 g_snprintf(buf, sizeof(buf), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_SEND_UID); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1491 sflap_send(ft->gc, buf, -1, TYPE_DATA); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1492 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1493 fd = |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1494 proxy_connect(ft->ip, ft->port, |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1495 user->proto_opt[USEROPT_SOCKSHOST], |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1496 atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1497 atoi(user->proto_opt[USEROPT_PROXYTYPE])); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1498 if (fd < 0) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1499 do_error_dialog(_("Could not connect for transfer!"), _("Error")); |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1500 g_free(ft->filename); |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1501 g_free(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1502 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1503 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1504 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1505 return; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1506 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1507 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1508 ft->inpa = gdk_input_add(fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_send_file_callback, ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1509 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1510 |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1511 static void toc_get_file_callback(gpointer data, gint source, GdkInputCondition cond) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1512 { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1513 char buf[BUF_LONG]; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1514 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1515 struct file_transfer *ft = data; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1516 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1517 if (cond & GDK_INPUT_EXCEPTION) { |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1518 do_error_dialog("The file tranfer has been aborted; the other side most likely" |
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1519 " cancelled.", "Error"); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1520 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1521 close(source); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1522 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1523 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1524 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1525 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1526 if (ft->file) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1527 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1528 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1529 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1530 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1531 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1532 if (cond & GDK_INPUT_WRITE) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1533 int remain = MIN(ntohl(ft->hdr.totsize) - ft->recvsize, 1024); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1534 int i; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1535 for (i = 0; i < remain; i++) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1536 fscanf(ft->file, "%c", &buf[i]); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1537 write(source, buf, remain); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1538 ft->recvsize += remain; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1539 if (ft->recvsize == ntohl(ft->hdr.totsize)) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1540 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1541 ft->inpa = gdk_input_add(source, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1542 toc_get_file_callback, ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1543 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1544 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1545 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1546 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1547 if (ft->hdr.hdrtype == htons(0x1108)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1548 struct tm *fortime; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1549 struct stat st; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1550 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1551 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1552 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1553 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1554 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1555 stat(ft->filename, &st); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1556 fortime = localtime(&st.st_mtime); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1557 g_snprintf(buf, sizeof(buf), "%2d/%2d/%4d %2d:%2d %8ld %s\r\n", |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1558 fortime->tm_mon + 1, fortime->tm_mday, fortime->tm_year + 1900, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1559 fortime->tm_hour + 1, fortime->tm_min + 1, (long)st.st_size, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1560 g_basename(ft->filename)); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1561 write(source, buf, ntohl(ft->hdr.size)); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1562 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1563 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1564 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1565 if (ft->hdr.hdrtype == htons(0x1209)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1566 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1567 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1568 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1569 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1570 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1571 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1572 if (ft->hdr.hdrtype == htons(0x120b)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1573 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1574 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1575 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1576 |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1577 if (ft->hdr.hdrtype != htons(0x120c)) { |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1578 g_snprintf(buf, sizeof(buf), "%s decided to cancel the transfer", ft->user); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1579 do_error_dialog(buf, "Error"); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1580 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1581 close(source); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1582 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1583 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1584 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1585 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1586 if (ft->file) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1587 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1588 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1589 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1590 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1591 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1592 ft->hdr.hdrtype = 0x0101; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1593 ft->hdr.totfiles = htons(1); ft->hdr.filesleft = htons(1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1594 ft->hdr.flags = 0x20; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1595 write(source, ft, 256); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1596 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1597 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1598 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1599 if (ft->hdr.hdrtype == 0x0101) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1600 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1601 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1602 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1603 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1604 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1605 ft->inpa = gdk_input_add(source, GDK_INPUT_WRITE | GDK_INPUT_EXCEPTION, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1606 toc_get_file_callback, ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1607 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1608 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1609 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1610 if (ft->hdr.hdrtype == 0x0202) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1611 read(source, ft, 8); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1612 read(source, &ft->hdr.bcookie, MIN(256 - 8, ntohs(ft->hdr.hdrlen) - 8)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1613 debug_header(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1614 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1615 gdk_input_remove(ft->inpa); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1616 close(source); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1617 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1618 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1619 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1620 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1621 if (ft->file) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1622 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1623 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1624 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1625 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1626 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1627 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1628 static void toc_get_file(gpointer a, struct file_transfer *old_ft) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1629 { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1630 struct file_transfer *ft; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1631 struct file_header *hdr; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1632 char *dirname = gtk_file_selection_get_filename(GTK_FILE_SELECTION(old_ft->window)); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1633 int fd; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1634 struct aim_user *user; |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1635 char *buf, buf2[BUF_LEN * 2]; |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1636 struct stat st; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1637 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1638 if (file_is_dir(dirname, old_ft->window)) |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1639 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1640 ft = g_new0(struct file_transfer, 1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1641 ft->filename = g_strdup(dirname); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1642 ft->file = fopen(ft->filename, "r"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1643 if (!ft->file) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1644 buf = g_strdup_printf("Unable to open %s for transfer!", ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1645 do_error_dialog(buf, "Error"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1646 g_free(buf); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1647 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1648 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1649 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1650 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1651 if (stat(dirname, &st)) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1652 buf = g_strdup_printf("Unable to examine %s!", dirname); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1653 do_error_dialog(buf, "Error"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1654 g_free(buf); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1655 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1656 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1657 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1658 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1659 ft->cookie = g_strdup(old_ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1660 ft->user = g_strdup(old_ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1661 ft->ip = g_strdup(old_ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1662 ft->port = old_ft->port; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1663 ft->gc = old_ft->gc; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1664 user = ft->gc->user; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1665 gtk_widget_destroy(old_ft->window); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1666 |
1615
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1667 g_snprintf(buf2, sizeof(buf2), "toc_rvous_accept %s %s %s", ft->user, ft->cookie, FILE_GET_UID); |
5a2fd3f2a1d0
[gaim-migrate @ 1625]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1533
diff
changeset
|
1668 sflap_send(ft->gc, buf2, -1, TYPE_DATA); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1669 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1670 fd = |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1671 proxy_connect(ft->ip, ft->port, |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1672 user->proto_opt[USEROPT_SOCKSHOST], |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1673 atoi(user->proto_opt[USEROPT_SOCKSPORT]), |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1674 atoi(user->proto_opt[USEROPT_PROXYTYPE])); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1675 if (fd < 0) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1676 do_error_dialog(_("Could not connect for transfer!"), _("Error")); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1677 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1678 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1679 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1680 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1681 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1682 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1683 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1684 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1685 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1686 hdr = (struct file_header *)ft; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1687 hdr->magic[0] = 'O'; hdr->magic[1] = 'F'; hdr->magic[2] = 'T'; hdr->magic[3] = '2'; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1688 hdr->hdrlen = htons(256); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1689 hdr->hdrtype = htons(0x1108); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1690 buf = frombase64(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1691 g_snprintf(hdr->bcookie, 8, "%s", buf); |
1469
d74112de59ed
[gaim-migrate @ 1479]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1466
diff
changeset
|
1692 g_free(buf); |
1466
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1693 hdr->totfiles = htons(1); hdr->filesleft = htons(1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1694 hdr->totparts = htons(1); hdr->partsleft = htons(1); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1695 hdr->totsize = htonl((long)st.st_size); /* combined size of all files */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1696 /* size = strlen("mm/dd/yyyy hh:mm sizesize 'name'\r\n") */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1697 hdr->size = htonl(28 + strlen(g_basename(ft->filename))); /* size of listing.txt */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1698 hdr->modtime = htonl(st.st_mtime); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1699 hdr->checksum = htonl(0x89f70000); /* uh... */ |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1700 g_snprintf(hdr->idstring, 32, "OFT_Windows ICBMFT V1.1 32"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1701 hdr->flags = 0x02; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1702 hdr->lnameoffset = 0x1A; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1703 hdr->lsizeoffset = 0x10; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1704 g_snprintf(hdr->name, 64, "listing.txt"); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1705 if (write(fd, hdr, 256) < 0) { |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1706 do_error_dialog(_("Could not write file header!"), _("Error")); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1707 fclose(ft->file); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1708 g_free(ft->filename); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1709 g_free(ft->cookie); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1710 g_free(ft->user); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1711 g_free(ft->ip); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1712 g_free(ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1713 return; |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1714 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1715 |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1716 ft->inpa = gdk_input_add(fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_get_file_callback, ft); |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1717 } |
1a24237f5865
[gaim-migrate @ 1476]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1459
diff
changeset
|
1718 |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1719 static void cancel_callback(gpointer a, struct file_transfer *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1720 gtk_widget_destroy(ft->window); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1721 if (a == ft->window) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1722 g_free(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1723 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1724 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1725 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1726 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1727 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1728 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1729 static void toc_accept_ft(gpointer a, struct ft_request *fr) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1730 GtkWidget *window; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1731 char buf[BUF_LEN]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1732 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1733 struct file_transfer *ft = g_new0(struct file_transfer, 1); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1734 ft->gc = fr->gc; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1735 ft->user = g_strdup(fr->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1736 ft->cookie = g_strdup(fr->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1737 ft->ip = g_strdup(fr->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1738 ft->port = fr->port; |
1459
d6340f73e94b
[gaim-migrate @ 1469]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1457
diff
changeset
|
1739 ft->files = fr->files; |
1457
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1740 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1741 ft->window = window = gtk_file_selection_new(_("Gaim - Save As...")); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1742 g_snprintf(buf, sizeof(buf), "%s/%s", g_get_home_dir(), fr->filename ? fr->filename : ""); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1743 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1744 gtk_signal_connect(GTK_OBJECT(window), "destroy", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1745 GTK_SIGNAL_FUNC(cancel_callback), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1746 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1747 GTK_SIGNAL_FUNC(cancel_callback), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1748 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1749 if (!strcmp(fr->UID, FILE_SEND_UID)) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1750 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1751 GTK_SIGNAL_FUNC(toc_send_file), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1752 else |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1753 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1754 GTK_SIGNAL_FUNC(toc_get_file), ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1755 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1756 gtk_widget_show(window); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1757 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1758 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1759 static void toc_reject_ft(gpointer a, struct ft_request *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1760 g_free(ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1761 g_free(ft->filename); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1762 g_free(ft->ip); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1763 g_free(ft->cookie); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1764 if (ft->message) |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1765 g_free(ft->message); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1766 g_free(ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1767 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1768 |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1769 static void accept_file_dialog(struct ft_request *ft) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1770 char buf[BUF_LONG]; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1771 if (!strcmp(ft->UID, FILE_SEND_UID)) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1772 /* holy crap. who the fuck would transfer gigabytes through AIM?! */ |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1773 static char *sizes[4] = { "bytes", "KB", "MB", "GB" }; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1774 float size = ft->size; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1775 int index = 0; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1776 while ((index < 4) && (size > 1024)) { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1777 size /= 1024; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1778 index++; |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1779 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1780 g_snprintf(buf, sizeof(buf), _("%s requests %s to accept %d file%s: %s (%.2f %s)%s%s"), |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1781 ft->user, ft->gc->username, ft->files, (ft->files == 1) ? "" : "s", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1782 ft->filename, size, sizes[index], (ft->message) ? "\n" : "", |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1783 (ft->message) ? ft->message : ""); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1784 } else { |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1785 g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1786 } |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1787 do_ask_dialog(buf, ft, toc_accept_ft, toc_reject_ft); |
c6f9d0cdaa00
[gaim-migrate @ 1467]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1435
diff
changeset
|
1788 } |