misc.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2000,2001 Florian Sander
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. static int countactivestatmembers_by_word(globstats *gs, int listable, int min)
  19. {
  20. int members = 0;
  21. locstats *ls;
  22. Context;
  23. for (ls = gs->local; ls; ls = ls->next) {
  24. if (listable && !listsuser(ls, gs->chan))
  25. continue;
  26. if (!ls->word)
  27. continue;
  28. if (ls->word->nr < min)
  29. continue;
  30. members++;
  31. }
  32. return members;
  33. }
  34. /* stolen from tcl_matchattr */
  35. /*
  36. static int matchattr (struct userrec *u, char *flags, char *chan) {
  37. struct flag_record plus, minus, user;
  38. int ok = 0, f;
  39. #ifndef OLDBOT
  40. if (u && (!chan || findchan_by_dname(chan))) {
  41. #else
  42. if (u && (!chan || findchan(chan))) {
  43. #endif
  44. user.match = FR_GLOBAL | (chan ? FR_CHAN : 0) | FR_BOT;
  45. get_user_flagrec(u, &user, chan);
  46. plus.match = user.match;
  47. break_down_flags(flags, &plus, &minus);
  48. f = (minus.global || minus.udef_global || minus.chan ||
  49. minus.udef_chan || minus.bot);
  50. if (flagrec_eq(&plus, &user)) {
  51. if (!f)
  52. ok = 1;
  53. else {
  54. minus.match = plus.match ^ (FR_AND | FR_OR);
  55. if (!flagrec_eq(&minus, &user))
  56. ok = 1;
  57. }
  58. }
  59. }
  60. return ok;
  61. }
  62. */
  63. static int secretchan(char *chan)
  64. {
  65. struct chanset_t *ch;
  66. if (list_secret_chans)
  67. return 0;
  68. ch = findchan_by_dname(chan);
  69. if (!ch)
  70. return 0;
  71. if (ch->status & CHAN_SECRET)
  72. return 1;
  73. return 0;
  74. }