comparison src/protocols/oscar/oscar.c @ 4778:85c6c3a60503

[gaim-migrate @ 5098] It helps when you commit stuff committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 14 Mar 2003 22:59:58 +0000
parents 6219ffd18c63
children 443aade63ef8
comparison
equal deleted inserted replaced
4777:e23a7e166680 4778:85c6c3a60503
4378 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { 4378 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
4379 struct gaim_connection *gc = sess->aux_data; 4379 struct gaim_connection *gc = sess->aux_data;
4380 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 4380 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
4381 struct aim_ssi_item *curitem; 4381 struct aim_ssi_item *curitem;
4382 int tmp; 4382 int tmp;
4383 gboolean export = FALSE;
4383 /* XXX - use these? 4384 /* XXX - use these?
4384 va_list ap; 4385 va_list ap;
4385 4386
4386 va_start(ap, fr); 4387 va_start(ap, fr);
4387 fmtver = (fu16_t)va_arg(ap, int); 4388 fmtver = (fu16_t)va_arg(ap, int);
4391 va_end(ap); */ 4392 va_end(ap); */
4392 4393
4393 debug_printf("ssi: syncing local list and server list\n"); 4394 debug_printf("ssi: syncing local list and server list\n");
4394 4395
4395 /* Clean the buddy list */ 4396 /* Clean the buddy list */
4396 aim_ssi_cleanlist(sess, fr->conn); 4397 /* aim_ssi_cleanlist(sess, fr->conn); */
4397 4398
4398 /* Add from server list to local list */ 4399 /* Add from server list to local list */
4399 tmp = 0;
4400 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { 4400 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) {
4401 switch (curitem->type) { 4401 switch (curitem->type) {
4402 case 0x0000: { /* Buddy */ 4402 case 0x0000: { /* Buddy */
4403 if (curitem->name) { 4403 if (curitem->name) {
4404 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); 4404 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name);
4424 gaim_blist_add_group(g, NULL); 4424 gaim_blist_add_group(g, NULL);
4425 } 4425 }
4426 4426
4427 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); 4427 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname);
4428 gaim_blist_add_buddy(buddy, g, NULL); 4428 gaim_blist_add_buddy(buddy, g, NULL);
4429 tmp++; 4429 export = TRUE;
4430 } 4430 }
4431 free(gname_utf8); 4431 free(gname_utf8);
4432 free(alias_utf8); 4432 free(alias_utf8);
4433 } 4433 }
4434 } break; 4434 } break;
4444 for (list=gc->account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 4444 for (list=gc->account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
4445 if (!list) { 4445 if (!list) {
4446 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name); 4446 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name);
4447 gaim_privacy_permit_add(gc->account, curitem->name); 4447 gaim_privacy_permit_add(gc->account, curitem->name);
4448 build_allow_list(); 4448 build_allow_list();
4449 tmp++; 4449 export = TRUE;
4450 } 4450 }
4451 } 4451 }
4452 } break; 4452 } break;
4453 4453
4454 case 0x0003: { /* Deny buddy */ 4454 case 0x0003: { /* Deny buddy */
4457 for (list=gc->account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); 4457 for (list=gc->account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
4458 if (!list) { 4458 if (!list) {
4459 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name); 4459 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name);
4460 gaim_privacy_deny_add(gc->account, curitem->name); 4460 gaim_privacy_deny_add(gc->account, curitem->name);
4461 build_block_list(); 4461 build_block_list();
4462 tmp++; 4462 export = TRUE;
4463 } 4463 }
4464 } 4464 }
4465 } break; 4465 } break;
4466 4466
4467 case 0x0004: { /* Permit/deny setting */ 4467 case 0x0004: { /* Permit/deny setting */
4471 debug_printf("ssi: changing permdeny from %d to %hhu\n", gc->account->permdeny, permdeny); 4471 debug_printf("ssi: changing permdeny from %d to %hhu\n", gc->account->permdeny, permdeny);
4472 gc->account->permdeny = permdeny; 4472 gc->account->permdeny = permdeny;
4473 if (od->icq && gc->account->permdeny == 0x03) { 4473 if (od->icq && gc->account->permdeny == 0x03) {
4474 serv_set_away(gc, "Invisible", ""); 4474 serv_set_away(gc, "Invisible", "");
4475 } 4475 }
4476 tmp++; 4476 export = TRUE;
4477 } 4477 }
4478 } 4478 }
4479 } break; 4479 } break;
4480 4480
4481 case 0x0005: { /* Presence setting */ 4481 case 0x0005: { /* Presence setting */
4483 } break; 4483 } break;
4484 } /* End of switch on curitem->type */ 4484 } /* End of switch on curitem->type */
4485 } /* End of for loop */ 4485 } /* End of for loop */
4486 4486
4487 /* If changes were made, then flush buddy list to file */ 4487 /* If changes were made, then flush buddy list to file */
4488 if (tmp) 4488 if (export)
4489 gaim_blist_save(); 4489 gaim_blist_save();
4490 4490
4491 { /* Add from local list to server list */ 4491 { /* Add from local list to server list */
4492 GaimBlistNode *gnode, *bnode; 4492 GaimBlistNode *gnode, *bnode;
4493 struct group *group; 4493 struct group *group;
4494 struct buddy *buddy; 4494 struct buddy *buddy;
4495 struct gaim_buddy_list *blist; 4495 struct gaim_buddy_list *blist;
4496 GSList *groups = gaim_blist_groups();
4497 GSList *cur; 4496 GSList *cur;
4498 4497
4499 /* Buddies */ 4498 /* Buddies */
4500 if ((blist = gaim_get_blist())) 4499 if ((blist = gaim_get_blist()))
4501 for (gnode = blist->root; gnode; gnode = gnode->next) { 4500 for (gnode = blist->root; gnode; gnode = gnode->next) {
4542 4541
4543 /* Presence settings (idle time visibility) */ 4542 /* Presence settings (idle time visibility) */
4544 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) 4543 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF)
4545 if (report_idle && !(tmp & 0x400)) 4544 if (report_idle && !(tmp & 0x400))
4546 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400); 4545 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400);
4547 4546 } /* end adding buddies from local list to server list */
4548 /* Check for maximum number of buddies */ 4547
4548 { /* Check for maximum number of buddies */
4549 GSList *groups = gaim_blist_groups(), *cur;
4549 for (cur=groups, tmp=0; cur; cur=g_slist_next(cur)) { 4550 for (cur=groups, tmp=0; cur; cur=g_slist_next(cur)) {
4550 struct group* gr = (struct group*)cur->data; 4551 struct group* gr = (struct group*)cur->data;
4551 GSList *buds = gaim_blist_members(gr); 4552 GSList *buds = gaim_blist_members(gr);
4552 GSList *buds1 = buds; 4553 GSList *buds1 = buds;
4553 while(buds1) { 4554 while(buds1) {
4565 " Until you are below the limit, some buddies will not show up as online."), 4566 " Until you are below the limit, some buddies will not show up as online."),
4566 od->rights.maxbuddies, tmp); 4567 od->rights.maxbuddies, tmp);
4567 do_error_dialog(_("Maximum buddy list length exceeded."), dialog_msg, GAIM_WARNING); 4568 do_error_dialog(_("Maximum buddy list length exceeded."), dialog_msg, GAIM_WARNING);
4568 g_free(dialog_msg); 4569 g_free(dialog_msg);
4569 } 4570 }
4571 }
4570 4572
4571 } /* end adding buddies from local list to server list */
4572
4573 /* Activate SSI */ 4573 /* Activate SSI */
4574 /* Sending the enable causes other people to be able to see you, and you to see them */ 4574 /* Sending the enable causes other people to be able to see you, and you to see them */
4575 /* Make sure your privacy setting/invisibility is set how you want it before this! */ 4575 /* Make sure your privacy setting/invisibility is set how you want it before this! */
4576 debug_printf("ssi: activating server-stored buddy list\n"); 4576 debug_printf("ssi: activating server-stored buddy list\n");
4577 aim_ssi_enable(sess); 4577 aim_ssi_enable(sess);