X-Git-Url: https://blacka.com/cgi-bin/gitweb.cgi?p=python-rwhoisd.git;a=blobdiff_plain;f=rwhoisd%2FDirectiveProcessor.py;h=634a003ebe67c4d384b45bae2d824303f1e39664;hp=94e3233f1d3e49fbd1333249b5961d25ea233b4e;hb=HEAD;hpb=a6b5f5371ee8a2510703e0f6f491df9f8065e622 diff --git a/rwhoisd/DirectiveProcessor.py b/rwhoisd/DirectiveProcessor.py index 94e3233..634a003 100644 --- a/rwhoisd/DirectiveProcessor.py +++ b/rwhoisd/DirectiveProcessor.py @@ -1,3 +1,22 @@ +# This file is part of python-rwhoisd +# +# Copyright (C) 2003, David E. Blacka +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA + import re import Rwhois, config @@ -12,7 +31,8 @@ class DirectiveProcessor: "limit" : self.limit_directive, "holdconnect" : self.hold_directive, "directive" : self.directive_directive, - "xfer" : self.xfer_directive + "xfer" : self.xfer_directive, + "status" : self.status_directive } def process_directive(self, session, line): @@ -97,6 +117,21 @@ class DirectiveProcessor: session.wfile.write(Rwhois.ok()) + def status_directive(self, session, arglist): + if session.holdconnect: + hc_str = "on" + else: + hc_str = "off" + + session.wfile.write("%%status limit: %d\r\n" % session.limit) + session.wfile.write("%%status holdconnect: %s\r\n" % hc_str) + session.wfile.write("%status forward: off\r\n") + session.wfile.write("%%status objects: %d\r\n" + % len(self.db.main_index)) + session.wfile.write("%status display: dump\r\n") + session.wfile.write("%status contact: N/A\r\n") + session.wfile.write(Rwhois.ok()) + def xfer_directive(self, session, arglist): if not arglist: session.wfile.write(Rwhois.error_message(338))