work on pm and fixed broken pex when none

This commit is contained in:
Kevin Froman 2018-04-03 19:34:15 -05:00
parent a611643526
commit 8d261b03dc
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
4 changed files with 18 additions and 7 deletions

View File

@ -155,9 +155,10 @@ class API:
response = 'none'
resp = Response(response)
elif action == 'kex':
response = ','.join(self._core.listPeers())
if len(response) == 0:
response = 'none'
peers = self._core.listPeers()
response = ''
if type(peers) != None:
response = ','.join(self._core.listPeers())
resp = Response(response)
else:
resp = Response("")

View File

@ -137,7 +137,8 @@ class Core:
forwardKey text,
dateSeen not null,
bytesStored int,
trust int);
trust int,
pubkeyExchanged int);
''')
conn.commit()
conn.close()
@ -377,11 +378,12 @@ class Core:
dateSeen not null, 5
bytesStored int, 6
trust int 7
pubkeyExchanged int 8
'''
conn = sqlite3.connect(self.peerDB)
c = conn.cursor()
command = (peer,)
infoNumbers = {'id': 0, 'name': 1, 'pubkey': 2, 'adders': 3, 'forwardKey': 4, 'dateSeen': 5, 'bytesStored': 6, 'trust': 7}
infoNumbers = {'id': 0, 'name': 1, 'pubkey': 2, 'adders': 3, 'forwardKey': 4, 'dateSeen': 5, 'bytesStored': 6, 'trust': 7, 'pubkeyExchanged': 8}
info = infoNumbers[info]
iterCount = 0
retVal = ''

View File

@ -256,7 +256,7 @@ class Onionr:
except KeyboardInterrupt:
break
else:
if self.onionrUtils.validateID(peer):
if self.onionrUtils.validatePubKey(peer):
break
else:
logger.error('Invalid peer ID')

View File

@ -37,9 +37,17 @@ class OnionrUtils:
self._core = coreInstance
return
def sendPM(self, user, message):
def sendPM(self, pubkey, message):
'''High level function to encrypt a message to a peer and insert it as a block'''
forwardKey = self._core.getPeerInfo(pubkey, 'forwardKey')
if self._core.getPeerInfo(pubkey, 'pubkeyExchanged'):
pass
if len(forwardKey) > 0:
pass
return
def incrementAddressSuccess(self, address):