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