Skip to content

Commit 7e5e30d

Browse files
author
Lee Miller
committed
Disable oniononly checkbox in Settings dialog if have no onion v3 nodes
1 parent 1434054 commit 7e5e30d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/bitmessageqt/settings.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import tempfile
88

9+
import six
910
from PyQt4 import QtCore, QtGui
1011

1112
import debug
@@ -160,6 +161,26 @@ def adjust_from_config(self, config):
160161
else self.comboBoxProxyType.findText(self._proxy_type))
161162
self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex())
162163

164+
if self._proxy_type:
165+
for node, info in six.iteritems(
166+
knownnodes.knownNodes.get(
167+
min(state.streamsInWhichIAmParticipating), [])
168+
):
169+
if (
170+
node.host.endswith('.onion') and len(node.host) > 22
171+
and not info.get('self')
172+
):
173+
break
174+
else:
175+
if self.checkBoxOnionOnly.isChecked():
176+
self.checkBoxOnionOnly.setText(
177+
self.checkBoxOnionOnly.text() + ", " + _translate(
178+
"MainWindow", "may cause connection problems!"))
179+
self.checkBoxOnionOnly.setStyleSheet(
180+
"QCheckBox { color : red; }")
181+
else:
182+
self.checkBoxOnionOnly.setEnabled(False)
183+
163184
self.lineEditSocksHostname.setText(
164185
config.get('bitmessagesettings', 'sockshostname'))
165186
self.lineEditSocksPort.setText(str(

0 commit comments

Comments
 (0)