Mercurial > pidgin
annotate src/list.c @ 2758:269fb9005d13
[gaim-migrate @ 2771]
Travis Farley (siege_2004)'s patch
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 19 Nov 2001 09:45:22 +0000 |
parents | 37d80035e77f |
children | 8cd878c14090 |
rev | line source |
---|---|
2382 | 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 | |
22 #ifdef HAVE_CONFIG_H | |
23 #include <config.h> | |
24 #endif | |
25 #include <string.h> | |
26 #include <sys/types.h> | |
27 #include <sys/stat.h> | |
28 #include <unistd.h> | |
29 #include "gaim.h" | |
30 #include "prpl.h" | |
31 | |
32 #define PATHSIZE 1024 | |
33 | |
34 void remove_buddy(struct gaim_connection *gc, struct group *rem_g, struct buddy *rem_b) | |
35 { | |
36 GSList *grp; | |
37 GSList *mem; | |
38 | |
39 struct group *delg; | |
40 struct buddy *delb; | |
41 | |
42 /* we assume that gc is not NULL and that the buddy exists somewhere within the | |
43 * gc's buddy list, therefore we can safely remove it. we need to ensure this | |
44 * via the UI | |
45 */ | |
46 | |
47 grp = g_slist_find(gc->groups, rem_g); | |
48 delg = (struct group *)grp->data; | |
49 mem = delg->members; | |
50 | |
51 mem = g_slist_find(mem, rem_b); | |
52 delb = (struct buddy *)mem->data; | |
53 | |
54 delg->members = g_slist_remove(delg->members, delb); | |
55 | |
56 ui_remove_buddy(gc, rem_g, rem_b); | |
57 | |
58 g_free(rem_b); | |
59 | |
60 /* we don't flush buddy list to cache because in the case of remove_group that would | |
61 * mean writing to the buddy list file once for each buddy, plus one more time */ | |
62 } | |
63 | |
64 void remove_group(struct gaim_connection *gc, struct group *rem_g) | |
65 { | |
66 GSList *grp; | |
67 GSList *mem; | |
68 GList *tmp = NULL; | |
69 | |
70 struct group *delg; | |
71 struct buddy *delb; | |
72 | |
73 /* we assume that the group actually does exist within the gc, and that the gc is not NULL. | |
74 * the UI is responsible for this */ | |
75 | |
76 grp = g_slist_find(gc->groups, rem_g); | |
77 delg = (struct group *)grp->data; | |
78 mem = delg->members; | |
79 | |
80 while (delg->members) { | |
81 delb = (struct buddy *)delg->members->data; | |
82 tmp = g_list_append(tmp, g_strdup(delb->name)); | |
83 remove_buddy(gc, delg, delb); /* this should take care of removing | |
84 the group_show if necessary */ | |
85 } | |
86 | |
87 gc->groups = g_slist_remove(gc->groups, delg); | |
88 | |
2681
37d80035e77f
[gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2662
diff
changeset
|
89 serv_remove_buddies(gc, tmp, rem_g->name); |
2382 | 90 while (tmp) { |
91 g_free(tmp->data); | |
92 tmp = g_list_remove(tmp, tmp->data); | |
93 } | |
94 | |
95 ui_remove_group(gc, rem_g); | |
96 | |
97 g_free(rem_g); | |
98 | |
99 /* don't flush buddy list to cache in order to be consistent with remove_buddy, | |
100 * mostly. remove_group is only called from one place, so we'll let it handle it. */ | |
101 } | |
102 | |
103 struct buddy *add_buddy(struct gaim_connection *gc, char *group, char *buddy, char *show) | |
104 { | |
105 struct buddy *b; | |
106 struct group *g; | |
107 char *good; | |
108 | |
2586
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
109 if (!g_slist_find(connections, gc)) |
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
110 return NULL; |
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
111 |
2382 | 112 if ((b = find_buddy(gc, buddy)) != NULL) |
113 return b; | |
114 | |
115 g = find_group(gc, group); | |
116 | |
117 if (g == NULL) | |
118 g = add_group(gc, group); | |
119 | |
120 b = (struct buddy *)g_new0(struct buddy, 1); | |
121 | |
122 if (!b) | |
123 return NULL; | |
124 | |
125 b->gc = gc; | |
126 b->present = 0; | |
127 | |
128 if (gc->prpl->normalize) | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
129 good = gc->prpl->normalize(buddy); |
2382 | 130 else |
131 good = buddy; | |
132 | |
133 g_snprintf(b->name, sizeof(b->name), "%s", good); | |
134 g_snprintf(b->show, sizeof(b->show), "%s", show ? (show[0] ? show : good) : good); | |
135 | |
136 g->members = g_slist_append(g->members, b); | |
137 | |
138 b->idle = 0; | |
139 b->caps = 0; | |
140 | |
141 ui_add_buddy(gc, g, b); | |
142 | |
143 return b; | |
144 } | |
145 | |
146 struct group *add_group(struct gaim_connection *gc, char *group) | |
147 { | |
148 struct group *g = find_group(gc, group); | |
149 if (g) | |
150 return g; | |
2586
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
151 if (!g_slist_find(connections, gc)) |
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
152 return NULL; |
2382 | 153 g = (struct group *)g_new0(struct group, 1); |
154 if (!g) | |
155 return NULL; | |
156 | |
157 g->gc = gc; | |
158 strncpy(g->name, group, sizeof(g->name)); | |
159 gc->groups = g_slist_append(gc->groups, g); | |
160 | |
161 g->members = NULL; | |
162 | |
163 ui_add_group(gc, g); | |
164 | |
165 return g; | |
166 } | |
167 | |
168 struct group *find_group(struct gaim_connection *gc, char *group) | |
169 { | |
170 struct group *g; | |
171 GSList *grp; | |
172 GSList *c = connections; | |
173 struct gaim_connection *z; | |
174 char *grpname = g_malloc(strlen(group) + 1); | |
175 | |
176 strcpy(grpname, normalize (group)); | |
177 if (gc) { | |
2586
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
178 if (!g_slist_find(connections, gc)) |
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
179 return NULL; |
2382 | 180 grp = gc->groups; |
181 while (grp) { | |
182 g = (struct group *)grp->data; | |
183 if (!g_strcasecmp(normalize (g->name), grpname)) { | |
184 g_free(grpname); | |
185 return g; | |
186 } | |
187 grp = g_slist_next(grp); | |
188 } | |
189 | |
190 g_free(grpname); | |
191 return NULL; | |
192 } else { | |
193 while (c) { | |
194 z = (struct gaim_connection *)c->data; | |
195 grp = z->groups; | |
196 while (grp) { | |
197 g = (struct group *)grp->data; | |
198 if (!g_strcasecmp(normalize (g->name), grpname)) { | |
199 g_free(grpname); | |
200 return g; | |
201 } | |
202 grp = g_slist_next(grp); | |
203 } | |
204 | |
205 c = c->next; | |
206 } | |
207 g_free(grpname); | |
208 return NULL; | |
209 } | |
210 } | |
211 | |
212 struct group *find_group_by_buddy(struct gaim_connection *gc, char *who) | |
213 { | |
214 struct group *g; | |
215 struct buddy *b; | |
216 GSList *grp; | |
217 GSList *mem; | |
218 char *whoname; | |
219 char *(*norm)(const char *); | |
220 | |
221 if (gc) { | |
222 if (gc->prpl->normalize) | |
223 norm = gc->prpl->normalize; | |
224 else | |
225 norm = normalize; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
226 whoname = g_strdup(norm(who)); |
2382 | 227 grp = gc->groups; |
228 while (grp) { | |
229 g = (struct group *)grp->data; | |
230 | |
231 mem = g->members; | |
232 while (mem) { | |
233 b = (struct buddy *)mem->data; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
234 if (!strcmp(norm(b->name), whoname)) { |
2382 | 235 g_free(whoname); |
236 return g; | |
237 } | |
238 mem = mem->next; | |
239 } | |
240 grp = g_slist_next(grp); | |
241 } | |
242 g_free(whoname); | |
243 return NULL; | |
244 } else { | |
245 GSList *c = connections; | |
246 struct gaim_connection *z; | |
247 while (c) { | |
248 z = (struct gaim_connection *)c->data; | |
249 if (z->prpl->normalize) | |
250 norm = z->prpl->normalize; | |
251 else | |
252 norm = normalize; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
253 whoname = g_strdup(norm(who)); |
2382 | 254 grp = z->groups; |
255 while (grp) { | |
256 g = (struct group *)grp->data; | |
257 | |
258 mem = g->members; | |
259 while (mem) { | |
260 b = (struct buddy *)mem->data; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
261 if (!strcmp(norm(b->name), whoname)) { |
2382 | 262 g_free(whoname); |
263 return g; | |
264 } | |
265 mem = mem->next; | |
266 } | |
267 grp = g_slist_next(grp); | |
268 } | |
269 c = c->next; | |
270 g_free(whoname); | |
271 } | |
272 return NULL; | |
273 } | |
274 } | |
275 | |
276 struct buddy *find_buddy(struct gaim_connection *gc, char *who) | |
277 { | |
278 struct group *g; | |
279 struct buddy *b; | |
280 GSList *grp; | |
281 GSList *c; | |
282 struct gaim_connection *z; | |
283 GSList *mem; | |
284 char *whoname; | |
285 char *(*norm)(const char *); | |
286 | |
287 if (gc) { | |
2586
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
288 if (!g_slist_find(connections, gc)) |
0f5390176949
[gaim-migrate @ 2599]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2548
diff
changeset
|
289 return NULL; |
2382 | 290 if (gc->prpl->normalize) |
291 norm = gc->prpl->normalize; | |
292 else | |
293 norm = normalize; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
294 whoname = g_strdup(norm(who)); |
2382 | 295 grp = gc->groups; |
296 while (grp) { | |
297 g = (struct group *)grp->data; | |
298 | |
299 mem = g->members; | |
300 while (mem) { | |
301 b = (struct buddy *)mem->data; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
302 if (!strcmp(norm(b->name), whoname)) { |
2382 | 303 g_free(whoname); |
304 return b; | |
305 } | |
306 mem = mem->next; | |
307 } | |
308 grp = g_slist_next(grp); | |
309 } | |
310 g_free(whoname); | |
311 return NULL; | |
312 } else { | |
313 c = connections; | |
314 while (c) { | |
315 z = (struct gaim_connection *)c->data; | |
316 if (z->prpl->normalize) | |
317 norm = z->prpl->normalize; | |
318 else | |
319 norm = normalize; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
320 whoname = g_strdup(norm(who)); |
2382 | 321 grp = z->groups; |
322 while (grp) { | |
323 g = (struct group *)grp->data; | |
324 | |
325 mem = g->members; | |
326 while (mem) { | |
327 b = (struct buddy *)mem->data; | |
2662
b0c5770156e1
[gaim-migrate @ 2675]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
328 if (!strcmp(norm(b->name), whoname)) { |
2382 | 329 g_free(whoname); |
330 return b; | |
331 } | |
332 mem = mem->next; | |
333 } | |
334 grp = g_slist_next(grp); | |
335 } | |
336 c = c->next; | |
337 g_free(whoname); | |
338 } | |
339 return NULL; | |
340 } | |
341 } | |
342 | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
343 void parse_toc_buddy_list(struct gaim_connection *gc, char *config) |
2382 | 344 { |
345 char *c; | |
346 char current[256]; | |
347 char *name; | |
348 GList *bud; | |
349 int how_many = 0; | |
350 | |
351 bud = NULL; | |
352 | |
353 if (config != NULL) { | |
354 | |
355 /* skip "CONFIG:" (if it exists) */ | |
356 c = strncmp(config + 6 /* sizeof(struct sflap_hdr) */ , "CONFIG:", strlen("CONFIG:")) ? | |
357 strtok(config, "\n") : | |
358 strtok(config + 6 /* sizeof(struct sflap_hdr) */ + strlen("CONFIG:"), "\n"); | |
359 do { | |
360 if (c == NULL) | |
361 break; | |
362 if (*c == 'g') { | |
363 strncpy(current, c + 2, sizeof(current)); | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
364 if (!find_group(gc, current)) { |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
365 add_group(gc, current); |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
366 how_many++; |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
367 } |
2382 | 368 } else if (*c == 'b' && !find_buddy(gc, c + 2)) { |
369 char nm[80], sw[80], *tmp = c + 2; | |
370 int i = 0; | |
371 while (*tmp != ':' && *tmp) | |
372 nm[i++] = *tmp++; | |
373 if (*tmp == ':') | |
374 *tmp++ = '\0'; | |
375 nm[i] = '\0'; | |
376 i = 0; | |
377 while (*tmp) | |
378 sw[i++] = *tmp++; | |
379 sw[i] = '\0'; | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
380 if (!find_buddy(gc, nm)) { |
2382 | 381 add_buddy(gc, current, nm, sw); |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
382 how_many++; |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
383 bud = g_list_append(bud, c + 2); |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
384 } |
2382 | 385 } else if (*c == 'p') { |
386 GSList *d = gc->permit; | |
387 char *n; | |
388 name = g_malloc(strlen(c + 2) + 2); | |
389 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2); | |
390 n = g_strdup(normalize (name)); | |
391 while (d) { | |
392 if (!g_strcasecmp(n, normalize (d->data))) | |
393 break; | |
394 d = d->next; | |
395 } | |
396 g_free(n); | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
397 if (!d) { |
2382 | 398 gc->permit = g_slist_append(gc->permit, name); |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
399 how_many++; |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
400 } else |
2382 | 401 g_free(name); |
402 } else if (*c == 'd') { | |
403 GSList *d = gc->deny; | |
404 char *n; | |
405 name = g_malloc(strlen(c + 2) + 2); | |
406 g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2); | |
407 n = g_strdup(normalize (name)); | |
408 while (d) { | |
409 if (!g_strcasecmp(n, normalize (d->data))) | |
410 break; | |
411 d = d->next; | |
412 } | |
413 g_free(n); | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
414 if (!d) { |
2382 | 415 gc->deny = g_slist_append(gc->deny, name); |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
416 how_many++; |
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
417 } else |
2382 | 418 g_free(name); |
419 } else if (!strncmp("toc", c, 3)) { | |
420 sscanf(c + strlen(c) - 1, "%d", &gc->permdeny); | |
421 debug_printf("permdeny: %d\n", gc->permdeny); | |
422 if (gc->permdeny == 0) | |
423 gc->permdeny = 1; | |
424 } else if (*c == 'm') { | |
425 sscanf(c + 2, "%d", &gc->permdeny); | |
426 debug_printf("permdeny: %d\n", gc->permdeny); | |
427 if (gc->permdeny == 0) | |
428 gc->permdeny = 1; | |
429 } | |
430 } while ((c = strtok(NULL, "\n"))); | |
431 | |
432 if (bud != NULL) { | |
433 serv_add_buddies(gc, bud); | |
434 g_list_free(bud); | |
435 } | |
436 serv_set_permit_deny(gc); | |
437 } | |
438 | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
439 if (how_many != 0) |
2382 | 440 do_export(gc); |
441 } | |
442 | |
443 void toc_build_config(struct gaim_connection *gc, char *s, int len, gboolean show) | |
444 { | |
445 GSList *grp = gc->groups; | |
446 GSList *mem; | |
447 struct group *g; | |
448 struct buddy *b; | |
449 GSList *plist = gc->permit; | |
450 GSList *dlist = gc->deny; | |
451 | |
452 int pos = 0; | |
453 | |
454 if (!gc->permdeny) | |
455 gc->permdeny = 1; | |
456 | |
457 pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny); | |
458 while (len > pos && grp) { | |
459 g = (struct group *)grp->data; | |
460 pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name); | |
461 mem = g->members; | |
462 while (len > pos && mem) { | |
463 b = (struct buddy *)mem->data; | |
464 pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name, | |
465 (show && strcmp(b->name, b->show)) ? ":" : "", | |
466 (show && strcmp(b->name, b->show)) ? b->show : ""); | |
467 mem = mem->next; | |
468 } | |
469 grp = g_slist_next(grp); | |
470 } | |
471 | |
472 while (len > pos && plist) { | |
473 pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data); | |
474 plist = plist->next; | |
475 } | |
476 | |
477 while (len > pos && dlist) { | |
478 pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data); | |
479 dlist = dlist->next; | |
480 } | |
481 } | |
482 | |
2536
0e0a54e5819a
[gaim-migrate @ 2549]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2526
diff
changeset
|
483 /* translate an AIM 3 buddylist (*.lst) to a Gaim buddylist */ |
2382 | 484 static void translate_lst(FILE *src_fp, char *dest) |
485 { | |
486 char line[BUF_LEN], *line2; | |
487 char *name; | |
488 int i; | |
489 | |
490 sprintf(dest, "m 1\n"); | |
491 | |
492 while (fgets(line, BUF_LEN, src_fp)) { | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
493 line2 = g_strchug(line); |
2382 | 494 if (strstr(line2, "group") == line2) { |
495 name = strpbrk(line2, " \t\n\r\f") + 1; | |
496 strcat(dest, "g "); | |
497 for (i = 0; i < strcspn(name, "\n\r"); i++) | |
498 if (name[i] != '\"') | |
499 strncat(dest, &name[i], 1); | |
500 strcat(dest, "\n"); | |
501 } | |
502 if (strstr(line2, "buddy") == line2) { | |
503 name = strpbrk(line2, " \t\n\r\f") + 1; | |
504 strcat(dest, "b "); | |
505 for (i = 0; i < strcspn(name, "\n\r"); i++) | |
506 if (name[i] != '\"') | |
507 strncat(dest, &name[i], 1); | |
508 strcat(dest, "\n"); | |
509 } | |
510 } | |
511 | |
512 return; | |
513 } | |
514 | |
515 | |
2536
0e0a54e5819a
[gaim-migrate @ 2549]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2526
diff
changeset
|
516 /* translate an AIM 4 buddylist (*.blt) to Gaim format */ |
2382 | 517 static void translate_blt(FILE *src_fp, char *dest) |
518 { | |
519 int i; | |
520 char line[BUF_LEN]; | |
521 char *buddy; | |
522 | |
523 sprintf(dest, "m 1\n"); | |
524 | |
525 while (strstr(fgets(line, BUF_LEN, src_fp), "Buddy") == NULL); | |
526 while (strstr(fgets(line, BUF_LEN, src_fp), "list") == NULL); | |
527 | |
528 while (1) { | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
529 fgets(line, BUF_LEN, src_fp); g_strchomp(line); |
2382 | 530 if (strchr(line, '}') != NULL) |
531 break; | |
532 | |
533 if (strchr(line, '{') != NULL) { | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
534 /* Syntax starting with "<group> {" */ |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
535 |
2382 | 536 strcat(dest, "g "); |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
537 buddy = g_strchug(strtok(line, "{")); |
2382 | 538 for (i = 0; i < strlen(buddy); i++) { |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
539 if (buddy[i] != '\"') { |
2382 | 540 strncat(dest, &buddy[i], 1); |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
541 } |
2382 | 542 } |
543 strcat(dest, "\n"); | |
544 while (strchr(fgets(line, BUF_LEN, src_fp), '}') == NULL) { | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
545 gboolean pounce = FALSE; |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
546 g_strchomp(line); |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
547 buddy = g_strchug(line); |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
548 debug_printf("\nbuddy: \"%s\"\n\n", buddy); |
2382 | 549 strcat(dest, "b "); |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
550 if (strchr(buddy, '{') != NULL) { |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
551 /* buddy pounce, etc */ |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
552 char *pos = strchr(buddy, '{') - 1; |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
553 *pos = 0; |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
554 pounce = TRUE; |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
555 } |
2382 | 556 if (strchr(buddy, '\"') != NULL) { |
557 buddy++; | |
558 strncat(dest, buddy, strchr(buddy, '\"') - buddy); | |
559 } else | |
560 strcat(dest, buddy); | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
561 strcat(dest, "\n"); |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
562 if (pounce) |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
563 do |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
564 fgets(line, BUF_LEN, src_fp); |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
565 while (!strchr(line, '}')); |
2382 | 566 } |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
567 } else { |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
568 |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
569 /* Syntax "group buddy buddy ..." */ |
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
570 buddy = g_strchug(strtok(line, " \n")); |
2382 | 571 strcat(dest, "g "); |
572 if (strchr(buddy, '\"') != NULL) { | |
573 strcat(dest, &buddy[1]); | |
574 strcat(dest, " "); | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
575 buddy = g_strchug(strtok(NULL, " \n")); |
2382 | 576 while (strchr(buddy, '\"') == NULL) { |
577 strcat(dest, buddy); | |
578 strcat(dest, " "); | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
579 buddy = g_strchug(strtok(NULL, " \n")); |
2382 | 580 } |
581 strncat(dest, buddy, strlen(buddy) - 1); | |
582 } else { | |
583 strcat(dest, buddy); | |
584 } | |
585 strcat(dest, "\n"); | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
586 while ((buddy = g_strchug(strtok(NULL, " \n"))) != NULL) { |
2382 | 587 strcat(dest, "b "); |
588 if (strchr(buddy, '\"') != NULL) { | |
589 strcat(dest, &buddy[1]); | |
590 strcat(dest, " "); | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
591 buddy = g_strchug(strtok(NULL, " \n")); |
2382 | 592 while (strchr(buddy, '\"') == NULL) { |
593 strcat(dest, buddy); | |
594 strcat(dest, " "); | |
2548
20418e5702eb
[gaim-migrate @ 2561]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
595 buddy = g_strchug(strtok(NULL, " \n")); |
2382 | 596 } |
597 strncat(dest, buddy, strlen(buddy) - 1); | |
598 } else { | |
599 strcat(dest, buddy); | |
600 } | |
601 strcat(dest, "\n"); | |
602 } | |
603 } | |
604 } | |
605 | |
606 return; | |
607 } | |
608 | |
609 static gchar *get_screenname_filename(const char *name) | |
610 { | |
611 gchar **split; | |
612 gchar *good; | |
613 | |
614 split = g_strsplit(name, G_DIR_SEPARATOR_S, -1); | |
615 good = g_strjoinv(NULL, split); | |
616 g_strfreev(split); | |
617 | |
618 g_strup(good); | |
619 | |
620 return good; | |
621 } | |
622 | |
623 /* see if a buddy list cache file for this user exists */ | |
624 | |
625 gboolean bud_list_cache_exists(struct gaim_connection *gc) | |
626 { | |
627 gboolean ret = FALSE; | |
628 char path[PATHSIZE]; | |
629 char *file; | |
630 struct stat sbuf; | |
631 char *g_screenname; | |
632 | |
633 g_screenname = get_screenname_filename(gc->username); | |
634 | |
635 file = gaim_user_dir(); | |
636 if (file != (char *)NULL) { | |
2590
2dd86a1af92b
[gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2586
diff
changeset
|
637 g_snprintf(path, sizeof path, "%s/%s.%d.blist", file, g_screenname, gc->protocol); |
2382 | 638 if (!stat(path, &sbuf)) { |
639 debug_printf("%s exists.\n", path); | |
640 ret = TRUE; | |
641 } else { | |
642 char path2[PATHSIZE]; | |
643 debug_printf("%s does not exist.\n", path); | |
644 g_snprintf(path2, sizeof path2, "%s/%s.blist", file, g_screenname); | |
645 if (!stat(path2, &sbuf)) { | |
646 debug_printf("%s exists, moving to %s\n", path2, path); | |
647 if (rename(path2, path)) | |
648 debug_printf("rename didn't work!\n"); | |
649 else | |
650 ret = TRUE; | |
651 } | |
652 } | |
653 g_free(file); | |
654 } | |
655 g_free(g_screenname); | |
656 return ret; | |
657 } | |
658 | |
659 void do_import(struct gaim_connection *gc, char *filename) | |
660 { | |
661 char *buf = g_malloc(BUF_LONG * 2); | |
662 char *buf2; | |
663 char *first = g_malloc(64); | |
664 char *file; | |
665 char path[PATHSIZE]; | |
666 char *g_screenname; | |
667 int len; | |
668 FILE *f; | |
669 | |
670 if (filename) { | |
671 g_snprintf(path, sizeof(path), "%s", filename); | |
672 } else { | |
673 g_screenname = get_screenname_filename(gc->username); | |
674 | |
675 file = gaim_user_dir(); | |
676 if (file != (char *)NULL) { | |
2590
2dd86a1af92b
[gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2586
diff
changeset
|
677 sprintf(path, "%s/%s.%d.blist", file, g_screenname, gc->protocol); |
2382 | 678 g_free(file); |
679 g_free(g_screenname); | |
680 } else { | |
681 g_free(g_screenname); | |
682 g_free(buf); | |
683 g_free(first); | |
684 return; | |
685 } | |
686 } | |
687 | |
688 if (!(f = fopen(path, "r"))) { | |
689 debug_printf("Unable to open %s.\n", path); | |
690 g_free(buf); | |
691 g_free(first); | |
692 return; | |
693 } | |
694 | |
695 fgets(first, 64, f); | |
696 | |
697 /* AIM 4 buddy list */ | |
698 if (!g_strncasecmp(first, "Config {", strlen("Config {"))) { | |
699 debug_printf("aim 4\n"); | |
700 rewind(f); | |
701 translate_blt(f, buf); | |
702 debug_printf("%s\n", buf); | |
703 buf2 = buf; | |
704 buf = g_malloc(8193); | |
705 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); | |
706 g_free(buf2); | |
707 /* AIM 3 buddy list */ | |
708 } else if (strstr(first, "group") != NULL) { | |
709 debug_printf("aim 3\n"); | |
710 rewind(f); | |
711 translate_lst(f, buf); | |
712 debug_printf("%s\n", buf); | |
713 buf2 = buf; | |
714 buf = g_malloc(8193); | |
715 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); | |
716 g_free(buf2); | |
2536
0e0a54e5819a
[gaim-migrate @ 2549]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2526
diff
changeset
|
717 /* Gaim buddy list - no translation */ |
2382 | 718 } else if (first[0] == 'm') { |
719 rewind(f); | |
720 len = fread(buf, 1, BUF_LONG * 2, f); | |
721 buf[len] = '\0'; | |
722 buf2 = buf; | |
723 buf = g_malloc(8193); | |
724 g_snprintf(buf, 8192, "toc_set_config {%s}\n", buf2); | |
725 g_free(buf2); | |
726 /* Something else */ | |
727 } else { | |
728 g_free(buf); | |
729 g_free(first); | |
730 fclose(f); | |
731 return; | |
732 } | |
733 | |
2526
413a81136e3a
[gaim-migrate @ 2539]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2382
diff
changeset
|
734 parse_toc_buddy_list(gc, buf); |
2382 | 735 |
736 fclose(f); | |
737 | |
738 g_free(buf); | |
739 g_free(first); | |
740 } | |
741 | |
742 void do_export(struct gaim_connection *g) | |
743 { | |
744 FILE *dir; | |
745 FILE *f; | |
746 char buf[32 * 1024]; | |
747 char *file; | |
748 char path[PATHSIZE]; | |
749 char *g_screenname; | |
750 | |
751 file = gaim_user_dir(); | |
752 if (!file) | |
753 return; | |
754 | |
755 strcpy(buf, file); | |
756 dir = fopen(buf, "r"); | |
757 if (!dir) | |
758 mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); | |
759 else | |
760 fclose(dir); | |
761 | |
762 g_screenname = get_screenname_filename(g->username); | |
763 | |
2590
2dd86a1af92b
[gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2586
diff
changeset
|
764 sprintf(path, "%s/%s.%d.blist", file, g_screenname, g->protocol); |
2382 | 765 if ((f = fopen(path, "w"))) { |
766 debug_printf("writing %s\n", path); | |
767 toc_build_config(g, buf, 8192 - 1, TRUE); | |
768 fprintf(f, "%s\n", buf); | |
769 fclose(f); | |
770 chmod(buf, S_IRUSR | S_IWUSR); | |
771 } else { | |
772 debug_printf("unable to write %s\n", path); | |
773 } | |
774 | |
775 g_free(g_screenname); | |
776 g_free(file); | |
777 } | |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
778 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
779 static gboolean is_blocked(struct buddy *b) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
780 { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
781 struct gaim_connection *gc = b->gc; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
782 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
783 if (gc->permdeny == PERMIT_ALL) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
784 return FALSE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
785 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
786 if (gc->permdeny == PERMIT_NONE) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
787 if (g_strcasecmp(b->name, gc->displayname)) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
788 return TRUE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
789 else |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
790 return FALSE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
791 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
792 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
793 if (gc->permdeny == PERMIT_SOME) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
794 char *x = g_strdup(normalize(b->name)); |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
795 GSList *s = gc->permit; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
796 while (s) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
797 if (!g_strcasecmp(x, normalize(s->data))) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
798 break; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
799 s = s->next; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
800 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
801 g_free(x); |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
802 if (s) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
803 return FALSE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
804 return TRUE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
805 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
806 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
807 if (gc->permdeny == DENY_SOME) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
808 char *x = g_strdup(normalize(b->name)); |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
809 GSList *s = gc->deny; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
810 while (s) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
811 if (!g_strcasecmp(x, normalize(s->data))) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
812 break; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
813 s = s->next; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
814 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
815 g_free(x); |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
816 if (s) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
817 return TRUE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
818 return FALSE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
819 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
820 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
821 return FALSE; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
822 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
823 |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
824 void signoff_blocked(struct gaim_connection *gc) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
825 { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
826 GSList *g = gc->groups; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
827 while (g) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
828 GSList *m = ((struct group *)g->data)->members; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
829 while (m) { |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
830 struct buddy *b = m->data; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
831 if (is_blocked(b)) |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
832 serv_got_update(gc, b->name, 0, 0, 0, 0, 0, 0); |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
833 m = m->next; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
834 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
835 g = g->next; |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
836 } |
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2590
diff
changeset
|
837 } |