Skip to content

Commit

Permalink
Merge pull request #256 from aadis/master
Browse files Browse the repository at this point in the history
Allow optional username for IRC backend.
  • Loading branch information
gbin committed Jun 22, 2014
2 parents ce3b7b0 + 01b72d7 commit edeec08
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions errbot/backends/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@


class IRCConnection(SingleServerIRCBot):
def __init__(self, callback, nickname, server, port=6667, ssl=False, password=None):
def __init__(self, callback, nickname, server, port=6667, ssl=False, password=None, username=None):
self.use_ssl = ssl
self.callback = callback
super().__init__([(server, port, password)], nickname, nickname)
if username is None:
username = nickname
super().__init__([(server, port, password)], nickname, username)

def _dispatcher(self, c, e):
super()._dispatcher(c, e)
Expand Down Expand Up @@ -80,10 +82,10 @@ def send_public_message(self, to, line):


class IRCBackend(ErrBot):
def __init__(self, nickname, server, port=6667, password=None, ssl=False):
def __init__(self, nickname, server, port=6667, password=None, ssl=False, username=None):
self.jid = nickname + '@' + server
super(IRCBackend, self).__init__()
self.conn = IRCConnection(self, nickname, server, port, ssl, password)
self.conn = IRCConnection(self, nickname, server, port, ssl, password, username)

def serve_forever(self):
try:
Expand Down

0 comments on commit edeec08

Please sign in to comment.