From a816b4b4ee33f5302bb6206fc16426d52af8debd Mon Sep 17 00:00:00 2001 From: skizzerz Date: Sun, 8 Nov 2015 11:00:03 -0600 Subject: [PATCH] Add SERVER_PASS config to control PASS command --- botconfig.py.example | 8 ++++++++ oyoyo/client.py | 9 ++++++--- wolfbot.py | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/botconfig.py.example b/botconfig.py.example index a6b3e99..277aa7f 100644 --- a/botconfig.py.example +++ b/botconfig.py.example @@ -12,6 +12,14 @@ CHANNEL = "##mywolfgame" CMD_CHAR = "!" +# If your server requires a connection password, or your services package expects +# a different format if authenticating to NickServ via the PASS command, modify this. +# The default should work fine on Atheme-based services packages. +# +# Note: Do not put the account and password here; they will be automatically substituted +# from the USERNAME (or NICK) and PASS variables on the top of the file. + +SERVER_PASS = "{account}:{password}" OWNERS = ("unaffiliated/wolfbot_admin1",) # The comma is required at the end if there is only one owner. ADMINS = ("unaffiliated/wolfbot_admin2", "unaffiliated/wolfbot_test*") diff --git a/oyoyo/client.py b/oyoyo/client.py index deccafc..fc062db 100644 --- a/oyoyo/client.py +++ b/oyoyo/client.py @@ -112,6 +112,7 @@ class IRCClient(object): self.blocking = True self.sasl_auth = False self.use_ssl = False + self.server_pass = None self.lock = threading.RLock() self.stream_handler = lambda output, level=None: print(output) @@ -189,9 +190,11 @@ class IRCClient(object): self.cap("LS", "302") - if not self.sasl_auth: - self.send("PASS {0}:{1}".format(self.authname if self.authname else self.nickname, - self.password if self.password else "NOPASS")) + if self.server_pass and (not self.sasl_auth or "{password}" not in self.server_pass): + message = "PASS :{0}".format(self.server_pass).format( + account=self.authname if self.authname else self.nickname, + password=self.password) + self.send(message) self.nick(self.nickname) self.user(self.ident, self.real_name) diff --git a/wolfbot.py b/wolfbot.py index 36f381d..c83719b 100755 --- a/wolfbot.py +++ b/wolfbot.py @@ -46,6 +46,7 @@ def main(): ident=botconfig.IDENT, real_name=botconfig.REALNAME, sasl_auth=botconfig.SASL_AUTHENTICATION, + server_pass=botconfig.SERVER_PASS, use_ssl=botconfig.USE_SSL, connect_cb=handler.connect_callback, stream_handler=src.stream,