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