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