bridge_with_irc: Add command line arg to specify stream.

This commit is contained in:
rht 2018-08-13 07:39:31 +01:00 committed by Tim Abbott
parent ed6c797d19
commit a5bc4b716c
2 changed files with 10 additions and 6 deletions

View file

@ -11,11 +11,12 @@ def zulip_sender(sender_string):
return nick + "@" + IRC_DOMAIN
class IRCBot(irc.bot.SingleServerIRCBot):
def __init__(self, zulip_client, channel, nickname, server, port=6667):
# type: (Any, irc.bot.Channel, str, str, int) -> None
def __init__(self, zulip_client, stream, channel, nickname, server, port=6667):
# type: (Any, str, irc.bot.Channel, str, str, int) -> None
irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
self.channel = channel # type: irc.bot.Channel
self.zulip_client = zulip_client
self.stream = stream
def on_nicknameinuse(self, c, e):
# type: (ServerConnection, Event) -> None
@ -62,7 +63,7 @@ class IRCBot(irc.bot.SingleServerIRCBot):
def on_pubmsg(self, c, e):
# type: (ServerConnection, Event) -> None
content = e.arguments[0]
stream = e.target
stream = self.stream
sender = zulip_sender(e.source)
if sender.endswith("_zulip@" + IRC_DOMAIN):
return