Skip to content

Commit

Permalink
IRC: Separate SASL password argument from nickserv-pw.
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Oct 1, 2023
1 parent a9ee2b2 commit a92dd34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion zulip/integrations/bridge_with_irc/irc-mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
--stream is a Zulip stream.
--topic is a Zulip topic, is optionally specified, defaults to "IRC".
--nickserv-pw is a password for the nickserv, is optionally specified.
Optional arguments:
--nickserv-pw is a password for the nickserv.
--sasl-password is a password for SASL authentication.
Specify your Zulip API credentials and server in a ~/.zuliprc file or using the options.
Expand All @@ -36,6 +38,7 @@
parser.add_argument("--stream", default="general")
parser.add_argument("--topic", default="IRC")
parser.add_argument("--nickserv-pw", default="")
parser.add_argument("--sasl-password", default=None)

options = parser.parse_args()
# Setting the client to irc_mirror is critical for this to work
Expand Down Expand Up @@ -64,5 +67,6 @@
options.irc_server,
options.nickserv_pw,
options.port,
sasl_password=options.sasl_password,
)
bot.start()
5 changes: 3 additions & 2 deletions zulip/integrations/bridge_with_irc/irc_mirror_backend.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import multiprocessing as mp
from typing import Any, Dict
from typing import Any, Dict, Optional

import irc.bot
import irc.strings
Expand All @@ -20,6 +20,7 @@ def __init__(
server: str,
nickserv_password: str = "",
port: int = 6667,
sasl_password: Optional[str] = None,
) -> None:
self.channel = channel # type: irc.bot.Channel
self.zulip_client = zulip_client
Expand All @@ -31,7 +32,7 @@ def __init__(
self.check_subscription_or_die()
# Initialize IRC bot after proper connection to Zulip server has been confirmed.
irc.bot.SingleServerIRCBot.__init__(
self, [(server, port, nickserv_password)], nickname, nickname, sasl_login=nickname
self, [(server, port, sasl_password)], nickname, nickname, sasl_login=nickname
)

def zulip_sender(self, sender_string: str) -> str:
Expand Down

0 comments on commit a92dd34

Please sign in to comment.