diff --git a/jmclient/jmclient/configure.py b/jmclient/jmclient/configure.py index 1d03ef666..d0ac9d4b7 100644 --- a/jmclient/jmclient/configure.py +++ b/jmclient/jmclient/configure.py @@ -496,13 +496,22 @@ def get_irc_mchannels(): irc_sections.append(s) assert irc_sections - fields = [("host", str), ("port", int), ("channel", str), ("usessl", str), - ("socks5", str), ("socks5_host", str), ("socks5_port", str)] + req_fields = [("host", str), ("port", int), ("channel", str), ("usessl", str)] configs = [] for section in irc_sections: server_data = {} - for option, otype in fields: + + # check if socks5 is enabled for tor and load relevant config if so + try: + server_data["socks5"] = jm_single().config.get(section, "socks5") + except NoOptionError: + server_data["socks5"] = "false" + if server_data["socks5"].lower() == 'true': + server_data["socks5_host"] = jm_single().config.get(section, "socks5_host") + server_data["socks5_port"] = jm_single().config.get(section, "socks5_port") + + for option, otype in req_fields: val = jm_single().config.get(section, option) server_data[option] = otype(val) server_data['btcnet'] = get_network() diff --git a/jmdaemon/jmdaemon/irc.py b/jmdaemon/jmdaemon/irc.py index 3697b3513..b568a2fa6 100644 --- a/jmdaemon/jmdaemon/irc.py +++ b/jmdaemon/jmdaemon/irc.py @@ -93,8 +93,9 @@ def __init__(self, self.hostid = configdata['host'] + str(configdata['port']) self.socks5 = configdata["socks5"] self.usessl = configdata["usessl"] - self.socks5_host = configdata["socks5_host"] - self.socks5_port = int(configdata["socks5_port"]) + if self.socks5.lower() == 'true': + self.socks5_host = configdata["socks5_host"] + self.socks5_port = int(configdata["socks5_port"]) self.channel = get_config_irc_channel(configdata["channel"], configdata["btcnet"]) self.userrealname = (username, realname)