From: Eric S. Raymond Date: Tue, 16 Apr 2013 11:42:39 +0000 (-0400) Subject: Added -p option. X-Git-Tag: 1.18~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5daca98b438dbe6ad993b2918001c59481126e7d;p=irker.git Added -p option. --- diff --git a/NEWS b/NEWS index f72b883..1f63f66 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ 1.18 Added -l option; irker can now be used as a channel monitor. - Added -n option: the nick can be forced. + Added -n and -p option: the nick can be forced and authenticated. 1.17 @ 2013-02-03 Various minor fixes and bulletproofing. diff --git a/irkerd b/irkerd index d3ea230..3889cc7 100755 --- a/irkerd +++ b/irkerd @@ -122,6 +122,8 @@ class Connection: "The server says we're OK, with a non-conflicting nick." self.status = "ready" self.irker.debug(1, "nick %s accepted" % self.nickname()) + if password: + self.connection.privmsg("nickserv", "identify %s" % password) def handle_badnick(self): "The server says our nick is ill-formed or has a conflict." self.irker.debug(1, "nick %s rejected" % self.nickname()) @@ -468,7 +470,7 @@ class Irker: self.debug(1, "irker has been kicked from %s on %s" % (target, connection.server)) if connection.context: connection.context.handle_kick(target) - def _handle_all_raw_messages(self, connection, event): + def _handle_all_raw_messages(self, _connection, event): "Log all messages when in watcher mode." with open(logfile, "w") as logfp: logfp.write("%03f|%s|%s\n" % \ @@ -545,8 +547,9 @@ class IrkerUDPHandler(SocketServer.BaseRequestHandler): if __name__ == '__main__': debuglvl = 0 namestyle = "irker%03d" + password = None logfile = None - (options, arguments) = getopt.getopt(sys.argv[1:], "d:l:n:V:") + (options, arguments) = getopt.getopt(sys.argv[1:], "d:l:n:p:V:") for (opt, val) in options: if opt == '-d': # Enable debug/progress messages debuglvl = int(val) @@ -556,6 +559,8 @@ if __name__ == '__main__': logfile = val elif opt == '-n': # Force the nick namestyle = val + elif opt == '-p': # Set a nickserv password + password = val elif opt == '-V': # Emit version and exit sys.stdout.write("irkerd version %s\n" % version) sys.exit(0) diff --git a/irkerd.xml b/irkerd.xml index 54d2ffb..345c053 100644 --- a/irkerd.xml +++ b/irkerd.xml @@ -21,6 +21,7 @@ -d debuglevel -l logfile -n nick + -p password -V @@ -88,6 +89,12 @@ to be used. If the nick contains a numeric format element in the event of a nick collision. +-p +Takes a following value, setting a nickserv +password to be used. If given, this password is shipped to +authenticate the nick on receipt of a welcom message. + + -V Write the program version to stdout and terminate.