From 475fa73bf37cdd8947be866619ddc6cac8215a63 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 12 Jan 2013 10:10:32 -0600 Subject: [PATCH 1/3] Dispatch: encode('utf-8') XML-RPC input --- modules/Dispatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Dispatch.py b/modules/Dispatch.py index 7cc9711..d087c71 100644 --- a/modules/Dispatch.py +++ b/modules/Dispatch.py @@ -85,7 +85,7 @@ class Dispatch(Module): key, dest = self._get_key_and_destination(key) if key is not None and dest is not None: - msg = "[{0:s}] {1:s}".format(key, message) + msg = "[{0:s}] {1:s}".format(key, message.encode('utf-8', 'ignore')) self.new_sendmsg(dest, msg) return dest, msg From 89847a6e58a086fcc10cea9561f0c6ad7c2b9873 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 13 Jan 2013 11:45:01 -0600 Subject: [PATCH 2/3] IrcAdmin: sleep a configured time before autojoin this is to let any sort of autosend commands apply before joining channels. for example, i have my bot set to turn on its hostserv cloak, which was sometimes happening after channel joins, making its hostname appear different in various channels. this solves that as a total aside, this module is becoming really poorly named, i should probably do something about that --- dr.botzo.cfg.example | 1 + modules/IrcAdmin.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/dr.botzo.cfg.example b/dr.botzo.cfg.example index 8d5c024..1bc6e8c 100644 --- a/dr.botzo.cfg.example +++ b/dr.botzo.cfg.example @@ -14,6 +14,7 @@ dbname = dr_botzo [IrcAdmin] autojoin = #bss +sleep = 30 automsg = nickserv identify foo [Karma] diff --git a/modules/IrcAdmin.py b/modules/IrcAdmin.py index 86fa3cb..bacc4f4 100644 --- a/modules/IrcAdmin.py +++ b/modules/IrcAdmin.py @@ -17,6 +17,7 @@ along with this program. If not, see . """ from ConfigParser import NoOptionError +import time from extlib import irclib @@ -56,6 +57,12 @@ class IrcAdmin(Module): ' '.join(command.split(' ')[1:])) except NoOptionError: pass + # sleep for a bit before autojoining, if told to + try: + sleep = self.config.getint(self.__class__.__name__, 'sleep') + time.sleep(sleep) + except NoOptionError: pass + # join the specified channels try: autojoins = self.config.get(self.__class__.__name__, 'autojoin').split(',') From ed63e027d4099f1ba5d86e81b7017fe6e80fa30c Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Tue, 22 Jan 2013 17:12:37 -0600 Subject: [PATCH 3/3] dr.botzo.py: optionally connect via ipv6, ssl --- dr.botzo.cfg.example | 2 ++ dr.botzo.py | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dr.botzo.cfg.example b/dr.botzo.cfg.example index 1bc6e8c..8953f36 100644 --- a/dr.botzo.cfg.example +++ b/dr.botzo.cfg.example @@ -11,6 +11,8 @@ dbhost = localhost dbuser = dr_botzo dbpass = password dbname = dr_botzo +ssl = no +ipv6 = yes [IrcAdmin] autojoin = #bss diff --git a/dr.botzo.py b/dr.botzo.py index 7f73642..64a1f4a 100644 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -85,12 +85,33 @@ except NoOptionError as e: sys.exit("Aborted due to error with necessary configuration: " "{0:s}".format(str(e))) +# get some optional parameters +use_ssl = False +try: + use_ssl = config.getboolean('dr.botzo', 'ssl') +except NoOptionError: + pass +if use_ssl: + log.info("SSL support enabled") +else: + log.debug("SSL not requested") + +use_ipv6 = False +try: + use_ipv6 = config.getboolean('dr.botzo', 'ipv6') +except NoOptionError: + pass +if use_ipv6: + log.info("IPv6 support enabled") +else: + log.debug("IPv6 not requested") + # start up the IRC bot # create IRC and server objects and connect irc = DrBotIRC.DrBotIRC(config) server = irc.server().connect(botserver, botport, botnick, botpass, - botuser, botircname) + botuser, botircname, ssl=use_ssl, ipv6=use_ipv6) # load features try: