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' response = 'none'
resp = Response(response) resp = Response(response)
elif action == 'kex': elif action == 'kex':
response = ','.join(self._core.listPeers()) peers = self._core.listPeers()
if len(response) == 0: response = ''
response = 'none' if type(peers) != None:
response = ','.join(self._core.listPeers())
resp = Response(response) resp = Response(response)
else: else:
resp = Response("") resp = Response("")

View File

@ -137,7 +137,8 @@ class Core:
forwardKey text, forwardKey text,
dateSeen not null, dateSeen not null,
bytesStored int, bytesStored int,
trust int); trust int,
pubkeyExchanged int);
''') ''')
conn.commit() conn.commit()
conn.close() conn.close()
@ -377,11 +378,12 @@ class Core:
dateSeen not null, 5 dateSeen not null, 5
bytesStored int, 6 bytesStored int, 6
trust int 7 trust int 7
pubkeyExchanged int 8
''' '''
conn = sqlite3.connect(self.peerDB) conn = sqlite3.connect(self.peerDB)
c = conn.cursor() c = conn.cursor()
command = (peer,) 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] info = infoNumbers[info]
iterCount = 0 iterCount = 0
retVal = '' retVal = ''

View File

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

View File

@ -37,9 +37,17 @@ class OnionrUtils:
self._core = coreInstance self._core = coreInstance
return 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''' '''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 return
def incrementAddressSuccess(self, address): def incrementAddressSuccess(self, address):