annotate src/toc.c @ 1112:3f56704a09bd

[gaim-migrate @ 1122] You know, PROTOCOL *told* me not to do this, but i did it anyway. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 20 Nov 2000 20:32:17 +0000
parents 5bc8fdacd2cb
children 4efa1ca61a2a
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>
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
38 #include "prpl.h"
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
39 #include "multi.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include "gnome_applet_mgr.h"
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
42 #include "proxy.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
44 #include "pixmaps/admin_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
45 #include "pixmaps/aol_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
46 #include "pixmaps/away_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
47 #include "pixmaps/dt_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
48 #include "pixmaps/free_icon.xpm"
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
49
1112
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
50 #define REVISION "gaim:$Revision: 1122 $"
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
51
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
52 #define TYPE_SIGNON 1
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
53 #define TYPE_DATA 2
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
54 #define TYPE_ERROR 3
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
55 #define TYPE_SIGNOFF 4
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
56 #define TYPE_KEEPALIVE 5
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
57
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
58 #define FLAPON "FLAPON\r\n\r\n"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
59 #define ROAST "Tic/Toc"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
60
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
61 #define TOC_HOST "toc.oscar.aol.com"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
62 #define TOC_PORT 9898
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
63 #define AUTH_HOST "login.oscar.aol.com"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
64 #define AUTH_PORT 5190
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
65 #define LANGUAGE "english"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
66
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
67 #define STATE_OFFLINE 0
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
68 #define STATE_FLAPON 1
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
69 #define STATE_SIGNON_REQUEST 2
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
70 #define STATE_ONLINE 3
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
71 #define STATE_PAUSE 4
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
72
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
73 struct toc_data {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
74 int toc_fd;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
75 int seqno;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
76 int state;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
77 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
78
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
79 struct sflap_hdr {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
80 unsigned char ast;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
81 unsigned char type;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
82 unsigned short seqno;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
83 unsigned short len;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
84 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
86 struct signon {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
87 unsigned int ver;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
88 unsigned short tag;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
89 unsigned short namelen;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
90 char username[80];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
91 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
92
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
93 /* constants to identify proto_opts */
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
94 #define USEROPT_AUTH 0
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
95 #define USEROPT_AUTHPORT 1
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
96 #define USEROPT_SOCKSHOST 2
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
97 #define USEROPT_SOCKSPORT 3
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
98 #define USEROPT_PROXYTYPE 4
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
99
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
100 static void toc_callback(gpointer, gint, GdkInputCondition);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
101 static unsigned char *roast_password(char *);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
102
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
103 /* 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
104 * 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
105 * on success. */
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
106 static void toc_login(struct aim_user *user) {
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
107 struct gaim_connection *gc;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
108 struct toc_data *tdt;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
109 char buf[80];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
110
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
111 gc = new_gaim_conn(user);
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
112 gc->proto_data = tdt = g_new0(struct toc_data, 1);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
113
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
114 g_snprintf(buf, sizeof buf, "Lookin up %s",
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
115 user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
116 /* this is such a hack */
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
117 set_login_progress(gc, 1, buf);
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
118 while (gtk_events_pending())
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
119 gtk_main_iteration();
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
120 if (!g_slist_find(connections, gc))
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
121 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
122
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
123 tdt->toc_fd = proxy_connect(
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
124 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
125 user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]):TOC_PORT,
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
126 user->proto_opt[USEROPT_SOCKSHOST], atoi(user->proto_opt[USEROPT_SOCKSPORT]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
127 atoi(user->proto_opt[USEROPT_PROXYTYPE]));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
128
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
129 debug_printf("* Client connects to TOC\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
130 if (tdt->toc_fd < 0) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
131 g_snprintf(buf, sizeof(buf), "Connect to %s failed",
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
132 user->proto_opt[USEROPT_AUTH]);
988
9523b772e546 [gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
133 hide_login_progress(gc, buf);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
134 signoff(gc);
980
82c5865f7cfe [gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 978
diff changeset
135 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
138 debug_printf("* Client sends \"FLAPON\\r\\n\\r\\n\"\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
139 if (write(tdt->toc_fd, FLAPON, strlen(FLAPON)) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
140 hide_login_progress(gc, "Disconnected.");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
141 signoff(gc);
1089
f0f5c10cce63 [gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1088
diff changeset
142 return;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
143 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
144 tdt->state = STATE_FLAPON;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
145
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
146 /* 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
147 * 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
148 * 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
149 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
150
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
151 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
152 set_login_progress(gc, 2, buf);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
153 }
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 static void toc_set_config(struct gaim_connection *gc) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
156 char buf[MSG_LEN], snd[MSG_LEN];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
157 toc_build_config(gc, buf, MSG_LEN, FALSE);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
158 g_snprintf(snd, MSG_LEN, "toc_set_config \"%s\"", buf);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
159 sflap_send(gc, snd, -1, TYPE_DATA);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
160 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
161
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
162 static void toc_close(struct gaim_connection *gc) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
163 toc_set_config(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
164 if (gc->inpa > 0)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
165 gdk_input_remove(gc->inpa);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
166 gc->inpa = -1;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
167 close(((struct toc_data *)gc->proto_data)->toc_fd);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
168 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
169
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
170 int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
171 int len;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
172 int slen=0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
173 struct sflap_hdr hdr;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
174 char obuf[MSG_LEN];
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
175 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
177 if (tdt->state == STATE_PAUSE)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
178 /* 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
179 * so we just return here like everything went through fine */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
180 return 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
181
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
182 /* One _last_ 2048 check here! This shouldn't ever
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
183 * get hit though, hopefully. If it gets hit on an IM
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
184 * It'll lose the last " and the message won't go through,
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
185 * but this'll stop a segfault. */
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
186 if (strlen(buf) > (MSG_LEN - sizeof(hdr))) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
187 debug_printf("message too long, truncating\n");
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
188 buf[MSG_LEN - sizeof(hdr) - 3] = '"';
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
189 buf[MSG_LEN - sizeof(hdr) - 2] = '\0';
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
190 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
191
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
192 if (olen < 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
193 len = escape_message(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
195 len = olen;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
196 hdr.ast = '*';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
197 hdr.type = type;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
198 hdr.seqno = htons(tdt->seqno++ & 0xffff);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
199 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
200
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
201 memcpy(obuf, &hdr, sizeof(hdr));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
202 slen += sizeof(hdr);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
203 memcpy(&obuf[slen], buf, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
204 slen += len;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
205 if (type != TYPE_SIGNON) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
206 obuf[slen]='\0';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
207 slen += 1;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
208 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
209
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
210 return write(tdt->toc_fd, obuf, slen);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
211 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
212
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
213 static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) {
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
214 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
215 struct sflap_hdr *hdr;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
216 int ret;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
217
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
218 if (read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
219 debug_printf("error, couldn't read flap header\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
220 return -1;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 50
diff changeset
221 }
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 50
diff changeset
222
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
223 hdr = (struct sflap_hdr *)buffer;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
224
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
225 if (buflen < ntohs(hdr->len)) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
226 /* fake like there's a read error */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
227 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
228 return -1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
230
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
231 if (ntohs(hdr->len) > 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
232 ret = read(tdt->toc_fd, buffer + sizeof(struct sflap_hdr), ntohs(hdr->len));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
233 buffer[sizeof(struct sflap_hdr) + ret] = '\0';
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
234 return ret;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
235 } else return 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
236 }
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 static unsigned char *roast_password(char *pass) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
239 /* Trivial "encryption" */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
240 static char rp[256];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
241 static char *roast = ROAST;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
242 int pos=2;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
243 int x;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
244 strcpy(rp, "0x");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
245 for (x=0;(x<150) && pass[x]; x++)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
246 pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % strlen(roast)]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
247 rp[pos]='\0';
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
248 return rp;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
249 }
1
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 static void toc_callback(gpointer data, gint source, GdkInputCondition condition) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
252 struct gaim_connection *gc = (struct gaim_connection *)data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
253 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
254 struct sflap_hdr *hdr;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
255 struct signon so;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
256 char buf[8 * 1024], *c;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
257 char snd[MSG_LEN];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
258
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
259 if (condition & GDK_INPUT_EXCEPTION) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
260 debug_printf("gdk_input exception! check internet connection\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
261 hide_login_progress(gc, _("Connection Closed"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
262 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
263 return;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 50
diff changeset
264 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
265
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
266 /* there's data waiting to be read, so read it. */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
267 if (wait_reply(gc, buf, 8 * 1024) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
268 hide_login_progress(gc, _("Connection Closed"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
269 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
270 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
271 }
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
272
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
273 if (tdt->state == STATE_FLAPON) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
274 hdr = (struct sflap_hdr *)buf;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
275 if (hdr->type != TYPE_SIGNON)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
276 debug_printf("problem, hdr->type != TYPE_SIGNON\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
277 else
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
278 debug_printf("* TOC sends Client FLAP SIGNON\n");
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
279 tdt->seqno = ntohs(hdr->seqno);
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
280 tdt->state = STATE_SIGNON_REQUEST;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
281
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
282 debug_printf("* Client sends TOC FLAP SIGNON\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
283 g_snprintf(so.username, sizeof(so.username), "%s", gc->username);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
284 so.ver = htonl(1);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
285 so.tag = htons(1);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
286 so.namelen = htons(strlen(so.username));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
287 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
288 hide_login_progress(gc, _("Disconnected."));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
289 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
290 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
291 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
292
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
293 debug_printf("* Client sends TOC \"toc_signon\" message\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
294 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"",
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
295 AUTH_HOST, AUTH_PORT, normalize(gc->username),
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
296 roast_password(gc->password), LANGUAGE, REVISION);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
297 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
298 hide_login_progress(gc, _("Disconnected."));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
299 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
300 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
301 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
302
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
303 set_login_progress(gc, 3, _("Waiting for reply..."));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
304 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
305 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
306
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
307 if (tdt->state == STATE_SIGNON_REQUEST) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
308 debug_printf("* TOC sends client SIGN_ON reply\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
309 if (strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
310 debug_printf("Didn't get SIGN_ON! buf was: %s\n", buf+sizeof(struct sflap_hdr));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
311 hide_login_progress(gc, _("Authentication Failed"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
312 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
313 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
314 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
315 /* 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
316 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
317
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
318 /* 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
319 * 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
320 * the callback in a better state if we get CONFIG anyway */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
321
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
322 gc->options = gc->user->options;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
323 tdt->state = STATE_ONLINE;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
324
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
325 account_online(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
326 serv_finish_login(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
327
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
328 do_import(0, gc);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
329
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
330 /* Client sends TOC toc_init_done message */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
331 debug_printf("* Client sends TOC toc_init_done message\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
332 g_snprintf(snd, sizeof snd, "toc_init_done");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
333 sflap_send(gc, snd, -1, TYPE_DATA);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
334
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
335 g_snprintf(snd, sizeof snd, "toc_set_caps %s %s %s %s %s",
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
336 FILE_SEND_UID, FILE_GET_UID, B_ICON_UID, IMAGE_UID, VOICE_UID);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
337 sflap_send(gc, snd, -1, TYPE_DATA);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
338
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
339 if (gc->keepalive < 0)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
340 update_keepalive(gc, gc->options & OPT_USR_KEEPALV);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
341
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342 return;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
343 }
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 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
346
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
347 c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
348
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
349 if (!strcasecmp(c, "SIGN_ON")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
350 /* we should only get here after a PAUSE */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
351 if (tdt->state != STATE_PAUSE)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
352 debug_printf("got SIGN_ON but not PAUSE!\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
353 else {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
354 tdt->state = STATE_ONLINE;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
355 do_error_dialog(_("TOC has come back from its pause. You may now send"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
356 " messages again."), _("TOC Resume"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
357 do_import(0, gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
358 g_snprintf(snd, sizeof snd, "toc_init_done");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
359 sflap_send(gc, snd, -1, TYPE_DATA);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
360 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
361 } else if (!strcasecmp(c, "CONFIG")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
362 c = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
363 parse_toc_buddy_list(gc, c, 0);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
364 } else if (!strcasecmp(c, "NICK")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
365 c = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
366 g_snprintf(gc->username, sizeof(gc->username), "%s", c);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
367 } else if (!strcasecmp(c, "IM_IN")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
368 char *away, *message;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
369 int a = 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
370
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
371 c = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
372 away = strtok(NULL, ":");
1112
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
373
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
374 message = away;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
375 while (*message && (*message != ':')) message++;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
376 message++;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
377
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
378 a = (away && (*away == 'T')) ? 1 : 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
379
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
380 serv_got_im(gc, c, message, a);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
381 } else if (!strcasecmp(c, "UPDATE_BUDDY")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
382 char *l, *uc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
383 int logged, evil, idle, type = 0;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
384 time_t signon, time_idle;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
385
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
386 c = strtok(NULL, ":"); /* name */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
387 l = strtok(NULL, ":"); /* online */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
388 sscanf(strtok(NULL, ":"), "%d", &evil);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
389 sscanf(strtok(NULL, ":"), "%d", &signon);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
390 sscanf(strtok(NULL, ":"), "%d", &idle);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
391 uc = strtok(NULL, ":");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
392
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
393 logged = (l && (*l == 'T')) ? 1 : 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
395 if (uc[0] == 'A') type |= UC_AOL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
396 switch (uc[1]) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
397 case 'A':
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398 type |= UC_ADMIN;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
399 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
400 case 'U':
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
401 type |= UC_UNCONFIRMED;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403 case 'O':
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404 type |= UC_NORMAL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
405 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406 default:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
407 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
408 }
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
409 if (uc[0] == 'U') type |= UC_UNAVAILABLE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
410
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
411 if (idle) { time(&time_idle); time_idle -= idle * 60; }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
412 else time_idle = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
413
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
414 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
415 } else if (!strcasecmp(c, "ERROR")) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
416 c = strtok(NULL, ":");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
417 show_error_dialog(c);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
418 } else if (!strcasecmp(c, "EVILED")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
419 int lev;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
420 char *name;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
421
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
422 sscanf(strtok(NULL, ":"), "%d", &lev);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
423 name = strtok(NULL, ":");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
424
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
425 serv_got_eviled(gc, name, lev);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
426 } else if (!strcasecmp(c, "CHAT_JOIN")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
427 char *name;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
428 int id;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
429
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
430 sscanf(strtok(NULL, ":"), "%d", &id);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
431 name = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
432
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
433 serv_got_joined_chat(gc, id, name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
434 } else if (!strcasecmp(c, "CHAT_IN")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
435 int id, w;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
436 char *m, *who, *whisper;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
437
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
438 sscanf(strtok(NULL, ":"), "%d", &id);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
439 who = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
440 whisper = strtok(NULL, ":");
1112
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
441 m = whisper;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
442 while (*m && (*m != ':')) m++;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
443 m++;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
444
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
445 w = (whisper && (*whisper == 'T')) ? 1 : 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
446
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
447 serv_got_chat_in(gc, id, who, w, m);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
448 } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
449 int id;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
450 char *in, *buddy;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
451 GSList *bcs = gc->buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
452 struct conversation *b = NULL;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
453
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
454 sscanf(strtok(NULL, ":"), "%d", &id);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
455 in = strtok(NULL, ":");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
456
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457 while(bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
458 b = (struct conversation *)bcs->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
459 if (id == b->id)
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
460 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
461 bcs = bcs->next;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
462 b = NULL;
44
e3e7351cf70d [gaim-migrate @ 53]
Rob Flynn <gaim@robflynn.com>
parents: 10
diff changeset
463 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
464
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
465 if (!b) return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
466
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
467 if (in && (*in == 'T'))
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
468 while ((buddy = strtok(NULL, ":")) != NULL)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
469 add_chat_buddy(b, buddy);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
470 else
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
471 while ((buddy = strtok(NULL, ":")) != NULL)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
472 remove_chat_buddy(b, buddy);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
473 } else if (!strcasecmp(c, "CHAT_INVITE")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
474 char *name, *who, *message;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
475 int id;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
476
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
477 name = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
478 sscanf(strtok(NULL, ":"), "%d", &id);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
479 who = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
480 message = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
481
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
482 serv_got_chat_invite(gc, name, id, who, message);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
483 } else if (!strcasecmp(c, "CHAT_LEFT")) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
484 int id;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
485
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
486 sscanf(strtok(NULL, ":"), "%d", &id);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
487
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
488 serv_got_chat_left(gc, id);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
489 } else if (!strcasecmp(c, "GOTO_URL")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
490 char *name, *url, tmp[256];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
491
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
492 name = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
493 url = strtok(NULL, ":");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
494
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
495 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
496 g_show_info(gc->user, tmp);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
497 } else if (!strcasecmp(c, "DIR_STATUS")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
498 } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
499 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
500 do_error_dialog(_("Password Change Successeful"), _("Gaim - Password Change"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
501 } else if (!strcasecmp(c, "PAUSE")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
502 tdt->state = STATE_PAUSE;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
503 do_error_dialog(_("TOC has sent a PAUSE command. When this happens, TOC ignores"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
504 " any messages sent to it, and may kick you off if you send a"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
505 " message. Gaim will prevent anything from going through. This"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
506 " is only temporary, please be patient."), _("TOC Pause"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
507 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
508 char *user, *uuid, *cookie;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
509 int seq;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
510 char *rip, *pip, *vip;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
511 int port;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
512
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
513 user = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
514 uuid = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
515 cookie = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
516 sscanf(strtok(NULL, ":"), "%d", &seq);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
517 rip = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
518 pip = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
519 vip = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
520 sscanf(strtok(NULL, ":"), "%d", &port);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
521
197
24f0fef56a73 [gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 196
diff changeset
522 if (!strcmp(uuid, FILE_SEND_UID)) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
523 /* they want us to get a file */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
524 int unk[4], i;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
525 char *messages[4], *tmp, *name;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
526 int subtype, files, totalsize = 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
527 struct file_transfer *ft;
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
528
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
529 for (i = 0; i < 4; i++) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
530 sscanf(strtok(NULL, ":"), "%d", unk + i);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
531 if (unk[1] == 10001) break;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
532 messages[i] = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
533 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
534 tmp = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
535
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
536 subtype = tmp[1];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
537 files = tmp[3];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
538
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
539 totalsize |= (tmp[4] << 24) & 0xff000000;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
540 totalsize |= (tmp[5] << 16) & 0x00ff0000;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
541 totalsize |= (tmp[6] << 8) & 0x0000ff00;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
542 totalsize |= (tmp[7] << 0) & 0x000000ff;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
543
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
544 if (!totalsize) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
545 g_free(tmp);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
546 for (i--; i >= 0; i--) g_free(messages[i]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
547 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
548 }
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
549
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
550 name = tmp + 8;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
551
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
552 ft = g_new0(struct file_transfer, 1);
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
553 ft->cookie = g_strdup(cookie);
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
554 ft->ip = g_strdup(pip);
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
555 ft->port = port;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
556 if (i) ft->message = g_strdup(messages[0]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
557 else ft->message = NULL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
558 ft->filename = g_strdup(name);
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
559 ft->user = g_strdup(user);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
560 ft->size = totalsize;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
561 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
562 ft->gc = gc;
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
563
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
564 g_free(tmp);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
565 for (i--; i >= 0; i--) g_free(messages[i]);
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
566
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
567 accept_file_dialog(ft);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
568 } else if (!strcmp(uuid, FILE_GET_UID)) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
569 /* they want us to send a file */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
570 int unk[4], i;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
571 char *messages[4], *tmp;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
572 struct file_transfer *ft;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
573
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
574 for (i = 0; i < 4; i++) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
575 sscanf(strtok(NULL, ":"), "%d", unk + i);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
576 if (unk[i] == 10001) break;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
577 messages[i] = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
578 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
579 tmp = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
580
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
581 ft = g_new0(struct file_transfer, 1);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
582 ft->cookie = g_strdup(cookie);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
583 ft->ip = g_strdup(pip);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
584 ft->port = port;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
585 if (i) ft->message = g_strdup(messages[0]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
586 else ft->message = NULL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
587 ft->user = g_strdup(user);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
588 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
589 ft->gc = gc;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
590
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
591 g_free(tmp);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
592 for (i--; i >= 0; i--) g_free(messages[i]);
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
593
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
594 accept_file_dialog(ft);
369
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 351
diff changeset
595 } else if (!strcmp(uuid, VOICE_UID)) {
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 351
diff changeset
596 /* oh goody. voice over ip. fun stuff. */
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
597 } else if (!strcmp(uuid, B_ICON_UID)) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
598 /* buddy icon... */
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
599 } else if (!strcmp(uuid, IMAGE_UID)) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
600 /* aka Direct IM */
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
601 } else {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
602 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
603 /* 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
604 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
605 } else {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
606 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
607 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
608 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
609
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
610 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
611 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
612 GSList *grp = gc->groups;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
613 GSList *mem;
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
614 struct group *g;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
615 struct buddy *b;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
616 GSList *plist = gc->permit;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
617 GSList *dlist = gc->deny;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
618
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
619 int pos=0;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
620
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
621 if (!gc->permdeny)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
622 gc->permdeny = 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
624 pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny);
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
625 while(grp) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
626 g = (struct group *)grp->data;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
627 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name);
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
628 mem = g->members;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
629 while(mem) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
630 b = (struct buddy *)mem->data;
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
631 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name,
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
632 show ? ":" : "", show ? b->show : "");
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
633 mem = mem->next;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
634 }
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 930
diff changeset
635 grp = g_slist_next(grp);
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
636 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
637
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
638 while(plist) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
639 pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data);
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
640 plist=plist->next;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
641 }
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
642
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
643 while(dlist) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
644 pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data);
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
645 dlist=dlist->next;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
646 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
647 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
648
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
649 void parse_toc_buddy_list(struct gaim_connection *gc, char *config, int from_do_import)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
650 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
651 char *c;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
652 char current[256];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
653 char *name;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
654 GList *bud;
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
655 int how_many = 0;
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
656
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
657 bud = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
658
332
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
659 if (config != NULL) {
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
660
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
661 /* skip "CONFIG:" (if it exists)*/
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
662 c = strncmp(config + sizeof(struct sflap_hdr),"CONFIG:",strlen("CONFIG:"))?
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
663 strtok(config, "\n"):
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
664 strtok(config + sizeof(struct sflap_hdr)+strlen("CONFIG:"), "\n");
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
665 do {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
666 if (c == NULL)
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
667 break;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
668 if (*c == 'g') {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
669 strncpy(current,c+2, sizeof(current));
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
670 add_group(gc, current);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
671 how_many++;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
672 } else if (*c == 'b' && !find_buddy(gc, c+2)) {
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
673 char nm[80], sw[80], *tmp = c+2;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
674 int i = 0;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
675 while (*tmp != ':' && *tmp)
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
676 nm[i++] = *tmp++;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
677 if (*tmp == ':') *tmp++ = '\0';
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
678 nm[i] = '\0';
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
679 i = 0;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
680 while (*tmp) sw[i++] = *tmp++;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
681 sw[i] = '\0';
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
682 if (!find_buddy(gc, nm))
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
683 add_buddy(gc, current, nm, sw);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
684 how_many++;
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
685
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
686 bud = g_list_append(bud, c+2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
687 } else if (*c == 'p') {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
688 GSList *d = gc->permit;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
689 char *n;
863
55194c5f338f [gaim-migrate @ 873]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 793
diff changeset
690 name = g_malloc(strlen(c+2) + 2);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
691 g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
692 n = g_strdup(normalize(name));
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
693 while (d) {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
694 if (!strcasecmp(n, normalize(d->data)))
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
695 break;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
696 d = d->next;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
697 }
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
698 g_free(n);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
699 if (!d)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
700 gc->permit = g_slist_append(gc->permit, name);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
701 } else if (*c == 'd') {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
702 GSList *d = gc->deny;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
703 char *n;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
704 name = g_malloc(strlen(c+2) + 2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
705 g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
706 n = g_strdup(normalize(name));
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
707 while (d) {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
708 if (!strcasecmp(n, normalize(d->data)))
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
709 break;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
710 d = d->next;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
711 }
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
712 g_free(n);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
713 if (!d)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
714 gc->deny = g_slist_append(gc->deny, name);
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
715 } else if (!strncmp("toc", c, 3)) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
716 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
717 sprintf(debug_buff, "permdeny: %d\n", gc->permdeny);
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
718 debug_print(debug_buff);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
719 if (gc->permdeny == 0)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
720 gc->permdeny = 1;
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
721 } else if (*c == 'm') {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
722 sscanf(c + 2, "%d", &gc->permdeny);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
723 sprintf(debug_buff, "permdeny: %d\n", gc->permdeny);
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
724 debug_print(debug_buff);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
725 if (gc->permdeny == 0)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
726 gc->permdeny = 1;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
727 }
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
728 } while((c=strtok(NULL,"\n")));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
729 #if 0
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
730 fprintf(stdout, "Sending message '%s'\n",buf);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
731 #endif
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
732
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
733 if (bud != NULL) serv_add_buddies(gc, bud);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
734 serv_set_permit_deny(gc);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
735 if (blist) {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
736 build_edit_tree();
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
737 }
332
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
738 }
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
739
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
740 /* perhaps the server dropped the buddy list, try importing from
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
741 cache */
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
742
296
a88b889b692b [gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 285
diff changeset
743 if ( how_many == 0 && !from_do_import ) {
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
744 do_import( (GtkWidget *) NULL, gc );
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
745 } else if ( gc && (bud_list_cache_exists(gc) == FALSE) ) {
229
e8ea7f37e28f [gaim-migrate @ 239]
Syd Logan <slogan>
parents: 228
diff changeset
746 do_export( (GtkWidget *) NULL, 0 );
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
747 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
748 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
749
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
750 static char *toc_name() {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
751 return "TOC";
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
752 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
753
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
754 static void toc_send_im(struct gaim_connection *gc, char *name, char *message, int away) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
755 char buf[MSG_LEN - 7];
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 escape_text(message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
758 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
759 message, ((away) ? " auto" : ""));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
760 sflap_send(gc, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
761 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
762
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
763 static void toc_get_info(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
764 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
765 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
766 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
767 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
768
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
769 static void toc_get_dir(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
770 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
771 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
772 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
773 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
774
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
775 static void toc_set_dir(struct gaim_connection *g, char *first, char *middle, char *last,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
776 char *maiden, char *city, char *state, char *country, int web) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
777 char buf2[BUF_LEN*4], buf[BUF_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
778 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
779 middle, last, maiden, city, state, country,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
780 (web == 1) ? "Y" : "");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
781 escape_text(buf2);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
782 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
783 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
784 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
785
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
786 static void toc_dir_search(struct gaim_connection *g, char *first, char *middle, char *last,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
787 char *maiden, char *city, char *state, char *country, char *email) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
788 char buf[BUF_LONG];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
789 g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
790 last, maiden, city, state, country, email);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
791 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
792 city, state, country);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
793 debug_print(debug_buff);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
794 sflap_send(g, buf, -1, TYPE_DATA);
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
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
797 static void toc_set_away(struct gaim_connection *g, char *message) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
798 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
799 if (message) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
800 escape_text(message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
801 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
802 } else
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
803 g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
804 sflap_send(g, buf, -1, TYPE_DATA);
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
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
807 static void toc_set_info(struct gaim_connection *g, char *info) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
808 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
809 escape_text(info);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
810 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info);
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
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
814 static void toc_change_passwd(struct gaim_connection *g, char *orig, char *new) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
815 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
816 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
817 sflap_send(g, buf, strlen(buf), TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
818 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
819
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
820 static void toc_add_buddy(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
821 char buf[1024];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
822 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
823 sflap_send(g, buf, -1, TYPE_DATA);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
824 toc_set_config(g);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
825 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
826
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
827 static void toc_add_buddies(struct gaim_connection *g, GList *buddies) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
828 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
829 int n;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
830
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
831 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
832 while (buddies) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
833 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 16) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
834 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
835 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
836 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
837 n += g_snprintf(buf + n, sizeof(buf)-n, " %s", normalize(buddies->data));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
838 buddies = buddies->next;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
839 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
840 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
841 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
842
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
843 static void toc_remove_buddy(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
844 char buf[1024];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
845 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
846 sflap_send(g, buf, -1, TYPE_DATA);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
847 toc_set_config(g);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
848 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
849
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
850 static void toc_set_idle(struct gaim_connection *g, int time) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
851 char buf[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
852 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
853 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
854 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
855
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
856 static void toc_warn(struct gaim_connection *g, char *name, int anon) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
857 char send[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
858 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
859 sflap_send(g, send, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
860 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
861
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
862 static void toc_accept_chat(struct gaim_connection *g, int i) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
863 char buf[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
864 g_snprintf(buf, 255, "toc_chat_accept %d", i);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
865 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
866 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
867
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
868 static void toc_join_chat(struct gaim_connection *g, int exchange, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
869 char buf[BUF_LONG];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
870 g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
871 sflap_send(g, buf, -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
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
874 static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
875 char buf[BUF_LONG];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
876 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
877 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
878 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
879
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
880 static void toc_chat_leave(struct gaim_connection *g, int id) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
881 char buf[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
882 g_snprintf(buf, 255, "toc_chat_leave %d", id);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
883 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
884 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
885
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
886 static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
887 char buf2[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
888 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
889 sflap_send(g, buf2, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
890 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
891
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
892 static void toc_chat_send(struct gaim_connection *g, int id, char *message) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
893 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
894 escape_text(message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
895 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
896 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
897 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
898
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
899 static void toc_keepalive(struct gaim_connection *gc) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
900 sflap_send(gc, "", 0, TYPE_KEEPALIVE);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
901 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
902
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
903 static char **toc_list_icon(int uc) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
904 if (uc & UC_UNAVAILABLE)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
905 return (char **)away_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
906 if (uc & UC_AOL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
907 return (char **)aol_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
908 if (uc & UC_NORMAL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
909 return (char **)free_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
910 if (uc & UC_ADMIN)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
911 return (char **)admin_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
912 if (uc & UC_UNCONFIRMED)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
913 return (char **)dt_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
914 return NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
915 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
916
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
917 static void toc_info(GtkObject *obj, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
918 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
919 serv_get_info(gc, who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
920 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
921
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
922 static void toc_dir_info(GtkObject *obj, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
923 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
924 serv_get_dir(gc, who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
925 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
926
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
927 static void toc_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
928 GtkWidget *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 button = gtk_menu_item_new_with_label(_("Get Info"));
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
931 gtk_signal_connect(GTK_OBJECT(button), "activate",
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
932 GTK_SIGNAL_FUNC(toc_info), who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
933 gtk_object_set_user_data(GTK_OBJECT(button), gc);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
934 gtk_menu_append(GTK_MENU(menu), button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
935 gtk_widget_show(button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
936
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
937 button = gtk_menu_item_new_with_label(_("Get Dir Info"));
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
938 gtk_signal_connect(GTK_OBJECT(button), "activate",
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
939 GTK_SIGNAL_FUNC(toc_dir_info), who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
940 gtk_object_set_user_data(GTK_OBJECT(button), gc);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
941 gtk_menu_append(GTK_MENU(menu), button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
942 gtk_widget_show(button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
943 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
944
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
945 static void toc_print_option(GtkEntry *entry, struct aim_user *user) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
946 int entrynum;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
947
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
948 entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
949
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
950 if (entrynum == USEROPT_AUTH) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
951 g_snprintf(user->proto_opt[USEROPT_AUTH],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
952 sizeof(user->proto_opt[USEROPT_AUTH]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
953 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
954 } else if (entrynum == USEROPT_AUTHPORT) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
955 g_snprintf(user->proto_opt[USEROPT_AUTHPORT],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
956 sizeof(user->proto_opt[USEROPT_AUTHPORT]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
957 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
958 } else if (entrynum == USEROPT_SOCKSHOST) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
959 g_snprintf(user->proto_opt[USEROPT_SOCKSHOST],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
960 sizeof(user->proto_opt[USEROPT_SOCKSHOST]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
961 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
962 } else if (entrynum == USEROPT_SOCKSPORT) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
963 g_snprintf(user->proto_opt[USEROPT_SOCKSPORT],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
964 sizeof(user->proto_opt[USEROPT_SOCKSPORT]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
965 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
966 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
967 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
968
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
969 static void toc_print_optionrad(GtkRadioButton *entry, struct aim_user *user) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
970 int entrynum;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
971
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
972 entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
973
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
974 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
975 sizeof(user->proto_opt[USEROPT_PROXYTYPE]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
976 "%d", entrynum);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
977 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
978
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
979 static void toc_user_opts(GtkWidget *book, struct aim_user *user) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
980 /* so here, we create the new notebook page */
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
981 GtkWidget *vbox;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
982 GtkWidget *hbox;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
983 GtkWidget *label;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
984 GtkWidget *entry;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
985 GtkWidget *first, *opt;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
986
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
987 vbox = gtk_vbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
988 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox,
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
989 gtk_label_new("TOC Options"));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
990 gtk_widget_show(vbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
991
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
992
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
993 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
994 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
995 gtk_widget_show(hbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
996
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
997 label = gtk_label_new("TOC Host:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
998 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
999 gtk_widget_show(label);
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 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1002 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1003 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1004 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1005 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1006 if (user->proto_opt[USEROPT_AUTH][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1007 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1008 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
1009 } else
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1010 gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1011 gtk_widget_show(entry);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1012
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1013 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1014 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1015 gtk_widget_show(hbox);
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 label = gtk_label_new("TOC Port:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1019 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1020 gtk_widget_show(label);
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 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1023 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1024 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1025 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1026 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1027 if (user->proto_opt[USEROPT_AUTHPORT][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1028 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1029 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
1030 } else
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1031 gtk_entry_set_text(GTK_ENTRY(entry), "9898");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1032
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1033 gtk_widget_show(entry);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1034
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1035
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1036 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1037 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1038 gtk_widget_show(hbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1039
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1040 label = gtk_label_new("Proxy Host:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1041 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1042 gtk_widget_show(label);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1043
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1044 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1045 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1046 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1047 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1048 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1049 if (user->proto_opt[USEROPT_SOCKSHOST][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_SOCKSHOST]);
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_SOCKSHOST]);
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
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1055
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1056 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1057 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1058 gtk_widget_show(hbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1059
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1060 label = gtk_label_new("Proxy Port:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1061 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1062 gtk_widget_show(label);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1063
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1064 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1065 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1066 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1067 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1068 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1069 if (user->proto_opt[USEROPT_SOCKSPORT][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1070 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSPORT]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1071 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
1072 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1073 gtk_widget_show(entry);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1074
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1075
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1076 first = gtk_radio_button_new_with_label(NULL, "No proxy");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1077 gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1078 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1079 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
1080 gtk_widget_show(first);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1081 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1082 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1083
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1084 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1085 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1086 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1087 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
1088 gtk_widget_show(opt);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1089 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1090 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1091
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1092 opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1093 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1094 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1095 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
1096 gtk_widget_show(opt);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1097 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1098 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1099
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1100 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
1101 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1102 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1103 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
1104 gtk_widget_show(opt);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1105 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1106 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1107 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1108
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1109 void toc_init(struct prpl *ret) {
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1110 ret->protocol = PROTO_TOC;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1111 ret->name = toc_name;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
1112 ret->list_icon = toc_list_icon;
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1113 ret->action_menu = toc_action_menu;
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1114 ret->user_opts = toc_user_opts;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1115 ret->login = toc_login;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1116 ret->close = toc_close;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1117 ret->send_im = toc_send_im;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1118 ret->set_info = toc_set_info;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1119 ret->get_info = toc_get_info;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1120 ret->set_away = toc_set_away;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1121 ret->get_away_msg = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1122 ret->set_dir = toc_set_dir;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1123 ret->get_dir = toc_get_dir;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1124 ret->dir_search = toc_dir_search;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1125 ret->set_idle = toc_set_idle;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1126 ret->change_passwd = toc_change_passwd;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1127 ret->add_buddy = toc_add_buddy;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1128 ret->add_buddies = toc_add_buddies;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1129 ret->remove_buddy = toc_remove_buddy;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1130 ret->add_permit = NULL; /* FIXME */
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1131 ret->add_deny = NULL;
1038
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
1132 ret->rem_permit = NULL;
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
1133 ret->rem_deny = NULL;
daad2440a642 [gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1032
diff changeset
1134 ret->set_permit_deny = NULL;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1135 ret->warn = toc_warn;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1136 ret->accept_chat = toc_accept_chat;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1137 ret->join_chat = toc_join_chat;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1138 ret->chat_invite = toc_chat_invite;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1139 ret->chat_leave = toc_chat_leave;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1140 ret->chat_whisper = toc_chat_whisper;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1141 ret->chat_send = toc_chat_send;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1142 ret->keepalive = toc_keepalive;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1143 }