]>
jfr.im git - irc/quakenet/newserv.git/blob - rbl/rbl_commands.c
3 #include "../core/hooks.h"
4 #include "../control/control.h"
5 #include "../irc/irc.h"
6 #include "../lib/irc_string.h"
7 #include "../lib/version.h"
12 static int rbl_cmdlookuprbl ( void * source
, int cargc
, char ** cargv
) {
13 nick
* sender
= source
;
15 struct irc_in_addr ip
;
20 if (! ipmask_parse ( cargv
[ 0 ], & ip
, NULL
)) {
21 controlreply ( sender
, "Invalid IP address." );
25 for ( rbl
= rbl_instances
; rbl
; rbl
= rbl
-> next
) {
27 if ( RBL_LOOKUP ( rbl
, & ip
, reason
, sizeof ( reason
)) <= 0 )
30 controlreply ( sender
, "RBL: %s ( %s )" , rbl
-> name
-> content
, reason
);
33 controlreply ( sender
, "Done." );
38 static int rbl_cmdlistrbl ( void * source
, int cargc
, char ** cargv
) {
39 nick
* sender
= source
;
42 for ( rbl
= rbl_instances
; rbl
; rbl
= rbl
-> next
)
43 controlreply ( sender
, " %s " , rbl
-> name
-> content
);
45 controlreply ( sender
, "End of list." );
51 registercontrolhelpcmd ( "lookuprbl" , NO_OPER
, 1 , & rbl_cmdlookuprbl
, "Usage: lookuprbl <IP> \n Looks up whether RBL records exist for the specified IP address." );
52 registercontrolhelpcmd ( "listrbl" , NO_OPER
, 0 , & rbl_cmdlistrbl
, "Usage: listrbl \n Lists RBLs." );
56 deregistercontrolcmd ( "lookuprbl" , & rbl_cmdlookuprbl
);
57 deregistercontrolcmd ( "listrbl" , & rbl_cmdlistrbl
);