Mercurial > pidgin
annotate src/toc.c @ 1047:ece2d1543b20
[gaim-migrate @ 1057]
Plugins now use GModule. Protocol plugins can be dynamically updated.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 01 Nov 2000 22:30:36 +0000 |
parents | daad2440a642 |
children | 713b0e14e0a9 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 | |
23 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
25 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
333
diff
changeset
|
26 #endif |
1 | 27 #include <netdb.h> |
28 #include <gtk/gtk.h> | |
29 #include <unistd.h> | |
30 #include <errno.h> | |
31 #include <netinet/in.h> | |
32 #include <arpa/inet.h> | |
33 #include <string.h> | |
34 #include <stdlib.h> | |
35 #include <stdio.h> | |
36 #include <time.h> | |
37 #include <sys/socket.h> | |
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 | 40 #include "gaim.h" |
41 #include "gnome_applet_mgr.h" | |
42 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
43 #include "pixmaps/admin_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
44 #include "pixmaps/aol_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
45 #include "pixmaps/away_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
46 #include "pixmaps/dt_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
47 #include "pixmaps/free_icon.xpm" |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
48 |
1038
daad2440a642
[gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
49 #define REVISION "gaim:$Revision: 1048 $" |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
50 |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
51 struct toc_data { |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
52 int toc_fd; |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
53 int seqno; |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
54 int state; |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
55 }; |
1 | 56 |
57 | |
58 static unsigned int peer_ver=0; | |
59 #ifdef _WIN32 | |
60 static int win32_r; | |
61 #endif | |
62 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
63 static int toc_signon(struct gaim_connection *); |
1 | 64 |
65 | |
66 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
67 /* 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
|
68 * 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
|
69 * on success. */ |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
70 void toc_login(struct aim_user *user) |
1 | 71 { |
72 char *config; | |
73 struct in_addr *sin; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
74 struct gaim_connection *gc; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
75 struct toc_data *tdt; |
1 | 76 char buf[80]; |
77 char buf2[2048]; | |
78 | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
79 gc = new_gaim_conn(PROTO_TOC, user->username, user->password); |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
80 gc->proto_data = tdt = g_new0(struct toc_data, 1); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
81 |
1 | 82 g_snprintf(buf, sizeof(buf), "Looking up %s", aim_host); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
83 set_login_progress(gc, 1, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
84 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
85 gtk_main_iteration(); |
1 | 86 |
87 sin = (struct in_addr *)get_address(aim_host); | |
88 if (!sin) { | |
89 g_snprintf(buf, sizeof(buf), "Unable to lookup %s", aim_host); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
90 hide_login_progress(gc, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
91 destroy_gaim_conn(gc); |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
92 return; |
1 | 93 } |
94 | |
95 g_snprintf(toc_addy, sizeof(toc_addy), "%s", inet_ntoa(*sin)); | |
96 g_snprintf(buf, sizeof(buf), "Connecting to %s", inet_ntoa(*sin)); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
97 set_login_progress(gc, 2, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
98 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
99 gtk_main_iteration(); |
1 | 100 |
101 | |
102 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
103 tdt->toc_fd = connect_address(sin->s_addr, aim_port); |
1 | 104 |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
105 if (tdt->toc_fd < 0) { |
1 | 106 g_snprintf(buf, sizeof(buf), "Connect to %s failed", |
107 inet_ntoa(*sin)); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
108 hide_login_progress(gc, buf); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
109 destroy_gaim_conn(gc); |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
110 return; |
1 | 111 } |
112 | |
113 g_free(sin); | |
114 | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
115 g_snprintf(buf, sizeof(buf), "Signon: %s", gc->username); |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
116 set_login_progress(gc, 3, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
117 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
118 gtk_main_iteration(); |
1 | 119 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
120 if (toc_signon(gc) < 0) { |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
121 hide_login_progress(gc, "Disconnected."); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
122 destroy_gaim_conn(gc); |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
123 return; |
1 | 124 } |
125 | |
126 g_snprintf(buf, sizeof(buf), "Waiting for reply..."); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
127 set_login_progress(gc, 4, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
128 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
129 gtk_main_iteration(); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
130 if (toc_wait_signon(gc) < 0) { |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
131 hide_login_progress(gc, "Authentication Failed"); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
132 destroy_gaim_conn(gc); |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
133 return; |
1 | 134 } |
135 | |
980
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
136 sprintf(gc->user_info, "%s", user->user_info); |
82c5865f7cfe
[gaim-migrate @ 990]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
978
diff
changeset
|
137 gc->options = user->options; |
1 | 138 save_prefs(); |
139 | |
140 g_snprintf(buf, sizeof(buf), "Retrieving config..."); | |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
141 set_login_progress(gc, 5, buf); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
142 while (gtk_events_pending()) |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
143 gtk_main_iteration(); |
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
144 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
145 account_online(user, gc); |
1002
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
146 serv_finish_login(gc); |
1d8f05ea6bdf
[gaim-migrate @ 1012]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
147 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
148 config = toc_wait_config(gc); |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
149 tdt->state = STATE_ONLINE; |
1 | 150 |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
151 if (config != NULL) |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
152 parse_toc_buddy_list(gc, config, 0); |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
153 else |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
154 do_import(0, gc); |
1 | 155 |
156 g_snprintf(buf2, sizeof(buf2), "toc_init_done"); | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
157 sflap_send(gc, buf2, -1, TYPE_DATA); |
1 | 158 |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
159 g_snprintf(buf2, sizeof(buf2), "toc_set_caps %s %s %s %s %s", |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
160 FILE_SEND_UID, FILE_GET_UID, B_ICON_UID, IMAGE_UID, |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
161 VOICE_UID); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
162 sflap_send(gc, buf2, -1, TYPE_DATA); |
149 | 163 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
164 if (gc->keepalive < 0) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
165 update_keepalive(gc, gc->options & OPT_USR_KEEPALV); |
1 | 166 } |
167 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
168 void toc_close(struct gaim_connection *gc) |
1 | 169 { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
170 if (gc->protocol != PROTO_TOC) return; /* how did this happen? */ |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
171 if (gc->inpa > 0) |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
172 gdk_input_remove(gc->inpa); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
173 gc->inpa = -1; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
174 close(((struct toc_data *)gc->proto_data)->toc_fd); |
1 | 175 } |
176 | |
177 unsigned char *roast_password(char *pass) | |
178 { | |
179 /* Trivial "encryption" */ | |
180 static char rp[256]; | |
181 static char *roast = ROAST; | |
182 int pos=2; | |
183 int x; | |
184 strcpy(rp, "0x"); | |
185 for (x=0;(x<150) && pass[x]; x++) | |
186 pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % strlen(roast)]); | |
187 rp[pos]='\0'; | |
188 return rp; | |
189 } | |
190 | |
191 | |
192 char *print_header(void *hdr_v) | |
193 { | |
194 static char s[80]; | |
195 struct sflap_hdr *hdr = (struct sflap_hdr *)hdr_v; | |
196 g_snprintf(s,sizeof(s), "[ ast: %c, type: %d, seqno: %d, len: %d ]", | |
197 hdr->ast, hdr->type, ntohs(hdr->seqno), ntohs(hdr->len)); | |
198 return s; | |
199 } | |
200 | |
201 void print_buffer(char *buf, int len) | |
202 { | |
203 #if 0 | |
204 int x; | |
205 printf("[ "); | |
206 for (x=0;x<len;x++) | |
207 printf("%d ", buf[x]); | |
208 printf("]\n"); | |
209 printf("[ "); | |
210 for (x=0;x<len;x++) | |
211 printf("%c ", buf[x]); | |
212 printf("]\n"); | |
213 #endif | |
214 } | |
215 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
216 int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type) |
1 | 217 { |
218 int len; | |
219 int slen=0; | |
220 struct sflap_hdr hdr; | |
221 char obuf[MSG_LEN]; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
222 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1 | 223 |
970 | 224 /* One _last_ 2048 check here! This shouldn't ever |
225 * get hit though, hopefully. If it gets hit on an IM | |
226 * It'll lose the last " and the message won't go through, | |
227 * but this'll stop a segfault. */ | |
228 if (strlen(buf) > (MSG_LEN - sizeof(hdr))) { | |
229 buf[MSG_LEN - sizeof(hdr) - 3] = '"'; | |
230 buf[MSG_LEN - sizeof(hdr) - 2] = '\0'; | |
231 } | |
1 | 232 |
970 | 233 debug_printf("%s [Len %d]\n", buf, strlen(buf)); |
1 | 234 |
235 if (olen < 0) | |
236 len = escape_message(buf); | |
237 else | |
238 len = olen; | |
239 hdr.ast = '*'; | |
240 hdr.type = type; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
241 hdr.seqno = htons(tdt->seqno++ & 0xffff); |
1 | 242 hdr.len = htons(len + (type == TYPE_SIGNON ? 0 : 1)); |
243 | |
244 sprintf(debug_buff,"Escaped message is '%s'\n",buf); | |
245 debug_print(debug_buff); | |
246 | |
247 memcpy(obuf, &hdr, sizeof(hdr)); | |
248 slen += sizeof(hdr); | |
249 memcpy(&obuf[slen], buf, len); | |
250 slen += len; | |
251 if (type != TYPE_SIGNON) { | |
252 obuf[slen]='\0'; | |
253 slen += 1; | |
254 } | |
255 print_buffer(obuf, slen); | |
256 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
257 return write(tdt->toc_fd, obuf, slen); |
1 | 258 } |
259 | |
260 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
261 static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) |
1 | 262 { |
79 | 263 size_t res=-1; |
264 int read_rv = -1; | |
1 | 265 struct sflap_hdr *hdr=(struct sflap_hdr *)buffer; |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
266 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1 | 267 char *c; |
268 | |
79 | 269 if(buflen < sizeof(struct sflap_hdr)) { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
270 do_error_dialog(_("Unable to read from server: Buffer too small"), |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
271 _("Gaim - Error (internal)")); |
79 | 272 return -1; |
273 } | |
274 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
275 while((read_rv = read(tdt->toc_fd, buffer, 1))) { |
79 | 276 if (read_rv < 0 || read_rv > 1) |
277 return -1; | |
1 | 278 if (buffer[0] == '*') |
279 break; | |
280 | |
281 } | |
282 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
283 read_rv = read(tdt->toc_fd, buffer+1, sizeof(struct sflap_hdr) - 1); |
1 | 284 |
79 | 285 if (read_rv < 0) |
286 return read_rv; | |
1 | 287 |
79 | 288 res = read_rv + 1; |
1 | 289 |
290 | |
291 sprintf(debug_buff, "Rcv: %s %s\n",print_header(buffer), ""); | |
292 debug_print(debug_buff); | |
293 | |
294 | |
79 | 295 if(buflen < sizeof(struct sflap_hdr) + ntohs(hdr->len) + 1) { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
296 do_error_dialog(_("Unable to read from server: Too much information"), |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
297 _("Gaim - Error (internal)")); |
79 | 298 return -1; |
299 } | |
1 | 300 |
301 while (res < (sizeof(struct sflap_hdr) + ntohs(hdr->len))) { | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
302 read_rv = read(tdt->toc_fd, buffer + res, (ntohs(hdr->len) + sizeof(struct sflap_hdr)) - res); |
79 | 303 if(read_rv < 0) return read_rv; |
304 res += read_rv; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
305 /* my feeling is this will kill us. if there's data pending then we'll come right back |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
306 * to where we are now. possible workarounds are to remove the input watcher until |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
307 * we're done with this part |
1 | 308 while(gtk_events_pending()) |
309 gtk_main_iteration(); | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
310 */ |
1 | 311 } |
312 | |
313 if (res >= sizeof(struct sflap_hdr)) | |
314 buffer[res]='\0'; | |
315 else | |
316 return res - sizeof(struct sflap_hdr); | |
317 | |
318 switch(hdr->type) { | |
319 case TYPE_SIGNON: | |
320 memcpy(&peer_ver, buffer + sizeof(struct sflap_hdr), 4); | |
321 peer_ver = ntohl(peer_ver); | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
322 tdt->seqno = ntohs(hdr->seqno); |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
323 tdt->state = STATE_SIGNON_REQUEST; |
1 | 324 break; |
325 case TYPE_DATA: | |
326 if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "SIGN_ON:", strlen("SIGN_ON:"))) | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
327 tdt->state = STATE_SIGNON_ACK; |
1 | 328 else if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "CONFIG:", strlen("CONFIG:"))) { |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
329 tdt->state = STATE_CONFIG; |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
330 } else if (!strncasecmp(buffer + sizeof(struct sflap_hdr), "ERROR:", strlen("ERROR:"))) { |
1 | 331 c = strtok(buffer + sizeof(struct sflap_hdr) + strlen("ERROR:"), ":"); |
332 show_error_dialog(c); | |
333 } | |
334 | |
335 sprintf(debug_buff, "Data: %s\n",buffer + sizeof(struct sflap_hdr)); | |
336 debug_print(debug_buff); | |
337 | |
338 break; | |
339 default: | |
340 sprintf(debug_buff, "Unknown/unimplemented packet type %d\n",hdr->type); | |
341 debug_print(debug_buff); | |
342 } | |
343 return res; | |
344 } | |
345 | |
346 | |
347 | |
348 void toc_callback( gpointer data, | |
349 gint source, | |
350 GdkInputCondition condition ) | |
351 { | |
352 char *buf; | |
353 char *c; | |
354 char *l; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
355 struct gaim_connection *gc = (struct gaim_connection *)data; |
1 | 356 |
866
646acb9e9c38
[gaim-migrate @ 876]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
863
diff
changeset
|
357 buf = g_malloc(2 * BUF_LONG); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
358 if (wait_reply(gc, buf, 2 * BUF_LONG) < 0) { |
988
9523b772e546
[gaim-migrate @ 998]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
981
diff
changeset
|
359 hide_login_progress(gc, "Connection Closed"); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
360 signoff(gc); /* this will free gc for us */ |
1 | 361 g_free(buf); |
362 return; | |
363 } | |
364 | |
365 | |
366 c=strtok(buf+sizeof(struct sflap_hdr),":"); /* Ditch the first part */ | |
367 if (!strcasecmp(c,"UPDATE_BUDDY")) { | |
368 char *uc; | |
369 int logged, evil, idle, type = 0; | |
370 time_t signon; | |
371 time_t time_idle; | |
372 | |
373 c = strtok(NULL,":"); /* c is name */ | |
374 | |
375 l = strtok(NULL,":"); /* l is T/F logged status */ | |
376 | |
377 sscanf(strtok(NULL, ":"), "%d", &evil); | |
378 | |
379 sscanf(strtok(NULL, ":"), "%ld", &signon); | |
380 | |
381 sscanf(strtok(NULL, ":"), "%d", &idle); | |
382 | |
383 uc = strtok(NULL, ":"); | |
384 | |
385 | |
386 if (!strncasecmp(l,"T",1)) | |
387 logged = 1; | |
388 else | |
389 logged = 0; | |
390 | |
391 | |
392 if (uc[0] == 'A') | |
393 type |= UC_AOL; | |
394 | |
395 switch(uc[1]) { | |
396 case 'A': | |
397 type |= UC_ADMIN; | |
398 break; | |
399 case 'U': | |
400 type |= UC_UNCONFIRMED; | |
401 break; | |
402 case 'O': | |
403 type |= UC_NORMAL; | |
404 break; | |
405 default: | |
406 break; | |
407 } | |
408 | |
409 switch(uc[2]) { | |
410 case 'U': | |
411 type |= UC_UNAVAILABLE; | |
412 break; | |
413 default: | |
414 break; | |
415 } | |
416 | |
417 if (idle) { | |
418 time(&time_idle); | |
419 time_idle -= idle*60; | |
420 } else | |
421 time_idle = 0; | |
422 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
423 serv_got_update(gc, c, logged, evil, signon, time_idle, type, 0); |
1 | 424 |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
425 } else if (!strcasecmp(c, "CONFIG")) { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
426 /* do we want to load the buddy list again here? */ |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
301
diff
changeset
|
427 c = strtok(NULL,":"); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
428 parse_toc_buddy_list(gc, c, 0); |
1 | 429 } else if (!strcasecmp(c, "ERROR")) { |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
430 /* This should be handled by wait_reply |
1 | 431 c = strtok(NULL,":"); |
432 show_error_dialog(c); | |
301
f905caee43ca
[gaim-migrate @ 311]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
300
diff
changeset
|
433 */ |
1 | 434 } else if (!strcasecmp(c, "NICK")) { |
435 c = strtok(NULL,":"); | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
436 g_snprintf(gc->username, sizeof(gc->username), "%s", c); |
1 | 437 } else if (!strcasecmp(c, "IM_IN")) { |
438 char *away, *message; | |
439 int a = 0; | |
440 | |
441 c = strtok(NULL,":"); | |
442 away = strtok(NULL,":"); | |
443 | |
444 message = away; | |
445 | |
446 while(*message && (*message != ':')) | |
447 message++; | |
448 | |
449 message++; | |
450 | |
451 if (!strncasecmp(away, "T", 1)) | |
452 a = 1; | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
453 serv_got_im(gc, c, message, a); |
1 | 454 |
455 } else if (!strcasecmp(c, "GOTO_URL")) { | |
456 char *name; | |
457 char *url; | |
458 | |
459 char tmp[256]; | |
460 | |
461 name = strtok(NULL, ":"); | |
462 url = strtok(NULL, ":"); | |
463 | |
464 | |
465 g_snprintf(tmp, sizeof(tmp), "http://%s:%d/%s", toc_addy, aim_port, url); | |
466 /* fprintf(stdout, "Name: %s\n%s\n", name, url); | |
467 printf("%s", grab_url(tmp));*/ | |
468 g_show_info(tmp); | |
469 } else if (!strcasecmp(c, "EVILED")) { | |
470 int lev; | |
471 char *name = NULL; | |
472 | |
473 sscanf(strtok(NULL, ":"), "%d", &lev); | |
474 name = strtok(NULL, ":"); | |
475 | |
476 sprintf(debug_buff,"%s | %d\n", name, lev); | |
477 debug_print(debug_buff); | |
478 | |
479 serv_got_eviled(name, lev); | |
480 | |
481 } else if (!strcasecmp(c, "CHAT_JOIN")) { | |
482 char *name; | |
483 int id; | |
484 | |
485 | |
486 sscanf(strtok(NULL, ":"), "%d", &id); | |
487 name = strtok(NULL, ":"); | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
488 serv_got_joined_chat(gc, id, name); |
1 | 489 |
490 } else if (!strcasecmp(c, "DIR_STATUS")) { | |
149 | 491 } else if (!strcasecmp(c, "ADMIN_PASSWD_STATUS")) { |
492 do_error_dialog("Password Change Successeful", "Gaim - Password Change"); | |
1 | 493 } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) { |
494 int id; | |
495 char *in; | |
496 char *buddy; | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
497 GSList *bcs = gc->buddy_chats; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
498 struct conversation *b = NULL; |
1 | 499 |
500 sscanf(strtok(NULL, ":"), "%d", &id); | |
501 | |
502 in = strtok(NULL, ":"); | |
503 | |
504 while(bcs) { | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
505 b = (struct conversation *)bcs->data; |
1 | 506 if (id == b->id) |
507 break; | |
508 bcs = bcs->next; | |
509 b = NULL; | |
510 } | |
511 | |
44 | 512 if (!b) { |
45 | 513 g_free(buf); |
1 | 514 return; |
44 | 515 } |
1 | 516 |
517 | |
518 if (!strcasecmp(in, "T")) { | |
519 while((buddy = strtok(NULL, ":")) != NULL) { | |
520 add_chat_buddy(b, buddy); | |
521 } | |
522 } else { | |
523 while((buddy = strtok(NULL, ":")) != NULL) { | |
524 remove_chat_buddy(b, buddy); | |
525 } | |
526 } | |
527 | |
528 } else if (!strcasecmp(c, "CHAT_LEFT")) { | |
529 int id; | |
530 | |
531 | |
532 sscanf(strtok(NULL, ":"), "%d", &id); | |
533 | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
534 serv_got_chat_left(gc, id); |
1 | 535 |
536 | |
537 } else if (!strcasecmp(c, "CHAT_IN")) { | |
538 | |
539 int id, w; | |
540 char *m; | |
541 char *who, *whisper; | |
542 | |
543 | |
544 sscanf(strtok(NULL, ":"), "%d", &id); | |
545 who = strtok(NULL, ":"); | |
546 whisper = strtok(NULL, ":"); | |
547 m = whisper; | |
548 while(*m && (*m != ':')) m++; | |
549 m++; | |
550 | |
551 if (!strcasecmp(whisper, "T")) | |
552 w = 1; | |
553 else | |
554 w = 0; | |
555 | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
556 serv_got_chat_in(gc, id, who, w, m); |
1 | 557 |
558 | |
559 } else if (!strcasecmp(c, "CHAT_INVITE")) { | |
560 char *name; | |
561 char *who; | |
562 char *message; | |
563 int id; | |
564 | |
565 | |
566 name = strtok(NULL, ":"); | |
567 sscanf(strtok(NULL, ":"), "%d", &id); | |
568 who = strtok(NULL, ":"); | |
569 message = strtok(NULL, ":"); | |
570 | |
964
2cd7b73e2c9a
[gaim-migrate @ 974]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
960
diff
changeset
|
571 serv_got_chat_invite(gc, name, id, who, message); |
1 | 572 |
573 | |
574 } else if (!strcasecmp(c, "RVOUS_PROPOSE")) { | |
575 char *user; | |
576 char *uuid; | |
577 char *cookie; | |
578 int seq; | |
579 char *rip, *pip, *vip; | |
580 int port; | |
581 int unk[4]; | |
582 char *messages[4]; | |
583 int subtype, files, totalsize; | |
584 char *name; | |
585 char *tmp; | |
586 int i; | |
587 struct file_transfer *ft; | |
588 | |
589 | |
590 user = strtok(NULL, ":"); | |
591 uuid = strtok(NULL, ":"); | |
592 cookie = strtok(NULL, ":"); | |
593 sscanf(strtok(NULL, ":"), "%d", &seq); | |
594 rip = strtok(NULL, ":"); | |
595 pip = strtok(NULL, ":"); | |
596 vip = strtok(NULL, ":"); | |
597 sscanf(strtok(NULL, ":"), "%d", &port); | |
598 | |
197
24f0fef56a73
[gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
196
diff
changeset
|
599 if (!strcmp(uuid, FILE_SEND_UID)) { |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
600 /* we're getting a file */ |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
601 for (i=0; i<4; i++) { |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
602 sscanf(strtok(NULL, ":"), "%d", &unk[i]); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
603 if (unk[i] == 10001) |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
604 break; |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
605 messages[i] = frombase64(strtok(NULL, ":")); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
606 } |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
607 tmp = frombase64(strtok(NULL, ":")); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
608 subtype = tmp[1]; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
609 files = tmp[3]; /* These are fine */ |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
610 |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
611 totalsize = 0; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
612 totalsize |= (tmp[4] << 24) & 0xff000000; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
613 totalsize |= (tmp[5] << 16) & 0x00ff0000; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
614 totalsize |= (tmp[6] << 8) & 0x0000ff00; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
615 totalsize |= (tmp[7] << 0) & 0x000000ff; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
616 |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
617 name = tmp + 8; |
1 | 618 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
619 ft = g_new0(struct file_transfer, 1); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
620 |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
621 ft->cookie = g_strdup(cookie); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
622 ft->ip = g_strdup(pip); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
623 ft->port = port; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
624 if (i) |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
625 ft->message = g_strdup(messages[0]); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
626 else |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
627 ft->message = NULL; |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
628 ft->filename = g_strdup(name); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
629 ft->user = g_strdup(user); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
630 ft->size = totalsize; |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
631 sprintf(ft->UID, "%s", FILE_SEND_UID); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
632 ft->gc = gc; |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
633 |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
634 g_free(tmp); |
1 | 635 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
636 for (i--; i >= 0; i--) |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
637 g_free(messages[i]); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
638 |
507
d17547ff9c2a
[gaim-migrate @ 517]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
639 if (totalsize) /* sanity check */ |
d17547ff9c2a
[gaim-migrate @ 517]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
472
diff
changeset
|
640 accept_file_dialog(ft); |
197
24f0fef56a73
[gaim-migrate @ 207]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
196
diff
changeset
|
641 } else if (!strcmp(uuid, FILE_GET_UID)) { |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
642 /* we're sending a file */ |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
643 for (i=0; i<4; i++) { |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
644 sscanf(strtok(NULL, ":"), "%d", &unk[i]); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
645 if (unk[i] == 10001) |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
646 break; |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
647 messages[i] = frombase64(strtok(NULL, ":")); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
648 } |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
649 tmp = frombase64(strtok(NULL, ":")); |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
650 ft = g_new0(struct file_transfer, 1); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
651 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
652 ft->cookie = g_strdup(cookie); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
653 ft->ip = g_strdup(pip); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
654 ft->port = port; |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
655 if (i) |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
656 ft->message = g_strdup(messages[0]); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
657 else |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
658 ft->message = NULL; |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
659 ft->user = g_strdup(user); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
660 sprintf(ft->UID, "%s", FILE_GET_UID); |
978
563c409e26a1
[gaim-migrate @ 988]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
976
diff
changeset
|
661 ft->gc = gc; |
198
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
662 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
663 g_free(tmp); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
664 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
665 for (i--; i >= 0; i--) |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
666 g_free(messages[i]); |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
667 |
73e9a0bfff62
[gaim-migrate @ 208]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
197
diff
changeset
|
668 accept_file_dialog(ft); |
369
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
669 } else if (!strcmp(uuid, VOICE_UID)) { |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
670 /* oh goody. voice over ip. fun stuff. */ |
cf895313fc50
[gaim-migrate @ 379]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
351
diff
changeset
|
671 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
672 /* |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
673 } else if (!strcmp(uuid, B_ICON_UID)) { |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
674 } else if (!strcmp(uuid, IMAGE_UID)) { |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
675 */ |
1 | 676 |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
677 } else { |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
678 sprintf(debug_buff,"don't know what to do with %s\n", |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
679 uuid); |
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
680 debug_print(debug_buff); |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
681 tmp = g_malloc(BUF_LEN); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
682 name = frombase64(cookie); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
683 snprintf(tmp, BUF_LEN, "toc_rvous_cancel %s %s %s", |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
684 user, name, uuid); |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
685 sflap_send(gc, tmp, strlen(tmp), TYPE_DATA); |
211
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
686 free(name); |
2042a38da38b
[gaim-migrate @ 221]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
208
diff
changeset
|
687 free(tmp); |
196
3042e11c1902
[gaim-migrate @ 206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
194
diff
changeset
|
688 } |
1 | 689 } else { |
690 sprintf(debug_buff,"don't know what to do with %s\n", c); | |
691 debug_print(debug_buff); | |
692 } | |
693 g_free(buf); | |
694 } | |
695 | |
696 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
697 int toc_signon(struct gaim_connection *gc) |
1 | 698 { |
699 char buf[BUF_LONG]; | |
700 int res; | |
701 struct signon so; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
702 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
1 | 703 |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
704 sprintf(debug_buff,"State = %d\n", tdt->state); |
1 | 705 debug_print(debug_buff); |
706 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
707 if ((res = write(tdt->toc_fd, FLAPON, strlen(FLAPON))) < 0) |
1 | 708 return res; |
709 /* Wait for signon packet */ | |
710 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
711 tdt->state = STATE_FLAPON; |
1 | 712 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
713 if ((res = wait_reply(gc, buf, sizeof(buf)) < 0)) |
1 | 714 return res; |
715 | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
716 if (tdt->state != STATE_SIGNON_REQUEST) { |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
717 sprintf(debug_buff, "State should be %d, but is %d instead\n", STATE_SIGNON_REQUEST, tdt->state); |
1 | 718 debug_print(debug_buff); |
719 return -1; | |
720 } | |
721 | |
722 /* Compose a response */ | |
723 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
724 g_snprintf(so.username, sizeof(so.username), "%s", gc->username); |
1 | 725 so.ver = ntohl(1); |
726 so.tag = ntohs(1); | |
727 so.namelen = htons(strlen(so.username)); | |
728 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
729 sflap_send(gc, (char *)&so, ntohs(so.namelen) + 8, TYPE_SIGNON); |
1 | 730 |
731 g_snprintf(buf, sizeof(buf), | |
732 "toc_signon %s %d %s %s %s \"%s\"", | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
733 login_host, login_port, normalize(gc->username), roast_password(gc->password), LANGUAGE, REVISION); |
1 | 734 |
735 sprintf(debug_buff,"Send: %s\n", buf); | |
736 debug_print(debug_buff); | |
737 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
738 return sflap_send(gc, buf, -1, TYPE_DATA); |
1 | 739 } |
740 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
741 int toc_wait_signon(struct gaim_connection *gc) |
1 | 742 { |
743 /* Wait for the SIGNON to be approved */ | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
744 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
351
22161278657c
[gaim-migrate @ 361]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
745 char buf[BUF_LONG]; |
1 | 746 int res; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
747 res = wait_reply(gc, buf, sizeof(buf)); |
1 | 748 if (res < 0) |
749 return res; | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
750 if (tdt->state != STATE_SIGNON_ACK) { |
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
751 sprintf(debug_buff, "State should be %d, but is %d instead\n",STATE_SIGNON_ACK, tdt->state); |
1 | 752 debug_print(debug_buff); |
753 return -1; | |
754 } | |
755 return 0; | |
756 } | |
757 | |
758 #ifdef _WIN32 | |
759 gint win32_read() | |
760 { | |
761 int ret; | |
762 struct fd_set fds; | |
763 struct timeval tv; | |
764 | |
765 FD_ZERO(&fds); | |
766 | |
767 tv.tv_sec = 0; | |
768 tv.tv_usec = 200; | |
769 | |
770 FD_SET(toc_fd, &fds); | |
771 | |
772 ret = select(toc_fd + 1, &fds, NULL, NULL, &tv); | |
773 | |
774 if (ret == 0) { | |
775 return TRUE; | |
776 } | |
777 | |
778 toc_callback(NULL, 0, (GdkInputCondition)0); | |
779 return TRUE; | |
780 } | |
781 #endif | |
782 | |
783 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
784 char *toc_wait_config(struct gaim_connection *gc) |
1 | 785 { |
786 /* Waits for configuration packet, returning the contents of the packet */ | |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
787 struct toc_data *tdt = (struct toc_data *)gc->proto_data; |
351
22161278657c
[gaim-migrate @ 361]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
788 static char buf[BUF_LONG]; |
1 | 789 int res; |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
790 res = wait_reply(gc, buf, sizeof(buf)); |
1 | 791 if (res < 0) |
792 return NULL; | |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
793 /* Apparently, the toc_config is optional. *VERY* Optional |
285 | 794 */ |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
795 if (tdt->state != STATE_CONFIG) { |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
796 res = 0; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
797 } else { |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
798 res = 1; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
799 } |
1 | 800 /* At this point, it's time to setup automatic handling of incoming packets */ |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
801 tdt->state = STATE_ONLINE; |
1 | 802 #ifdef _WIN32 |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
803 win32_r = gtk_timeout_add(1000, (GtkFunction)win32_read, NULL); |
1 | 804 #else |
998
70c685de2be5
[gaim-migrate @ 1008]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
988
diff
changeset
|
805 gc->inpa = gdk_input_add(tdt->toc_fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, toc_callback, gc); |
1 | 806 #endif |
300
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
807 if (res) |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
808 return buf; |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
809 else |
b32c83750104
[gaim-migrate @ 310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
296
diff
changeset
|
810 return NULL; |
1 | 811 } |
812 | |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
813 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show) |
1 | 814 { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
815 GSList *grp = gc->groups; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
816 GSList *mem; |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
817 struct group *g; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
818 struct buddy *b; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
819 GSList *plist = gc->permit; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
820 GSList *dlist = gc->deny; |
1 | 821 |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
822 int pos=0; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
823 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
824 if (!gc->permdeny) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
825 gc->permdeny = 1; |
1 | 826 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
827 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
|
828 while(grp) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
829 g = (struct group *)grp->data; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
830 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
|
831 mem = g->members; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
832 while(mem) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
833 b = (struct buddy *)mem->data; |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
834 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
|
835 show ? ":" : "", show ? b->show : ""); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
836 mem = mem->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
837 } |
940 | 838 grp = g_slist_next(grp); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
839 } |
1 | 840 |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
841 while(plist) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
842 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
|
843 plist=plist->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
844 } |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
845 |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
846 while(dlist) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
847 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
|
848 dlist=dlist->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
676
diff
changeset
|
849 } |
1 | 850 } |
851 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
852 void parse_toc_buddy_list(struct gaim_connection *gc, char *config, int from_do_import) |
1 | 853 { |
854 char *c; | |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
855 char current[256]; |
1 | 856 char *name; |
857 GList *bud; | |
228 | 858 int how_many = 0; |
859 | |
1 | 860 bud = NULL; |
861 | |
332
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
862 if (config != NULL) { |
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
863 |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
864 /* skip "CONFIG:" (if it exists)*/ |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
865 c = strncmp(config + sizeof(struct sflap_hdr),"CONFIG:",strlen("CONFIG:"))? |
1 | 866 strtok(config, "\n"): |
867 strtok(config + sizeof(struct sflap_hdr)+strlen("CONFIG:"), "\n"); | |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
868 do { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
869 if (c == NULL) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
870 break; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
871 if (*c == 'g') { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
872 strncpy(current,c+2, sizeof(current)); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
873 add_group(gc, current); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
874 how_many++; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
875 } else if (*c == 'b' && !find_buddy(gc, c+2)) { |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
876 char nm[80], sw[80], *tmp = c+2; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
877 int i = 0; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
878 while (*tmp != ':' && *tmp) |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
879 nm[i++] = *tmp++; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
880 if (*tmp == ':') *tmp++ = '\0'; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
881 nm[i] = '\0'; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
882 i = 0; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
883 while (*tmp) sw[i++] = *tmp++; |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
884 sw[i] = '\0'; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
885 if (!find_buddy(gc, nm)) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
886 add_buddy(gc, current, nm, sw); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
887 how_many++; |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
681
diff
changeset
|
888 |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
889 bud = g_list_append(bud, c+2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
890 } else if (*c == 'p') { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
891 GSList *d = gc->permit; |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
892 char *n; |
863
55194c5f338f
[gaim-migrate @ 873]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
793
diff
changeset
|
893 name = g_malloc(strlen(c+2) + 2); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
894 g_snprintf(name, strlen(c+2) + 1, "%s", c+2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
895 n = g_strdup(normalize(name)); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
896 while (d) { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
897 if (!strcasecmp(n, normalize(d->data))) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
898 break; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
899 d = d->next; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
900 } |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
901 g_free(n); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
902 if (!d) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
903 gc->permit = g_slist_append(gc->permit, name); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
904 } else if (*c == 'd') { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
905 GSList *d = gc->deny; |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
906 char *n; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
907 name = g_malloc(strlen(c+2) + 2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
908 g_snprintf(name, strlen(c+2) + 1, "%s", c+2); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
909 n = g_strdup(normalize(name)); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
910 while (d) { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
911 if (!strcasecmp(n, normalize(d->data))) |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
912 break; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
913 d = d->next; |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
914 } |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
915 g_free(n); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
916 if (!d) |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
917 gc->deny = g_slist_append(gc->deny, name); |
793
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
918 } else if (!strncmp("toc", c, 3)) { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
919 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
920 sprintf(debug_buff, "permdeny: %d\n", gc->permdeny); |
793
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
921 debug_print(debug_buff); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
922 if (gc->permdeny == 0) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
923 gc->permdeny = 1; |
793
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
924 } else if (*c == 'm') { |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
925 sscanf(c + 2, "%d", &gc->permdeny); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
926 sprintf(debug_buff, "permdeny: %d\n", gc->permdeny); |
793
57cc66fbfa8e
[gaim-migrate @ 803]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
774
diff
changeset
|
927 debug_print(debug_buff); |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
928 if (gc->permdeny == 0) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
929 gc->permdeny = 1; |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
930 } |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
931 } while((c=strtok(NULL,"\n"))); |
1 | 932 #if 0 |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
933 fprintf(stdout, "Sending message '%s'\n",buf); |
1 | 934 #endif |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
935 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
936 if (bud != NULL) serv_add_buddies(gc, bud); |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
937 serv_set_permit_deny(gc); |
681
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
938 if (blist) { |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
939 build_edit_tree(); |
5422dbecd861
[gaim-migrate @ 691]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
940 } |
332
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
941 } |
b573f33c5e0e
[gaim-migrate @ 342]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
942 |
228 | 943 /* perhaps the server dropped the buddy list, try importing from |
944 cache */ | |
945 | |
296
a88b889b692b
[gaim-migrate @ 306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
285
diff
changeset
|
946 if ( how_many == 0 && !from_do_import ) { |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
947 do_import( (GtkWidget *) NULL, gc ); |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
940
diff
changeset
|
948 } else if ( gc && (bud_list_cache_exists(gc) == FALSE) ) { |
229 | 949 do_export( (GtkWidget *) NULL, 0 ); |
228 | 950 } |
1 | 951 } |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
952 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
953 static char *toc_name() { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
954 return "TOC"; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
955 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
956 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
957 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
|
958 char buf[MSG_LEN - 7]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
959 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
960 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
961 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
|
962 message, ((away) ? " auto" : "")); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
963 sflap_send(gc, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
964 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
965 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
966 static void toc_get_info(struct gaim_connection *g, char *name) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
967 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
968 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
969 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
970 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
971 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
972 static void toc_get_dir(struct gaim_connection *g, char *name) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
973 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
974 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
975 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
976 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
977 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
978 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
|
979 char *maiden, char *city, char *state, char *country, int web) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
980 char buf2[BUF_LEN*4], buf[BUF_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
981 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
|
982 middle, last, maiden, city, state, country, |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
983 (web == 1) ? "Y" : ""); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
984 escape_text(buf2); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
985 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
986 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
987 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
988 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
989 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
|
990 char *maiden, char *city, char *state, char *country, char *email) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
991 char buf[BUF_LONG]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
992 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
|
993 last, maiden, city, state, country, email); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
994 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
995 city, state, country); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
996 debug_print(debug_buff); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
997 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
998 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
999 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1000 static void toc_set_away(struct gaim_connection *g, char *message) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1001 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1002 if (message) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1003 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1004 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1005 } else |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1006 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1007 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1008 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1009 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1010 static void toc_set_info(struct gaim_connection *g, char *info) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1011 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1012 escape_text(info); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1013 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1014 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1015 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1016 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1017 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
|
1018 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1019 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
|
1020 sflap_send(g, buf, strlen(buf), TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1021 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1022 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1023 static void toc_add_buddy(struct gaim_connection *g, char *name) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1024 char buf[1024]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1025 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1026 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1027 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1028 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1029 static void toc_add_buddies(struct gaim_connection *g, GList *buddies) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1030 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1031 int n; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1032 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1033 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1034 while (buddies) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1035 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 16) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1036 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1037 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1038 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1039 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
|
1040 buddies = buddies->next; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1041 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1042 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1043 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1044 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1045 static void toc_remove_buddy(struct gaim_connection *g, char *name) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1046 char buf[1024]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1047 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1048 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1049 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1050 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1051 static void toc_set_idle(struct gaim_connection *g, int time) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1052 char buf[256]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1053 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1054 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1055 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1056 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1057 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
|
1058 char send[256]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1059 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
|
1060 sflap_send(g, send, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1061 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1062 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1063 static void toc_accept_chat(struct gaim_connection *g, int i) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1064 char buf[256]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1065 g_snprintf(buf, 255, "toc_chat_accept %d", i); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1066 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1067 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1068 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1069 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
|
1070 char buf[BUF_LONG]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1071 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
|
1072 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1073 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1074 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1075 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
|
1076 char buf[BUF_LONG]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1077 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
|
1078 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1079 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1080 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1081 static void toc_chat_leave(struct gaim_connection *g, int id) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1082 char buf[256]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1083 g_snprintf(buf, 255, "toc_chat_leave %d", id); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1084 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1085 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1086 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1087 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
|
1088 char buf2[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1089 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
|
1090 sflap_send(g, buf2, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1091 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1092 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1093 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
|
1094 char buf[MSG_LEN]; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1095 escape_text(message); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1096 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
|
1097 sflap_send(g, buf, -1, TYPE_DATA); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1098 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1099 |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1100 static void toc_keepalive(struct gaim_connection *gc) { |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1101 sflap_send(gc, "", 0, TYPE_KEEPALIVE); |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1102 } |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1103 |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1104 static char **toc_list_icon(int uc) { |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1105 if (uc & UC_UNAVAILABLE) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1106 return (char **)away_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1107 if (uc & UC_AOL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1108 return (char **)aol_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1109 if (uc & UC_NORMAL) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1110 return (char **)free_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1111 if (uc & UC_ADMIN) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1112 return (char **)admin_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1113 if (uc & UC_UNCONFIRMED) |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1114 return (char **)dt_icon_xpm; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1115 return NULL; |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1116 } |
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1117 |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1118 static void toc_info(GtkObject *obj, char *who) { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1119 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
|
1120 serv_get_info(gc, who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1121 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1122 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1123 static void toc_dir_info(GtkObject *obj, char *who) { |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1124 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
|
1125 serv_get_dir(gc, who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1126 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1127 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1128 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
|
1129 GtkWidget *button; |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1130 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1131 button = gtk_menu_item_new_with_label(_("Get Info")); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1132 gtk_signal_connect(GTK_OBJECT(button), "activate", |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1133 GTK_SIGNAL_FUNC(toc_info), who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1134 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1135 gtk_menu_append(GTK_MENU(menu), button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1136 gtk_widget_show(button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1137 |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1138 button = gtk_menu_item_new_with_label(_("Get Dir Info")); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1139 gtk_signal_connect(GTK_OBJECT(button), "activate", |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1140 GTK_SIGNAL_FUNC(toc_dir_info), who); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1141 gtk_object_set_user_data(GTK_OBJECT(button), gc); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1142 gtk_menu_append(GTK_MENU(menu), button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1143 gtk_widget_show(button); |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1144 } |
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1145 |
1000
91b7377e7b45
[gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
998
diff
changeset
|
1146 void toc_init(struct prpl *ret) { |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1147 ret->protocol = PROTO_TOC; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1148 ret->name = toc_name; |
1030
38452403563b
[gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1020
diff
changeset
|
1149 ret->list_icon = toc_list_icon; |
1032
643a4d81c18a
[gaim-migrate @ 1042]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1150 ret->action_menu = toc_action_menu; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1151 ret->login = toc_login; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1152 ret->close = toc_close; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1153 ret->send_im = toc_send_im; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1154 ret->set_info = toc_set_info; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1155 ret->get_info = toc_get_info; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1156 ret->set_away = toc_set_away; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1157 ret->get_away_msg = NULL; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1158 ret->set_dir = toc_set_dir; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1159 ret->get_dir = toc_get_dir; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1160 ret->dir_search = toc_dir_search; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1161 ret->set_idle = toc_set_idle; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1162 ret->change_passwd = toc_change_passwd; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1163 ret->add_buddy = toc_add_buddy; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1164 ret->add_buddies = toc_add_buddies; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1165 ret->remove_buddy = toc_remove_buddy; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1166 ret->add_permit = NULL; /* FIXME */ |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1167 ret->add_deny = NULL; |
1038
daad2440a642
[gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
1168 ret->rem_permit = NULL; |
daad2440a642
[gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
1169 ret->rem_deny = NULL; |
daad2440a642
[gaim-migrate @ 1048]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1032
diff
changeset
|
1170 ret->set_permit_deny = NULL; |
981
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1171 ret->warn = toc_warn; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1172 ret->accept_chat = toc_accept_chat; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1173 ret->join_chat = toc_join_chat; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1174 ret->chat_invite = toc_chat_invite; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1175 ret->chat_leave = toc_chat_leave; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1176 ret->chat_whisper = toc_chat_whisper; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1177 ret->chat_send = toc_chat_send; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1178 ret->keepalive = toc_keepalive; |
7e231bc0018a
[gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
980
diff
changeset
|
1179 } |