00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef lint
00021 static const char rcsid[] = "$Id: events.c,v 1.12 2007-04-14 15:21:13 sven Exp $";
00022 #endif
00023
00024 #include <eggdrop/eggdrop.h>
00025 #include "telnetparty.h"
00026
00027 static int on_privmsg(void *client_data, partymember_t *dest, botnet_entity_t *src, const char *text, int len);
00028 static int on_nick(void *client_data, partymember_t *src, const char *oldnick, const char *newnick);
00029 static int on_quit(void *client_data, partymember_t *src, const botnet_bot_t *lostbot, const char *text, int len);
00030 static int on_chanmsg(void *client_data, partychan_t *chan, botnet_entity_t *src, const char *text, int len);
00031 static int on_join(void *client_data, partychan_t *chan, partymember_t *src, int linking);
00032 static int on_part(void *client_data, partychan_t *chan, partymember_t *src, const char *text, int len);
00033
00034 partyline_event_t telnet_party_handler = {
00035 on_privmsg,
00036 on_nick,
00037 on_quit,
00038 on_chanmsg,
00039 on_join,
00040 on_part
00041 };
00042
00043 static int on_privmsg(void *client_data, partymember_t *dest, botnet_entity_t *src, const char *text, int len)
00044 {
00045 return partyline_idx_privmsg (((telnet_session_t *)client_data)->idx, dest, src, text, len);
00046 }
00047
00048 static int on_nick(void *client_data, partymember_t *src, const char *oldnick, const char *newnick)
00049 {
00050 return partyline_idx_nick (((telnet_session_t *)client_data)->idx, src, oldnick, newnick);
00051 }
00052
00053 static int on_quit(void *client_data, partymember_t *src, const botnet_bot_t *lostbot, const char *text, int len)
00054 {
00055 telnet_session_t *session = client_data;
00056
00057 if (lostbot) return 0;
00058 partyline_idx_quit(session->idx, src, text, len);
00059
00060 return(0);
00061 }
00062
00063 static int on_chanmsg(void *client_data, partychan_t *chan, botnet_entity_t *src, const char *text, int len)
00064 {
00065 return partyline_idx_chanmsg (((telnet_session_t *)client_data)->idx, chan, src, text, len);
00066 }
00067
00068 static int on_join(void *client_data, partychan_t *chan, partymember_t *src, int linking)
00069 {
00070 if (linking) return 0;
00071 return partyline_idx_join(((telnet_session_t *)client_data)->idx, chan, src);
00072 }
00073
00074 static int on_part(void *client_data, partychan_t *chan, partymember_t *src, const char *text, int len)
00075 {
00076 return partyline_idx_part(((telnet_session_t *)client_data)->idx, chan, src, text, len);
00077 }