Mercurial > pidgin
comparison src/server.c @ 679:71b2477033cb
[gaim-migrate @ 689]
mods to permit/deny stuff
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Tue, 15 Aug 2000 02:40:53 +0000 |
| parents | c72f58814e9f |
| children | acdbee5a9492 |
comparison
equal
deleted
inserted
replaced
| 678:c72f58814e9f | 679:71b2477033cb |
|---|---|
| 378 void serv_set_permit_deny() | 378 void serv_set_permit_deny() |
| 379 { | 379 { |
| 380 if (!USE_OSCAR) { | 380 if (!USE_OSCAR) { |
| 381 char buf[MSG_LEN]; | 381 char buf[MSG_LEN]; |
| 382 int at; | 382 int at; |
| 383 int cnt; | |
| 384 GList *list; | 383 GList *list; |
| 385 GList *mem; | |
| 386 struct buddy *b; | |
| 387 struct group *g; | |
| 388 | 384 |
| 389 switch (permdeny) { | 385 switch (permdeny) { |
| 390 case PERMIT_ALL: | 386 case PERMIT_ALL: |
| 391 /* toc_add_permit current_user to go to permit mode, | 387 /* toc_add_permit current_user to go to permit mode, |
| 392 toc_add_deny <none> to deny none */ | 388 toc_add_deny <none> to deny none */ |
| 435 sflap_send(buf, -1, TYPE_DATA); | 431 sflap_send(buf, -1, TYPE_DATA); |
| 436 sprintf(buf, "toc_add_deny"); | 432 sprintf(buf, "toc_add_deny"); |
| 437 sflap_send(buf, -1, TYPE_DATA); | 433 sflap_send(buf, -1, TYPE_DATA); |
| 438 } | 434 } |
| 439 break; | 435 break; |
| 440 case PERMIT_BUDDY: | |
| 441 /* toc_add_permit <bud> */ | |
| 442 /* if there are no buddies this is the same as PERMIT_NONE */ | |
| 443 at = g_snprintf(buf, sizeof(buf), "toc_add_permit"); | |
| 444 list = groups; | |
| 445 cnt = 0; | |
| 446 while (list) { | |
| 447 g = (struct group *)list->data; | |
| 448 mem = g->members; | |
| 449 while (mem) { | |
| 450 b = (struct buddy *)mem->data; | |
| 451 at += g_snprintf(&buf[at], sizeof(buf) - at, " %s", normalize(b->name)); | |
| 452 cnt++; | |
| 453 mem = mem->next; | |
| 454 } | |
| 455 list = list->next; | |
| 456 } | |
| 457 if (cnt) { | |
| 458 sflap_send(buf, -1, TYPE_DATA); | |
| 459 } else { | |
| 460 sprintf(buf, "toc_add_deny %s", current_user->username); | |
| 461 sflap_send(buf, -1, TYPE_DATA); | |
| 462 sprintf(buf, "toc_add_permit"); | |
| 463 sflap_send(buf, -1, TYPE_DATA); | |
| 464 } | |
| 465 } | 436 } |
| 466 } else { | 437 } else { |
| 467 int at; | 438 int at; |
| 468 GList *list; | 439 GList *list; |
| 469 GList *mem; | |
| 470 struct buddy *b; | |
| 471 struct group *g; | |
| 472 char buf[MSG_LEN]; | 440 char buf[MSG_LEN]; |
| 473 int cnt; | |
| 474 | 441 |
| 475 switch (permdeny) { | 442 switch (permdeny) { |
| 476 /* aim_bos_changevisibility(gaim_sess, gaim_conn, type, list) */ | 443 /* aim_bos_changevisibility(gaim_sess, gaim_conn, type, list) */ |
| 477 case PERMIT_ALL: | 444 case PERMIT_ALL: |
| 478 /* AIM_VISIBILITYCHANGE_DENYADD current_user */ | 445 /* AIM_VISIBILITYCHANGE_DENYADD current_user */ |
| 485 AIM_VISIBILITYCHANGE_PERMITADD, current_user->username); | 452 AIM_VISIBILITYCHANGE_PERMITADD, current_user->username); |
| 486 break; | 453 break; |
| 487 case PERMIT_SOME: | 454 case PERMIT_SOME: |
| 488 /* PERMIT <permit> */ | 455 /* PERMIT <permit> */ |
| 489 /* if permit is empty this is the same as PERMIT_NONE */ | 456 /* if permit is empty this is the same as PERMIT_NONE */ |
| 490 if (permit) { | 457 at = g_snprintf(buf, sizeof(buf), "%s", current_user->username); |
| 491 at = 0; | 458 list = permit; |
| 492 list = permit; | 459 while (list) { |
| 493 while (list) { | 460 at += g_snprintf(&buf[at], sizeof(buf) - at, "&"); |
| 494 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s", list->data); | 461 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s", list->data); |
| 495 list = list->next; | 462 list = list->next; |
| 496 if (list) | |
| 497 at += g_snprintf(&buf[at], sizeof(buf) - at, "&"); | |
| 498 } | |
| 499 aim_bos_changevisibility(gaim_sess, gaim_conn, | |
| 500 AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
| 501 } else { | |
| 502 aim_bos_changevisibility(gaim_sess, gaim_conn, | |
| 503 AIM_VISIBILITYCHANGE_PERMITADD, current_user->username); | |
| 504 } | 463 } |
| 464 aim_bos_changevisibility(gaim_sess, gaim_conn, | |
| 465 AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
| 505 break; | 466 break; |
| 506 case DENY_SOME: | 467 case DENY_SOME: |
| 507 /* DENY <deny> */ | 468 /* DENY <deny> */ |
| 508 /* if deny is empty this is the same as PERMIT_ALL */ | 469 /* if deny is empty this is the same as PERMIT_ALL */ |
| 509 if (deny) { | 470 if (deny) { |
| 520 } else { | 481 } else { |
| 521 aim_bos_changevisibility(gaim_sess, gaim_conn, | 482 aim_bos_changevisibility(gaim_sess, gaim_conn, |
| 522 AIM_VISIBILITYCHANGE_DENYADD, current_user->username); | 483 AIM_VISIBILITYCHANGE_DENYADD, current_user->username); |
| 523 } | 484 } |
| 524 break; | 485 break; |
| 525 case PERMIT_BUDDY: | |
| 526 /* PERMIT <bud> */ | |
| 527 /* if there are no buddies this is the same as PERMIT_NONE */ | |
| 528 at = 0; | |
| 529 list = groups; | |
| 530 cnt = 0; | |
| 531 while (list) { | |
| 532 g = (struct group *)list->data; | |
| 533 mem = g->members; | |
| 534 while (mem) { | |
| 535 b = (struct buddy *)mem->data; | |
| 536 if (at) | |
| 537 at += g_snprintf(&buf[at], sizeof(buf) - at, "&"); | |
| 538 at += g_snprintf(&buf[at], sizeof(buf) - at, "%s", b->name); | |
| 539 cnt++; | |
| 540 mem = mem->next; | |
| 541 } | |
| 542 list = list->next; | |
| 543 } | |
| 544 if (cnt) { | |
| 545 aim_bos_changevisibility(gaim_sess, gaim_conn, | |
| 546 AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
| 547 } else { | |
| 548 aim_bos_changevisibility(gaim_sess, gaim_conn, | |
| 549 AIM_VISIBILITYCHANGE_PERMITADD, current_user->username); | |
| 550 } | |
| 551 break; | |
| 552 } | 486 } |
| 553 } | 487 } |
| 554 } | 488 } |
| 555 | 489 |
| 556 void serv_set_idle(int time) | 490 void serv_set_idle(int time) |
