def ok(self): addr = str(self.addrString.text()) name_ = InitConfigValue(self.Parent.Obj.Settings, 'ServerName', 'Own Avahi Server') if self.Parent.Obj.TLS : encode = 'Yes' else : encode = 'No' res = differentIP(addr) if res == '' : print 'Incorrect IP' self.Parent.Obj.showMSG('Incorrect IP') self.done(0) return None elif res == 'local' : serverAddr = self.Parent.Obj.server_addr else : serverAddr = getExternalIP() if serverAddr == '' : print 'External IP not detected. Check connect to Internet.' self.Parent.Obj.showMSG('External IP not detected. Check connect to Internet.') self.done(0) return None data = QtCore.QString('1' + '<||>' + \ name_ + '<||>' + \ serverAddr + '<||>' + \ str(self.Parent.Obj.server_port) + '<||>' + \ encode + '<||>' + \ self.Parent.Obj.serverState + '<||>' + \ '*infoShare*') Sender(data, addr) self.done(0)
def enable_proxy(addr, Settings): res = False if differentIP(addr) not in ('', 'local') : if loadSocksModule(Settings, None) : res = True return res