4
0

egg_bindings.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 eggbnd_pubm(char *nick, char *uhost, char *hand, char *channel, char *rest)
  19. {
  20. struct stats_chan *chan;
  21. chan = schan_find(channel);
  22. if (chan)
  23. sensor_text(chan, nick, rest);
  24. return 0;
  25. }
  26. static int eggbnd_topc(char *nick, char *uhost, char *hand, char *channel, char *topic)
  27. {
  28. struct stats_chan *chan;
  29. chan = schan_find(channel);
  30. if (chan)
  31. sensor_topic(nick, chan, topic);
  32. return 0;
  33. }
  34. static int eggbnd_action(char *nick, char *uhost, char *hand, char *channel,
  35. char *key, char *rest)
  36. {
  37. struct stats_chan *chan;
  38. if (strchr(CHANMETA, channel[0])) {
  39. chan = schan_find(channel);
  40. if (chan)
  41. sensor_action(nick, chan, rest);
  42. }
  43. return 0;
  44. }
  45. static int eggbnd_kick(char *nick, char *uhost, char *hand, char *channel,
  46. char *victim, char *reason)
  47. {
  48. struct stats_chan *chan;
  49. chan = schan_find(channel);
  50. if (chan) {
  51. sensor_kick(nick, chan, victim, reason);
  52. schan_leave(chan, victim);
  53. }
  54. return 0;
  55. }
  56. static int eggbnd_mode(char *nick, char *uhost, char *hand, char *channel,
  57. char *mode, char *victim)
  58. {
  59. struct stats_chan *chan;
  60. chan = schan_find(channel);
  61. if (chan)
  62. sensor_mode(nick, chan, mode, victim);
  63. return 0;
  64. }
  65. static int eggbnd_nick(char *nick, char *uhost, char *hand, char *channel,
  66. char *newnick)
  67. {
  68. struct stats_chan *chan;
  69. chan = schan_find(channel);
  70. if (chan) {
  71. sensor_nick(nick, chan, newnick);
  72. schan_members_rename(&chan->members, nick, newnick);
  73. }
  74. return 0;
  75. }
  76. static int eggbnd_join(char *nick, char *uhost, char *hand, char *channel)
  77. {
  78. struct stats_chan *chan;
  79. chan = schan_find(channel);
  80. if (!chan)
  81. chan = schan_add(channel);
  82. schan_join(chan, nick, uhost, *hand != '*' ? hand : NULL);
  83. sensor_join(nick, uhost, chan);
  84. return 0;
  85. }
  86. static int eggbnd_part(char *nick, char *uhost, char *hand, char *channel)
  87. {
  88. struct stats_chan *chan;
  89. chan = schan_find(channel);
  90. if (chan) {
  91. sensor_left(nick, chan, SL_PART);
  92. schan_leave(chan, nick);
  93. }
  94. return 0;
  95. }
  96. static int eggbnd_sign(char *nick, char *uhost, char *hand, char *channel,
  97. char *reason)
  98. {
  99. struct stats_chan *chan;
  100. chan = schan_find(channel);
  101. if (chan) {
  102. sensor_left(nick, chan, SL_QUIT);
  103. schan_leave(chan, nick);
  104. }
  105. return 0;
  106. }
  107. static int eggbnd_minutely()
  108. {
  109. sensor_minutely();
  110. egg_check_chan_desynch();
  111. }
  112. static cmd_t stats_pubm[] =
  113. {
  114. {"*", "", (Function) eggbnd_pubm, "stat"},
  115. {0, 0, 0, 0}
  116. };
  117. static cmd_t stats_topc[] =
  118. {
  119. {"*", "", (Function) eggbnd_topc, "stat"},
  120. {0, 0, 0, 0}
  121. };
  122. static cmd_t stats_ctcp[] =
  123. {
  124. {"ACTION", "", (Function) eggbnd_action, "stat"},
  125. {0, 0, 0, 0}
  126. };
  127. static cmd_t stats_kick[] =
  128. {
  129. {"*", "", (Function) eggbnd_kick, "stat"},
  130. {0, 0, 0, 0}
  131. };
  132. static cmd_t stats_mode[] =
  133. {
  134. {"*", "", (Function) eggbnd_mode, "stat"},
  135. {0, 0, 0, 0}
  136. };
  137. static cmd_t stats_nick[] =
  138. {
  139. {"*", "", (Function) eggbnd_nick, "stat"},
  140. {0, 0, 0, 0}
  141. };
  142. static cmd_t stats_join[] =
  143. {
  144. {"*", "", (Function) eggbnd_join, "stat"},
  145. {0, 0, 0, 0}
  146. };
  147. static cmd_t stats_part[] =
  148. {
  149. {"*", "", (Function) eggbnd_part, "stat"},
  150. {0, 0, 0, 0}
  151. };
  152. static cmd_t stats_sign[] =
  153. {
  154. {"*", "", (Function) eggbnd_sign, "stat"},
  155. {0, 0, 0, 0}
  156. };