Merge remote-tracking branch 'upsteam/master' into splitting_bitmessagemain
This commit is contained in:
commit
181614fe80
|
@ -73,14 +73,17 @@ class outgoingSynSender(threading.Thread):
|
||||||
if shared.shutdown:
|
if shared.shutdown:
|
||||||
break
|
break
|
||||||
random.seed()
|
random.seed()
|
||||||
|
shared.knownNodesLock.acquire()
|
||||||
HOST, = random.sample(shared.knownNodes[self.streamNumber], 1)
|
HOST, = random.sample(shared.knownNodes[self.streamNumber], 1)
|
||||||
|
shared.knownNodesLock.release()
|
||||||
alreadyAttemptedConnectionsListLock.acquire()
|
alreadyAttemptedConnectionsListLock.acquire()
|
||||||
while HOST in alreadyAttemptedConnectionsList or HOST in shared.connectedHostsList:
|
while HOST in alreadyAttemptedConnectionsList or HOST in shared.connectedHostsList:
|
||||||
alreadyAttemptedConnectionsListLock.release()
|
alreadyAttemptedConnectionsListLock.release()
|
||||||
# print 'choosing new sample'
|
# print 'choosing new sample'
|
||||||
random.seed()
|
random.seed()
|
||||||
HOST, = random.sample(shared.knownNodes[
|
shared.knownNodesLock.acquire()
|
||||||
self.streamNumber], 1)
|
HOST, = random.sample(shared.knownNodes[self.streamNumber], 1)
|
||||||
|
shared.knownNodesLock.release()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
# Clear out the alreadyAttemptedConnectionsList every half
|
# Clear out the alreadyAttemptedConnectionsList every half
|
||||||
# hour so that this program will again attempt a connection
|
# hour so that this program will again attempt a connection
|
||||||
|
@ -3967,18 +3970,18 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
return data
|
return data
|
||||||
elif method == 'getAllSentMessages':
|
elif method == 'getAllSentMessages':
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status FROM sent where folder='sent' ORDER BY lastactiontime''')
|
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent where folder='sent' ORDER BY lastactiontime''')
|
||||||
shared.sqlSubmitQueue.put('')
|
shared.sqlSubmitQueue.put('')
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
data = '{"sentMessages":['
|
data = '{"sentMessages":['
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status = row
|
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
|
||||||
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
if len(data) > 25:
|
if len(data) > 25:
|
||||||
data += ','
|
data += ','
|
||||||
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status},indent=4, separators=(',', ': '))
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status,'ackData':ackdata.encode('hex')},indent=4, separators=(',', ': '))
|
||||||
data += ']}'
|
data += ']}'
|
||||||
return data
|
return data
|
||||||
elif method == 'getInboxMessagesByAddress':
|
elif method == 'getInboxMessagesByAddress':
|
||||||
|
@ -4005,16 +4008,34 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
msgid = params[0].decode('hex')
|
msgid = params[0].decode('hex')
|
||||||
v = (msgid,)
|
v = (msgid,)
|
||||||
shared.sqlLock.acquire()
|
shared.sqlLock.acquire()
|
||||||
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status FROM sent WHERE msgid=?''')
|
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE msgid=?''')
|
||||||
shared.sqlSubmitQueue.put(v)
|
shared.sqlSubmitQueue.put(v)
|
||||||
queryreturn = shared.sqlReturnQueue.get()
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
shared.sqlLock.release()
|
shared.sqlLock.release()
|
||||||
data = '{"sentMessage":['
|
data = '{"sentMessage":['
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status = row
|
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
|
||||||
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status},indent=4, separators=(',', ': '))
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status,'ackData':ackdata.encode('hex')},indent=4, separators=(',', ': '))
|
||||||
|
data += ']}'
|
||||||
|
return data
|
||||||
|
elif method == 'getSentMessageByAckData':
|
||||||
|
if len(params) == 0:
|
||||||
|
return 'API Error 0000: I need parameters!'
|
||||||
|
ackData = params[0].decode('hex')
|
||||||
|
v = (ackData,)
|
||||||
|
shared.sqlLock.acquire()
|
||||||
|
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE ackdata=?''')
|
||||||
|
shared.sqlSubmitQueue.put(v)
|
||||||
|
queryreturn = shared.sqlReturnQueue.get()
|
||||||
|
shared.sqlLock.release()
|
||||||
|
data = '{"sentMessage":['
|
||||||
|
for row in queryreturn:
|
||||||
|
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
|
||||||
|
subject = shared.fixPotentiallyInvalidUTF8Data(subject)
|
||||||
|
message = shared.fixPotentiallyInvalidUTF8Data(message)
|
||||||
|
data += json.dumps({'msgid':msgid.encode('hex'),'toAddress':toAddress,'fromAddress':fromAddress,'subject':subject.encode('base64'),'message':message.encode('base64'),'encodingType':encodingtype,'lastActionTime':lastactiontime,'status':status,'ackData':ackdata.encode('hex')},indent=4, separators=(',', ': '))
|
||||||
data += ']}'
|
data += ']}'
|
||||||
return data
|
return data
|
||||||
elif (method == 'trashMessage') or (method == 'trashInboxMessage'):
|
elif (method == 'trashMessage') or (method == 'trashInboxMessage'):
|
||||||
|
|
|
@ -1076,8 +1076,8 @@ class MyForm(QtGui.QMainWindow):
|
||||||
shared.statusIconColor = 'red'
|
shared.statusIconColor = 'red'
|
||||||
# if the connection is lost then show a notification
|
# if the connection is lost then show a notification
|
||||||
if self.connected:
|
if self.connected:
|
||||||
self.notifierShow('Bitmessage', _translate(
|
self.notifierShow('Bitmessage', unicode(_translate(
|
||||||
"MainWindow", "Connection lost"))
|
"MainWindow", "Connection lost").toUtf8(),'utf-8'))
|
||||||
self.connected = False
|
self.connected = False
|
||||||
|
|
||||||
if self.actionStatus is not None:
|
if self.actionStatus is not None:
|
||||||
|
@ -1109,8 +1109,8 @@ class MyForm(QtGui.QMainWindow):
|
||||||
QIcon(":/newPrefix/images/greenicon.png"))
|
QIcon(":/newPrefix/images/greenicon.png"))
|
||||||
shared.statusIconColor = 'green'
|
shared.statusIconColor = 'green'
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
self.notifierShow('Bitmessage', _translate(
|
self.notifierShow('Bitmessage', unicode(_translate(
|
||||||
"MainWindow", "Connected"))
|
"MainWindow", "Connected").toUtf8(),'utf-8'))
|
||||||
self.connected = True
|
self.connected = True
|
||||||
|
|
||||||
if self.actionStatus is not None:
|
if self.actionStatus is not None:
|
||||||
|
@ -1582,12 +1582,12 @@ class MyForm(QtGui.QMainWindow):
|
||||||
newItem = QtGui.QTableWidgetItem(unicode(fromAddress, 'utf-8'))
|
newItem = QtGui.QTableWidgetItem(unicode(fromAddress, 'utf-8'))
|
||||||
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
|
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
|
||||||
if shared.config.getboolean('bitmessagesettings', 'showtraynotifications'):
|
if shared.config.getboolean('bitmessagesettings', 'showtraynotifications'):
|
||||||
self.notifierShow('New Message', 'From ' + fromAddress)
|
self.notifierShow(unicode(_translate("MainWindow",'New Message').toUtf8(),'utf-8'), unicode(_translate("MainWindow",'From ').toUtf8(),'utf-8') + unicode(fromAddress, 'utf-8'))
|
||||||
else:
|
else:
|
||||||
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
|
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
|
||||||
newItem.setToolTip(unicode(unicode(fromLabel, 'utf-8')))
|
newItem.setToolTip(unicode(unicode(fromLabel, 'utf-8')))
|
||||||
if shared.config.getboolean('bitmessagesettings', 'showtraynotifications'):
|
if shared.config.getboolean('bitmessagesettings', 'showtraynotifications'):
|
||||||
self.notifierShow('New Message', 'From ' + fromLabel)
|
self.notifierShow(unicode(_translate("MainWindow",'New Message').toUtf8(),'utf-8'), unicode(_translate("MainWindow",'From ').toUtf8(),'utf-8') + unicode(fromLabel, 'utf-8'))
|
||||||
newItem.setData(Qt.UserRole, str(fromAddress))
|
newItem.setData(Qt.UserRole, str(fromAddress))
|
||||||
newItem.setFont(font)
|
newItem.setFont(font)
|
||||||
self.ui.tableWidgetInbox.setItem(0, 1, newItem)
|
self.ui.tableWidgetInbox.setItem(0, 1, newItem)
|
||||||
|
|
|
@ -427,7 +427,7 @@ except:
|
||||||
lib_path = path.join(sys._MEIPASS, "libeay32.dll")
|
lib_path = path.join(sys._MEIPASS, "libeay32.dll")
|
||||||
OpenSSL = _OpenSSL(lib_path)
|
OpenSSL = _OpenSSL(lib_path)
|
||||||
except:
|
except:
|
||||||
if 'linux' in sys.platform or 'darwin' in sys.platform:
|
if 'linux' in sys.platform or 'darwin' in sys.platform or 'freebsd' in sys.platform:
|
||||||
try:
|
try:
|
||||||
from ctypes.util import find_library
|
from ctypes.util import find_library
|
||||||
OpenSSL = _OpenSSL(find_library('ssl'))
|
OpenSSL = _OpenSSL(find_library('ssl'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user