annotate src/toc.c @ 1491:5a5284be5d66

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