Fix socksproxytype in the support message,

made that a separate function getSOCKSProxyType(config) in the settings.
This commit is contained in:
Dmitri Bogomolov 2019-12-07 21:33:30 +02:00
parent 52d5c1ff03
commit 1c4d7655c3
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 18 additions and 10 deletions

View File

@ -22,6 +22,19 @@ from network.asyncore_pollchoose import set_rates
from tr import _translate from tr import _translate
def getSOCKSProxyType(config):
"""Get user socksproxytype setting from *config*"""
try:
result = ConfigParser.SafeConfigParser.get(
config, 'bitmessagesettings', 'socksproxytype')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
return
else:
if result.lower() in ('', 'none', 'false'):
result = None
return result
class SettingsDialog(QtGui.QDialog): class SettingsDialog(QtGui.QDialog):
"""The "Settings" dialog""" """The "Settings" dialog"""
def __init__(self, parent=None, firstrun=False): def __init__(self, parent=None, firstrun=False):
@ -129,14 +142,9 @@ class SettingsDialog(QtGui.QDialog):
self.checkBoxOnionOnly.setChecked( self.checkBoxOnionOnly.setChecked(
config.safeGetBoolean('bitmessagesettings', 'onionservicesonly')) config.safeGetBoolean('bitmessagesettings', 'onionservicesonly'))
try: self._proxy_type = getSOCKSProxyType(config)
# Get real value, not temporary
self._proxy_type = ConfigParser.SafeConfigParser.get(
config, 'bitmessagesettings', 'socksproxytype')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
self._proxy_type = 'none'
self.comboBoxProxyType.setCurrentIndex( self.comboBoxProxyType.setCurrentIndex(
0 if self._proxy_type == 'none' 0 if not self._proxy_type
else self.comboBoxProxyType.findText(self._proxy_type)) else self.comboBoxProxyType.findText(self._proxy_type))
self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex()) self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex())
@ -330,7 +338,7 @@ class SettingsDialog(QtGui.QDialog):
proxytype_index = self.comboBoxProxyType.currentIndex() proxytype_index = self.comboBoxProxyType.currentIndex()
if proxytype_index == 0: if proxytype_index == 0:
if self._proxy_type != 'none' and shared.statusIconColor != 'red': if self._proxy_type and shared.statusIconColor != 'red':
self.net_restart_needed = True self.net_restart_needed = True
elif self.comboBoxProxyType.currentText() != self._proxy_type: elif self.comboBoxProxyType.currentText() != self._proxy_type:
self.net_restart_needed = True self.net_restart_needed = True

View File

@ -15,6 +15,7 @@ from openclpow import openclAvailable, openclEnabled
import paths import paths
import proofofwork import proofofwork
from pyelliptic.openssl import OpenSSL from pyelliptic.openssl import OpenSSL
from settings import getSOCKSProxyType
import queues import queues
import network.stats import network.stats
import state import state
@ -118,8 +119,7 @@ def createSupportMessage(myapp):
BMConfigParser().safeGet('bitmessagesettings', 'opencl') BMConfigParser().safeGet('bitmessagesettings', 'opencl')
) if openclEnabled() else "None" ) if openclEnabled() else "None"
locale = getTranslationLanguage() locale = getTranslationLanguage()
socks = BMConfigParser().safeGet( socks = getSOCKSProxyType(BMConfigParser()) or "N/A"
'bitmessagesettings', 'socksproxytype', "N/A")
upnp = BMConfigParser().safeGet('bitmessagesettings', 'upnp', "N/A") upnp = BMConfigParser().safeGet('bitmessagesettings', 'upnp', "N/A")
connectedhosts = len(network.stats.connectedHostsList()) connectedhosts = len(network.stats.connectedHostsList())