Skip to content

Commit fe2a4d6

Browse files
rhttimabbott
authored andcommitted
[BUGFIX] IRC bridge: Use connection initialized from aio_reactor.
Additionally, pin the irc library version to 18.0 because the newer version has an error in the AioReactor: ``` File "/home/rht/code/venv/lib/python3.8/site-packages/irc/bot.py", line 108, in run self.bot.reactor.scheduler.execute_after(intvl, self.check) AttributeError: 'AioReactor' object has no attribute 'scheduler' ```
1 parent 3607182 commit fe2a4d6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

zulip/integrations/bridge_with_irc/irc_mirror_backend.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def connect(self, *args: Any, **kwargs: Any) -> None:
3030
# Taken from
3131
# https://github.com/jaraco/irc/blob/master/irc/client_aio.py,
3232
# in particular the method of AioSimpleIRCClient
33-
self.reactor.loop.run_until_complete(
33+
self.c = self.reactor.loop.run_until_complete(
3434
self.connection.connect(*args, **kwargs)
3535
)
3636
print("Listening now. Please send an IRC message to verify operation")
@@ -65,16 +65,16 @@ def forward_to_irc(msg: Dict[str, Any]) -> None:
6565
at_the_specified_subject = msg["subject"].casefold() == self.topic.casefold()
6666
if in_the_specified_stream and at_the_specified_subject:
6767
msg["content"] = ("@**%s**: " % msg["sender_full_name"]) + msg["content"]
68-
send = lambda x: c.privmsg(self.channel, x)
68+
send = lambda x: self.c.privmsg(self.channel, x)
6969
else:
7070
return
7171
else:
7272
recipients = [u["short_name"] for u in msg["display_recipient"] if
7373
u["email"] != msg["sender_email"]]
7474
if len(recipients) == 1:
75-
send = lambda x: c.privmsg(recipients[0], x)
75+
send = lambda x: self.c.privmsg(recipients[0], x)
7676
else:
77-
send = lambda x: c.privmsg_many(recipients, x)
77+
send = lambda x: self.c.privmsg_many(recipients, x)
7878
for line in msg["content"].split("\n"):
7979
send(line)
8080

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
irc>=16.4
1+
irc==18.0

0 commit comments

Comments
 (0)