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