Mercurial > pidgin
annotate src/server.c @ 762:977048924ce1
[gaim-migrate @ 772]
bad placement.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 25 Aug 2000 01:02:17 +0000 |
parents | 870fcc64a709 |
children | a566fc987db9 |
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 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
24 #endif |
1 | 25 #include <time.h> |
26 #include <stdio.h> | |
27 #include <string.h> | |
28 #include <sys/types.h> | |
29 #include <sys/stat.h> | |
30 #include <sys/time.h> | |
31 #include <unistd.h> | |
32 #include <gtk/gtk.h> | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
335
diff
changeset
|
33 #include <aim.h> |
276
9e6fc62490cd
[gaim-migrate @ 286]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
273
diff
changeset
|
34 extern int gaim_caps; |
1 | 35 #include "gaim.h" |
36 | |
37 static int idle_timer = -1; | |
38 static time_t lastsent = 0; | |
39 static time_t login_time = 0; | |
40 static struct timeval lag_tv; | |
41 static int is_idle = 0; | |
42 | |
43 int correction_time = 0; | |
44 | |
45 int serv_login(char *username, char *password) | |
46 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
47 if (!(general_options & OPT_GEN_USE_OSCAR)) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
48 USE_OSCAR = 0; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
49 return toc_login(username, password); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
50 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
51 USE_OSCAR = 1; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
52 debug_print("Logging in using Oscar. Expect problems.\n"); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
53 return oscar_login(username, password); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
54 } |
1 | 55 } |
56 | |
57 void serv_close() | |
58 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
59 if (!USE_OSCAR) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
60 toc_close(); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
61 else |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
62 oscar_close(); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
63 |
1 | 64 gtk_timeout_remove(idle_timer); |
65 idle_timer = -1; | |
66 } | |
67 | |
68 | |
69 void serv_touch_idle() | |
70 { | |
71 /* Are we idle? If so, not anymore */ | |
72 if (is_idle > 0) { | |
73 is_idle = 0; | |
74 serv_set_idle(0); | |
75 } | |
76 time(&lastsent); | |
77 } | |
78 | |
79 | |
80 static gint check_idle() | |
81 { | |
82 time_t t; | |
83 | |
84 /* Not idle, really... :) */ | |
85 update_all_buddies(); | |
86 | |
87 time(&t); | |
88 | |
89 gettimeofday(&lag_tv, NULL); | |
90 | |
91 if (report_idle != IDLE_GAIM) | |
92 return TRUE; | |
93 | |
94 | |
95 if (is_idle) | |
96 return TRUE; | |
97 | |
98 if ((t - lastsent) > 600) { /* 15 minutes! */ | |
99 serv_set_idle((int)t - lastsent); | |
100 is_idle = 1; | |
101 } | |
102 | |
115
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
103 #ifdef GAIM_PLUGINS |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
104 { |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
105 GList *c = callbacks; |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
106 struct gaim_callback *g; |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
107 void (*function)(void *); |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
108 while (c) { |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
109 g = (struct gaim_callback *)c->data; |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
110 if (g->event == event_blist_update && |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
111 g->function != NULL) { |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
112 function = g->function; |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
113 (*function)(g->data); |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
114 } |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
115 c = c->next; |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
116 } |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
117 } |
890cfb7d8fdb
[gaim-migrate @ 125]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
101
diff
changeset
|
118 #endif |
1 | 119 |
120 return TRUE; | |
121 | |
122 } | |
123 | |
124 | |
125 void serv_finish_login() | |
126 { | |
127 char *buf; | |
128 | |
129 if (strlen(current_user->user_info)) { | |
79 | 130 buf = g_malloc(strlen(current_user->user_info) * 4); |
1 | 131 strcpy(buf, current_user->user_info); |
132 escape_text(buf); | |
133 serv_set_info(buf); | |
134 g_free(buf); | |
135 } | |
136 | |
137 if (idle_timer != -1) | |
138 gtk_timeout_remove(idle_timer); | |
139 | |
140 idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, NULL); | |
141 serv_touch_idle(); | |
142 | |
143 time(&login_time); | |
144 | |
145 serv_add_buddy(current_user->username); | |
146 | |
147 if (!(general_options & OPT_GEN_REGISTERED)) | |
148 { | |
149 show_register_dialog(); | |
150 save_prefs(); | |
151 } | |
152 } | |
153 | |
154 | |
155 | |
156 void serv_send_im(char *name, char *message, int away) | |
157 { | |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
158 struct conversation *cnv = find_conversation(name); |
518
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
159 if (cnv && cnv->is_direct) { |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
160 if (!USE_OSCAR) { |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
161 /* FIXME */ |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
162 } else { |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
163 sprintf(debug_buff, "Sending DirectIM to %s\n", name); |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
164 debug_print(debug_buff); |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
165 aim_send_im_direct(gaim_sess, cnv->conn, message); |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
166 } |
091d081a269d
[gaim-migrate @ 528]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
516
diff
changeset
|
167 } else { |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
168 if (!USE_OSCAR) { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
169 char buf[MSG_LEN - 7]; |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
170 |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
171 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
172 message, ((away) ? " auto" : "")); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
173 sflap_send(buf, strlen(buf), TYPE_DATA); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
174 } else { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
175 if (away) |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
176 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
177 else |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
178 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_ACK, message); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
179 } |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
180 } |
1 | 181 if (!away) |
182 serv_touch_idle(); | |
183 } | |
184 | |
185 void serv_get_info(char *name) | |
186 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
187 if (!USE_OSCAR) { |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
188 char buf[MSG_LEN]; |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
189 g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name)); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
190 sflap_send(buf, -1, TYPE_DATA); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
191 } else { |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
192 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_GENERALINFO); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
193 } |
249
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
248
diff
changeset
|
194 } |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
248
diff
changeset
|
195 |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
248
diff
changeset
|
196 void serv_get_away_msg(char *name) |
810c595258c8
[gaim-migrate @ 259]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
248
diff
changeset
|
197 { |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
198 if (!USE_OSCAR) { |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
199 /* HAHA! TOC doesn't have this yet */ |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
200 } else { |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
201 aim_getinfo(gaim_sess, gaim_conn, name, AIM_GETINFO_AWAYMESSAGE); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
202 } |
1 | 203 } |
204 | |
205 void serv_get_dir(char *name) | |
206 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
207 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
208 char buf[MSG_LEN]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
209 g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name)); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
210 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
211 } |
1 | 212 } |
213 | |
214 void serv_set_dir(char *first, char *middle, char *last, char *maiden, | |
215 char *city, char *state, char *country, int web) | |
216 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
217 if (!USE_OSCAR) { |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
218 char buf2[BUF_LEN*4], buf[BUF_LEN]; |
1 | 219 g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first, |
220 middle, last, maiden, city, state, country, | |
221 (web == 1) ? "Y" : ""); | |
222 escape_text(buf2); | |
223 g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2); | |
224 sflap_send(buf, -1, TYPE_DATA); | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
225 } |
1 | 226 } |
227 | |
228 void serv_dir_search(char *first, char *middle, char *last, char *maiden, | |
229 char *city, char *state, char *country, char *email) | |
230 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
231 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
232 char buf[BUF_LONG]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
233 g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle, last, maiden, city, state, country, email); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
234 sprintf(debug_buff,"Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden, city, state, country); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
235 debug_print(debug_buff); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
236 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
237 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
238 if (strlen(email)) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
239 aim_usersearch_address(gaim_sess, gaim_conn, email); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
240 } |
1 | 241 } |
242 | |
243 | |
244 void serv_set_away(char *message) | |
245 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
246 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
247 char buf[MSG_LEN]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
248 if (message) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
249 g_snprintf(buf, MSG_LEN, "toc_set_away \"%s\"", message); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
250 else |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
251 g_snprintf(buf, MSG_LEN, "toc_set_away \"\""); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
252 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
253 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
254 aim_bos_setprofile(gaim_sess, gaim_conn, current_user->user_info, |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
255 message, gaim_caps); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
256 } |
1 | 257 } |
258 | |
259 void serv_set_info(char *info) | |
260 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
261 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
262 char buf[MSG_LEN]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
263 g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
264 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
265 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
266 if (awaymessage) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
267 aim_bos_setprofile(gaim_sess, gaim_conn, info, |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
268 awaymessage->message, gaim_caps); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
269 else |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
270 aim_bos_setprofile(gaim_sess, gaim_conn, info, |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
271 NULL, gaim_caps); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
272 } |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
273 } |
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
274 |
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
275 void serv_change_passwd(char *orig, char *new) { |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
276 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
277 char *buf = g_malloc(BUF_LONG); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
278 g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
279 sflap_send(buf, strlen(buf), TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
280 g_free(buf); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
281 } else { |
747
eec93c5929b9
[gaim-migrate @ 757]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
736
diff
changeset
|
282 /* FIXME */ |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
283 } |
1 | 284 } |
285 | |
286 void serv_add_buddy(char *name) | |
287 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
288 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
289 char buf[1024]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
290 g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name)); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
291 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
292 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
293 aim_add_buddy(gaim_sess, gaim_conn, name); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
294 } |
1 | 295 } |
296 | |
297 void serv_add_buddies(GList *buddies) | |
298 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
299 if (!USE_OSCAR) { |
447
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
300 char buf[MSG_LEN]; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
301 int n, num = 0; |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
302 |
447
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
303 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
304 while(buddies) { |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
305 /* i don't know why we choose 8, it just seems good */ |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
306 if (strlen(normalize(buddies->data)) > MSG_LEN - n - 8) { |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
307 sflap_send(buf, -1, TYPE_DATA); |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
308 n = g_snprintf(buf, sizeof(buf), "toc_add_buddy"); |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
309 num = 0; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
310 } |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
311 ++num; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
312 n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data)); |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
313 buddies = buddies->next; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
314 } |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
315 sflap_send(buf, -1, TYPE_DATA); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
316 } else { |
447
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
317 char buf[MSG_LEN]; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
318 int n = 0; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
319 while(buddies) { |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
320 if (n > MSG_LEN - 18) { |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
321 aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
322 n = 0; |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
323 } |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
324 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
325 (char *)buddies->data); |
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
326 buddies = buddies->next; |
319
cea40691706c
[gaim-migrate @ 329]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
318
diff
changeset
|
327 } |
447
5db3734a1fe6
[gaim-migrate @ 457]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
423
diff
changeset
|
328 aim_bos_setbuddylist(gaim_sess, gaim_conn, buf); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
329 } |
1 | 330 } |
331 | |
332 | |
333 void serv_remove_buddy(char *name) | |
334 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
335 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
336 char buf[1024]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
337 g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name)); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
338 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
339 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
340 aim_remove_buddy(gaim_sess, gaim_conn, name); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
341 } |
1 | 342 } |
343 | |
344 void serv_add_permit(char *name) | |
345 { | |
752
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
346 permdeny = 3; |
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
347 build_permit_tree(); |
1 | 348 } |
349 | |
350 | |
351 | |
352 void serv_add_deny(char *name) | |
353 { | |
752
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
354 permdeny = 4; |
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
355 build_permit_tree(); |
1 | 356 } |
357 | |
358 | |
359 | |
360 void serv_set_permit_deny() | |
361 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
362 if (!USE_OSCAR) { |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
363 char buf[MSG_LEN]; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
364 int at; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
365 GList *list; |
1 | 366 |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
367 switch (permdeny) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
368 case PERMIT_ALL: |
752
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
369 sprintf(buf, "toc_add_permit %s", current_user->username); |
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
370 sflap_send(buf, -1, TYPE_DATA); |
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
371 sprintf(buf, "toc_add_deny"); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
372 sflap_send(buf, -1, TYPE_DATA); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
373 break; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
374 case PERMIT_NONE: |
752
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
375 sprintf(buf, "toc_add_deny %s", current_user->username); |
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
376 sflap_send(buf, -1, TYPE_DATA); |
870fcc64a709
[gaim-migrate @ 762]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
747
diff
changeset
|
377 sprintf(buf, "toc_add_permit"); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
378 sflap_send(buf, -1, TYPE_DATA); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
379 break; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
380 case PERMIT_SOME: |
684
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
381 at = g_snprintf(buf, sizeof(buf), "toc_add_permit"); |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
382 list = permit; |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
383 while (list) { |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
384 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
385 list = list->next; |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
386 } |
684
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
387 buf[at] = 0; /* is this necessary? */ |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
388 sflap_send(buf, -1, TYPE_DATA); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
389 break; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
390 case DENY_SOME: |
685
94a27f7567c5
[gaim-migrate @ 695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
684
diff
changeset
|
391 /* you'll still see people as being online, but they won't see you, and you |
94a27f7567c5
[gaim-migrate @ 695]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
684
diff
changeset
|
392 * won't get updates for them. that's why i thought this was broken. */ |
684
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
393 at = g_snprintf(buf, sizeof(buf), "toc_add_deny"); |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
394 list = deny; |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
395 while (list) { |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
396 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(list->data)); |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
397 list = list->next; |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
398 } |
684
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
399 buf[at] = 0; /* is this necessary? */ |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
400 sflap_send(buf, -1, TYPE_DATA); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
401 break; |
318
35796808896a
[gaim-migrate @ 328]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
314
diff
changeset
|
402 } |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
403 } else { |
707
668b4d544afe
[gaim-migrate @ 717]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
694
diff
changeset
|
404 /* |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
405 int at; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
406 GList *list; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
407 char buf[MSG_LEN]; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
408 |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
409 switch (permdeny) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
410 case PERMIT_ALL: |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
411 aim_bos_changevisibility(gaim_sess, gaim_conn, |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
412 AIM_VISIBILITYCHANGE_DENYADD, current_user->username); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
413 break; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
414 case PERMIT_NONE: |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
415 aim_bos_changevisibility(gaim_sess, gaim_conn, |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
416 AIM_VISIBILITYCHANGE_PERMITADD, current_user->username); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
417 break; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
418 case PERMIT_SOME: |
679
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
419 at = g_snprintf(buf, sizeof(buf), "%s", current_user->username); |
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
420 list = permit; |
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
421 while (list) { |
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
422 at += g_snprintf(&buf[at], sizeof(buf) - at, "&"); |
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
423 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s", list->data); |
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
424 list = list->next; |
281
7b06ba09ffe2
[gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
280
diff
changeset
|
425 } |
679
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
426 aim_bos_changevisibility(gaim_sess, gaim_conn, |
71b2477033cb
[gaim-migrate @ 689]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
678
diff
changeset
|
427 AIM_VISIBILITYCHANGE_PERMITADD, buf); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
428 break; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
429 case DENY_SOME: |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
430 if (deny) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
431 at = 0; |
680
acdbee5a9492
[gaim-migrate @ 690]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
679
diff
changeset
|
432 list = deny; |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
433 while (list) { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
434 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s", list->data); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
435 list = list->next; |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
436 if (list) |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
437 at += g_snprintf(&buf[at], sizeof(buf) - at, "&"); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
438 } |
684
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
439 sprintf(debug_buff, "denying %s\n", buf); |
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
680
diff
changeset
|
440 debug_print(debug_buff); |
678
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
441 aim_bos_changevisibility(gaim_sess, gaim_conn, |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
442 AIM_VISIBILITYCHANGE_DENYADD, buf); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
443 } else { |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
444 aim_bos_changevisibility(gaim_sess, gaim_conn, |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
445 AIM_VISIBILITYCHANGE_DENYADD, current_user->username); |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
446 } |
c72f58814e9f
[gaim-migrate @ 688]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
660
diff
changeset
|
447 break; |
281
7b06ba09ffe2
[gaim-migrate @ 291]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
280
diff
changeset
|
448 } |
707
668b4d544afe
[gaim-migrate @ 717]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
694
diff
changeset
|
449 */ |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
450 } |
1 | 451 } |
452 | |
453 void serv_set_idle(int time) | |
454 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
455 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
456 char buf[256]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
457 g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
458 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
459 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
460 aim_bos_setidle(gaim_sess, gaim_conn, time); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
461 } |
1 | 462 } |
463 | |
464 | |
465 void serv_warn(char *name, int anon) | |
466 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
467 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
468 char *send = g_malloc(256); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
469 g_snprintf(send, 255, "toc_evil %s %s", name, |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
470 ((anon) ? "anon" : "norm")); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
471 sflap_send(send, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
472 g_free(send); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
473 } |
1 | 474 } |
475 | |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
707
diff
changeset
|
476 void serv_build_config(char *buf, int len, gboolean show) { |
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
707
diff
changeset
|
477 toc_build_config(buf, len, show); |
237
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
478 } |
6ced2f1c8b24
[gaim-migrate @ 247]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
200
diff
changeset
|
479 |
1 | 480 |
481 void serv_save_config() | |
482 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
483 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
484 char *buf = g_malloc(BUF_LONG); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
485 char *buf2 = g_malloc(MSG_LEN); |
710
efd72a117875
[gaim-migrate @ 720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
707
diff
changeset
|
486 serv_build_config(buf, BUF_LONG / 2, FALSE); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
487 g_snprintf(buf2, MSG_LEN, "toc_set_config {%s}", buf); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
488 sflap_send(buf2, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
489 g_free(buf2); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
490 g_free(buf); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
491 } |
1 | 492 } |
493 | |
494 | |
495 void serv_accept_chat(int i) | |
496 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
497 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
498 char *buf = g_malloc(256); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
499 g_snprintf(buf, 255, "toc_chat_accept %d", i); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
500 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
501 g_free(buf); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
502 } else { |
252
4a41f8323022
[gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
249
diff
changeset
|
503 /* this should never get called because libfaim doesn't use the id |
4a41f8323022
[gaim-migrate @ 262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
249
diff
changeset
|
504 * (i'm not even sure Oscar does). go through serv_join_chat instead */ |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
505 } |
1 | 506 } |
507 | |
508 void serv_join_chat(int exchange, char *name) | |
509 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
510 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
511 char buf[BUF_LONG]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
512 g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
513 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
514 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
515 sprintf(debug_buff, "Attempting to join chat room %s.\n", name); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
516 debug_print(debug_buff); |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
517 aim_chat_join(gaim_sess, gaim_conn, exchange, name); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
518 } |
1 | 519 } |
520 | |
521 void serv_chat_invite(int id, char *message, char *name) | |
522 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
523 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
524 char buf[BUF_LONG]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
525 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
526 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
527 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
528 GList *bcs = buddy_chats; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
529 struct conversation *b = NULL; |
258
1eeece1c7b7b
[gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
256
diff
changeset
|
530 |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
531 while (bcs) { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
532 b = (struct conversation *)bcs->data; |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
533 if (id == b->id) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
534 break; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
535 bcs = bcs->next; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
536 b = NULL; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
537 } |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
538 |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
539 if (!b) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
540 return; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
541 |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
542 aim_chat_invite(gaim_sess, gaim_conn, name, message, 0x4, b->name, 0x1); |
258
1eeece1c7b7b
[gaim-migrate @ 268]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
256
diff
changeset
|
543 } |
1 | 544 } |
545 | |
546 void serv_chat_leave(int id) | |
547 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
548 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
549 char *buf = g_malloc(256); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
550 g_snprintf(buf, 255, "toc_chat_leave %d", id); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
551 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
552 g_free(buf); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
553 } else { |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
554 GList *bcs = buddy_chats; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
555 struct conversation *b = NULL; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
556 struct chat_connection *c = NULL; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
557 int count = 0; |
248
cfc73b8501a7
[gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
558 |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
559 while (bcs) { |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
560 count++; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
561 b = (struct conversation *)bcs->data; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
562 if (id == b->id) |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
563 break; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
564 bcs = bcs->next; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
565 b = NULL; |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
566 } |
248
cfc73b8501a7
[gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
567 |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
568 if (!b) |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
569 return; |
248
cfc73b8501a7
[gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
570 |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
571 sprintf(debug_buff, "Attempting to leave room %s (currently in %d rooms)\n", |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
572 b->name, count); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
573 debug_print(debug_buff); |
368
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
574 |
694
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
693
diff
changeset
|
575 // aim_chat_leaveroom(gaim_sess, b->name); |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
576 c = find_oscar_chat(b->name); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
577 if (c != NULL) { |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
578 oscar_chats = g_list_remove(oscar_chats, c); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
579 gdk_input_remove(c->inpa); |
694
150214f1d48b
[gaim-migrate @ 704]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
693
diff
changeset
|
580 aim_conn_kill(gaim_sess, &c->conn); |
692
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
581 g_free(c->name); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
582 g_free(c); |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
583 } |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
584 /* we do this because with Oscar it doesn't tell us we left */ |
f4026275bc9f
[gaim-migrate @ 702]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
685
diff
changeset
|
585 serv_got_chat_left(b->id); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
586 } |
1 | 587 } |
588 | |
589 void serv_chat_whisper(int id, char *who, char *message) | |
590 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
591 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
592 char buf2[MSG_LEN]; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
593 g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
594 sflap_send(buf2, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
595 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
596 do_error_dialog("Sorry, Oscar doesn't whisper. Send an IM. (The last message was not received.)", |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
597 "Gaim - Chat"); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
598 } |
1 | 599 } |
600 | |
601 void serv_chat_send(int id, char *message) | |
602 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
603 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
604 char buf[MSG_LEN]; |
528
d9e638d13e5a
[gaim-migrate @ 538]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
518
diff
changeset
|
605 escape_text(message); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
606 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
607 sflap_send(buf, -1, TYPE_DATA); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
608 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
609 struct aim_conn_t *cn; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
610 GList *bcs = buddy_chats; |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
611 struct conversation *b = NULL; |
248
cfc73b8501a7
[gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
612 |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
613 while (bcs) { |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
614 b = (struct conversation *)bcs->data; |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
615 if (id == b->id) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
616 break; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
617 bcs = bcs->next; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
618 b = NULL; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
619 } |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
620 if (!b) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
621 return; |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
622 |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
623 cn = aim_chat_getconn(gaim_sess, b->name); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
624 aim_chat_send_im(gaim_sess, cn, message); |
248
cfc73b8501a7
[gaim-migrate @ 258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
247
diff
changeset
|
625 } |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
626 serv_touch_idle(); |
1 | 627 } |
628 | |
629 | |
630 | |
631 | |
632 void serv_got_im(char *name, char *message, int away) | |
633 { | |
634 struct conversation *cnv; | |
635 int is_idle = -1; | |
636 int new_conv = 0; | |
637 | |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
638 #ifdef GAIM_PLUGINS |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
639 GList *c = callbacks; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
640 struct gaim_callback *g; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
641 void (*function)(char **, char **, void *); |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
642 char *buffy = g_strdup(message); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
643 char *angel = g_strdup(name); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
644 while (c) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
645 g = (struct gaim_callback *)c->data; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
646 if (g->event == event_im_recv && g->function != NULL) { |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
647 function = g->function; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
648 (*function)(&angel, &buffy, g->data); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
649 } |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
650 c = c->next; |
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
651 } |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
652 if (!buffy || !angel) |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
653 return; |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
654 g_snprintf(message, strlen(message) + 1, "%s", buffy); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
655 g_free(buffy); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
656 g_snprintf(name, strlen(name) + 1, "%s", angel); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
657 g_free(angel); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
79
diff
changeset
|
658 #endif |
1 | 659 |
736
d05d746384a7
[gaim-migrate @ 746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
660 if ((general_options & OPT_GEN_TIK_HACK) && awaymessage && |
d05d746384a7
[gaim-migrate @ 746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
661 !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) { |
d05d746384a7
[gaim-migrate @ 746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
662 serv_send_im(name, awaymessage->message, 1); |
d05d746384a7
[gaim-migrate @ 746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
663 return; |
d05d746384a7
[gaim-migrate @ 746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
664 } |
d05d746384a7
[gaim-migrate @ 746]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
710
diff
changeset
|
665 |
1 | 666 cnv = find_conversation(name); |
616 | 667 |
668 if (general_options & OPT_GEN_SEND_LINKS) { | |
669 linkify_text(message); | |
670 } | |
671 | |
145
41bd1cd48571
[gaim-migrate @ 155]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
136
diff
changeset
|
672 if (away) away = WFLAG_AUTO; |
1 | 673 |
674 if (awaymessage != NULL) { | |
675 if (!(general_options & OPT_GEN_DISCARD_WHEN_AWAY)) { | |
676 if (cnv == NULL) { | |
677 new_conv = 1; | |
678 cnv = new_conversation(name); | |
679 } | |
680 } | |
681 if (cnv != NULL) { | |
682 if (sound_options & OPT_SOUND_WHEN_AWAY) | |
683 play_sound(AWAY); | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
684 write_to_conv(cnv, message, away | WFLAG_RECV, NULL); |
1 | 685 } |
686 | |
687 } else { | |
688 if (cnv == NULL) { | |
689 new_conv = 1; | |
690 cnv = new_conversation(name); | |
691 } | |
692 if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) { | |
693 play_sound(FIRST_RECEIVE); | |
694 } else { | |
695 if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) | |
696 play_sound(RECEIVE); | |
697 } | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
698 write_to_conv(cnv, message, away | WFLAG_RECV, NULL); |
1 | 699 } |
700 | |
701 | |
702 | |
703 | |
704 if (awaymessage != NULL) { | |
705 time_t t; | |
263
8aa7368baae7
[gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
260
diff
changeset
|
706 char tmpmsg[BUF_LEN]; |
1 | 707 |
708 time(&t); | |
709 | |
710 | |
711 if ((cnv == NULL) || (t - cnv->sent_away) < 120) | |
712 return; | |
713 | |
714 cnv->sent_away = t; | |
715 | |
716 if (is_idle) | |
717 is_idle = -1; | |
718 | |
263
8aa7368baae7
[gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
260
diff
changeset
|
719 strcpy(tmpmsg, awaymessage->message); |
8aa7368baae7
[gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
260
diff
changeset
|
720 escape_text(tmpmsg); |
8aa7368baae7
[gaim-migrate @ 273]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
260
diff
changeset
|
721 escape_message(tmpmsg); |
592
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
722 serv_send_im(name, away_subs(tmpmsg, name), 1); |
1 | 723 |
724 if (is_idle == -1) | |
725 is_idle = 1; | |
726 | |
727 if (cnv != NULL) | |
592
7c75d69a1129
[gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
535
diff
changeset
|
728 write_to_conv(cnv, away_subs(awaymessage->message, name), WFLAG_SEND | WFLAG_AUTO, NULL); |
1 | 729 } |
730 } | |
731 | |
732 | |
733 | |
513
eaddaa0dbbcb
[gaim-migrate @ 523]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
511
diff
changeset
|
734 void serv_got_update(char *name, int loggedin, int evil, time_t signon, time_t idle, int type, u_short caps) |
1 | 735 { |
736 struct buddy *b; | |
737 char *nname; | |
738 | |
739 b = find_buddy(name); | |
740 | |
741 nname = g_strdup(normalize(name)); | |
742 if (!strcasecmp(nname, normalize(current_user->username))) { | |
743 correction_time = (int)(signon - login_time); | |
744 update_all_buddies(); | |
25 | 745 if (!b) { |
746 g_free(nname); | |
1 | 747 return; |
25 | 748 } |
1 | 749 } |
750 | |
25 | 751 g_free(nname); |
1 | 752 |
753 if (!b) { | |
754 sprintf(debug_buff,"Error, no such person\n"); | |
755 debug_print(debug_buff); | |
756 return; | |
757 } | |
758 | |
759 /* This code will 'align' the name from the TOC */ | |
760 /* server with what's in our record. We want to */ | |
761 /* store things how THEY want it... */ | |
762 if (strcmp(name, b->name)) { | |
763 GList *cnv = conversations; | |
764 struct conversation *cv; | |
765 | |
766 char *who = g_malloc(80); | |
767 | |
768 strcpy(who, normalize(name)); | |
769 | |
770 while(cnv) { | |
771 cv = (struct conversation *)cnv->data; | |
772 if (!strcasecmp(who, normalize(cv->name))) { | |
773 g_snprintf(cv->name, sizeof(cv->name), "%s", name); | |
774 if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL)) | |
775 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name); | |
776 else | |
777 g_snprintf(who, 63, CONVERSATION_TITLE, name); | |
778 gtk_window_set_title(GTK_WINDOW(cv->window), who); | |
79 | 779 /* was g_free(buf), but break gives us that |
780 * and freeing twice is not good --Sumner */ | |
1 | 781 break; |
782 } | |
783 cnv = cnv->next; | |
784 } | |
45 | 785 g_free(who); |
1 | 786 g_snprintf(b->name, sizeof(b->name), "%s", name); |
787 /*gtk_label_set_text(GTK_LABEL(b->label), b->name);*/ | |
788 | |
789 /* okay lets save the new config... */ | |
790 | |
791 } | |
792 | |
793 b->idle = idle; | |
794 b->evil = evil; | |
136
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
795 #ifdef GAIM_PLUGINS |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
796 if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) { |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
797 GList *c = callbacks; |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
798 struct gaim_callback *g; |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
799 void (*function)(char *, void *); |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
800 while (c) { |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
801 g = (struct gaim_callback *)c->data; |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
802 if (g->event == event_buddy_back && |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
803 g->function != NULL) { |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
804 function = g->function; |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
805 (*function)(b->name, g->data); |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
806 } |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
807 c = c->next; |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
808 } |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
809 } |
4e91b92f91a7
[gaim-migrate @ 146]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
115
diff
changeset
|
810 #endif |
1 | 811 b->uc = type; |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
812 if (caps) b->caps = caps; |
1 | 813 |
814 b->signon = signon; | |
815 | |
816 if (loggedin) { | |
817 if (!b->present) { | |
818 b->present = 1; | |
819 do_pounce(b->name); | |
820 } | |
821 } else | |
822 b->present = 0; | |
823 | |
824 set_buddy(b); | |
825 } | |
826 | |
827 static | |
828 void close_warned(GtkWidget *w, GtkWidget *w2) | |
829 { | |
830 gtk_widget_destroy(w2); | |
831 } | |
832 | |
833 | |
834 | |
835 void serv_got_eviled(char *name, int lev) | |
836 { | |
837 char *buf2 = g_malloc(1024); | |
838 GtkWidget *d, *label, *close; | |
839 | |
840 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
841 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
842 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
843 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
844 void (*function)(char *, int, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
845 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
846 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
847 if (g->event == event_warned && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
848 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
849 (*function)(name, lev, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
850 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
851 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
852 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
853 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
854 |
400
bb87776942c4
[gaim-migrate @ 410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
391
diff
changeset
|
855 g_snprintf(buf2, 1023, "You have just been warned by %s.\nYour new warning level is %d%%", |
1 | 856 ((name == NULL) ? "an anonymous person" : name) , lev); |
857 | |
858 | |
859 d = gtk_dialog_new(); | |
860 gtk_widget_realize(d); | |
861 aol_icon(d->window); | |
862 | |
863 label = gtk_label_new(buf2); | |
864 gtk_widget_show(label); | |
865 close = gtk_button_new_with_label("Close"); | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
528
diff
changeset
|
866 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
528
diff
changeset
|
867 gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); |
1 | 868 gtk_widget_show(close); |
869 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), | |
870 label, FALSE, FALSE, 5); | |
871 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), | |
872 close, FALSE, FALSE, 5); | |
873 | |
874 gtk_window_set_title(GTK_WINDOW(d), "Warned"); | |
875 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_warned), d); | |
876 gtk_widget_show(d); | |
877 } | |
878 | |
879 | |
880 | |
881 static void close_invite(GtkWidget *w, GtkWidget *w2) | |
882 { | |
883 gtk_widget_destroy(w2); | |
884 } | |
885 | |
886 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) | |
887 { | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
888 if (!USE_OSCAR) { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
889 int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2)); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
890 serv_accept_chat(i); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
891 gtk_widget_destroy(w2); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
892 } else { |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
893 char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2)); |
693
30a8e386849d
[gaim-migrate @ 703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
894 int id = (int)gtk_object_get_user_data(GTK_OBJECT(w)); |
30a8e386849d
[gaim-migrate @ 703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
895 serv_join_chat(id, i); |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
896 g_free(i); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
897 gtk_widget_destroy(w2); |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
898 } |
1 | 899 } |
900 | |
901 | |
902 | |
903 void serv_got_chat_invite(char *name, int id, char *who, char *message) | |
904 { | |
905 GtkWidget *d; | |
906 GtkWidget *label; | |
907 GtkWidget *yesbtn; | |
908 GtkWidget *nobtn; | |
909 | |
910 char buf2[BUF_LONG]; | |
911 | |
912 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
913 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
914 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
915 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
916 void (*function)(char *, char *, char *, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
917 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
918 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
919 if (g->event == event_chat_invited && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
920 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
921 (*function)(who, name, message, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
922 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
923 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
924 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
925 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
926 |
414
f9dc74875833
[gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
927 if (message) |
f9dc74875833
[gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
928 g_snprintf(buf2, sizeof(buf2), "User '%s' invites you to buddy chat room: '%s'\n%s", who, name, message); |
f9dc74875833
[gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
929 else |
f9dc74875833
[gaim-migrate @ 424]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
411
diff
changeset
|
930 g_snprintf(buf2, sizeof(buf2), "User '%s' invites you to buddy chat room: '%s'\n", who, name); |
1 | 931 |
932 d = gtk_dialog_new(); | |
933 gtk_widget_realize(d); | |
934 aol_icon(d->window); | |
935 | |
936 | |
937 label = gtk_label_new(buf2); | |
938 gtk_widget_show(label); | |
939 yesbtn = gtk_button_new_with_label("Yes"); | |
940 gtk_widget_show(yesbtn); | |
941 nobtn = gtk_button_new_with_label("No"); | |
942 gtk_widget_show(nobtn); | |
943 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), | |
944 label, FALSE, FALSE, 5); | |
945 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), | |
946 yesbtn, FALSE, FALSE, 5); | |
947 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), | |
948 nobtn, FALSE, FALSE, 5); | |
949 | |
535
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
528
diff
changeset
|
950 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
528
diff
changeset
|
951 gtk_button_set_relief(GTK_BUTTON(yesbtn), GTK_RELIEF_NONE); |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
528
diff
changeset
|
952 if (display_options & OPT_DISP_COOL_LOOK) |
f03f041c1aa9
[gaim-migrate @ 545]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
528
diff
changeset
|
953 gtk_button_set_relief(GTK_BUTTON(nobtn), GTK_RELIEF_NONE); |
1 | 954 |
955 /* gtk_widget_set_usize(d, 200, 110); */ | |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
956 |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
957 if (!USE_OSCAR) |
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
958 gtk_object_set_user_data(GTK_OBJECT(d), (void *)id); |
693
30a8e386849d
[gaim-migrate @ 703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
959 else { |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
960 gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name)); |
693
30a8e386849d
[gaim-migrate @ 703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
961 gtk_object_set_user_data(GTK_OBJECT(yesbtn), (void *)id); |
30a8e386849d
[gaim-migrate @ 703]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
692
diff
changeset
|
962 } |
1 | 963 |
964 | |
965 gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite"); | |
966 gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d); | |
967 gtk_signal_connect(GTK_OBJECT(yesbtn), "clicked", GTK_SIGNAL_FUNC(chat_invite_callback), d); | |
968 | |
969 | |
970 gtk_widget_show(d); | |
971 } | |
972 | |
973 void serv_got_joined_chat(int id, char *name) | |
974 { | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
975 struct conversation *b; |
1 | 976 |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
977 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
978 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
979 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
980 void (*function)(char *, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
981 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
982 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
983 if (g->event == event_chat_join && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
984 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
985 (*function)(name, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
986 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
987 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
988 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
989 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
990 |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
991 b = (struct conversation *)g_new0(struct conversation, 1); |
1 | 992 buddy_chats = g_list_append(buddy_chats, b); |
993 | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
994 b->is_chat = TRUE; |
1 | 995 b->ignored = NULL; |
996 b->in_room = NULL; | |
997 b->id = id; | |
998 g_snprintf(b->name, 80, "%s", name); | |
999 show_new_buddy_chat(b); | |
1000 } | |
1001 | |
1002 void serv_got_chat_left(int id) | |
1003 { | |
1004 GList *bcs = buddy_chats; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
1005 struct conversation *b = NULL; |
1 | 1006 |
1007 | |
1008 while(bcs) { | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
1009 b = (struct conversation *)bcs->data; |
1 | 1010 if (id == b->id) { |
1011 break; | |
1012 } | |
1013 b = NULL; | |
1014 bcs = bcs->next; | |
1015 } | |
1016 | |
1017 if (!b) | |
1018 return; | |
1019 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1020 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1021 { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1022 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1023 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1024 void (*function)(char *, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1025 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1026 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1027 if (g->event == event_chat_leave && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1028 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1029 (*function)(b->name, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1030 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1031 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1032 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1033 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1034 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1035 |
368
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1036 sprintf(debug_buff, "Leaving room %s.\n", b->name); |
9bf1f77985d2
[gaim-migrate @ 378]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
1037 debug_print(debug_buff); |
1 | 1038 |
1039 buddy_chats = g_list_remove(buddy_chats, b); | |
1040 | |
1041 g_free(b); | |
1042 } | |
1043 | |
1044 void serv_got_chat_in(int id, char *who, int whisper, char *message) | |
1045 { | |
1046 int w; | |
1047 GList *bcs = buddy_chats; | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
1048 struct conversation *b = NULL; |
1 | 1049 |
1050 while(bcs) { | |
472
6a92cd7322cc
[gaim-migrate @ 482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
447
diff
changeset
|
1051 b = (struct conversation *)bcs->data; |
1 | 1052 if (id == b->id) |
1053 break; | |
1054 bcs = bcs->next; | |
1055 b = NULL; | |
1056 | |
1057 } | |
1058 if (!b) | |
1059 return; | |
1060 | |
391
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1061 #ifdef GAIM_PLUGINS |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1062 { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1063 GList *c = callbacks; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1064 struct gaim_callback *g; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1065 void (*function)(char *, char *, char *, void *); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1066 while (c) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1067 g = (struct gaim_callback *)c->data; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1068 if (g->event == event_chat_recv && g->function != NULL) { |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1069 function = g->function; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1070 (*function)(b->name, who, message, g->data); |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1071 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1072 c = c->next; |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1073 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1074 } |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1075 #endif |
be408b41c172
[gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
368
diff
changeset
|
1076 |
1 | 1077 if (whisper) |
1078 w = WFLAG_WHISPER; | |
1079 else | |
1080 w = 0; | |
1081 | |
1082 chat_write(b, who, w, message); | |
1083 } | |
1084 | |
260
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1085 void serv_rvous_accept(char *name, char *cookie, char *uid) |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1086 { |
423
0d4e80bdb96b
[gaim-migrate @ 433]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
414
diff
changeset
|
1087 /* Oscar doesn't matter here because this won't ever be called for it */ |
260
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1088 char buf[MSG_LEN]; |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1089 g_snprintf(buf, MSG_LEN, "toc_rvous_accept %s %s %s", normalize(name), |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1090 cookie, uid); |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1091 sflap_send(buf, strlen(buf), TYPE_DATA); |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1092 } |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1093 |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1094 void serv_rvous_cancel(char *name, char *cookie, char *uid) |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1095 { |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1096 char buf[MSG_LEN]; |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1097 g_snprintf(buf, MSG_LEN, "toc_rvous_cancel %s %s %s", normalize(name), |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1098 cookie, uid); |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1099 sflap_send(buf, strlen(buf), TYPE_DATA); |
325d9804df10
[gaim-migrate @ 270]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
258
diff
changeset
|
1100 } |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1101 |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1102 void serv_do_imimage(GtkWidget *w, char *name) { |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1103 struct conversation *cnv = find_conversation(name); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1104 if (!cnv) cnv = new_conversation(name); |
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1105 |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1106 if (!USE_OSCAR) { |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1107 /* FIXME */ |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1108 } else { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1109 oscar_do_directim(name); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1110 } |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1111 } |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1112 |
515
b33ed0a7f49b
[gaim-migrate @ 525]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
513
diff
changeset
|
1113 void serv_got_imimage(char *name, char *cookie, char *ip, struct aim_conn_t *conn, int watcher) |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1114 { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1115 if (!USE_OSCAR) { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1116 /* FIXME */ |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1117 } else { |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1118 struct conversation *cnv = find_conversation(name); |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1119 if (!cnv) cnv = new_conversation(name); |
516
ee4e18868584
[gaim-migrate @ 526]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
515
diff
changeset
|
1120 make_direct(cnv, TRUE, conn, watcher); |
511
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1121 } |
3133ab511d92
[gaim-migrate @ 521]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
503
diff
changeset
|
1122 } |