annotate src/toc.c @ 1250:b5783215b245

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