annotate src/toc.c @ 1182:bab9f3dc07f8

[gaim-migrate @ 1192] i hope this doesn't break things. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 01 Dec 2000 14:57:56 +0000
parents 3063e6743913
children 66a70fbb2b09
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
1182
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
50 #define REVISION "gaim:$Revision: 1192 $"
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_close(struct gaim_connection *gc) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
156 if (gc->inpa > 0)
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
157 gdk_input_remove(gc->inpa);
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
158 gc->inpa = -1;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
159 close(((struct toc_data *)gc->proto_data)->toc_fd);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
160 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
161
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
162 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
163 int len;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
164 int slen=0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
165 struct sflap_hdr hdr;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166 char obuf[MSG_LEN];
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
167 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
168
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
169 if (tdt->state == STATE_PAUSE)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
170 /* 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
171 * so we just return here like everything went through fine */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
172 return 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
173
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
174 /* One _last_ 2048 check here! This shouldn't ever
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
175 * get hit though, hopefully. If it gets hit on an IM
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
176 * 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
177 * but this'll stop a segfault. */
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
178 if (strlen(buf) > (MSG_LEN - sizeof(hdr))) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
179 debug_printf("message too long, truncating\n");
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
180 buf[MSG_LEN - sizeof(hdr) - 3] = '"';
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
181 buf[MSG_LEN - sizeof(hdr) - 2] = '\0';
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 966
diff changeset
182 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
183
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
184 if (olen < 0)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
185 len = escape_message(buf);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
186 else
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
187 len = olen;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
188 hdr.ast = '*';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
189 hdr.type = type;
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
190 hdr.seqno = htons(tdt->seqno++ & 0xffff);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
191 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
192
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
193 memcpy(obuf, &hdr, sizeof(hdr));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
194 slen += sizeof(hdr);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
195 memcpy(&obuf[slen], buf, len);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
196 slen += len;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
197 if (type != TYPE_SIGNON) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
198 obuf[slen]='\0';
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
199 slen += 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
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
202 return write(tdt->toc_fd, obuf, slen);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
203 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
204
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
205 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
206 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
207 struct sflap_hdr *hdr;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
208 int ret;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
209
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
210 if (read(tdt->toc_fd, buffer, sizeof(struct sflap_hdr)) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
211 debug_printf("error, couldn't read flap header\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
212 return -1;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 50
diff changeset
213 }
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 50
diff changeset
214
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
215 hdr = (struct sflap_hdr *)buffer;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
216
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
217 if (buflen < ntohs(hdr->len)) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
218 /* fake like there's a read error */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
219 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
220 return -1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
221 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
222
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
223 if (ntohs(hdr->len) > 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
224 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
225 buffer[sizeof(struct sflap_hdr) + ret] = '\0';
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
226 return ret;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
227 } else return 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
228 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
230 static unsigned char *roast_password(char *pass) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
231 /* Trivial "encryption" */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
232 static char rp[256];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
233 static char *roast = ROAST;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
234 int pos=2;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
235 int x;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
236 strcpy(rp, "0x");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
237 for (x=0;(x<150) && pass[x]; x++)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
238 pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % strlen(roast)]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
239 rp[pos]='\0';
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
240 return rp;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
241 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
242
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
243 static void toc_callback(gpointer data, gint source, GdkInputCondition condition) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
244 struct gaim_connection *gc = (struct gaim_connection *)data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
245 struct toc_data *tdt = (struct toc_data *)gc->proto_data;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
246 struct sflap_hdr *hdr;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
247 struct signon so;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
248 char buf[8 * 1024], *c;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
249 char snd[MSG_LEN];
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 if (condition & GDK_INPUT_EXCEPTION) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
252 debug_printf("gdk_input exception! check internet connection\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
253 hide_login_progress(gc, _("Connection Closed"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
254 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
255 return;
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 50
diff changeset
256 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
258 /* there's data waiting to be read, so read it. */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
259 if (wait_reply(gc, buf, 8 * 1024) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
260 hide_login_progress(gc, _("Connection Closed"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
261 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
262 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
263 }
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
264
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
265 if (tdt->state == STATE_FLAPON) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
266 hdr = (struct sflap_hdr *)buf;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
267 if (hdr->type != TYPE_SIGNON)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
268 debug_printf("problem, hdr->type != TYPE_SIGNON\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
269 else
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
270 debug_printf("* TOC sends Client FLAP SIGNON\n");
998
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
271 tdt->seqno = ntohs(hdr->seqno);
70c685de2be5 [gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 988
diff changeset
272 tdt->state = STATE_SIGNON_REQUEST;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
273
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
274 debug_printf("* Client sends TOC FLAP SIGNON\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
275 g_snprintf(so.username, sizeof(so.username), "%s", gc->username);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
276 so.ver = htonl(1);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
277 so.tag = htons(1);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
278 so.namelen = htons(strlen(so.username));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
279 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
280 hide_login_progress(gc, _("Disconnected."));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
281 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
282 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
283 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
284
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
285 debug_printf("* Client sends TOC \"toc_signon\" message\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
286 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
287 AUTH_HOST, AUTH_PORT, normalize(gc->username),
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
288 roast_password(gc->password), LANGUAGE, REVISION);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
289 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
290 hide_login_progress(gc, _("Disconnected."));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
291 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
292 return;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
293 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
295 set_login_progress(gc, 3, _("Waiting for reply..."));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
296 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
297 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
298
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
299 if (tdt->state == STATE_SIGNON_REQUEST) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
300 debug_printf("* TOC sends client SIGN_ON reply\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
301 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
302 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
303 hide_login_progress(gc, _("Authentication Failed"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
304 signoff(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
305 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
306 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
307 /* 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
308 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
309
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
310 /* 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
311 * 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
312 * the callback in a better state if we get CONFIG anyway */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
313
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
314 tdt->state = STATE_ONLINE;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
315
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
316 account_online(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
317 serv_finish_login(gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
318
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
319 do_import(0, gc);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
321 /* Client sends TOC toc_init_done message */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
322 debug_printf("* Client sends TOC toc_init_done message\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
323 g_snprintf(snd, sizeof snd, "toc_init_done");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
324 sflap_send(gc, snd, -1, TYPE_DATA);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
325
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
326 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
327 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
328 sflap_send(gc, snd, -1, TYPE_DATA);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
329
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
330 return;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
331 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
332
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
333 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
334
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
335 c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
336
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
337 if (!strcasecmp(c, "SIGN_ON")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
338 /* we should only get here after a PAUSE */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
339 if (tdt->state != STATE_PAUSE)
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
340 debug_printf("got SIGN_ON but not PAUSE!\n");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
341 else {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
342 tdt->state = STATE_ONLINE;
1146
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
343 g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"",
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
344 AUTH_HOST, AUTH_PORT, normalize(gc->username),
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
345 roast_password(gc->password), LANGUAGE, REVISION);
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
346 if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
347 hide_login_progress(gc, _("Disconnected."));
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
348 signoff(gc);
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
349 return;
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
350 }
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
351 do_import(0, gc);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
352 g_snprintf(snd, sizeof snd, "toc_init_done");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
353 sflap_send(gc, snd, -1, TYPE_DATA);
1146
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
354 do_error_dialog(_("TOC has come back from its pause. You may now send"
22f3c32a28f6 [gaim-migrate @ 1156]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
355 " messages again."), _("TOC Resume"));
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
356 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
357 } else if (!strcasecmp(c, "CONFIG")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
358 c = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
359 parse_toc_buddy_list(gc, c, 0);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
360 } else if (!strcasecmp(c, "NICK")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
361 c = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
362 g_snprintf(gc->username, sizeof(gc->username), "%s", c);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
363 } else if (!strcasecmp(c, "IM_IN")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
364 char *away, *message;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
365 int a = 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
366
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
367 c = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
368 away = strtok(NULL, ":");
1112
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
369
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
370 message = away;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
371 while (*message && (*message != ':')) message++;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
372 message++;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
373
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
374 a = (away && (*away == 'T')) ? 1 : 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
375
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
376 serv_got_im(gc, c, message, a);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
377 } else if (!strcasecmp(c, "UPDATE_BUDDY")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
378 char *l, *uc;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
379 int logged, evil, idle, type = 0;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
380 time_t signon, time_idle;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
381
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
382 c = strtok(NULL, ":"); /* name */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
383 l = strtok(NULL, ":"); /* online */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
384 sscanf(strtok(NULL, ":"), "%d", &evil);
1114
c61f9c384413 [gaim-migrate @ 1124]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1113
diff changeset
385 sscanf(strtok(NULL, ":"), "%ld", &signon);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
386 sscanf(strtok(NULL, ":"), "%d", &idle);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
387 uc = strtok(NULL, ":");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
388
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
389 logged = (l && (*l == 'T')) ? 1 : 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
390
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
391 if (uc[0] == 'A') type |= UC_AOL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
392 switch (uc[1]) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
393 case 'A':
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 type |= UC_ADMIN;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
395 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
396 case 'U':
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
397 type |= UC_UNCONFIRMED;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
398 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
399 case 'O':
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
400 type |= UC_NORMAL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
401 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402 default:
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404 }
1132
028295b1f1b3 [gaim-migrate @ 1142]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1118
diff changeset
405 if (uc[2] == 'U') type |= UC_UNAVAILABLE;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
406
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
407 if (idle) { time(&time_idle); time_idle -= idle * 60; }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
408 else time_idle = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
409
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
410 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
411 } else if (!strcasecmp(c, "ERROR")) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
412 c = strtok(NULL, ":");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
413 show_error_dialog(c);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
414 } else if (!strcasecmp(c, "EVILED")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
415 int lev;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
416 char *name;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
417
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
418 sscanf(strtok(NULL, ":"), "%d", &lev);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
419 name = strtok(NULL, ":");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
420
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1089
diff changeset
421 serv_got_eviled(gc, name, lev);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
422 } else if (!strcasecmp(c, "CHAT_JOIN")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
423 char *name;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
424 int id;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
425
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
426 sscanf(strtok(NULL, ":"), "%d", &id);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
427 name = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
428
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
429 serv_got_joined_chat(gc, id, name);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
430 } else if (!strcasecmp(c, "CHAT_IN")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
431 int id, w;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
432 char *m, *who, *whisper;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
433
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
434 sscanf(strtok(NULL, ":"), "%d", &id);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
435 who = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
436 whisper = strtok(NULL, ":");
1112
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
437 m = whisper;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
438 while (*m && (*m != ':')) m++;
3f56704a09bd [gaim-migrate @ 1122]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1106
diff changeset
439 m++;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
440
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
441 w = (whisper && (*whisper == 'T')) ? 1 : 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
442
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
443 serv_got_chat_in(gc, id, who, w, m);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
444 } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
445 int id;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
446 char *in, *buddy;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
447 GSList *bcs = gc->buddy_chats;
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
448 struct conversation *b = NULL;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
449
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
450 sscanf(strtok(NULL, ":"), "%d", &id);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
451 in = strtok(NULL, ":");
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
452
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
453 while(bcs) {
472
6a92cd7322cc [gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 447
diff changeset
454 b = (struct conversation *)bcs->data;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
455 if (id == b->id)
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
456 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
457 bcs = bcs->next;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
458 b = NULL;
44
e3e7351cf70d [gaim-migrate @ 53]
Rob Flynn <gaim@robflynn.com>
parents: 10
diff changeset
459 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
460
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
461 if (!b) return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
462
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
463 if (in && (*in == 'T'))
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
464 while ((buddy = strtok(NULL, ":")) != NULL)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
465 add_chat_buddy(b, buddy);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
466 else
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
467 while ((buddy = strtok(NULL, ":")) != NULL)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
468 remove_chat_buddy(b, buddy);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
469 } else if (!strcasecmp(c, "CHAT_INVITE")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
470 char *name, *who, *message;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
471 int id;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
472
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
473 name = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
474 sscanf(strtok(NULL, ":"), "%d", &id);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
475 who = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
476 message = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
477
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
478 serv_got_chat_invite(gc, name, id, who, message);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
479 } else if (!strcasecmp(c, "CHAT_LEFT")) {
1182
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
480 GSList *bcs = gc->buddy_chats;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
481 struct conversation *b = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
482 int id;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
483
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
484 sscanf(strtok(NULL, ":"), "%d", &id);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
485
1182
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
486 while (bcs) {
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
487 b = (struct conversation *)bcs->data;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
488 if (id == b->id)
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
489 break;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
490 b = NULL;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
491 bcs = bcs->next;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
492 }
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
493
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
494 if (!b)
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
495 return;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
496
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
497 if (b->window) {
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
498 char error_buf[BUF_LONG];
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
499 b->gc = NULL;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
500 g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected"
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
501 " from chat room %s."), b->name);
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
502 } else
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
503 serv_got_chat_left(gc, id);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
504 } else if (!strcasecmp(c, "GOTO_URL")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
505 char *name, *url, tmp[256];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
506
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
507 name = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
508 url = strtok(NULL, ":");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
509
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
510 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
511 g_show_info(gc->user, tmp);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
512 } else if (!strcasecmp(c, "DIR_STATUS")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
513 } else if (!strcasecmp(c, "ADMIN_NICK_STATUS")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
514 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
515 do_error_dialog(_("Password Change Successeful"), _("Gaim - Password Change"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
516 } else if (!strcasecmp(c, "PAUSE")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
517 tdt->state = STATE_PAUSE;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
518 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
519 " 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
520 " message. Gaim will prevent anything from going through. This"
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
521 " is only temporary, please be patient."), _("TOC Pause"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
522 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
523 char *user, *uuid, *cookie;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
524 int seq;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
525 char *rip, *pip, *vip;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
526 int port;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
527
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
528 user = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
529 uuid = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
530 cookie = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
531 sscanf(strtok(NULL, ":"), "%d", &seq);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
532 rip = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
533 pip = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
534 vip = strtok(NULL, ":");
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
535 sscanf(strtok(NULL, ":"), "%d", &port);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
536
197
24f0fef56a73 [gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 196
diff changeset
537 if (!strcmp(uuid, FILE_SEND_UID)) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
538 /* they want us to get a file */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
539 int unk[4], i;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
540 char *messages[4], *tmp, *name;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
541 int subtype, files, totalsize = 0;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
542 struct file_transfer *ft;
196
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 for (i = 0; i < 4; i++) {
1113
4efa1ca61a2a [gaim-migrate @ 1123]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1112
diff changeset
545 sscanf(strtok(NULL, ":"), "%d", &unk[i]);
4efa1ca61a2a [gaim-migrate @ 1123]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1112
diff changeset
546 if (unk[i] == 10001) break;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
547 messages[i] = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
548 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
549 tmp = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
550
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
551 subtype = tmp[1];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
552 files = tmp[3];
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
553
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
554 totalsize |= (tmp[4] << 24) & 0xff000000;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
555 totalsize |= (tmp[5] << 16) & 0x00ff0000;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
556 totalsize |= (tmp[6] << 8) & 0x0000ff00;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
557 totalsize |= (tmp[7] << 0) & 0x000000ff;
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
558
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
559 if (!totalsize) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
560 g_free(tmp);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
561 for (i--; i >= 0; i--) g_free(messages[i]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
562 return;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
563 }
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
564
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
565 name = tmp + 8;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
566
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
567 ft = g_new0(struct file_transfer, 1);
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
568 ft->cookie = g_strdup(cookie);
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
569 ft->ip = g_strdup(pip);
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
570 ft->port = port;
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
571 if (i) ft->message = g_strdup(messages[0]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
572 else ft->message = NULL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
573 ft->filename = g_strdup(name);
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
574 ft->user = g_strdup(user);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
575 ft->size = totalsize;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
576 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
577 ft->gc = gc;
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
578
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
579 g_free(tmp);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
580 for (i--; i >= 0; i--) g_free(messages[i]);
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
581
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
582 accept_file_dialog(ft);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
583 } else if (!strcmp(uuid, FILE_GET_UID)) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
584 /* they want us to send a file */
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
585 int unk[4], i;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
586 char *messages[4], *tmp;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
587 struct file_transfer *ft;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
588
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
589 for (i = 0; i < 4; i++) {
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
590 sscanf(strtok(NULL, ":"), "%d", unk + i);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
591 if (unk[i] == 10001) break;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
592 messages[i] = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
593 }
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
594 tmp = frombase64(strtok(NULL, ":"));
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
595
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
596 ft = g_new0(struct file_transfer, 1);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
597 ft->cookie = g_strdup(cookie);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
598 ft->ip = g_strdup(pip);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
599 ft->port = port;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
600 if (i) ft->message = g_strdup(messages[0]);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
601 else ft->message = NULL;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
602 ft->user = g_strdup(user);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
603 g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
604 ft->gc = gc;
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
605
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
606 g_free(tmp);
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
607 for (i--; i >= 0; i--) g_free(messages[i]);
198
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
608
73e9a0bfff62 [gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 197
diff changeset
609 accept_file_dialog(ft);
369
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 351
diff changeset
610 } else if (!strcmp(uuid, VOICE_UID)) {
cf895313fc50 [gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 351
diff changeset
611 /* oh goody. voice over ip. fun stuff. */
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
612 } else if (!strcmp(uuid, B_ICON_UID)) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
613 /* buddy icon... */
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
614 } else if (!strcmp(uuid, IMAGE_UID)) {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
615 /* aka Direct IM */
196
3042e11c1902 [gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 194
diff changeset
616 } else {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
617 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
618 /* 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
619 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
620 } else {
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
621 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
622 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
623 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
624
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
625 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
626 {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
627 GSList *grp = gc->groups;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
628 GSList *mem;
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
629 struct group *g;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
630 struct buddy *b;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
631 GSList *plist = gc->permit;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
632 GSList *dlist = gc->deny;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
633
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
634 int pos=0;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
635
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
636 if (!gc->permdeny)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
637 gc->permdeny = 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
638
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
639 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
640 while(grp) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
641 g = (struct group *)grp->data;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
642 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
643 mem = g->members;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
644 while(mem) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
645 b = (struct buddy *)mem->data;
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
646 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
647 show ? ":" : "", show ? b->show : "");
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
648 mem = mem->next;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
649 }
940
9fca1293f871 [gaim-migrate @ 950]
Rob Flynn <gaim@robflynn.com>
parents: 930
diff changeset
650 grp = g_slist_next(grp);
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
651 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
652
678
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
653 while(plist) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
654 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
655 plist=plist->next;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
656 }
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
657
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
658 while(dlist) {
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
659 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
660 dlist=dlist->next;
c72f58814e9f [gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 676
diff changeset
661 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
662 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
663
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
664 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
665 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
666 char *c;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
667 char current[256];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
668 char *name;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
669 GList *bud;
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
670 int how_many = 0;
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
671
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
672 bud = NULL;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
673
332
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
674 if (config != NULL) {
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
675
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
676 /* skip "CONFIG:" (if it exists)*/
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
677 c = strncmp(config + sizeof(struct sflap_hdr),"CONFIG:",strlen("CONFIG:"))?
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
678 strtok(config, "\n"):
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
679 strtok(config + sizeof(struct sflap_hdr)+strlen("CONFIG:"), "\n");
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
680 do {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
681 if (c == NULL)
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
682 break;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
683 if (*c == 'g') {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
684 strncpy(current,c+2, sizeof(current));
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
685 add_group(gc, current);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
686 how_many++;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
687 } else if (*c == 'b' && !find_buddy(gc, c+2)) {
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
688 char nm[80], sw[80], *tmp = c+2;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
689 int i = 0;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
690 while (*tmp != ':' && *tmp)
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
691 nm[i++] = *tmp++;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
692 if (*tmp == ':') *tmp++ = '\0';
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
693 nm[i] = '\0';
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
694 i = 0;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
695 while (*tmp) sw[i++] = *tmp++;
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
696 sw[i] = '\0';
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
697 if (!find_buddy(gc, nm))
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
698 add_buddy(gc, current, nm, sw);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
699 how_many++;
710
efd72a117875 [gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 681
diff changeset
700
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
701 bud = g_list_append(bud, c+2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
702 } else if (*c == 'p') {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
703 GSList *d = gc->permit;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
704 char *n;
863
55194c5f338f [gaim-migrate @ 873]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 793
diff changeset
705 name = g_malloc(strlen(c+2) + 2);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
706 g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
707 n = g_strdup(normalize(name));
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
708 while (d) {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
709 if (!strcasecmp(n, normalize(d->data)))
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
710 break;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
711 d = d->next;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
712 }
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
713 g_free(n);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
714 if (!d)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
715 gc->permit = g_slist_append(gc->permit, name);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
716 } else if (*c == 'd') {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
717 GSList *d = gc->deny;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
718 char *n;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
719 name = g_malloc(strlen(c+2) + 2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
720 g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
721 n = g_strdup(normalize(name));
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
722 while (d) {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
723 if (!strcasecmp(n, normalize(d->data)))
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
724 break;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
725 d = d->next;
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
726 }
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
727 g_free(n);
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
728 if (!d)
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
729 gc->deny = g_slist_append(gc->deny, name);
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
730 } else if (!strncmp("toc", c, 3)) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
731 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
732 sprintf(debug_buff, "permdeny: %d\n", gc->permdeny);
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
733 debug_print(debug_buff);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
734 if (gc->permdeny == 0)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
735 gc->permdeny = 1;
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
736 } else if (*c == 'm') {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
737 sscanf(c + 2, "%d", &gc->permdeny);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
738 sprintf(debug_buff, "permdeny: %d\n", gc->permdeny);
793
57cc66fbfa8e [gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 774
diff changeset
739 debug_print(debug_buff);
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
740 if (gc->permdeny == 0)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
741 gc->permdeny = 1;
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
742 }
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
743 } while((c=strtok(NULL,"\n")));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
744 #if 0
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
745 fprintf(stdout, "Sending message '%s'\n",buf);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
746 #endif
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
747
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
748 if (bud != NULL) serv_add_buddies(gc, bud);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
749 serv_set_permit_deny(gc);
681
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
750 if (blist) {
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
751 build_edit_tree();
5422dbecd861 [gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 678
diff changeset
752 }
332
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
753 }
b573f33c5e0e [gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 318
diff changeset
754
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
755 /* perhaps the server dropped the buddy list, try importing from
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
756 cache */
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
757
296
a88b889b692b [gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 285
diff changeset
758 if ( how_many == 0 && !from_do_import ) {
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
759 do_import( (GtkWidget *) NULL, gc );
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 940
diff changeset
760 } else if ( gc && (bud_list_cache_exists(gc) == FALSE) ) {
229
e8ea7f37e28f [gaim-migrate @ 239]
Syd Logan <slogan>
parents: 228
diff changeset
761 do_export( (GtkWidget *) NULL, 0 );
228
f3b61c04f44e [gaim-migrate @ 238]
Syd Logan <slogan>
parents: 217
diff changeset
762 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
763 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
764
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
765 static char *toc_name() {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
766 return "TOC";
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_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
770 char buf[MSG_LEN - 7];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
771
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
772 escape_text(message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
773 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
774 message, ((away) ? " auto" : ""));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
775 sflap_send(gc, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
776 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
777
1118
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
778 static void toc_set_config(struct gaim_connection *gc) {
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
779 char buf[MSG_LEN], snd[MSG_LEN];
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
780 toc_build_config(gc, buf, MSG_LEN, FALSE);
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
781 g_snprintf(snd, MSG_LEN, "toc_set_config \"%s\"", buf);
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
782 sflap_send(gc, snd, -1, TYPE_DATA);
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
783 }
e1078ee286ba [gaim-migrate @ 1128]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1114
diff changeset
784
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
785 static void toc_get_info(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
786 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
787 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
788 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
789 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
790
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
791 static void toc_get_dir(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
792 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
793 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
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_dir(struct gaim_connection *g, char *first, char *middle, char *last,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
798 char *maiden, char *city, char *state, char *country, int web) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
799 char buf2[BUF_LEN*4], buf[BUF_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
800 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
801 middle, last, maiden, city, state, country,
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
802 (web == 1) ? "Y" : "");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
803 escape_text(buf2);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
804 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
805 sflap_send(g, buf, -1, TYPE_DATA);
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
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
808 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
809 char *maiden, char *city, char *state, char *country, char *email) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
810 char buf[BUF_LONG];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
811 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
812 last, maiden, city, state, country, email);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
813 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
814 city, state, country);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
815 debug_print(debug_buff);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
816 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
817 }
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 static void toc_set_away(struct gaim_connection *g, char *message) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
820 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
821 if (message) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
822 escape_text(message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
823 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
824 } else
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
825 g_snprintf(buf, MSG_LEN, "toc_set_away \"\"");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
826 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
827 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
828
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
829 static void toc_set_info(struct gaim_connection *g, char *info) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
830 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
831 escape_text(info);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
832 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
833 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
834 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
835
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
836 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
837 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
838 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
839 sflap_send(g, buf, strlen(buf), TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
840 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
841
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
842 static void toc_add_buddy(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
843 char buf[1024];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
844 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
845 sflap_send(g, buf, -1, TYPE_DATA);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
846 toc_set_config(g);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
847 }
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 static void toc_add_buddies(struct gaim_connection *g, GList *buddies) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
850 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
851 int n;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
852
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
853 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
854 while (buddies) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
855 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 16) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
856 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
857 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
858 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
859 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
860 buddies = buddies->next;
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 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
863 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
864
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
865 static void toc_remove_buddy(struct gaim_connection *g, char *name) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
866 char buf[1024];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
867 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
868 sflap_send(g, buf, -1, TYPE_DATA);
1106
5bc8fdacd2cb [gaim-migrate @ 1116]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1100
diff changeset
869 toc_set_config(g);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
870 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
871
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
872 static void toc_set_idle(struct gaim_connection *g, int time) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
873 char buf[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
874 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
875 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
876 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
877
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
878 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
879 char send[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
880 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
881 sflap_send(g, send, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
882 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
883
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
884 static void toc_accept_chat(struct gaim_connection *g, int i) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
885 char buf[256];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
886 g_snprintf(buf, 255, "toc_chat_accept %d", i);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
887 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
888 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
889
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
890 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
891 char buf[BUF_LONG];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
892 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
893 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
894 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
895
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
896 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
897 char buf[BUF_LONG];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
898 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
899 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
900 }
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 static void toc_chat_leave(struct gaim_connection *g, int id) {
1182
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
903 GSList *bcs = g->buddy_chats;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
904 struct conversation *b = NULL;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
905 char buf[256];
1182
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
906
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
907 while (bcs) {
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
908 b = (struct conversation *)bcs->data;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
909 if (id == b->id)
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
910 break;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
911 b = NULL;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
912 bcs = bcs->next;
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
913 }
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
914
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
915 if (!b)
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
916 return; /* can this happen? */
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
917
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
918 if (!b->gc) /* TOC already kicked us out of this room */
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
919 serv_got_chat_left(g, id);
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
920 else {
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
921 g_snprintf(buf, 255, "toc_chat_leave %d", id);
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
922 sflap_send(g, buf, -1, TYPE_DATA);
bab9f3dc07f8 [gaim-migrate @ 1192]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1153
diff changeset
923 }
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
924 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
925
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
926 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
927 char buf2[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
928 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
929 sflap_send(g, buf2, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
930 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
931
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
932 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
933 char buf[MSG_LEN];
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
934 escape_text(message);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
935 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
936 sflap_send(g, buf, -1, TYPE_DATA);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
937 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
938
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
939 static void toc_keepalive(struct gaim_connection *gc) {
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
940 sflap_send(gc, "", 0, TYPE_KEEPALIVE);
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
941 }
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
942
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
943 static char **toc_list_icon(int uc) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
944 if (uc & UC_UNAVAILABLE)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
945 return (char **)away_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
946 if (uc & UC_AOL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
947 return (char **)aol_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
948 if (uc & UC_NORMAL)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
949 return (char **)free_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
950 if (uc & UC_ADMIN)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
951 return (char **)admin_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
952 if (uc & UC_UNCONFIRMED)
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
953 return (char **)dt_icon_xpm;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
954 return NULL;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
955 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
956
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
957 static void toc_info(GtkObject *obj, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
958 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
959 serv_get_info(gc, who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
960 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
961
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
962 static void toc_dir_info(GtkObject *obj, char *who) {
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
963 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
964 serv_get_dir(gc, who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
965 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
966
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
967 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
968 GtkWidget *button;
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
969
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
970 button = gtk_menu_item_new_with_label(_("Get Info"));
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
971 gtk_signal_connect(GTK_OBJECT(button), "activate",
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
972 GTK_SIGNAL_FUNC(toc_info), who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
973 gtk_object_set_user_data(GTK_OBJECT(button), gc);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
974 gtk_menu_append(GTK_MENU(menu), button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
975 gtk_widget_show(button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
976
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
977 button = gtk_menu_item_new_with_label(_("Get Dir Info"));
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
978 gtk_signal_connect(GTK_OBJECT(button), "activate",
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
979 GTK_SIGNAL_FUNC(toc_dir_info), who);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
980 gtk_object_set_user_data(GTK_OBJECT(button), gc);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
981 gtk_menu_append(GTK_MENU(menu), button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
982 gtk_widget_show(button);
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
983 }
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
984
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
985 static void toc_print_option(GtkEntry *entry, struct aim_user *user) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
986 int entrynum;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
987
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
988 entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
989
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
990 if (entrynum == USEROPT_AUTH) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
991 g_snprintf(user->proto_opt[USEROPT_AUTH],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
992 sizeof(user->proto_opt[USEROPT_AUTH]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
993 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
994 } else if (entrynum == USEROPT_AUTHPORT) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
995 g_snprintf(user->proto_opt[USEROPT_AUTHPORT],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
996 sizeof(user->proto_opt[USEROPT_AUTHPORT]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
997 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
998 } else if (entrynum == USEROPT_SOCKSHOST) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
999 g_snprintf(user->proto_opt[USEROPT_SOCKSHOST],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1000 sizeof(user->proto_opt[USEROPT_SOCKSHOST]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1001 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1002 } else if (entrynum == USEROPT_SOCKSPORT) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1003 g_snprintf(user->proto_opt[USEROPT_SOCKSPORT],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1004 sizeof(user->proto_opt[USEROPT_SOCKSPORT]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1005 "%s", gtk_entry_get_text(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1006 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1007 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1008
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1009 static void toc_print_optionrad(GtkRadioButton *entry, struct aim_user *user) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1010 int entrynum;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1011
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1012 entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1013
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1014 g_snprintf(user->proto_opt[USEROPT_PROXYTYPE],
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1015 sizeof(user->proto_opt[USEROPT_PROXYTYPE]),
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1016 "%d", entrynum);
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
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1019 static void toc_user_opts(GtkWidget *book, struct aim_user *user) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1020 /* so here, we create the new notebook page */
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1021 GtkWidget *vbox;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1022 GtkWidget *hbox;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1023 GtkWidget *label;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1024 GtkWidget *entry;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1025 GtkWidget *first, *opt;
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1026
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1027 vbox = gtk_vbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1028 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox,
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1029 gtk_label_new("TOC Options"));
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1030 gtk_widget_show(vbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1031
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 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1034 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1035 gtk_widget_show(hbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1036
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1037 label = gtk_label_new("TOC Host:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1038 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1039 gtk_widget_show(label);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1040
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1041 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1042 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1043 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1044 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1045 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1046 if (user->proto_opt[USEROPT_AUTH][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1047 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1048 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
1049 } else
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1050 gtk_entry_set_text(GTK_ENTRY(entry), "toc.oscar.aol.com");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1051 gtk_widget_show(entry);
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 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1054 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1055 gtk_widget_show(hbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1056
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1057
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1058 label = gtk_label_new("TOC Port:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1059 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1060 gtk_widget_show(label);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1061
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1062 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1063 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1064 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1065 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1066 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1067 if (user->proto_opt[USEROPT_AUTHPORT][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1068 debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1069 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
1070 } else
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1071 gtk_entry_set_text(GTK_ENTRY(entry), "9898");
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 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1077 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1078 gtk_widget_show(hbox);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1079
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1080 label = gtk_label_new("Proxy Host:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1081 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1082 gtk_widget_show(label);
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 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1085 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1086 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1087 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1088 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1089 if (user->proto_opt[USEROPT_SOCKSHOST][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1090 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSHOST]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1091 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
1092 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1093 gtk_widget_show(entry);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1094
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1095
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1096 hbox = gtk_hbox_new(FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1097 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1098 gtk_widget_show(hbox);
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 label = gtk_label_new("Proxy Port:");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1101 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1102 gtk_widget_show(label);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1103
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1104 entry = gtk_entry_new();
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1105 gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1106 gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1107 gtk_signal_connect(GTK_OBJECT(entry), "changed",
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1108 GTK_SIGNAL_FUNC(toc_print_option), user);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1109 if (user->proto_opt[USEROPT_SOCKSPORT][0]) {
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1110 debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSPORT]);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1111 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
1112 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1113 gtk_widget_show(entry);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1114
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1115
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1116 first = gtk_radio_button_new_with_label(NULL, "No proxy");
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1117 gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1118 gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1119 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
1120 gtk_widget_show(first);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1121 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1122 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1123
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1124 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
1125 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1126 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1127 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
1128 gtk_widget_show(opt);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1129 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1130 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1131
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1132 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
1133 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1134 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1135 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
1136 gtk_widget_show(opt);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1137 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS5)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1138 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1139
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1140 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
1141 gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1142 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_HTTP);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1143 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
1144 gtk_widget_show(opt);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1145 if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_HTTP)
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1146 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1147 }
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1148
1145
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1149 static void toc_add_permit(struct gaim_connection *gc, char *who) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1150 char buf2[MSG_LEN];
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1151 if (gc->permdeny != 3) return;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1152 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who));
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1153 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1154 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1155
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1156 static void toc_add_deny(struct gaim_connection *gc, char *who) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1157 char buf2[MSG_LEN];
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1158 if (gc->permdeny != 4) return;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1159 g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who));
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1160 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1161 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1162
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1163 static void toc_set_permit_deny(struct gaim_connection *gc) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1164 char buf2[MSG_LEN];
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1165 GSList *list;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1166 int at;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1167
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1168 switch (gc->permdeny) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1169 case 1:
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1170 /* permit all, deny none. to get here reliably we need to have been in permit
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1171 * mode, and send an empty toc_add_deny message, which will switch us to deny none */
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1172 g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1173 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1174 g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1175 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1176 break;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1177 case 2:
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1178 /* deny all, permit none. to get here reliably we need to have been in deny
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1179 * mode, and send an empty toc_add_permit message, which will switch us to permit none */
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1180 g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1181 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1182 g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1183 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1184 break;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1185 case 3:
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1186 /* permit some. we want to switch to deny mode first, then send the toc_add_permit
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1187 * message, which will clear and set our permit list. toc sucks. */
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1188 g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1189 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1190
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1191 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1192 list = gc->permit;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1193 while (list) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1194 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data));
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1195 if (at > MSG_LEN + 32) /* from out my ass comes greatness */ {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1196 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1197 at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1198 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1199 list = list->next;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1200 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1201 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1202 break;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1203 case 4:
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1204 /* deny some. we want to switch to permit mode first, then send the toc_add_deny
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1205 * message, which will clear and set our deny list. toc sucks. */
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1206 g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1207 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1208
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1209 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1210 list = gc->deny;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1211 while (list) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1212 at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data));
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1213 if (at > MSG_LEN + 32) /* from out my ass comes greatness */ {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1214 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1215 at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1216 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1217 list = list->next;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1218 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1219 sflap_send(gc, buf2, -1, TYPE_DATA);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1220 break;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1221 default:
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1222 break;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1223 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1224 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1225
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1226 static void toc_rem_permit(struct gaim_connection *gc, char *who) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1227 if (gc->permdeny != 3) return;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1228 toc_set_permit_deny(gc);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1229 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1230
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1231 static void toc_rem_deny(struct gaim_connection *gc, char *who) {
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1232 if (gc->permdeny != 4) return;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1233 toc_set_permit_deny(gc);
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1234 }
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1235
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 998
diff changeset
1236 void toc_init(struct prpl *ret) {
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1237 ret->protocol = PROTO_TOC;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1238 ret->name = toc_name;
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1020
diff changeset
1239 ret->list_icon = toc_list_icon;
1032
643a4d81c18a [gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1030
diff changeset
1240 ret->action_menu = toc_action_menu;
1087
56c7ceb986a8 [gaim-migrate @ 1097]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1051
diff changeset
1241 ret->user_opts = toc_user_opts;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1242 ret->login = toc_login;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1243 ret->close = toc_close;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1244 ret->send_im = toc_send_im;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1245 ret->set_info = toc_set_info;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1246 ret->get_info = toc_get_info;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1247 ret->set_away = toc_set_away;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1248 ret->get_away_msg = NULL;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1249 ret->set_dir = toc_set_dir;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1250 ret->get_dir = toc_get_dir;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1251 ret->dir_search = toc_dir_search;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1252 ret->set_idle = toc_set_idle;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1253 ret->change_passwd = toc_change_passwd;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1254 ret->add_buddy = toc_add_buddy;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1255 ret->add_buddies = toc_add_buddies;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1256 ret->remove_buddy = toc_remove_buddy;
1145
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1257 ret->add_permit = toc_add_permit;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1258 ret->add_deny = toc_add_deny;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1259 ret->rem_permit = toc_rem_permit;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1260 ret->rem_deny = toc_add_deny;
cd96ca1aed02 [gaim-migrate @ 1155]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1132
diff changeset
1261 ret->set_permit_deny = toc_set_permit_deny;
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1262 ret->warn = toc_warn;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1263 ret->accept_chat = toc_accept_chat;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1264 ret->join_chat = toc_join_chat;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1265 ret->chat_invite = toc_chat_invite;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1266 ret->chat_leave = toc_chat_leave;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1267 ret->chat_whisper = toc_chat_whisper;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1268 ret->chat_send = toc_chat_send;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1269 ret->keepalive = toc_keepalive;
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 980
diff changeset
1270 }