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