schan_interface.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /*
  19. static void ci_join(char *nick, char *uhost, char *user, char *channel)
  20. {
  21. struct stats_chan *chan;
  22. chan = schan_find(channel);
  23. if (!chan) {
  24. chan = schan_add(channel);
  25. }
  26. schan_join(chan, nick, uhost, user);
  27. }
  28. */
  29. /*
  30. static void ci_leave(char *nick, char *channel)
  31. {
  32. struct stats_chan *chan;
  33. chan = schan_find(channel);
  34. if (chan)
  35. schan_leave(chan, nick);
  36. }
  37. */
  38. static void ci_clearchan(struct stats_chan *chan)
  39. {
  40. struct stats_member *m;
  41. Assert(chan);
  42. for (m = schan_members_getfirst(&chan->members); m; m = schan_members_getnext(&chan->members)) {
  43. schan_members_leave(&chan->members, m->nick);
  44. }
  45. }
  46. static struct stats_member *getschanmember(char *nick, char *channel)
  47. {
  48. struct stats_chan *chan;
  49. chan = schan_find(channel);
  50. if (chan)
  51. return schan_members_find(&chan->members, nick);
  52. else
  53. return NULL;
  54. }
  55. /* used when shosts/susers changed */
  56. static void update_schannel_members()
  57. {
  58. struct stats_chan *chan;
  59. struct stats_member *m;
  60. Context;
  61. for (chan = schan_getfirst(); chan; chan = schan_getnext())
  62. for (m = schan_members_getfirst(&chan->members); m; m = schan_members_getnext(&chan->members))
  63. schan_members_update(m, chan->chan);
  64. }