Merge branch 'upstream/master'

Conflicts:
	src/bitmessageqt/__init__.py
	src/bitmessageqt/bitmessageui.py
	src/bitmessageqt/settings.py
	src/bitmessageqt/settings.ui
	src/helper_startup.py
This commit is contained in:
sendiulo 2013-09-21 16:24:14 +02:00
commit aed489a2bc
39 changed files with 2018 additions and 2110 deletions

View File

@ -57,8 +57,8 @@ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Now, install the required dependencies Now, install the required dependencies
``` ```
sudo port install python27 py27-pyqt4 openssl brew install python pyqt
sudo port install git-core +svn +doc +bash_completion +gitweb brew install git
``` ```
Download and run PyBitmessage: Download and run PyBitmessage:

View File

@ -7,7 +7,8 @@ PREFIX?=/usr/local
all: all:
debug: debug:
source: source:
tar -cvzf ../${APP}_${VERSION}.orig.tar.gz ../${APP}-${VERSION} --exclude-vcs tar -cvf ../${APP}_${VERSION}.orig.tar ../${APP}-${VERSION} --exclude-vcs
gzip -f9n ../${APP}_${VERSION}.orig.tar
install: install:
mkdir -p ${DESTDIR}/usr mkdir -p ${DESTDIR}/usr
mkdir -p ${DESTDIR}${PREFIX} mkdir -p ${DESTDIR}${PREFIX}

19
arch.sh
View File

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
GIT_APP=PyBitmessage
APP=pybitmessage APP=pybitmessage
PREV_VERSION=0.3.5 PREV_VERSION=0.3.5
VERSION=0.3.5 VERSION=0.3.5
RELEASE=1 RELEASE=1
ARCH_TYPE=`uname -m` ARCH_TYPE=any
CURRDIR=`pwd` CURRDIR=`pwd`
SOURCE=archpackage/${APP}-${VERSION}.tar.gz SOURCE=archpackage/${APP}-${VERSION}.tar.gz
@ -25,24 +26,12 @@ make clean
rm -f archpackage/*.gz rm -f archpackage/*.gz
# having the root directory called name-version seems essential # having the root directory called name-version seems essential
mv ../${APP} ../${APP}-${VERSION} mv ../${GIT_APP} ../${APP}-${VERSION}
tar -cvzf ${SOURCE} ../${APP}-${VERSION} --exclude-vcs tar -cvzf ${SOURCE} ../${APP}-${VERSION} --exclude-vcs
# rename the root directory without the version number # rename the root directory without the version number
mv ../${APP}-${VERSION} ../${APP} mv ../${APP}-${VERSION} ../${GIT_APP}
# calculate the MD5 checksum # calculate the MD5 checksum
CHECKSM=$(md5sum ${SOURCE}) CHECKSM=$(md5sum ${SOURCE})
sed -i "s/md5sums[^)]*)/md5sums=(${CHECKSM%% *})/g" archpackage/PKGBUILD sed -i "s/md5sums[^)]*)/md5sums=(${CHECKSM%% *})/g" archpackage/PKGBUILD
cd archpackage
# Create the package
tar -c -f ${APP}-${VERSION}.pkg.tar .
sync
xz ${APP}-${VERSION}.pkg.tar
sync
# Move back to the original directory
cd ${CURRDIR}

View File

@ -3,13 +3,13 @@ pkgname=pybitmessage
pkgver=0.3.5 pkgver=0.3.5
pkgrel=1 pkgrel=1
pkgdesc="Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide "non-content" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs." pkgdesc="Bitmessage is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide "non-content" data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs."
arch=('i686' 'x86_64') arch=('any')
url="https://github.com/Bitmessage/PyBitmessage" url="https://github.com/Bitmessage/PyBitmessage"
license=('MIT') license=('MIT')
groups=() groups=()
depends=('python2' 'qt4' 'python2-pyqt4' 'sqlite' 'openssl' 'gst123') depends=('python2' 'qt4' 'python2-pyqt4' 'sqlite' 'openssl' 'mpg123')
makedepends=() makedepends=()
optdepends=('python2-gevent') optdepends=('python2-gevent: Python network library that uses greenlet and libevent for easy and scalable concurrency')
provides=() provides=()
conflicts=() conflicts=()
replaces=() replaces=()
@ -19,7 +19,7 @@ install=
changelog= changelog=
source=($pkgname-$pkgver.tar.gz) source=($pkgname-$pkgver.tar.gz)
noextract=() noextract=()
md5sums=() md5sums=(ebf89129571571198473559b4b2e552c)
build() { build() {
cd "$srcdir/$pkgname-$pkgver" cd "$srcdir/$pkgname-$pkgver"
./configure --prefix=/usr ./configure --prefix=/usr

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
APP=pybitmessage APP=pybitmessage
PREV_VERSION=0.3.4 PREV_VERSION=0.3.5
VERSION=0.3.5 VERSION=0.3.5
RELEASE=1 RELEASE=1
ARCH_TYPE=`uname -m` ARCH_TYPE=all
DIR=${APP}-${VERSION} DIR=${APP}-${VERSION}
if [ $ARCH_TYPE == "x86_64" ]; then if [ $ARCH_TYPE == "x86_64" ]; then

3
debian/changelog vendored
View File

@ -14,7 +14,8 @@ pybitmessage (0.3.5-1) raring; urgency=low
* Added Russian translation * Added Russian translation
* Added search support in the UI * Added search support in the UI
* Added 'make uninstall' * Added 'make uninstall'
* To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1 if PKCS5_PBKDF2_HMAC is unavailable * To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1
if PKCS5_PBKDF2_HMAC is unavailable
* Added better warnings for OSX users who are using old versions of Python * Added better warnings for OSX users who are using old versions of Python
* Repaired debian packaging * Repaired debian packaging
* Altered Makefile to avoid needing to chase changes * Altered Makefile to avoid needing to chase changes

4
debian/control vendored
View File

@ -1,4 +1,5 @@
Source: pybitmessage Source: pybitmessage
Section: mail
Priority: extra Priority: extra
Maintainer: Bob Mottram (4096 bits) <bob@robotics.uk.to> Maintainer: Bob Mottram (4096 bits) <bob@robotics.uk.to>
Build-Depends: debhelper (>= 9.0.0) Build-Depends: debhelper (>= 9.0.0)
@ -7,8 +8,7 @@ Homepage: https://github.com/Bitmessage/PyBitmessage
Vcs-Git: https://github.com/Bitmessage/PyBitmessage.git Vcs-Git: https://github.com/Bitmessage/PyBitmessage.git
Package: pybitmessage Package: pybitmessage
Section: mail Architecture: all
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev, gst123 Depends: ${shlibs:Depends}, ${misc:Depends}, python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev, gst123
Suggests: libmessaging-menu-dev Suggests: libmessaging-menu-dev
Description: Send encrypted messages Description: Send encrypted messages

View File

@ -26,7 +26,7 @@ packagemonkey -n "PyBitmessage" --version "0.3.5" --dir "." -l "mit" \
--dependspuppy "openssl, python-qt4, sqlite3, sqlite3-dev, " \ --dependspuppy "openssl, python-qt4, sqlite3, sqlite3-dev, " \
"python-openssl, python-sip, gst123" \ "python-openssl, python-sip, gst123" \
--dependsarch "python2, qt4, python2-pyqt4, sqlite, openssl, gst123" \ --dependsarch "python2, qt4, python2-pyqt4, sqlite, openssl, gst123" \
--suggestsarch "python2-gevent" --pythonversion 2 \ --suggestsarch "python2-gevent: Python network library that uses greenlet and libevent for easy and scalable concurrency" --pythonversion 2 \
--dependsebuild "dev-libs/openssl, dev-python/PyQt4[${PYTHON_USEDEP}]" \ --dependsebuild "dev-libs/openssl, dev-python/PyQt4[${PYTHON_USEDEP}]" \
--buildebuild "\${PYTHON_DEPS}" --pythonreq "sqlite" \ --buildebuild "\${PYTHON_DEPS}" --pythonreq "sqlite" \
--repository "https://github.com/Bitmessage/PyBitmessage.git" --repository "https://github.com/Bitmessage/PyBitmessage.git"

4
osx.sh Normal file → Executable file
View File

@ -12,12 +12,12 @@ if [[ -z "$1" ]]; then
exit exit
fi fi
echo "Creating OS X packages for Bitmessage. This script will ask for sudo to create the dmg volume" echo "Creating OS X packages for Bitmessage."
cd src && python build_osx.py py2app cd src && python build_osx.py py2app
if [[ $? = "0" ]]; then if [[ $? = "0" ]]; then
sudo hdiutil create -fs HFS+ -volname "Bitmessage" -srcfolder dist/Bitmessage.app dist/bitmessage-v$1.dmg hdiutil create -fs HFS+ -volname "Bitmessage" -srcfolder dist/Bitmessage.app dist/bitmessage-v$1.dmg
else else
echo "Problem creating Bitmessage.app, stopping." echo "Problem creating Bitmessage.app, stopping."
exit exit

View File

@ -1 +1 @@
pybitmessage-0.3.5-1|PyBitmessage|0.3.5|1|Internet;mailnews;|7.2M||pybitmessage-0.3.5-1.pet|+openssl,+python-qt4,+sqlite3,+sqlite3-dev,+python-openssl,+python-sip,+gst123|Send encrypted messages|ubuntu|precise|5| pybitmessage-0.3.5-1|PyBitmessage|0.3.5|1|Internet;mailnews;|3.8M||pybitmessage-0.3.5-1.pet|+openssl,+python-qt4,+sqlite3,+sqlite3-dev,+python-openssl,+python-sip,+gst123|Send encrypted messages|ubuntu|precise|5|

View File

@ -6,6 +6,7 @@ License: MIT
URL: https://github.com/Bitmessage/PyBitmessage URL: https://github.com/Bitmessage/PyBitmessage
Packager: Bob Mottram (4096 bits) <bob@robotics.uk.to> Packager: Bob Mottram (4096 bits) <bob@robotics.uk.to>
Source0: http://yourdomainname.com/src/%{name}_%{version}.orig.tar.gz Source0: http://yourdomainname.com/src/%{name}_%{version}.orig.tar.gz
BuildArch: noarch
Group: Office/Email Group: Office/Email
Requires: python, PyQt4, openssl-compat-bitcoin-libs, gst123 Requires: python, PyQt4, openssl-compat-bitcoin-libs, gst123
@ -83,7 +84,8 @@ make install -B DESTDIR=%{buildroot} PREFIX=/usr
- Added Russian translation - Added Russian translation
- Added search support in the UI - Added search support in the UI
- Added 'make uninstall' - Added 'make uninstall'
- To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1 if PKCS5_PBKDF2_HMAC is unavailable - To improve OSX support, use PKCS5_PBKDF2_HMAC_SHA1
if PKCS5_PBKDF2_HMAC is unavailable
- Added better warnings for OSX users who are using old versions of Python - Added better warnings for OSX users who are using old versions of Python
- Repaired debian packaging - Repaired debian packaging
- Altered Makefile to avoid needing to chase changes - Altered Makefile to avoid needing to chase changes

View File

@ -97,13 +97,18 @@ def calculateInventoryHash(data):
return sha2.digest()[0:32] return sha2.digest()[0:32]
def encodeAddress(version,stream,ripe): def encodeAddress(version,stream,ripe):
if version >= 2: if version >= 2 and version < 4:
if len(ripe) != 20: if len(ripe) != 20:
raise Exception("Programming error in encodeAddress: The length of a given ripe hash was not 20.") raise Exception("Programming error in encodeAddress: The length of a given ripe hash was not 20.")
if ripe[:2] == '\x00\x00': if ripe[:2] == '\x00\x00':
ripe = ripe[2:] ripe = ripe[2:]
elif ripe[:1] == '\x00': elif ripe[:1] == '\x00':
ripe = ripe[1:] ripe = ripe[1:]
elif version == 4:
if len(ripe) != 20:
raise Exception("Programming error in encodeAddress: The length of a given ripe hash was not 20.")
ripe = ripe.lstrip('\x00')
a = encodeVarint(version) + encodeVarint(stream) + ripe a = encodeVarint(version) + encodeVarint(stream) + ripe
sha = hashlib.new('sha512') sha = hashlib.new('sha512')
sha.update(a) sha.update(a)
@ -164,7 +169,7 @@ def decodeAddress(address):
#print 'addressVersionNumber', addressVersionNumber #print 'addressVersionNumber', addressVersionNumber
#print 'bytesUsedByVersionNumber', bytesUsedByVersionNumber #print 'bytesUsedByVersionNumber', bytesUsedByVersionNumber
if addressVersionNumber > 3: if addressVersionNumber > 4:
print 'cannot decode address version numbers this high' print 'cannot decode address version numbers this high'
status = 'versiontoohigh' status = 'versiontoohigh'
return status,0,0,0 return status,0,0,0
@ -191,6 +196,15 @@ def decodeAddress(address):
return 'ripetoolong',0,0,0 return 'ripetoolong',0,0,0
else: else:
return 'otherproblem',0,0,0 return 'otherproblem',0,0,0
elif addressVersionNumber == 4:
if len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]) > 20:
return 'ripetoolong',0,0,0
elif len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]) < 4:
return 'ripetooshort',0,0,0
else:
x00string = '\x00' * (20 - len(data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]))
return status,addressVersionNumber,streamNumber,x00string+data[bytesUsedByVersionNumber+bytesUsedByStreamNumber:-4]
def addBMIfNotPresent(address): def addBMIfNotPresent(address):
address = str(address).strip() address = str(address).strip()

View File

@ -9,13 +9,6 @@
# The software version variable is now held in shared.py # The software version variable is now held in shared.py
# import ctypes
try:
from gevent import monkey
monkey.patch_all()
except ImportError as ex:
print "Not using the gevent module as it was not found. No need to worry."
import signal # Used to capture a Ctrl-C keypress so that Bitmessage can shutdown gracefully. import signal # Used to capture a Ctrl-C keypress so that Bitmessage can shutdown gracefully.
# The next 3 are used for the API # The next 3 are used for the API
from SimpleXMLRPCServer import * from SimpleXMLRPCServer import *
@ -32,18 +25,32 @@ if sys.platform == 'darwin':
sys.exit(0) sys.exit(0)
# Classes # Classes
from helper_sql import *
from class_sqlThread import * from class_sqlThread import *
from class_singleCleaner import * from class_singleCleaner import *
from class_singleWorker import * from class_singleWorker import *
from class_outgoingSynSender import * from class_outgoingSynSender import *
from class_singleListener import * from class_singleListener import *
from class_addressGenerator import * from class_addressGenerator import *
from debug import logger
# Helper Functions # Helper Functions
import helper_bootstrap import helper_bootstrap
import proofofwork
import sys
if sys.platform == 'darwin':
if float("{1}.{2}".format(*sys.version_info)) < 7.5:
logger.critical("You should use python 2.7.5 or greater. Your version: %s", "{0}.{1}.{2}".format(*sys.version_info))
sys.exit(0)
def connectToStream(streamNumber): def connectToStream(streamNumber):
selfInitiatedConnections[streamNumber] = {} selfInitiatedConnections[streamNumber] = {}
shared.inventorySets[streamNumber] = set()
queryData = sqlQuery('''SELECT hash FROM inventory WHERE streamnumber=?''', streamNumber)
for row in queryData:
shared.inventorySets[streamNumber].add(row[0])
if sys.platform[0:3] == 'win': if sys.platform[0:3] == 'win':
maximumNumberOfHalfOpenConnections = 9 maximumNumberOfHalfOpenConnections = 9
else: else:
@ -54,6 +61,13 @@ def connectToStream(streamNumber):
a.start() a.start()
class APIError(Exception):
def __init__(self, error_number, error_message):
self.error_number = error_number
self.error_message = error_message
def __str__(self):
return "API Error %04i: %s" % (self.error_number, self.error_message)
# This is one of several classes that constitute the API # This is one of several classes that constitute the API
# This class was written by Vaibhav Bhatia. Modified by Jonathan Warren (Atheros). # This class was written by Vaibhav Bhatia. Modified by Jonathan Warren (Atheros).
# http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/ # http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/
@ -127,20 +141,38 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
else: else:
return False return False
else: else:
print 'Authentication failed because header lacks Authentication field' logger.warn('Authentication failed because header lacks Authentication field')
time.sleep(2) time.sleep(2)
return False return False
return False return False
def _dispatch(self, method, params): def _decode(self, text, decode_type):
self.cookies = [] try:
return text.decode(decode_type)
except TypeError as e:
raise APIError(22, "Decode error - " + str(e))
def _verifyAddress(self, address):
status, addressVersionNumber, streamNumber, ripe = decodeAddress(address)
if status != 'success':
logger.warn('API Error 0007: Could not decode address %s. Status: %s.', address, status)
validuser = self.APIAuthenticateClient() if status == 'checksumfailed':
if not validuser: raise APIError(8, 'Checksum failed for address: ' + address)
time.sleep(2) if status == 'invalidcharacters':
return "RPC Username or password incorrect or HTTP header lacks authentication at all." raise APIError(9, 'Invalid characters in address: ' + address)
# handle request if status == 'versiontoohigh':
raise APIError(10, 'Address version number too high (or zero) in address: ' + address)
raise APIError(7, 'Could not decode address: ' + address + ' : ' + status)
if addressVersionNumber < 2 or addressVersionNumber > 3:
raise APIError(11, 'The address version number currently must be 2 or 3. Others aren\'t supported. Check the address.')
if streamNumber != 1:
raise APIError(12, 'The stream number must be 1. Others aren\'t supported. Check the address.')
return (status, addressVersionNumber, streamNumber, ripe)
def _handle_request(self, method, params):
if method == 'helloWorld': if method == 'helloWorld':
(a, b) = params (a, b) = params
return a + '-' + b return a + '-' + b
@ -160,13 +192,55 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
data data
if len(data) > 20: if len(data) > 20:
data += ',' data += ','
if shared.config.has_option(addressInKeysFile, 'chan'):
chan = shared.config.getboolean(addressInKeysFile, 'chan')
else:
chan = False
data += json.dumps({'label': shared.config.get(addressInKeysFile, 'label'), 'address': addressInKeysFile, 'stream': data += json.dumps({'label': shared.config.get(addressInKeysFile, 'label'), 'address': addressInKeysFile, 'stream':
streamNumber, 'enabled': shared.config.getboolean(addressInKeysFile, 'enabled')}, indent=4, separators=(',', ': ')) streamNumber, 'enabled': shared.config.getboolean(addressInKeysFile, 'enabled'), 'chan': chan}, indent=4, separators=(',', ': '))
data += ']}' data += ']}'
return data return data
elif method == 'listAddressBookEntries' or method == 'listAddressbook': # the listAddressbook alias should be removed eventually.
queryreturn = sqlQuery('''SELECT label, address from addressbook''')
data = '{"addresses":['
for row in queryreturn:
label, address = row
label = shared.fixPotentiallyInvalidUTF8Data(label)
if len(data) > 20:
data += ','
data += json.dumps({'label':label.encode('base64'), 'address': address}, indent=4, separators=(',', ': '))
data += ']}'
return data
elif method == 'addAddressBookEntry' or method == 'addAddressbook': # the addAddressbook alias should be deleted eventually.
if len(params) != 2:
raise APIError(0, "I need label and address")
address, label = params
label = self._decode(label, "base64")
address = addBMIfNotPresent(address)
self._verifyAddress(address)
queryreturn = sqlQuery("SELECT address FROM addressbook WHERE address=?", address)
if queryreturn != []:
raise APIError(16, 'You already have this address in your address book.')
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
shared.UISignalQueue.put(('rerenderInboxFromLabels',''))
shared.UISignalQueue.put(('rerenderSentToLabels',''))
shared.UISignalQueue.put(('rerenderAddressBook',''))
return "Added address %s to address book" % address
elif method == 'deleteAddressBookEntry' or method == 'deleteAddressbook': # The deleteAddressbook alias should be deleted eventually.
if len(params) != 1:
raise APIError(0, "I need an address")
address, = params
address = addBMIfNotPresent(address)
self._verifyAddress(address)
sqlExecute('DELETE FROM addressbook WHERE address=?', address)
shared.UISignalQueue.put(('rerenderInboxFromLabels',''))
shared.UISignalQueue.put(('rerenderSentToLabels',''))
shared.UISignalQueue.put(('rerenderAddressBook',''))
return "Deleted address book entry for %s if it existed" % address
elif method == 'createRandomAddress': elif method == 'createRandomAddress':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
elif len(params) == 1: elif len(params) == 1:
label, = params label, = params
eighteenByteRipe = False eighteenByteRipe = False
@ -193,12 +267,12 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
payloadLengthExtraBytes = int( payloadLengthExtraBytes = int(
shared.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty) shared.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty)
else: else:
return 'API Error 0000: Too many parameters!' raise APIError(0, 'Too many parameters!')
label = label.decode('base64') label = self._decode(label, "base64")
try: try:
unicode(label, 'utf-8') unicode(label, 'utf-8')
except: except:
return 'API Error 0017: Label is not valid UTF-8 data.' raise APIError(17, 'Label is not valid UTF-8 data.')
shared.apiAddressGeneratorReturnQueue.queue.clear() shared.apiAddressGeneratorReturnQueue.queue.clear()
streamNumberForAddress = 1 streamNumberForAddress = 1
shared.addressGeneratorQueue.put(( shared.addressGeneratorQueue.put((
@ -206,7 +280,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return shared.apiAddressGeneratorReturnQueue.get() return shared.apiAddressGeneratorReturnQueue.get()
elif method == 'createDeterministicAddresses': elif method == 'createDeterministicAddresses':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
elif len(params) == 1: elif len(params) == 1:
passphrase, = params passphrase, = params
numberOfAddresses = 1 numberOfAddresses = 1
@ -260,24 +334,26 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
payloadLengthExtraBytes = int( payloadLengthExtraBytes = int(
shared.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty) shared.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty)
else: else:
return 'API Error 0000: Too many parameters!' raise APIError(0, 'Too many parameters!')
if len(passphrase) == 0: if len(passphrase) == 0:
return 'API Error 0001: The specified passphrase is blank.' raise APIError(1, 'The specified passphrase is blank.')
passphrase = passphrase.decode('base64') if not isinstance(eighteenByteRipe, bool):
raise APIError(23, 'Bool expected in eighteenByteRipe, saw %s instead' % type(eighteenByteRipe))
passphrase = self._decode(passphrase, "base64")
if addressVersionNumber == 0: # 0 means "just use the proper addressVersionNumber" if addressVersionNumber == 0: # 0 means "just use the proper addressVersionNumber"
addressVersionNumber = 3 addressVersionNumber = 3
if addressVersionNumber != 3: if addressVersionNumber != 3:
return 'API Error 0002: The address version number currently must be 3 (or 0 which means auto-select). ' + addressVersionNumber + ' isn\'t supported.' raise APIError(2,'The address version number currently must be 3 (or 0 which means auto-select). ' + addressVersionNumber + ' isn\'t supported.')
if streamNumber == 0: # 0 means "just use the most available stream" if streamNumber == 0: # 0 means "just use the most available stream"
streamNumber = 1 streamNumber = 1
if streamNumber != 1: if streamNumber != 1:
return 'API Error 0003: The stream number must be 1 (or 0 which means auto-select). Others aren\'t supported.' raise APIError(3,'The stream number must be 1 (or 0 which means auto-select). Others aren\'t supported.')
if numberOfAddresses == 0: if numberOfAddresses == 0:
return 'API Error 0004: Why would you ask me to generate 0 addresses for you?' raise APIError(4, 'Why would you ask me to generate 0 addresses for you?')
if numberOfAddresses > 999: if numberOfAddresses > 999:
return 'API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.' raise APIError(5, 'You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.')
shared.apiAddressGeneratorReturnQueue.queue.clear() shared.apiAddressGeneratorReturnQueue.queue.clear()
print 'Requesting that the addressGenerator create', numberOfAddresses, 'addresses.' logger.debug('Requesting that the addressGenerator create %s addresses.', numberOfAddresses)
shared.addressGeneratorQueue.put( shared.addressGeneratorQueue.put(
('createDeterministicAddresses', addressVersionNumber, streamNumber, ('createDeterministicAddresses', addressVersionNumber, streamNumber,
'unused API address', numberOfAddresses, passphrase, eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes)) 'unused API address', numberOfAddresses, passphrase, eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes))
@ -291,30 +367,26 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'getDeterministicAddress': elif method == 'getDeterministicAddress':
if len(params) != 3: if len(params) != 3:
return 'API Error 0000: I need exactly 3 parameters.' raise APIError(0, 'I need exactly 3 parameters.')
passphrase, addressVersionNumber, streamNumber = params passphrase, addressVersionNumber, streamNumber = params
numberOfAddresses = 1 numberOfAddresses = 1
eighteenByteRipe = False eighteenByteRipe = False
if len(passphrase) == 0: if len(passphrase) == 0:
return 'API Error 0001: The specified passphrase is blank.' raise APIError(1, 'The specified passphrase is blank.')
passphrase = passphrase.decode('base64') passphrase = self._decode(passphrase, "base64")
if addressVersionNumber != 3: if addressVersionNumber != 3:
return 'API Error 0002: The address version number currently must be 3. ' + addressVersionNumber + ' isn\'t supported.' raise APIError(2, 'The address version number currently must be 3. ' + addressVersionNumber + ' isn\'t supported.')
if streamNumber != 1: if streamNumber != 1:
return 'API Error 0003: The stream number must be 1. Others aren\'t supported.' raise APIError(3, ' The stream number must be 1. Others aren\'t supported.')
shared.apiAddressGeneratorReturnQueue.queue.clear() shared.apiAddressGeneratorReturnQueue.queue.clear()
print 'Requesting that the addressGenerator create', numberOfAddresses, 'addresses.' logger.debug('Requesting that the addressGenerator create %s addresses.', numberOfAddresses)
shared.addressGeneratorQueue.put( shared.addressGeneratorQueue.put(
('getDeterministicAddress', addressVersionNumber, ('getDeterministicAddress', addressVersionNumber,
streamNumber, 'unused API address', numberOfAddresses, passphrase, eighteenByteRipe)) streamNumber, 'unused API address', numberOfAddresses, passphrase, eighteenByteRipe))
return shared.apiAddressGeneratorReturnQueue.get() return shared.apiAddressGeneratorReturnQueue.get()
elif method == 'getAllInboxMessages': elif method == 'getAllInboxMessages':
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype, read FROM inbox where folder='inbox' ORDER BY received''') '''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype, read FROM inbox where folder='inbox' ORDER BY received''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"inboxMessages":[' data = '{"inboxMessages":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, encodingtype, read = row msgid, toAddress, fromAddress, subject, received, message, encodingtype, read = row
@ -327,12 +399,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
data += ']}' data += ']}'
return data return data
elif method == 'getAllInboxMessageIds' or method == 'getAllInboxMessageIDs': elif method == 'getAllInboxMessageIds' or method == 'getAllInboxMessageIDs':
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT msgid FROM inbox where folder='inbox' ORDER BY received''') '''SELECT msgid FROM inbox where folder='inbox' ORDER BY received''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"inboxMessageIds":[' data = '{"inboxMessageIds":['
for row in queryreturn: for row in queryreturn:
msgid = row[0] msgid = row[0]
@ -343,14 +411,19 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'getInboxMessageById' or method == 'getInboxMessageByID': elif method == 'getInboxMessageById' or method == 'getInboxMessageByID':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
msgid = params[0].decode('hex') elif len(params) == 1:
v = (msgid,) msgid = self._decode(params[0], "hex")
shared.sqlLock.acquire() elif len(params) >= 2:
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype, read FROM inbox WHERE msgid=?''') msgid = self._decode(params[0], "hex")
shared.sqlSubmitQueue.put(v) readStatus = params[1]
queryreturn = shared.sqlReturnQueue.get() if not isinstance(readStatus, bool):
shared.sqlLock.release() raise APIError(23, 'Bool expected in readStatus, saw %s instead.' % type(readStatus))
queryreturn = sqlQuery('''SELECT read FROM inbox WHERE msgid=?''', msgid)
# UPDATE is slow, only update if status is different
if queryreturn != [] and (queryreturn[0][0] == 1) != readStatus:
sqlExecute('''UPDATE inbox set read = ? WHERE msgid=?''', readStatus, msgid)
queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype, read FROM inbox WHERE msgid=?''', msgid)
data = '{"inboxMessage":[' data = '{"inboxMessage":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, encodingtype, read = row msgid, toAddress, fromAddress, subject, received, message, encodingtype, read = row
@ -360,11 +433,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
data += ']}' data += ']}'
return data return data
elif method == 'getAllSentMessages': elif method == 'getAllSentMessages':
shared.sqlLock.acquire() queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata 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('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"sentMessages":[' data = '{"sentMessages":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
@ -376,11 +445,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
data += ']}' data += ']}'
return data return data
elif method == 'getAllSentMessageIds' or method == 'getAllSentMessageIDs': elif method == 'getAllSentMessageIds' or method == 'getAllSentMessageIDs':
shared.sqlLock.acquire() queryreturn = sqlQuery('''SELECT msgid FROM sent where folder='sent' ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put('''SELECT msgid FROM sent where folder='sent' ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"sentMessageIds":[' data = '{"sentMessageIds":['
for row in queryreturn: for row in queryreturn:
msgid = row[0] msgid = row[0]
@ -391,14 +456,9 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'getInboxMessagesByReceiver' or method == 'getInboxMessagesByAddress': #after some time getInboxMessagesByAddress should be removed elif method == 'getInboxMessagesByReceiver' or method == 'getInboxMessagesByAddress': #after some time getInboxMessagesByAddress should be removed
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
toAddress = params[0] toAddress = params[0]
v = (toAddress,) queryReturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype FROM inbox WHERE folder='inbox' AND toAddress=?''', toAddress)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, received, message, encodingtype FROM inbox WHERE folder='inbox' AND toAddress=?''')
shared.sqlSubmitQueue.put(v)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"inboxMessages":[' data = '{"inboxMessages":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, encodingtype = row msgid, toAddress, fromAddress, subject, received, message, encodingtype = row
@ -411,14 +471,9 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'getSentMessageById' or method == 'getSentMessageByID': elif method == 'getSentMessageById' or method == 'getSentMessageByID':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
msgid = params[0].decode('hex') msgid = self._decode(params[0], "hex")
v = (msgid,) queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE msgid=?''', msgid)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE msgid=?''')
shared.sqlSubmitQueue.put(v)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"sentMessage":[' data = '{"sentMessage":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
@ -429,14 +484,10 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'getSentMessagesByAddress' or method == 'getSentMessagesBySender': elif method == 'getSentMessagesByAddress' or method == 'getSentMessagesBySender':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
fromAddress = params[0] fromAddress = params[0]
v = (fromAddress,) queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE folder='sent' AND fromAddress=? ORDER BY lastactiontime''',
shared.sqlLock.acquire() fromAddress)
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE folder='sent' AND fromAddress=? ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put(v)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"sentMessages":[' data = '{"sentMessages":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
@ -449,14 +500,10 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'getSentMessageByAckData': elif method == 'getSentMessageByAckData':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
ackData = params[0].decode('hex') ackData = self._decode(params[0], "hex")
v = (ackData,) queryreturn = sqlQuery('''SELECT msgid, toaddress, fromaddress, subject, lastactiontime, message, encodingtype, status, ackdata FROM sent WHERE ackdata=?''',
shared.sqlLock.acquire() ackData)
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":[' data = '{"sentMessage":['
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row msgid, toAddress, fromAddress, subject, lastactiontime, message, encodingtype, status, ackdata = row
@ -467,95 +514,57 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'trashMessage': elif method == 'trashMessage':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
msgid = params[0].decode('hex') msgid = self._decode(params[0], "hex")
# Trash if in inbox table # Trash if in inbox table
helper_inbox.trash(msgid) helper_inbox.trash(msgid)
# Trash if in sent table # Trash if in sent table
t = (msgid,) sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', msgid)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''UPDATE sent SET folder='trash' WHERE msgid=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# shared.UISignalQueue.put(('removeSentRowByMsgid',msgid)) This function doesn't exist yet.
return 'Trashed message (assuming message existed).' return 'Trashed message (assuming message existed).'
elif method == 'trashInboxMessage': elif method == 'trashInboxMessage':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
msgid = params[0].decode('hex') msgid = self._decode(params[0], "hex")
helper_inbox.trash(msgid) helper_inbox.trash(msgid)
return 'Trashed inbox message (assuming message existed).' return 'Trashed inbox message (assuming message existed).'
elif method == 'trashSentMessage': elif method == 'trashSentMessage':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
msgid = params[0].decode('hex') msgid = self._decode(params[0], "hex")
t = (msgid,) sqlExecute('''UPDATE sent SET folder='trash' WHERE msgid=?''', msgid)
shared.sqlLock.acquire() return 'Trashed sent message (assuming message existed).'
shared.sqlSubmitQueue.put('''UPDATE sent SET folder='trash' WHERE msgid=?''') elif method == 'trashSentMessageByAckData':
shared.sqlSubmitQueue.put(t) # This API method should only be used when msgid is not available
shared.sqlReturnQueue.get() if len(params) == 0:
shared.sqlSubmitQueue.put('commit') raise APIError(0, 'I need parameters!')
shared.sqlLock.release() ackdata = self._decode(params[0], "hex")
# shared.UISignalQueue.put(('removeSentRowByMsgid',msgid)) This function doesn't exist yet. sqlExecute('''UPDATE sent SET folder='trash' WHERE ackdata=?''',
ackdata)
return 'Trashed sent message (assuming message existed).' return 'Trashed sent message (assuming message existed).'
elif method == 'sendMessage': elif method == 'sendMessage':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
elif len(params) == 4: elif len(params) == 4:
toAddress, fromAddress, subject, message = params toAddress, fromAddress, subject, message = params
encodingType = 2 encodingType = 2
elif len(params) == 5: elif len(params) == 5:
toAddress, fromAddress, subject, message, encodingType = params toAddress, fromAddress, subject, message, encodingType = params
if encodingType != 2: if encodingType != 2:
return 'API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.' raise APIError(6, 'The encoding type must be 2 because that is the only one this program currently supports.')
subject = subject.decode('base64') subject = self._decode(subject, "base64")
message = message.decode('base64') message = self._decode(message, "base64")
status, addressVersionNumber, streamNumber, toRipe = decodeAddress(
toAddress)
if status != 'success':
with shared.printLock:
print 'API Error 0007: Could not decode address:', toAddress, ':', status
if status == 'checksumfailed':
return 'API Error 0008: Checksum failed for address: ' + toAddress
if status == 'invalidcharacters':
return 'API Error 0009: Invalid characters in address: ' + toAddress
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + toAddress
return 'API Error 0007: Could not decode address: ' + toAddress + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: The address version number currently must be 2 or 3. Others aren\'t supported. Check the toAddress.'
if streamNumber != 1:
return 'API Error 0012: The stream number must be 1. Others aren\'t supported. Check the toAddress.'
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
fromAddress)
if status != 'success':
with shared.printLock:
print 'API Error 0007: Could not decode address:', fromAddress, ':', status
if status == 'checksumfailed':
return 'API Error 0008: Checksum failed for address: ' + fromAddress
if status == 'invalidcharacters':
return 'API Error 0009: Invalid characters in address: ' + fromAddress
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + fromAddress
return 'API Error 0007: Could not decode address: ' + fromAddress + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: The address version number currently must be 2 or 3. Others aren\'t supported. Check the fromAddress.'
if streamNumber != 1:
return 'API Error 0012: The stream number must be 1. Others aren\'t supported. Check the fromAddress.'
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
fromAddress = addBMIfNotPresent(fromAddress) fromAddress = addBMIfNotPresent(fromAddress)
status, addressVersionNumber, streamNumber, toRipe = self._verifyAddress(toAddress)
self._verifyAddress(fromAddress)
try: try:
fromAddressEnabled = shared.config.getboolean( fromAddressEnabled = shared.config.getboolean(
fromAddress, 'enabled') fromAddress, 'enabled')
except: except:
return 'API Error 0013: Could not find your fromAddress in the keys.dat file.' raise APIError(13, 'Could not find your fromAddress in the keys.dat file.')
if not fromAddressEnabled: if not fromAddressEnabled:
return 'API Error 0014: Your fromAddress is disabled. Cannot send.' raise APIError(14, 'Your fromAddress is disabled. Cannot send.')
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
@ -564,13 +573,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
helper_sent.insert(t) helper_sent.insert(t)
toLabel = '' toLabel = ''
t = (toAddress,) queryreturn = sqlQuery('''select label from addressbook where address=?''', toAddress)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
toLabel, = row toLabel, = row
@ -584,40 +587,24 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
elif method == 'sendBroadcast': elif method == 'sendBroadcast':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
if len(params) == 3: if len(params) == 3:
fromAddress, subject, message = params fromAddress, subject, message = params
encodingType = 2 encodingType = 2
elif len(params) == 4: elif len(params) == 4:
fromAddress, subject, message, encodingType = params fromAddress, subject, message, encodingType = params
if encodingType != 2: if encodingType != 2:
return 'API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.' raise APIError(6, 'The encoding type must be 2 because that is the only one this program currently supports.')
subject = subject.decode('base64') subject = self._decode(subject, "base64")
message = message.decode('base64') message = self._decode(message, "base64")
status, addressVersionNumber, streamNumber, fromRipe = decodeAddress(
fromAddress)
if status != 'success':
with shared.printLock:
print 'API Error 0007: Could not decode address:', fromAddress, ':', status
if status == 'checksumfailed':
return 'API Error 0008: Checksum failed for address: ' + fromAddress
if status == 'invalidcharacters':
return 'API Error 0009: Invalid characters in address: ' + fromAddress
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + fromAddress
return 'API Error 0007: Could not decode address: ' + fromAddress + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: the address version number currently must be 2 or 3. Others aren\'t supported. Check the fromAddress.'
if streamNumber != 1:
return 'API Error 0012: the stream number must be 1. Others aren\'t supported. Check the fromAddress.'
fromAddress = addBMIfNotPresent(fromAddress) fromAddress = addBMIfNotPresent(fromAddress)
self._verifyAddress(fromAddress)
try: try:
fromAddressEnabled = shared.config.getboolean( fromAddressEnabled = shared.config.getboolean(
fromAddress, 'enabled') fromAddress, 'enabled')
except: except:
return 'API Error 0013: could not find your fromAddress in the keys.dat file.' raise APIError(13, 'could not find your fromAddress in the keys.dat file.')
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
toAddress = '[Broadcast subscribers]' toAddress = '[Broadcast subscribers]'
ripe = '' ripe = ''
@ -635,16 +622,14 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return ackdata.encode('hex') return ackdata.encode('hex')
elif method == 'getStatus': elif method == 'getStatus':
if len(params) != 1: if len(params) != 1:
return 'API Error 0000: I need one parameter!' raise APIError(0, 'I need one parameter!')
ackdata, = params ackdata, = params
if len(ackdata) != 64: if len(ackdata) != 64:
return 'API Error 0015: The length of ackData should be 32 bytes (encoded in hex thus 64 characters).' raise APIError(15, 'The length of ackData should be 32 bytes (encoded in hex thus 64 characters).')
shared.sqlLock.acquire() ackdata = self._decode(ackdata, "hex")
shared.sqlSubmitQueue.put( queryreturn = sqlQuery(
'''SELECT status FROM sent where ackdata=?''') '''SELECT status FROM sent where ackdata=?''',
shared.sqlSubmitQueue.put((ackdata.decode('hex'),)) ackdata)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
return 'notfound' return 'notfound'
for row in queryreturn: for row in queryreturn:
@ -652,56 +637,27 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return status return status
elif method == 'addSubscription': elif method == 'addSubscription':
if len(params) == 0: if len(params) == 0:
return 'API Error 0000: I need parameters!' raise APIError(0, 'I need parameters!')
if len(params) == 1: if len(params) == 1:
address, = params address, = params
label == '' label == ''
if len(params) == 2: if len(params) == 2:
address, label = params address, label = params
label = label.decode('base64') label = self._decode(label, "base64")
try: try:
unicode(label, 'utf-8') unicode(label, 'utf-8')
except: except:
return 'API Error 0017: Label is not valid UTF-8 data.' raise APIError(17, 'Label is not valid UTF-8 data.')
if len(params) > 2: if len(params) > 2:
return 'API Error 0000: I need either 1 or 2 parameters!' raise APIError(0, 'I need either 1 or 2 parameters!')
address = addBMIfNotPresent(address) address = addBMIfNotPresent(address)
status, addressVersionNumber, streamNumber, toRipe = decodeAddress( self._verifyAddress(address)
address)
if status != 'success':
with shared.printLock:
print 'API Error 0007: Could not decode address:', address, ':', status
if status == 'checksumfailed':
return 'API Error 0008: Checksum failed for address: ' + address
if status == 'invalidcharacters':
return 'API Error 0009: Invalid characters in address: ' + address
if status == 'versiontoohigh':
return 'API Error 0010: Address version number too high (or zero) in address: ' + address
return 'API Error 0007: Could not decode address: ' + address + ' : ' + status
if addressVersionNumber < 2 or addressVersionNumber > 3:
return 'API Error 0011: The address version number currently must be 2 or 3. Others aren\'t supported.'
if streamNumber != 1:
return 'API Error 0012: The stream number must be 1. Others aren\'t supported.'
# First we must check to see if the address is already in the # First we must check to see if the address is already in the
# subscriptions list. # subscriptions list.
shared.sqlLock.acquire() queryreturn = sqlQuery('''select * from subscriptions where address=?''', address)
t = (address,)
shared.sqlSubmitQueue.put(
'''select * from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
return 'API Error 0016: You are already subscribed to that address.' raise APIError(16, 'You are already subscribed to that address.')
t = (label, address, True) sqlExecute('''INSERT INTO subscriptions VALUES (?,?,?)''',label, address, True)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''INSERT INTO subscriptions VALUES (?,?,?)''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.reloadBroadcastSendersForWhichImWatching() shared.reloadBroadcastSendersForWhichImWatching()
shared.UISignalQueue.put(('rerenderInboxFromLabels', '')) shared.UISignalQueue.put(('rerenderInboxFromLabels', ''))
shared.UISignalQueue.put(('rerenderSubscriptions', '')) shared.UISignalQueue.put(('rerenderSubscriptions', ''))
@ -709,27 +665,16 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
elif method == 'deleteSubscription': elif method == 'deleteSubscription':
if len(params) != 1: if len(params) != 1:
return 'API Error 0000: I need 1 parameter!' raise APIError(0, 'I need 1 parameter!')
address, = params address, = params
address = addBMIfNotPresent(address) address = addBMIfNotPresent(address)
t = (address,) sqlExecute('''DELETE FROM subscriptions WHERE address=?''', address)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''DELETE FROM subscriptions WHERE address=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.reloadBroadcastSendersForWhichImWatching() shared.reloadBroadcastSendersForWhichImWatching()
shared.UISignalQueue.put(('rerenderInboxFromLabels', '')) shared.UISignalQueue.put(('rerenderInboxFromLabels', ''))
shared.UISignalQueue.put(('rerenderSubscriptions', '')) shared.UISignalQueue.put(('rerenderSubscriptions', ''))
return 'Deleted subscription if it existed.' return 'Deleted subscription if it existed.'
elif method == 'listSubscriptions': elif method == 'listSubscriptions':
shared.sqlLock.acquire() queryreturn = sqlQuery('''SELECT label, address, enabled FROM subscriptions''')
shared.sqlSubmitQueue.put('''SELECT label, address, enabled FROM subscriptions''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
data = '{"subscriptions":[' data = '{"subscriptions":['
for row in queryreturn: for row in queryreturn:
label, address, enabled = row label, address, enabled = row
@ -741,33 +686,58 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return data return data
elif method == 'disseminatePreEncryptedMsg': elif method == 'disseminatePreEncryptedMsg':
# The device issuing this command to PyBitmessage supplies a msg object that has # The device issuing this command to PyBitmessage supplies a msg object that has
# already been encrypted and had the necessary proof of work done for it to be # already been encrypted but which still needs the POW to be done. PyBitmessage
# disseminated to the rest of the Bitmessage network. PyBitmessage accepts this msg # accepts this msg object and sends it out to the rest of the Bitmessage network
# object and sends it out to the rest of the Bitmessage network as if it had generated the # as if it had generated the message itself. Please do not yet add this to the
# message itself. Please do not yet add this to the api doc. # api doc.
if len(params) != 1: if len(params) != 3:
return 'API Error 0000: I need 1 parameter!' raise APIError(0, 'I need 3 parameter!')
encryptedPayload, = params encryptedPayload, requiredAverageProofOfWorkNonceTrialsPerByte, requiredPayloadLengthExtraBytes = params
encryptedPayload = encryptedPayload.decode('hex') encryptedPayload = self._decode(encryptedPayload, "hex")
# Let us do the POW and attach it to the front
target = 2**64 / ((len(encryptedPayload)+requiredPayloadLengthExtraBytes+8) * requiredAverageProofOfWorkNonceTrialsPerByte)
with shared.printLock:
print '(For msg message via API) Doing proof of work. Total required difficulty:', float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte, 'Required small message difficulty:', float(requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes
powStartTime = time.time()
initialHash = hashlib.sha512(encryptedPayload).digest()
trialValue, nonce = proofofwork.run(target, initialHash)
with shared.printLock:
print '(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce
try:
print 'POW took', int(time.time() - powStartTime), 'seconds.', nonce / (time.time() - powStartTime), 'nonce trials per second.'
except:
pass
encryptedPayload = pack('>Q', nonce) + encryptedPayload
toStreamNumber = decodeVarint(encryptedPayload[16:26])[0] toStreamNumber = decodeVarint(encryptedPayload[16:26])[0]
inventoryHash = calculateInventoryHash(encryptedPayload) inventoryHash = calculateInventoryHash(encryptedPayload)
objectType = 'msg' objectType = 'msg'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, toStreamNumber, encryptedPayload, int(time.time())) objectType, toStreamNumber, encryptedPayload, int(time.time()))
shared.inventorySets[toStreamNumber].add(inventoryHash)
with shared.printLock: with shared.printLock:
print 'Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', inventoryHash.encode('hex') print 'Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
toStreamNumber, 'sendinv', inventoryHash)) toStreamNumber, 'advertiseobject', inventoryHash))
elif method == 'disseminatePubkey': elif method == 'disseminatePubkey':
# The device issuing this command to PyBitmessage supplies a pubkey object that has # The device issuing this command to PyBitmessage supplies a pubkey object to be
# already had the necessary proof of work done for it to be disseminated to the rest of the # disseminated to the rest of the Bitmessage network. PyBitmessage accepts this
# Bitmessage network. PyBitmessage accepts this pubkey object and sends it out to the # pubkey object and sends it out to the rest of the Bitmessage network as if it
# rest of the Bitmessage network as if it had generated the pubkey object itself. Please # had generated the pubkey object itself. Please do not yet add this to the api
# do not yet add this to the api doc. # doc.
if len(params) != 1: if len(params) != 1:
return 'API Error 0000: I need 1 parameter!' raise APIError(0, 'I need 1 parameter!')
payload, = params payload, = params
payload = payload.decode('hex') payload = self._decode(payload, "hex")
# Let us do the POW
target = 2 ** 64 / ((len(payload) + shared.networkDefaultPayloadLengthExtraBytes +
8) * shared.networkDefaultProofOfWorkNonceTrialsPerByte)
print '(For pubkey message via API) Doing proof of work...'
initialHash = hashlib.sha512(payload).digest()
trialValue, nonce = proofofwork.run(target, initialHash)
print '(For pubkey message via API) Found proof of work', trialValue, 'Nonce:', nonce
payload = pack('>Q', nonce) + payload
pubkeyReadPosition = 8 # bypass the nonce pubkeyReadPosition = 8 # bypass the nonce
if payload[pubkeyReadPosition:pubkeyReadPosition+4] == '\x00\x00\x00\x00': # if this pubkey uses 8 byte time if payload[pubkeyReadPosition:pubkeyReadPosition+4] == '\x00\x00\x00\x00': # if this pubkey uses 8 byte time
pubkeyReadPosition += 8 pubkeyReadPosition += 8
@ -780,46 +750,38 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
objectType = 'pubkey' objectType = 'pubkey'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, pubkeyStreamNumber, payload, int(time.time())) objectType, pubkeyStreamNumber, payload, int(time.time()))
shared.inventorySets[pubkeyStreamNumber].add(inventoryHash)
with shared.printLock: with shared.printLock:
print 'broadcasting inv within API command disseminatePubkey with hash:', inventoryHash.encode('hex') print 'broadcasting inv within API command disseminatePubkey with hash:', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
elif method == 'getMessageDataByDestinationHash': elif method == 'getMessageDataByDestinationHash':
# Method will eventually be used by a particular Android app to # Method will eventually be used by a particular Android app to
# select relevant messages. Do not yet add this to the api # select relevant messages. Do not yet add this to the api
# doc. # doc.
if len(params) != 1: if len(params) != 1:
return 'API Error 0000: I need 1 parameter!' raise APIError(0, 'I need 1 parameter!')
requestedHash, = params requestedHash, = params
if len(requestedHash) != 40: if len(requestedHash) != 40:
return 'API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).' raise APIError(19, 'The length of hash should be 20 bytes (encoded in hex thus 40 characters).')
requestedHash = requestedHash.decode('hex') requestedHash = self._decode(requestedHash, "hex")
# This is not a particularly commonly used API function. Before we # This is not a particularly commonly used API function. Before we
# use it we'll need to fill out a field in our inventory database # use it we'll need to fill out a field in our inventory database
# which is blank by default (first20bytesofencryptedmessage). # which is blank by default (first20bytesofencryptedmessage).
parameters = '' queryreturn = sqlQuery(
with shared.sqlLock: '''SELECT hash, payload FROM inventory WHERE first20bytesofencryptedmessage = '' and objecttype = 'msg' ; ''')
shared.sqlSubmitQueue.put('''SELECT hash, payload FROM inventory WHERE first20bytesofencryptedmessage = '' and objecttype = 'msg' ; ''') with SqlBulkExecute() as sql:
shared.sqlSubmitQueue.put(parameters)
queryreturn = shared.sqlReturnQueue.get()
for row in queryreturn: for row in queryreturn:
hash, payload = row hash, payload = row
readPosition = 16 # Nonce length + time length readPosition = 16 # Nonce length + time length
readPosition += decodeVarint(payload[readPosition:readPosition+10])[1] # Stream Number length readPosition += decodeVarint(payload[readPosition:readPosition+10])[1] # Stream Number length
t = (payload[readPosition:readPosition+20],hash) t = (payload[readPosition:readPosition+20],hash)
shared.sqlSubmitQueue.put('''UPDATE inventory SET first20bytesofencryptedmessage=? WHERE hash=?; ''') sql.execute('''UPDATE inventory SET first20bytesofencryptedmessage=? WHERE hash=?; ''', *t)
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
parameters = (requestedHash,) queryreturn = sqlQuery('''SELECT payload FROM inventory WHERE first20bytesofencryptedmessage = ?''',
with shared.sqlLock: requestedHash)
shared.sqlSubmitQueue.put('commit')
shared.sqlSubmitQueue.put('''SELECT payload FROM inventory WHERE first20bytesofencryptedmessage = ?''')
shared.sqlSubmitQueue.put(parameters)
queryreturn = shared.sqlReturnQueue.get()
data = '{"receivedMessageDatas":[' data = '{"receivedMessageDatas":['
for row in queryreturn: for row in queryreturn:
payload, = row payload, = row
@ -832,16 +794,12 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
# Method will eventually be used by a particular Android app to # Method will eventually be used by a particular Android app to
# retrieve pubkeys. Please do not yet add this to the api docs. # retrieve pubkeys. Please do not yet add this to the api docs.
if len(params) != 1: if len(params) != 1:
return 'API Error 0000: I need 1 parameter!' raise APIError(0, 'I need 1 parameter!')
requestedHash, = params requestedHash, = params
if len(requestedHash) != 40: if len(requestedHash) != 40:
return 'API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).' raise APIError(19, 'The length of hash should be 20 bytes (encoded in hex thus 40 characters).')
requestedHash = requestedHash.decode('hex') requestedHash = self._decode(requestedHash, "hex")
parameters = (requestedHash,) queryreturn = sqlQuery('''SELECT transmitdata FROM pubkeys WHERE hash = ? ; ''', requestedHash)
with shared.sqlLock:
shared.sqlSubmitQueue.put('''SELECT transmitdata FROM pubkeys WHERE hash = ? ; ''')
shared.sqlSubmitQueue.put(parameters)
queryreturn = shared.sqlReturnQueue.get()
data = '{"pubkey":[' data = '{"pubkey":['
for row in queryreturn: for row in queryreturn:
transmitdata, = row transmitdata, = row
@ -849,9 +807,31 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
data += ']}' data += ']}'
return data return data
elif method == 'clientStatus': elif method == 'clientStatus':
return '{ "networkConnections" : "%s" }' % str(len(shared.connectedHostsList)) if len(shared.connectedHostsList) == 0:
networkStatus = 'notConnected'
elif len(shared.connectedHostsList) > 0 and not shared.clientHasReceivedIncomingConnections:
networkStatus = 'connectedButHaveNotReceivedIncomingConnections'
else:
networkStatus = 'connectedAndReceivingIncomingConnections'
return json.dumps({'networkConnections':len(shared.connectedHostsList),'numberOfMessagesProcessed':shared.numberOfMessagesProcessed, 'numberOfBroadcastsProcessed':shared.numberOfBroadcastsProcessed, 'numberOfPubkeysProcessed':shared.numberOfPubkeysProcessed, 'networkStatus':networkStatus}, indent=4, separators=(',', ': '))
else: else:
return 'API Error 0020: Invalid method: %s' % method raise APIError(20, 'Invalid method: %s' % method)
def _dispatch(self, method, params):
self.cookies = []
validuser = self.APIAuthenticateClient()
if not validuser:
time.sleep(2)
return "RPC Username or password incorrect or HTTP header lacks authentication at all."
try:
return self._handle_request(method, params)
except APIError as e:
return str(e)
except Exception as e:
logger.exception(e)
return "API Error 0021: Unexpected API Failure - %s" % str(e)
# This thread, of which there is only one, runs the API. # This thread, of which there is only one, runs the API.
@ -878,7 +858,8 @@ if shared.useVeryEasyProofOfWorkForTesting:
shared.networkDefaultPayloadLengthExtraBytes / 7000) shared.networkDefaultPayloadLengthExtraBytes / 7000)
class Main: class Main:
def start(self, deamon=False): def start(self, daemon=False):
shared.daemon = daemon
# is the application already running? If yes then exit. # is the application already running? If yes then exit.
thisapp = singleton.singleinstance() thisapp = singleton.singleinstance()
@ -931,7 +912,7 @@ class Main:
singleListenerThread.daemon = True # close the main program even if there are threads left singleListenerThread.daemon = True # close the main program even if there are threads left
singleListenerThread.start() singleListenerThread.start()
if deamon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False: if daemon == False and shared.safeConfigGetBoolean('bitmessagesettings', 'daemon') == False:
try: try:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
except Exception as err: except Exception as err:
@ -944,7 +925,7 @@ class Main:
else: else:
shared.config.remove_option('bitmessagesettings', 'dontconnect') shared.config.remove_option('bitmessagesettings', 'dontconnect')
if deamon: if daemon:
with shared.printLock: with shared.printLock:
print 'Running as a daemon. The main program should exit this thread.' print 'Running as a daemon. The main program should exit this thread.'
else: else:
@ -962,7 +943,6 @@ class Main:
def getApiAddress(self): def getApiAddress(self):
if not shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'): if not shared.safeConfigGetBoolean('bitmessagesettings', 'apienabled'):
return None return None
address = shared.config.get('bitmessagesettings', 'apiinterface') address = shared.config.get('bitmessagesettings', 'apiinterface')
port = shared.config.getint('bitmessagesettings', 'apiport') port = shared.config.getint('bitmessagesettings', 'apiport')
return {'address':address,'port':port} return {'address':address,'port':port}

View File

@ -36,6 +36,7 @@ import debug
from debug import logger from debug import logger
import subprocess import subprocess
import datetime import datetime
from helper_sql import *
try: try:
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
@ -234,6 +235,10 @@ class MyForm(QtGui.QMainWindow):
self.ui.labelSendBroadcastWarning.setVisible(False) self.ui.labelSendBroadcastWarning.setVisible(False)
self.timer = QtCore.QTimer()
self.timer.start(2000) # milliseconds
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
# FILE MENU and other buttons # FILE MENU and other buttons
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL(
"triggered()"), self.quit) "triggered()"), self.quit)
@ -477,23 +482,7 @@ class MyForm(QtGui.QMainWindow):
self.loadSent() self.loadSent()
# Initialize the address book # Initialize the address book
shared.sqlLock.acquire() self.rerenderAddressBook()
shared.sqlSubmitQueue.put('SELECT * FROM addressbook')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn:
label, address = row
self.ui.tableWidgetAddressBook.insertRow(0)
# address book item
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
newItem.setIcon(avatarize(address))
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setIcon(identiconize(address))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
# Initialize the Subscriptions # Initialize the Subscriptions
self.rerenderSubscriptions() self.rerenderSubscriptions()
@ -561,19 +550,25 @@ class MyForm(QtGui.QMainWindow):
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"updateNetworkStatusTab()"), self.updateNetworkStatusTab) "updateNetworkStatusTab()"), self.updateNetworkStatusTab)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"incrementNumberOfMessagesProcessed()"), self.incrementNumberOfMessagesProcessed) "updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"incrementNumberOfPubkeysProcessed()"), self.incrementNumberOfPubkeysProcessed) "updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"incrementNumberOfBroadcastsProcessed()"), self.incrementNumberOfBroadcastsProcessed) "updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon) "setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderInboxFromLabels()"), self.rerenderInboxFromLabels) "rerenderInboxFromLabels()"), self.rerenderInboxFromLabels)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderSentToLabels()"), self.rerenderSentToLabels)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderAddressBook()"), self.rerenderAddressBook)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderSubscriptions()"), self.rerenderSubscriptions) "rerenderSubscriptions()"), self.rerenderSubscriptions)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid) "removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"displayAlert(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayAlert)
self.UISignalThread.start() self.UISignalThread.start()
# Below this point, it would be good if all of the necessary global data # Below this point, it would be good if all of the necessary global data
@ -705,7 +700,7 @@ class MyForm(QtGui.QMainWindow):
else: else:
where = "toaddress || fromaddress || subject || message" where = "toaddress || fromaddress || subject || message"
sqlQuery = ''' sqlStatement = '''
SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime
FROM sent WHERE folder="sent" AND %s LIKE ? FROM sent WHERE folder="sent" AND %s LIKE ?
ORDER BY lastactiontime ORDER BY lastactiontime
@ -714,12 +709,7 @@ class MyForm(QtGui.QMainWindow):
while self.ui.tableWidgetSent.rowCount() > 0: while self.ui.tableWidgetSent.rowCount() > 0:
self.ui.tableWidgetSent.removeRow(0) self.ui.tableWidgetSent.removeRow(0)
t = (what,) queryreturn = sqlQuery(sqlStatement, what)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(sqlQuery)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
toAddress, fromAddress, subject, message, status, ackdata, lastactiontime = row toAddress, fromAddress, subject, message, status, ackdata, lastactiontime = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
@ -732,13 +722,8 @@ class MyForm(QtGui.QMainWindow):
fromLabel = fromAddress fromLabel = fromAddress
toLabel = '' toLabel = ''
t = (toAddress,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''select label from addressbook where address=?''', toAddress)
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
@ -837,7 +822,7 @@ class MyForm(QtGui.QMainWindow):
else: else:
where = "toaddress || fromaddress || subject || message" where = "toaddress || fromaddress || subject || message"
sqlQuery = ''' sqlStatement = '''
SELECT msgid, toaddress, fromaddress, subject, received, message, read SELECT msgid, toaddress, fromaddress, subject, received, message, read
FROM inbox WHERE folder="inbox" AND %s LIKE ? FROM inbox WHERE folder="inbox" AND %s LIKE ?
ORDER BY received ORDER BY received
@ -848,12 +833,7 @@ class MyForm(QtGui.QMainWindow):
font = QFont() font = QFont()
font.setBold(True) font.setBold(True)
t = (what,) queryreturn = sqlQuery(sqlStatement, what)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(sqlQuery)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, message, read = row msgid, toAddress, fromAddress, subject, received, message, read = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
@ -876,26 +856,16 @@ class MyForm(QtGui.QMainWindow):
checkIfChan = False checkIfChan = False
if fromLabel == '': # If this address wasn't in our address book... if fromLabel == '': # If this address wasn't in our address book...
t = (fromAddress,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''select label from addressbook where address=?''', fromAddress)
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
if fromLabel == '': # If this address wasn't in our address book... if fromLabel == '': # If this address wasn't in our address book...
t = (fromAddress,) queryReturn = sqlQuery(
shared.sqlLock.acquire() '''select label from subscriptions where address=?''', fromAddress)
shared.sqlSubmitQueue.put(
'''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
@ -1044,12 +1014,8 @@ class MyForm(QtGui.QMainWindow):
if not (self.mmapp.has_source("Subscriptions") or self.mmapp.has_source("Messages")): if not (self.mmapp.has_source("Subscriptions") or self.mmapp.has_source("Messages")):
return return
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put( '''SELECT toaddress, read FROM inbox WHERE msgid=?''', inventoryHash)
'''SELECT toaddress, read FROM inbox WHERE msgid=?''')
shared.sqlSubmitQueue.put(inventoryHash)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
toAddress, read = row toAddress, read = row
if not read: if not read:
@ -1065,12 +1031,8 @@ class MyForm(QtGui.QMainWindow):
unreadMessages = 0 unreadMessages = 0
unreadSubscriptions = 0 unreadSubscriptions = 0
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT msgid, toaddress, read FROM inbox where folder='inbox' ''') '''SELECT msgid, toaddress, read FROM inbox where folder='inbox' ''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
msgid, toAddress, read = row msgid, toAddress, read = row
@ -1233,12 +1195,22 @@ class MyForm(QtGui.QMainWindow):
if 'linux' in sys.platform: if 'linux' in sys.platform:
# Note: QSound was a nice idea but it didn't work # Note: QSound was a nice idea but it didn't work
if '.mp3' in soundFilename: if '.mp3' in soundFilename:
gst_available=False
try: try:
subprocess.call(["gst123", soundFilename], subprocess.call(["gst123", soundFilename],
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
gst_available=True
except: except:
print "WARNING: gst123 must be installed in order to play mp3 sounds" print "WARNING: gst123 must be installed in order to play mp3 sounds"
if not gst_available:
try:
subprocess.call(["mpg123", soundFilename],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
gst_available=True
except:
print "WARNING: mpg123 must be installed in order to play mp3 sounds"
else: else:
try: try:
subprocess.call(["aplay", soundFilename], subprocess.call(["aplay", soundFilename],
@ -1307,9 +1279,7 @@ class MyForm(QtGui.QMainWindow):
def click_actionDeleteAllTrashedMessages(self): def click_actionDeleteAllTrashedMessages(self):
if QtGui.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No: if QtGui.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
return return
shared.sqlLock.acquire() sqlStoredProcedure('deleteandvacuume')
shared.sqlSubmitQueue.put('deleteandvacuume')
shared.sqlLock.release()
def click_actionRegenerateDeterministicAddresses(self): def click_actionRegenerateDeterministicAddresses(self):
self.regenerateAddressesDialogInstance = regenerateAddressesDialog( self.regenerateAddressesDialogInstance = regenerateAddressesDialog(
@ -1421,20 +1391,17 @@ class MyForm(QtGui.QMainWindow):
self.actionShow.setChecked(not self.actionShow.isChecked()) self.actionShow.setChecked(not self.actionShow.isChecked())
self.appIndicatorShowOrHideWindow() self.appIndicatorShowOrHideWindow()
def incrementNumberOfMessagesProcessed(self): def updateNumberOfMessagesProcessed(self):
self.numberOfMessagesProcessed += 1
self.ui.labelMessageCount.setText(_translate( self.ui.labelMessageCount.setText(_translate(
"MainWindow", "Processed %1 person-to-person messages.").arg(str(self.numberOfMessagesProcessed))) "MainWindow", "Processed %1 person-to-person messages.").arg(str(shared.numberOfMessagesProcessed)))
def incrementNumberOfBroadcastsProcessed(self): def updateNumberOfBroadcastsProcessed(self):
self.numberOfBroadcastsProcessed += 1
self.ui.labelBroadcastCount.setText(_translate( self.ui.labelBroadcastCount.setText(_translate(
"MainWindow", "Processed %1 broadcast messages.").arg(str(self.numberOfBroadcastsProcessed))) "MainWindow", "Processed %1 broadcast messages.").arg(str(shared.numberOfBroadcastsProcessed)))
def incrementNumberOfPubkeysProcessed(self): def updateNumberOfPubkeysProcessed(self):
self.numberOfPubkeysProcessed += 1
self.ui.labelPubkeyCount.setText(_translate( self.ui.labelPubkeyCount.setText(_translate(
"MainWindow", "Processed %1 public keys.").arg(str(self.numberOfPubkeysProcessed))) "MainWindow", "Processed %1 public keys.").arg(str(shared.numberOfPubkeysProcessed)))
def updateNetworkStatusTab(self): def updateNetworkStatusTab(self):
# print 'updating network status tab' # print 'updating network status tab'
@ -1484,6 +1451,12 @@ class MyForm(QtGui.QMainWindow):
elif len(shared.connectedHostsList) == 0: elif len(shared.connectedHostsList) == 0:
self.setStatusIcon('red') self.setStatusIcon('red')
# timer driven
def runEveryTwoSeconds(self):
self.ui.labelLookupsPerSecond.setText(_translate(
"MainWindow", "Inventory lookups per second: %1").arg(str(shared.numberOfInventoryLookupsPerformed/2)))
shared.numberOfInventoryLookupsPerformed = 0
# Indicates whether or not there is a connection to the Bitmessage network # Indicates whether or not there is a connection to the Bitmessage network
connected = False connected = False
@ -1588,18 +1561,19 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetInbox.removeRow(i) self.ui.tableWidgetInbox.removeRow(i)
break break
def displayAlert(self, title, text, exitAfterUserClicksOk):
self.statusBar().showMessage(text)
QtGui.QMessageBox.critical(self, title, text, QMessageBox.Ok)
if exitAfterUserClicksOk:
os._exit(0)
def rerenderInboxFromLabels(self): def rerenderInboxFromLabels(self):
for i in range(self.ui.tableWidgetInbox.rowCount()): for i in range(self.ui.tableWidgetInbox.rowCount()):
addressToLookup = str(self.ui.tableWidgetInbox.item( addressToLookup = str(self.ui.tableWidgetInbox.item(
i, 1).data(Qt.UserRole).toPyObject()) i, 1).data(Qt.UserRole).toPyObject())
fromLabel = '' fromLabel = ''
t = (addressToLookup,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''select label from addressbook where address=?''', addressToLookup)
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
@ -1611,12 +1585,8 @@ class MyForm(QtGui.QMainWindow):
else: else:
# It might be a broadcast message. We should check for that # It might be a broadcast message. We should check for that
# label. # label.
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put( '''select label from subscriptions where address=?''', addressToLookup)
'''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
@ -1691,28 +1661,31 @@ class MyForm(QtGui.QMainWindow):
addressToLookup = str(self.ui.tableWidgetSent.item( addressToLookup = str(self.ui.tableWidgetSent.item(
i, 0).data(Qt.UserRole).toPyObject()) i, 0).data(Qt.UserRole).toPyObject())
toLabel = '' toLabel = ''
t = (addressToLookup,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''select label from addressbook where address=?''', addressToLookup)
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
toLabel, = row toLabel, = row
self.ui.tableWidgetSent.item( self.ui.tableWidgetSent.item(
i, 0).setText(unicode(toLabel, 'utf-8')) i, 0).setText(unicode(toLabel, 'utf-8'))
def rerenderAddressBook(self):
self.ui.tableWidgetAddressBook.setRowCount(0)
queryreturn = sqlQuery('SELECT * FROM addressbook')
for row in queryreturn:
label, address = row
self.ui.tableWidgetAddressBook.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
def rerenderSubscriptions(self): def rerenderSubscriptions(self):
self.ui.tableWidgetSubscriptions.setRowCount(0) self.ui.tableWidgetSubscriptions.setRowCount(0)
shared.sqlLock.acquire() queryreturn = sqlQuery('SELECT label, address, enabled FROM subscriptions')
shared.sqlSubmitQueue.put(
'SELECT label, address, enabled FROM subscriptions')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
label, address, enabled = row label, address, enabled = row
self.ui.tableWidgetSubscriptions.insertRow(0) self.ui.tableWidgetSubscriptions.insertRow(0)
@ -1797,24 +1770,26 @@ class MyForm(QtGui.QMainWindow):
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
"MainWindow", "Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.")) "MainWindow", "Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect."))
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
shared.sqlLock.acquire() t = ()
t = ('', toAddress, ripe, fromAddress, subject, message, ackdata, int( sqlExecute(
time.time()), 'msgqueued', 1, 1, 'sent', 2) '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''',
shared.sqlSubmitQueue.put( '',
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''') toAddress,
shared.sqlSubmitQueue.put(t) ripe,
shared.sqlReturnQueue.get() fromAddress,
shared.sqlSubmitQueue.put('commit') subject,
shared.sqlLock.release() message,
ackdata,
int(time.time()),
'msgqueued',
1,
1,
'sent',
2)
toLabel = '' toLabel = ''
t = (toAddress,) queryreturn = sqlQuery('''select label from addressbook where address=?''',
shared.sqlLock.acquire() toAddress)
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
toLabel, = row toLabel, = row
@ -1845,15 +1820,10 @@ class MyForm(QtGui.QMainWindow):
ackdata = OpenSSL.rand(32) ackdata = OpenSSL.rand(32)
toAddress = self.str_broadcast_subscribers toAddress = self.str_broadcast_subscribers
ripe = '' ripe = ''
shared.sqlLock.acquire()
t = ('', toAddress, ripe, fromAddress, subject, message, ackdata, int( t = ('', toAddress, ripe, fromAddress, subject, message, ackdata, int(
time.time()), 'broadcastqueued', 1, 1, 'sent', 2) time.time()), 'broadcastqueued', 1, 1, 'sent', 2)
shared.sqlSubmitQueue.put( sqlExecute(
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''') '''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.workerQueue.put(('sendbroadcast', '')) shared.workerQueue.put(('sendbroadcast', ''))
@ -2011,25 +1981,15 @@ class MyForm(QtGui.QMainWindow):
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
message = shared.fixPotentiallyInvalidUTF8Data(message) message = shared.fixPotentiallyInvalidUTF8Data(message)
fromLabel = '' fromLabel = ''
shared.sqlLock.acquire() queryreturn = sqlQuery(
t = (fromAddress,) '''select label from addressbook where address=?''', fromAddress)
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
else: else:
# There might be a label in the subscriptions table # There might be a label in the subscriptions table
shared.sqlLock.acquire() queryreturn = sqlQuery(
t = (fromAddress,) '''select label from subscriptions where address=?''', fromAddress)
shared.sqlSubmitQueue.put(
'''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
@ -2105,13 +2065,7 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "The address you entered was invalid. Ignoring it.")) "MainWindow", "The address you entered was invalid. Ignoring it."))
def addEntryToAddressBook(self,address,label): def addEntryToAddressBook(self,address,label):
shared.sqlLock.acquire() queryreturn = sqlQuery('''select * from addressbook where address=?''', address)
t = (address,)
shared.sqlSubmitQueue.put(
'''select * from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
self.ui.tableWidgetAddressBook.setSortingEnabled(False) self.ui.tableWidgetAddressBook.setSortingEnabled(False)
self.ui.tableWidgetAddressBook.insertRow(0) self.ui.tableWidgetAddressBook.insertRow(0)
@ -2124,14 +2078,7 @@ class MyForm(QtGui.QMainWindow):
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem) self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
self.ui.tableWidgetAddressBook.setSortingEnabled(True) self.ui.tableWidgetAddressBook.setSortingEnabled(True)
t = (str(label), address) sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', str(label), address)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''INSERT INTO addressbook VALUES (?,?)''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
self.rerenderSentToLabels() self.rerenderSentToLabels()
else: else:
@ -2155,13 +2102,7 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetSubscriptions.setItem(0,1,newItem) self.ui.tableWidgetSubscriptions.setItem(0,1,newItem)
self.ui.tableWidgetSubscriptions.setSortingEnabled(True) self.ui.tableWidgetSubscriptions.setSortingEnabled(True)
#Add to database (perhaps this should be separated from the MyForm class) #Add to database (perhaps this should be separated from the MyForm class)
t = (str(label),address,True) sqlExecute('''INSERT INTO subscriptions VALUES (?,?,?)''',str(label),address,True)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''INSERT INTO subscriptions VALUES (?,?,?)''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
shared.reloadBroadcastSendersForWhichImWatching() shared.reloadBroadcastSendersForWhichImWatching()
@ -2182,16 +2123,10 @@ class MyForm(QtGui.QMainWindow):
def loadBlackWhiteList(self): def loadBlackWhiteList(self):
# Initialize the Blacklist or Whitelist table # Initialize the Blacklist or Whitelist table
listType = shared.config.get('bitmessagesettings', 'blackwhitelist') listType = shared.config.get('bitmessagesettings', 'blackwhitelist')
shared.sqlLock.acquire()
if listType == 'black': if listType == 'black':
shared.sqlSubmitQueue.put( queryreturn = sqlQuery('''SELECT label, address, enabled FROM blacklist''')
'''SELECT label, address, enabled FROM blacklist''')
else: else:
shared.sqlSubmitQueue.put( queryreturn = sqlQuery('''SELECT label, address, enabled FROM whitelist''')
'''SELECT label, address, enabled FROM whitelist''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
label, address, enabled = row label, address, enabled = row
self.ui.tableWidgetBlacklist.insertRow(0) self.ui.tableWidgetBlacklist.insertRow(0)
@ -2256,14 +2191,19 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "You must restart Bitmessage for the port number change to take effect.")) "MainWindow", "You must restart Bitmessage for the port number change to take effect."))
shared.config.set('bitmessagesettings', 'port', str( shared.config.set('bitmessagesettings', 'port', str(
self.settingsDialogInstance.ui.lineEditTCPPort.text())) self.settingsDialogInstance.ui.lineEditTCPPort.text()))
if shared.config.get('bitmessagesettings', 'socksproxytype') == 'none' and str(self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5] == 'SOCKS': #print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText()', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()
#print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5]', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5]
if shared.config.get('bitmessagesettings', 'socksproxytype') == 'none' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
if shared.statusIconColor != 'red': if shared.statusIconColor != 'red':
QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
"MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any).")) "MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any)."))
if shared.config.get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and str(self.settingsDialogInstance.ui.comboBoxProxyType.currentText()) == 'none': if shared.config.get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS':
self.statusBar().showMessage('') self.statusBar().showMessage('')
shared.config.set('bitmessagesettings', 'socksproxytype', str( if self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
self.settingsDialogInstance.ui.comboBoxProxyType.currentText())) shared.config.set('bitmessagesettings', 'socksproxytype', str(
self.settingsDialogInstance.ui.comboBoxProxyType.currentText()))
else:
shared.config.set('bitmessagesettings', 'socksproxytype', 'none')
shared.config.set('bitmessagesettings', 'socksauthentication', str( shared.config.set('bitmessagesettings', 'socksauthentication', str(
self.settingsDialogInstance.ui.checkBoxAuthentication.isChecked())) self.settingsDialogInstance.ui.checkBoxAuthentication.isChecked()))
shared.config.set('bitmessagesettings', 'sockshostname', str( shared.config.set('bitmessagesettings', 'sockshostname', str(
@ -2327,9 +2267,7 @@ class MyForm(QtGui.QMainWindow):
if shared.appdata != '' and self.settingsDialogInstance.ui.checkBoxPortableMode.isChecked(): # If we are NOT using portable mode now but the user selected that we should... if shared.appdata != '' and self.settingsDialogInstance.ui.checkBoxPortableMode.isChecked(): # If we are NOT using portable mode now but the user selected that we should...
# Write the keys.dat file to disk in the new location # Write the keys.dat file to disk in the new location
shared.sqlLock.acquire() sqlStoredProcedure('movemessagstoprog')
shared.sqlSubmitQueue.put('movemessagstoprog')
shared.sqlLock.release()
with open('keys.dat', 'wb') as configfile: with open('keys.dat', 'wb') as configfile:
shared.config.write(configfile) shared.config.write(configfile)
# Write the knownnodes.dat file to disk in the new location # Write the knownnodes.dat file to disk in the new location
@ -2353,9 +2291,7 @@ class MyForm(QtGui.QMainWindow):
shared.appdata = shared.lookupAppdataFolder() shared.appdata = shared.lookupAppdataFolder()
if not os.path.exists(shared.appdata): if not os.path.exists(shared.appdata):
os.makedirs(shared.appdata) os.makedirs(shared.appdata)
shared.sqlLock.acquire() sqlStoredProcedure('movemessagstoappdata')
shared.sqlSubmitQueue.put('movemessagstoappdata')
shared.sqlLock.release()
# Write the keys.dat file to disk in the new location # Write the keys.dat file to disk in the new location
with open(shared.appdata + 'keys.dat', 'wb') as configfile: with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile) shared.config.write(configfile)
@ -2401,18 +2337,13 @@ class MyForm(QtGui.QMainWindow):
# First we must check to see if the address is already in the # First we must check to see if the address is already in the
# address book. The user cannot add it again or else it will # address book. The user cannot add it again or else it will
# cause problems when updating and deleting the entry. # cause problems when updating and deleting the entry.
shared.sqlLock.acquire()
t = (addBMIfNotPresent(str( t = (addBMIfNotPresent(str(
self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text())),) self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text())),)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.sqlSubmitQueue.put( sql = '''select * from blacklist where address=?'''
'''select * from blacklist where address=?''')
else: else:
shared.sqlSubmitQueue.put( sql = '''select * from whitelist where address=?'''
'''select * from whitelist where address=?''') queryreturn = sqlQuery(sql,*t)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
self.ui.tableWidgetBlacklist.setSortingEnabled(False) self.ui.tableWidgetBlacklist.setSortingEnabled(False)
self.ui.tableWidgetBlacklist.insertRow(0) self.ui.tableWidgetBlacklist.insertRow(0)
@ -2427,17 +2358,11 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetBlacklist.setSortingEnabled(True) self.ui.tableWidgetBlacklist.setSortingEnabled(True)
t = (str(self.NewBlacklistDialogInstance.ui.newsubscriptionlabel.text().toUtf8()), addBMIfNotPresent( t = (str(self.NewBlacklistDialogInstance.ui.newsubscriptionlabel.text().toUtf8()), addBMIfNotPresent(
str(self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text())), True) str(self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text())), True)
shared.sqlLock.acquire()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.sqlSubmitQueue.put( sql = '''INSERT INTO blacklist VALUES (?,?,?)'''
'''INSERT INTO blacklist VALUES (?,?,?)''')
else: else:
shared.sqlSubmitQueue.put( sql = '''INSERT INTO whitelist VALUES (?,?,?)'''
'''INSERT INTO whitelist VALUES (?,?,?)''') sqlExecute(sql, *t)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
else: else:
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
"MainWindow", "Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want.")) "MainWindow", "Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want."))
@ -2564,20 +2489,11 @@ class MyForm(QtGui.QMainWindow):
currentRow = row.row() currentRow = row.row()
inventoryHashToMarkUnread = str(self.ui.tableWidgetInbox.item( inventoryHashToMarkUnread = str(self.ui.tableWidgetInbox.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
t = (inventoryHashToMarkUnread,) sqlExecute('''UPDATE inbox SET read=0 WHERE msgid=?''', inventoryHashToMarkUnread)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''UPDATE inbox SET read=0 WHERE msgid=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlLock.release()
self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font)
self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font)
self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font)
self.ui.tableWidgetInbox.item(currentRow, 3).setFont(font) self.ui.tableWidgetInbox.item(currentRow, 3).setFont(font)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# self.ui.tableWidgetInbox.selectRow(currentRow + 1) # self.ui.tableWidgetInbox.selectRow(currentRow + 1)
# This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary. # This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary.
# We could also select upwards, but then our problem would be with the topmost message. # We could also select upwards, but then our problem would be with the topmost message.
@ -2602,7 +2518,15 @@ class MyForm(QtGui.QMainWindow):
else: else:
self.ui.labelFrom.setText(toAddressAtCurrentInboxRow) self.ui.labelFrom.setText(toAddressAtCurrentInboxRow)
self.setBroadcastEnablementDependingOnWhetherThisIsAChanAddress(toAddressAtCurrentInboxRow) self.setBroadcastEnablementDependingOnWhetherThisIsAChanAddress(toAddressAtCurrentInboxRow)
self.ui.lineEditTo.setText(str(fromAddressAtCurrentInboxRow)) self.ui.lineEditTo.setText(str(fromAddressAtCurrentInboxRow))
# If the previous message was to a chan then we should send our reply to the chan rather than to the particular person who sent the message.
if shared.config.has_section(toAddressAtCurrentInboxRow):
if shared.safeConfigGetBoolean(toAddressAtCurrentInboxRow, 'chan'):
print 'original sent to a chan. Setting the to address in the reply to the chan address.'
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
self.ui.comboBoxSendFrom.setCurrentIndex(0) self.ui.comboBoxSendFrom.setCurrentIndex(0)
# self.ui.comboBoxSendFrom.setEditText(str(self.ui.tableWidgetInbox.item(currentInboxRow,0).text)) # self.ui.comboBoxSendFrom.setEditText(str(self.ui.tableWidgetInbox.item(currentInboxRow,0).text))
self.ui.textEditMessage.setText('\n\n------------------------------------------------------\n' + self.ui.tableWidgetInbox.item( self.ui.textEditMessage.setText('\n\n------------------------------------------------------\n' + self.ui.tableWidgetInbox.item(
@ -2622,13 +2546,8 @@ class MyForm(QtGui.QMainWindow):
addressAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item( addressAtCurrentInboxRow = str(self.ui.tableWidgetInbox.item(
currentInboxRow, 1).data(Qt.UserRole).toPyObject()) currentInboxRow, 1).data(Qt.UserRole).toPyObject())
# Let's make sure that it isn't already in the address book # Let's make sure that it isn't already in the address book
shared.sqlLock.acquire() queryreturn = sqlQuery('''select * from addressbook where address=?''',
t = (addressAtCurrentInboxRow,) addressAtCurrentInboxRow)
shared.sqlSubmitQueue.put(
'''select * from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
self.ui.tableWidgetAddressBook.insertRow(0) self.ui.tableWidgetAddressBook.insertRow(0)
newItem = QtGui.QTableWidgetItem( newItem = QtGui.QTableWidgetItem(
@ -2638,15 +2557,9 @@ class MyForm(QtGui.QMainWindow):
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem) self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
t = ('--New entry. Change label in Address Book.--', sqlExecute('''INSERT INTO addressbook VALUES (?,?)''',
addressAtCurrentInboxRow) '--New entry. Change label in Address Book.--',
shared.sqlLock.acquire() addressAtCurrentInboxRow)
shared.sqlSubmitQueue.put(
'''INSERT INTO addressbook VALUES (?,?)''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.ui.tabWidget.setCurrentIndex(5) self.ui.tabWidget.setCurrentIndex(5)
self.ui.tableWidgetAddressBook.setCurrentCell(0, 0) self.ui.tableWidgetAddressBook.setCurrentCell(0, 0)
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
@ -2661,20 +2574,11 @@ class MyForm(QtGui.QMainWindow):
currentRow = self.ui.tableWidgetInbox.selectedIndexes()[0].row() currentRow = self.ui.tableWidgetInbox.selectedIndexes()[0].row()
inventoryHashToTrash = str(self.ui.tableWidgetInbox.item( inventoryHashToTrash = str(self.ui.tableWidgetInbox.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
t = (inventoryHashToTrash,) sqlExecute('''UPDATE inbox SET folder='trash' WHERE msgid=?''', inventoryHashToTrash)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''UPDATE inbox SET folder='trash' WHERE msgid=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlLock.release()
self.ui.textEditInboxMessage.setText("") self.ui.textEditInboxMessage.setText("")
self.ui.tableWidgetInbox.removeRow(currentRow) self.ui.tableWidgetInbox.removeRow(currentRow)
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
"MainWindow", "Moved items to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.")) "MainWindow", "Moved items to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back."))
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
if currentRow == 0: if currentRow == 0:
self.ui.tableWidgetInbox.selectRow(currentRow) self.ui.tableWidgetInbox.selectRow(currentRow)
else: else:
@ -2705,20 +2609,11 @@ class MyForm(QtGui.QMainWindow):
currentRow = self.ui.tableWidgetSent.selectedIndexes()[0].row() currentRow = self.ui.tableWidgetSent.selectedIndexes()[0].row()
ackdataToTrash = str(self.ui.tableWidgetSent.item( ackdataToTrash = str(self.ui.tableWidgetSent.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
t = (ackdataToTrash,) sqlExecute('''UPDATE sent SET folder='trash' WHERE ackdata=?''', ackdataToTrash)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''UPDATE sent SET folder='trash' WHERE ackdata=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlLock.release()
self.ui.textEditSentMessage.setPlainText("") self.ui.textEditSentMessage.setPlainText("")
self.ui.tableWidgetSent.removeRow(currentRow) self.ui.tableWidgetSent.removeRow(currentRow)
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
"MainWindow", "Moved items to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.")) "MainWindow", "Moved items to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back."))
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
if currentRow == 0: if currentRow == 0:
self.ui.tableWidgetSent.selectRow(currentRow) self.ui.tableWidgetSent.selectRow(currentRow)
else: else:
@ -2729,18 +2624,10 @@ class MyForm(QtGui.QMainWindow):
addressAtCurrentRow = str(self.ui.tableWidgetSent.item( addressAtCurrentRow = str(self.ui.tableWidgetSent.item(
currentRow, 0).data(Qt.UserRole).toPyObject()) currentRow, 0).data(Qt.UserRole).toPyObject())
toRipe = decodeAddress(addressAtCurrentRow)[3] toRipe = decodeAddress(addressAtCurrentRow)[3]
t = (toRipe,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='forcepow' WHERE toripe=? AND status='toodifficult' and folder='sent' ''',
shared.sqlSubmitQueue.put( toRipe)
'''UPDATE sent SET status='forcepow' WHERE toripe=? AND status='toodifficult' and folder='sent' ''') queryreturn = sqlQuery('''select ackdata FROM sent WHERE status='forcepow' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlSubmitQueue.put(
'''select ackdata FROM sent WHERE status='forcepow' ''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
ackdata, = row ackdata, = row
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', ( shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (
@ -2766,14 +2653,8 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).text().toUtf8() currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item( addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(labelAtCurrentRow), str(addressAtCurrentRow)) sqlExecute('''DELETE FROM addressbook WHERE label=? AND address=?''',
shared.sqlLock.acquire() str(labelAtCurrentRow), str(addressAtCurrentRow))
shared.sqlSubmitQueue.put(
'''DELETE FROM addressbook WHERE label=? AND address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.ui.tableWidgetAddressBook.removeRow(currentRow) self.ui.tableWidgetAddressBook.removeRow(currentRow)
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
self.rerenderSentToLabels() self.rerenderSentToLabels()
@ -2843,14 +2724,8 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).text().toUtf8() currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item( addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(labelAtCurrentRow), str(addressAtCurrentRow)) sqlExecute('''DELETE FROM subscriptions WHERE label=? AND address=?''',
shared.sqlLock.acquire() str(labelAtCurrentRow), str(addressAtCurrentRow))
shared.sqlSubmitQueue.put(
'''DELETE FROM subscriptions WHERE label=? AND address=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.ui.tableWidgetSubscriptions.removeRow(currentRow) self.ui.tableWidgetSubscriptions.removeRow(currentRow)
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
shared.reloadBroadcastSendersForWhichImWatching() shared.reloadBroadcastSendersForWhichImWatching()
@ -2868,14 +2743,9 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).text().toUtf8() currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item( addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(labelAtCurrentRow), str(addressAtCurrentRow)) sqlExecute(
shared.sqlLock.acquire() '''update subscriptions set enabled=1 WHERE label=? AND address=?''',
shared.sqlSubmitQueue.put( str(labelAtCurrentRow), str(addressAtCurrentRow))
'''update subscriptions set enabled=1 WHERE label=? AND address=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.ui.tableWidgetSubscriptions.item( self.ui.tableWidgetSubscriptions.item(
currentRow, 0).setTextColor(QApplication.palette().text().color()) currentRow, 0).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetSubscriptions.item( self.ui.tableWidgetSubscriptions.item(
@ -2888,14 +2758,9 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).text().toUtf8() currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item( addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(labelAtCurrentRow), str(addressAtCurrentRow)) sqlExecute(
shared.sqlLock.acquire() '''update subscriptions set enabled=0 WHERE label=? AND address=?''',
shared.sqlSubmitQueue.put( str(labelAtCurrentRow), str(addressAtCurrentRow))
'''update subscriptions set enabled=0 WHERE label=? AND address=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.ui.tableWidgetSubscriptions.item( self.ui.tableWidgetSubscriptions.item(
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128)) currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetSubscriptions.item( self.ui.tableWidgetSubscriptions.item(
@ -2916,20 +2781,14 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).text().toUtf8() currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetBlacklist.item( addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(labelAtCurrentRow), str(addressAtCurrentRow))
shared.sqlLock.acquire()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.sqlSubmitQueue.put( sqlExecute(
'''DELETE FROM blacklist WHERE label=? AND address=?''') '''DELETE FROM blacklist WHERE label=? AND address=?''',
shared.sqlSubmitQueue.put(t) str(labelAtCurrentRow), str(addressAtCurrentRow))
shared.sqlReturnQueue.get()
else: else:
shared.sqlSubmitQueue.put( sqlExecute(
'''DELETE FROM whitelist WHERE label=? AND address=?''') '''DELETE FROM whitelist WHERE label=? AND address=?''',
shared.sqlSubmitQueue.put(t) str(labelAtCurrentRow), str(addressAtCurrentRow))
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.ui.tableWidgetBlacklist.removeRow(currentRow) self.ui.tableWidgetBlacklist.removeRow(currentRow)
def on_action_BlacklistClipboard(self): def on_action_BlacklistClipboard(self):
@ -2951,20 +2810,14 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).setTextColor(QApplication.palette().text().color()) currentRow, 0).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetBlacklist.item( self.ui.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QApplication.palette().text().color()) currentRow, 1).setTextColor(QApplication.palette().text().color())
t = (str(addressAtCurrentRow),)
shared.sqlLock.acquire()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.sqlSubmitQueue.put( sqlExecute(
'''UPDATE blacklist SET enabled=1 WHERE address=?''') '''UPDATE blacklist SET enabled=1 WHERE address=?''',
shared.sqlSubmitQueue.put(t) str(addressAtCurrentRow))
shared.sqlReturnQueue.get()
else: else:
shared.sqlSubmitQueue.put( sqlExecute(
'''UPDATE whitelist SET enabled=1 WHERE address=?''') '''UPDATE whitelist SET enabled=1 WHERE address=?''',
shared.sqlSubmitQueue.put(t) str(addressAtCurrentRow))
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
def on_action_BlacklistDisable(self): def on_action_BlacklistDisable(self):
currentRow = self.ui.tableWidgetBlacklist.currentRow() currentRow = self.ui.tableWidgetBlacklist.currentRow()
@ -2974,20 +2827,12 @@ class MyForm(QtGui.QMainWindow):
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128)) currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetBlacklist.item( self.ui.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128)) currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128))
t = (str(addressAtCurrentRow),)
shared.sqlLock.acquire()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.sqlSubmitQueue.put( sqlExecute(
'''UPDATE blacklist SET enabled=0 WHERE address=?''') '''UPDATE blacklist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
else: else:
shared.sqlSubmitQueue.put( sqlExecute(
'''UPDATE whitelist SET enabled=0 WHERE address=?''') '''UPDATE whitelist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# Group of functions for the Your Identities dialog box # Group of functions for the Your Identities dialog box
def on_action_YourIdentitiesNew(self): def on_action_YourIdentitiesNew(self):
@ -3133,12 +2978,7 @@ class MyForm(QtGui.QMainWindow):
currentRow = self.ui.tableWidgetSent.currentRow() currentRow = self.ui.tableWidgetSent.currentRow()
ackData = str(self.ui.tableWidgetSent.item( ackData = str(self.ui.tableWidgetSent.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
shared.sqlLock.acquire() queryreturn = sqlQuery('''SELECT status FROM sent where ackdata=?''', ackData)
shared.sqlSubmitQueue.put(
'''SELECT status FROM sent where ackdata=?''')
shared.sqlSubmitQueue.put((ackData,))
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
status, = row status, = row
if status == 'toodifficult': if status == 'toodifficult':
@ -3193,15 +3033,8 @@ class MyForm(QtGui.QMainWindow):
inventoryHash = str(self.ui.tableWidgetInbox.item( inventoryHash = str(self.ui.tableWidgetInbox.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
t = (inventoryHash,) self.ubuntuMessagingMenuClear(inventoryHash)
self.ubuntuMessagingMenuClear(t) sqlExecute('''update inbox set read=1 WHERE msgid=?''', inventoryHash)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''update inbox set read=1 WHERE msgid=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
def tableWidgetSentItemClicked(self): def tableWidgetSentItemClicked(self):
currentRow = self.ui.tableWidgetSent.currentRow() currentRow = self.ui.tableWidgetSent.currentRow()
@ -3226,35 +3059,23 @@ class MyForm(QtGui.QMainWindow):
def tableWidgetAddressBookItemChanged(self): def tableWidgetAddressBookItemChanged(self):
currentRow = self.ui.tableWidgetAddressBook.currentRow() currentRow = self.ui.tableWidgetAddressBook.currentRow()
shared.sqlLock.acquire()
if currentRow >= 0: if currentRow >= 0:
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item( addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(self.ui.tableWidgetAddressBook.item( sqlExecute('''UPDATE addressbook set label=? WHERE address=?''',
currentRow, 0).text().toUtf8()), str(addressAtCurrentRow)) str(self.ui.tableWidgetAddressBook.item(currentRow, 0).text().toUtf8()),
shared.sqlSubmitQueue.put( str(addressAtCurrentRow))
'''UPDATE addressbook set label=? WHERE address=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
self.rerenderSentToLabels() self.rerenderSentToLabels()
def tableWidgetSubscriptionsItemChanged(self): def tableWidgetSubscriptionsItemChanged(self):
currentRow = self.ui.tableWidgetSubscriptions.currentRow() currentRow = self.ui.tableWidgetSubscriptions.currentRow()
shared.sqlLock.acquire()
if currentRow >= 0: if currentRow >= 0:
addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item( addressAtCurrentRow = self.ui.tableWidgetSubscriptions.item(
currentRow, 1).text() currentRow, 1).text()
t = (str(self.ui.tableWidgetSubscriptions.item( sqlExecute('''UPDATE subscriptions set label=? WHERE address=?''',
currentRow, 0).text().toUtf8()), str(addressAtCurrentRow)) str(self.ui.tableWidgetSubscriptions.item(currentRow, 0).text().toUtf8()),
shared.sqlSubmitQueue.put( str(addressAtCurrentRow))
'''UPDATE subscriptions set label=? WHERE address=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
self.rerenderSentToLabels() self.rerenderSentToLabels()
@ -3355,8 +3176,8 @@ class settingsDialog(QtGui.QDialog):
self.ui.comboBoxIdenticonStyle.addItem(_translate("settingsDialog", "None"), "none") self.ui.comboBoxIdenticonStyle.addItem(_translate("settingsDialog", "None"), "none")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon.png"), _translate("settingsDialog", "QIdenticon"), "qidenticon") self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon.png"), _translate("settingsDialog", "QIdenticon"), "qidenticon")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_x.png"), _translate("settingsDialog", "QIdenticon (transparent)"), "qidenticon_x") self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_x.png"), _translate("settingsDialog", "QIdenticon (transparent)"), "qidenticon_x")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_two.png"), _translate("settingsDialog", "QIdenticon two"), "qidenticon_two") self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_two.png"), _translate("settingsDialog", "QIdenticon bicolored"), "qidenticon_two")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_two_x.png"), _translate("settingsDialog", "QIdenticon two (transparent)"), "qidenticon_two_x") self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_two_x.png"), _translate("settingsDialog", "QIdenticon bicolored (transparent)"), "qidenticon_two_x")
curr_index = self.ui.comboBoxIdenticonStyle.findData(str(shared.config.get('bitmessagesettings', 'identicon')), Qt.UserRole) curr_index = self.ui.comboBoxIdenticonStyle.findData(str(shared.config.get('bitmessagesettings', 'identicon')), Qt.UserRole)
self.ui.comboBoxIdenticonStyle.setCurrentIndex(curr_index) self.ui.comboBoxIdenticonStyle.setCurrentIndex(curr_index)
self.ui.lineEditIdenticonSuffix.setText( self.ui.lineEditIdenticonSuffix.setText(
@ -3649,86 +3470,74 @@ class myTableWidgetItem(QTableWidgetItem):
def __lt__(self, other): def __lt__(self, other):
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject()) return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
from threading import Thread class UISignaler(QThread):
class UISignaler(Thread,QThread):
def __init__(self, parent=None): def __init__(self, parent=None):
Thread.__init__(self, parent)
QThread.__init__(self, parent) QThread.__init__(self, parent)
def run(self): def run(self):
while True: while True:
try: command, data = shared.UISignalQueue.get()
command, data = shared.UISignalQueue.get() if command == 'writeNewAddressToTable':
if command == 'writeNewAddressToTable': label, address, streamNumber = data
label, address, streamNumber = data self.emit(SIGNAL(
self.emit(SIGNAL( "writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), label, address, str(streamNumber))
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), label, address, str(streamNumber)) elif command == 'updateStatusBar':
elif command == 'updateStatusBar': self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"), data)
self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"), data) elif command == 'updateSentItemStatusByHash':
elif command == 'updateSentItemStatusByHash': hash, message = data
hash, message = data self.emit(SIGNAL(
self.emit(SIGNAL( "updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), hash, message)
"updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), hash, message) elif command == 'updateSentItemStatusByAckdata':
elif command == 'updateSentItemStatusByAckdata': ackData, message = data
ackData, message = data self.emit(SIGNAL(
self.emit(SIGNAL( "updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), ackData, message)
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), ackData, message) elif command == 'displayNewInboxMessage':
elif command == 'displayNewInboxMessage': inventoryHash, toAddress, fromAddress, subject, body = data
inventoryHash, toAddress, fromAddress, subject, body = data self.emit(SIGNAL(
self.emit(SIGNAL( "displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), inventoryHash, toAddress, fromAddress, subject, body)
inventoryHash, toAddress, fromAddress, subject, body) elif command == 'displayNewSentMessage':
elif command == 'displayNewSentMessage': toAddress, fromLabel, fromAddress, subject, message, ackdata = data
toAddress, fromLabel, fromAddress, subject, message, ackdata = data self.emit(SIGNAL(
self.emit(SIGNAL( "displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), toAddress, fromLabel, fromAddress, subject, message, ackdata)
toAddress, fromLabel, fromAddress, subject, message, ackdata) elif command == 'updateNetworkStatusTab':
elif command == 'updateNetworkStatusTab': self.emit(SIGNAL("updateNetworkStatusTab()"))
self.emit(SIGNAL("updateNetworkStatusTab()")) elif command == 'updateNumberOfMessagesProcessed':
elif command == 'incrementNumberOfMessagesProcessed': self.emit(SIGNAL("updateNumberOfMessagesProcessed()"))
self.emit(SIGNAL("incrementNumberOfMessagesProcessed()")) elif command == 'updateNumberOfPubkeysProcessed':
elif command == 'incrementNumberOfPubkeysProcessed': self.emit(SIGNAL("updateNumberOfPubkeysProcessed()"))
self.emit(SIGNAL("incrementNumberOfPubkeysProcessed()")) elif command == 'updateNumberOfBroadcastsProcessed':
elif command == 'incrementNumberOfBroadcastsProcessed': self.emit(SIGNAL("updateNumberOfBroadcastsProcessed()"))
self.emit(SIGNAL("incrementNumberOfBroadcastsProcessed()")) elif command == 'setStatusIcon':
elif command == 'setStatusIcon': self.emit(SIGNAL("setStatusIcon(PyQt_PyObject)"), data)
self.emit(SIGNAL("setStatusIcon(PyQt_PyObject)"), data) elif command == 'rerenderInboxFromLabels':
elif command == 'rerenderInboxFromLabels': self.emit(SIGNAL("rerenderInboxFromLabels()"))
self.emit(SIGNAL("rerenderInboxFromLabels()")) elif command == 'rerenderSentToLabels':
elif command == 'rerenderSubscriptions': self.emit(SIGNAL("rerenderSentToLabels()"))
self.emit(SIGNAL("rerenderSubscriptions()")) elif command == 'rerenderAddressBook':
elif command == 'removeInboxRowByMsgid': self.emit(SIGNAL("rerenderAddressBook()"))
self.emit(SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), data) elif command == 'rerenderSubscriptions':
else: self.emit(SIGNAL("rerenderSubscriptions()"))
sys.stderr.write( elif command == 'removeInboxRowByMsgid':
'Command sent to UISignaler not recognized: %s\n' % command) self.emit(SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), data)
except Exception,ex: elif command == 'alert':
# uncaught exception will block gevent title, text, exitAfterUserClicksOk = data
import traceback self.emit(SIGNAL("displayAlert(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), title, text, exitAfterUserClicksOk)
traceback.print_exc() else:
traceback.print_stack() sys.stderr.write(
print ex 'Command sent to UISignaler not recognized: %s\n' % command)
pass
try:
import gevent
except ImportError as ex:
gevent = None
else:
def mainloop(app):
while True:
app.processEvents()
gevent.sleep(0.01)
def testprint():
#print 'this is running'
gevent.spawn_later(1, testprint)
def run(): def run():
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
translator = QtCore.QTranslator() translator = QtCore.QTranslator()
locale_countrycode = str(locale.getdefaultlocale()[0]) try:
locale_countrycode = str(locale.getdefaultlocale()[0])
except:
# The above is not compatible with all versions of OSX.
locale_countrycode = "en_US" # Default to english.
locale_lang = locale_countrycode[0:2] locale_lang = locale_countrycode[0:2]
user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale')) user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale'))
user_lang = user_countrycode[0:2] user_lang = user_countrycode[0:2]
@ -3780,8 +3589,4 @@ def run():
myapp.notifierInit() myapp.notifierInit()
if shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'): if shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
myapp.showConnectDialog() # ask the user if we may connect myapp.showConnectDialog() # ask the user if we may connect
if gevent is None: sys.exit(app.exec_())
sys.exit(app.exec_())
else:
gevent.joinall([gevent.spawn(testprint), gevent.spawn(mainloop, app), gevent.spawn(mainloop, app), gevent.spawn(mainloop, app), gevent.spawn(mainloop, app), gevent.spawn(mainloop, app)])
print 'done'

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'bitmessageui.ui' # Form implementation generated from reading ui file 'bitmessageui.ui'
# #
# Created: Sat Sep 21 13:55:14 2013 # Created: Sat Sep 21 15:59:39 2013
# by: PyQt4 UI code generator 4.10.2 # by: PyQt4 UI code generator 4.10.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -69,7 +69,11 @@ class Ui_MainWindow(object):
self.inboxSearchOptionCB.addItem(_fromUtf8("")) self.inboxSearchOptionCB.addItem(_fromUtf8(""))
self.horizontalLayoutSearch.addWidget(self.inboxSearchOptionCB) self.horizontalLayoutSearch.addWidget(self.inboxSearchOptionCB)
self.verticalLayout_2.addLayout(self.horizontalLayoutSearch) self.verticalLayout_2.addLayout(self.horizontalLayoutSearch)
self.tableWidgetInbox = QtGui.QTableWidget(self.inbox) self.splitter = QtGui.QSplitter(self.inbox)
self.splitter.setOrientation(QtCore.Qt.Vertical)
self.splitter.setObjectName(_fromUtf8("splitter"))
self.tableWidgetInbox = QtGui.QTableWidget(self.splitter)
self.tableWidgetInbox.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.tableWidgetInbox.setAlternatingRowColors(True) self.tableWidgetInbox.setAlternatingRowColors(True)
self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.tableWidgetInbox.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.tableWidgetInbox.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
@ -93,11 +97,11 @@ class Ui_MainWindow(object):
self.tableWidgetInbox.horizontalHeader().setStretchLastSection(True) self.tableWidgetInbox.horizontalHeader().setStretchLastSection(True)
self.tableWidgetInbox.verticalHeader().setVisible(False) self.tableWidgetInbox.verticalHeader().setVisible(False)
self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26) self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_2.addWidget(self.tableWidgetInbox) self.textEditInboxMessage = QtGui.QTextEdit(self.splitter)
self.textEditInboxMessage = QtGui.QTextEdit(self.inbox)
self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessage.setReadOnly(True)
self.textEditInboxMessage.setObjectName(_fromUtf8("textEditInboxMessage")) self.textEditInboxMessage.setObjectName(_fromUtf8("textEditInboxMessage"))
self.verticalLayout_2.addWidget(self.textEditInboxMessage) self.verticalLayout_2.addWidget(self.splitter)
icon1 = QtGui.QIcon() icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/inbox.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/inbox.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.tabWidget.addTab(self.inbox, icon1, _fromUtf8("")) self.tabWidget.addTab(self.inbox, icon1, _fromUtf8(""))
@ -193,7 +197,11 @@ class Ui_MainWindow(object):
self.sentSearchOptionCB.addItem(_fromUtf8("")) self.sentSearchOptionCB.addItem(_fromUtf8(""))
self.horizontalLayout.addWidget(self.sentSearchOptionCB) self.horizontalLayout.addWidget(self.sentSearchOptionCB)
self.verticalLayout.addLayout(self.horizontalLayout) self.verticalLayout.addLayout(self.horizontalLayout)
self.tableWidgetSent = QtGui.QTableWidget(self.sent) self.splitter_2 = QtGui.QSplitter(self.sent)
self.splitter_2.setOrientation(QtCore.Qt.Vertical)
self.splitter_2.setObjectName(_fromUtf8("splitter_2"))
self.tableWidgetSent = QtGui.QTableWidget(self.splitter_2)
self.tableWidgetSent.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop) self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.tableWidgetSent.setAlternatingRowColors(True) self.tableWidgetSent.setAlternatingRowColors(True)
self.tableWidgetSent.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.tableWidgetSent.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
@ -217,10 +225,10 @@ class Ui_MainWindow(object):
self.tableWidgetSent.horizontalHeader().setStretchLastSection(True) self.tableWidgetSent.horizontalHeader().setStretchLastSection(True)
self.tableWidgetSent.verticalHeader().setVisible(False) self.tableWidgetSent.verticalHeader().setVisible(False)
self.tableWidgetSent.verticalHeader().setStretchLastSection(False) self.tableWidgetSent.verticalHeader().setStretchLastSection(False)
self.verticalLayout.addWidget(self.tableWidgetSent) self.textEditSentMessage = QtGui.QTextEdit(self.splitter_2)
self.textEditSentMessage = QtGui.QTextEdit(self.sent) self.textEditSentMessage.setReadOnly(True)
self.textEditSentMessage.setObjectName(_fromUtf8("textEditSentMessage")) self.textEditSentMessage.setObjectName(_fromUtf8("textEditSentMessage"))
self.verticalLayout.addWidget(self.textEditSentMessage) self.verticalLayout.addWidget(self.splitter_2)
icon3 = QtGui.QIcon() icon3 = QtGui.QIcon()
icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/sent.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/sent.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.tabWidget.addTab(self.sent, icon3, _fromUtf8("")) self.tabWidget.addTab(self.sent, icon3, _fromUtf8(""))
@ -422,6 +430,9 @@ class Ui_MainWindow(object):
self.labelBroadcastCount = QtGui.QLabel(self.networkstatus) self.labelBroadcastCount = QtGui.QLabel(self.networkstatus)
self.labelBroadcastCount.setGeometry(QtCore.QRect(350, 150, 351, 16)) self.labelBroadcastCount.setGeometry(QtCore.QRect(350, 150, 351, 16))
self.labelBroadcastCount.setObjectName(_fromUtf8("labelBroadcastCount")) self.labelBroadcastCount.setObjectName(_fromUtf8("labelBroadcastCount"))
self.labelLookupsPerSecond = QtGui.QLabel(self.networkstatus)
self.labelLookupsPerSecond.setGeometry(QtCore.QRect(320, 210, 291, 16))
self.labelLookupsPerSecond.setObjectName(_fromUtf8("labelLookupsPerSecond"))
icon9 = QtGui.QIcon() icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/networkstatus.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/networkstatus.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.tabWidget.addTab(self.networkstatus, icon9, _fromUtf8("")) self.tabWidget.addTab(self.networkstatus, icon9, _fromUtf8(""))
@ -613,6 +624,7 @@ class Ui_MainWindow(object):
self.labelMessageCount.setText(_translate("MainWindow", "Processed 0 person-to-person message.", None)) self.labelMessageCount.setText(_translate("MainWindow", "Processed 0 person-to-person message.", None))
self.labelPubkeyCount.setText(_translate("MainWindow", "Processed 0 public key.", None)) self.labelPubkeyCount.setText(_translate("MainWindow", "Processed 0 public key.", None))
self.labelBroadcastCount.setText(_translate("MainWindow", "Processed 0 broadcast.", None)) self.labelBroadcastCount.setText(_translate("MainWindow", "Processed 0 broadcast.", None))
self.labelLookupsPerSecond.setText(_translate("MainWindow", "Inventory lookups per second: 0", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status", None))
self.menuFile.setTitle(_translate("MainWindow", "File", None)) self.menuFile.setTitle(_translate("MainWindow", "File", None))
self.menuSettings.setTitle(_translate("MainWindow", "Settings", None)) self.menuSettings.setTitle(_translate("MainWindow", "Settings", None))

View File

@ -112,76 +112,85 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="tableWidgetInbox"> <widget class="QSplitter" name="splitter">
<property name="alternatingRowColors"> <property name="orientation">
<bool>true</bool> <enum>Qt::Vertical</enum>
</property> </property>
<property name="selectionMode"> <widget class="QTableWidget" name="tableWidgetInbox">
<enum>QAbstractItemView::ExtendedSelection</enum> <property name="editTriggers">
</property> <set>QAbstractItemView::NoEditTriggers</set>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>200</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>27</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>26</number>
</attribute>
<column>
<property name="text">
<string>To</string>
</property> </property>
</column> <property name="alternatingRowColors">
<column> <bool>true</bool>
<property name="text">
<string>From</string>
</property> </property>
</column> <property name="selectionMode">
<column> <enum>QAbstractItemView::ExtendedSelection</enum>
<property name="text">
<string>Subject</string>
</property> </property>
</column> <property name="selectionBehavior">
<column> <enum>QAbstractItemView::SelectRows</enum>
<property name="text">
<string>Received</string>
</property> </property>
</column> <property name="sortingEnabled">
</widget> <bool>true</bool>
</item> </property>
<item> <property name="wordWrap">
<widget class="QTextEdit" name="textEditInboxMessage"> <bool>false</bool>
<property name="baseSize"> </property>
<size> <attribute name="horizontalHeaderCascadingSectionResizes">
<width>0</width> <bool>true</bool>
<height>500</height> </attribute>
</size> <attribute name="horizontalHeaderDefaultSectionSize">
</property> <number>200</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>27</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>26</number>
</attribute>
<column>
<property name="text">
<string>To</string>
</property>
</column>
<column>
<property name="text">
<string>From</string>
</property>
</column>
<column>
<property name="text">
<string>Subject</string>
</property>
</column>
<column>
<property name="text">
<string>Received</string>
</property>
</column>
</widget>
<widget class="QTextEdit" name="textEditInboxMessage">
<property name="baseSize">
<size>
<width>0</width>
<height>500</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -409,71 +418,81 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTableWidget" name="tableWidgetSent"> <widget class="QSplitter" name="splitter_2">
<property name="dragDropMode"> <property name="orientation">
<enum>QAbstractItemView::DragDrop</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="alternatingRowColors"> <widget class="QTableWidget" name="tableWidgetSent">
<bool>true</bool> <property name="editTriggers">
</property> <set>QAbstractItemView::NoEditTriggers</set>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>130</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>To</string>
</property> </property>
</column> <property name="dragDropMode">
<column> <enum>QAbstractItemView::DragDrop</enum>
<property name="text">
<string>From</string>
</property> </property>
</column> <property name="alternatingRowColors">
<column> <bool>true</bool>
<property name="text">
<string>Subject</string>
</property> </property>
</column> <property name="selectionMode">
<column> <enum>QAbstractItemView::ExtendedSelection</enum>
<property name="text">
<string>Status</string>
</property> </property>
</column> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>130</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>To</string>
</property>
</column>
<column>
<property name="text">
<string>From</string>
</property>
</column>
<column>
<property name="text">
<string>Subject</string>
</property>
</column>
<column>
<property name="text">
<string>Status</string>
</property>
</column>
</widget>
<widget class="QTextEdit" name="textEditSentMessage">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget> </widget>
</item> </item>
<item>
<widget class="QTextEdit" name="textEditSentMessage"/>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="youridentities"> <widget class="QWidget" name="youridentities">
@ -1012,6 +1031,19 @@ p, li { white-space: pre-wrap; }
<string>Processed 0 broadcast.</string> <string>Processed 0 broadcast.</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="labelLookupsPerSecond">
<property name="geometry">
<rect>
<x>320</x>
<y>210</y>
<width>291</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Inventory lookups per second: 0</string>
</property>
</widget>
</widget> </widget>
</widget> </widget>
</item> </item>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'settings.ui' # Form implementation generated from reading ui file 'settings.ui'
# #
# Created: Sat Sep 21 13:55:15 2013 # Created: Sat Sep 21 16:16:22 2013
# by: PyQt4 UI code generator 4.10.2 # by: PyQt4 UI code generator 4.10.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -26,7 +26,7 @@ except AttributeError:
class Ui_settingsDialog(object): class Ui_settingsDialog(object):
def setupUi(self, settingsDialog): def setupUi(self, settingsDialog):
settingsDialog.setObjectName(_fromUtf8("settingsDialog")) settingsDialog.setObjectName(_fromUtf8("settingsDialog"))
settingsDialog.resize(567, 343) settingsDialog.resize(600, 407)
self.gridLayout = QtGui.QGridLayout(settingsDialog) self.gridLayout = QtGui.QGridLayout(settingsDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.buttonBox = QtGui.QDialogButtonBox(settingsDialog) self.buttonBox = QtGui.QDialogButtonBox(settingsDialog)
@ -41,6 +41,24 @@ class Ui_settingsDialog(object):
self.tabUserInterface.setObjectName(_fromUtf8("tabUserInterface")) self.tabUserInterface.setObjectName(_fromUtf8("tabUserInterface"))
self.gridLayout_5 = QtGui.QGridLayout(self.tabUserInterface) self.gridLayout_5 = QtGui.QGridLayout(self.tabUserInterface)
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
self.groupBox = QtGui.QGroupBox(self.tabUserInterface)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.languageComboBox = QtGui.QComboBox(self.groupBox)
self.languageComboBox.setMinimumSize(QtCore.QSize(100, 0))
self.languageComboBox.setObjectName(_fromUtf8("languageComboBox"))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.horizontalLayout_2.addWidget(self.languageComboBox)
self.gridLayout_5.addWidget(self.groupBox, 7, 1, 4, 1)
self.checkBoxMinimizeToTray = QtGui.QCheckBox(self.tabUserInterface) self.checkBoxMinimizeToTray = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxMinimizeToTray.setChecked(True) self.checkBoxMinimizeToTray.setChecked(True)
self.checkBoxMinimizeToTray.setObjectName(_fromUtf8("checkBoxMinimizeToTray")) self.checkBoxMinimizeToTray.setObjectName(_fromUtf8("checkBoxMinimizeToTray"))
@ -58,42 +76,44 @@ class Ui_settingsDialog(object):
self.checkBoxStartInTray.setObjectName(_fromUtf8("checkBoxStartInTray")) self.checkBoxStartInTray.setObjectName(_fromUtf8("checkBoxStartInTray"))
self.gridLayout_5.addWidget(self.checkBoxStartInTray, 1, 0, 1, 1) self.gridLayout_5.addWidget(self.checkBoxStartInTray, 1, 0, 1, 1)
self.PortableModeDescription = QtGui.QLabel(self.tabUserInterface) self.PortableModeDescription = QtGui.QLabel(self.tabUserInterface)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.PortableModeDescription.sizePolicy().hasHeightForWidth())
self.PortableModeDescription.setSizePolicy(sizePolicy)
self.PortableModeDescription.setWordWrap(True) self.PortableModeDescription.setWordWrap(True)
self.PortableModeDescription.setObjectName(_fromUtf8("PortableModeDescription")) self.PortableModeDescription.setObjectName(_fromUtf8("PortableModeDescription"))
self.gridLayout_5.addWidget(self.PortableModeDescription, 5, 0, 1, 2) self.gridLayout_5.addWidget(self.PortableModeDescription, 5, 0, 1, 2)
self.checkBoxWillinglySendToMobile = QtGui.QCheckBox(self.tabUserInterface) self.checkBoxWillinglySendToMobile = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxWillinglySendToMobile.setObjectName(_fromUtf8("checkBoxWillinglySendToMobile")) self.checkBoxWillinglySendToMobile.setObjectName(_fromUtf8("checkBoxWillinglySendToMobile"))
self.gridLayout_5.addWidget(self.checkBoxWillinglySendToMobile, 6, 0, 1, 2) self.gridLayout_5.addWidget(self.checkBoxWillinglySendToMobile, 6, 0, 1, 2)
self.groupBox = QtGui.QGroupBox(self.tabUserInterface)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.languageComboBox = QtGui.QComboBox(self.groupBox)
self.languageComboBox.setObjectName(_fromUtf8("languageComboBox"))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.horizontalLayout_2.addWidget(self.languageComboBox)
self.gridLayout_5.addWidget(self.groupBox, 7, 1, 4, 1)
self.groupBox_3 = QtGui.QGroupBox(self.tabUserInterface) self.groupBox_3 = QtGui.QGroupBox(self.tabUserInterface)
self.groupBox_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.groupBox_3.setFlat(False)
self.groupBox_3.setCheckable(False)
self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
self.gridLayout_9 = QtGui.QGridLayout(self.groupBox_3)
self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
self.checkBoxLoadAvatars = QtGui.QCheckBox(self.groupBox_3)
self.checkBoxLoadAvatars.setObjectName(_fromUtf8("checkBoxLoadAvatars"))
self.gridLayout_9.addWidget(self.checkBoxLoadAvatars, 1, 0, 1, 1)
self.lineEditIdenticonSuffix = QtGui.QLineEdit(self.groupBox_3)
self.lineEditIdenticonSuffix.setObjectName(_fromUtf8("lineEditIdenticonSuffix"))
self.gridLayout_9.addWidget(self.lineEditIdenticonSuffix, 1, 1, 1, 1)
self.comboBoxIdenticonStyle = QtGui.QComboBox(self.groupBox_3) self.comboBoxIdenticonStyle = QtGui.QComboBox(self.groupBox_3)
self.comboBoxIdenticonStyle.setGeometry(QtCore.QRect(20, 20, 251, 31)) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.comboBoxIdenticonStyle.sizePolicy().hasHeightForWidth())
self.comboBoxIdenticonStyle.setSizePolicy(sizePolicy)
self.comboBoxIdenticonStyle.setIconSize(QtCore.QSize(24, 24)) self.comboBoxIdenticonStyle.setIconSize(QtCore.QSize(24, 24))
self.comboBoxIdenticonStyle.setObjectName(_fromUtf8("comboBoxIdenticonStyle")) self.comboBoxIdenticonStyle.setObjectName(_fromUtf8("comboBoxIdenticonStyle"))
self.checkBoxLoadAvatars = QtGui.QCheckBox(self.groupBox_3) self.gridLayout_9.addWidget(self.comboBoxIdenticonStyle, 0, 0, 1, 2)
self.checkBoxLoadAvatars.setGeometry(QtCore.QRect(20, 50, 121, 18)) self.gridLayout_5.addWidget(self.groupBox_3, 7, 0, 5, 1)
self.checkBoxLoadAvatars.setObjectName(_fromUtf8("checkBoxLoadAvatars")) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.lineEditIdenticonSuffix = QtGui.QLineEdit(self.groupBox_3) self.gridLayout_5.addItem(spacerItem, 12, 0, 1, 1)
self.lineEditIdenticonSuffix.setGeometry(QtCore.QRect(140, 50, 131, 16)) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.lineEditIdenticonSuffix.setObjectName(_fromUtf8("lineEditIdenticonSuffix")) self.gridLayout_5.addItem(spacerItem1, 11, 1, 2, 1)
self.gridLayout_5.addWidget(self.groupBox_3, 7, 0, 4, 1)
self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8(""))
self.tabNetworkSettings = QtGui.QWidget() self.tabNetworkSettings = QtGui.QWidget()
self.tabNetworkSettings.setObjectName(_fromUtf8("tabNetworkSettings")) self.tabNetworkSettings.setObjectName(_fromUtf8("tabNetworkSettings"))
@ -103,8 +123,8 @@ class Ui_settingsDialog(object):
self.groupBox1.setObjectName(_fromUtf8("groupBox1")) self.groupBox1.setObjectName(_fromUtf8("groupBox1"))
self.gridLayout_3 = QtGui.QGridLayout(self.groupBox1) self.gridLayout_3 = QtGui.QGridLayout(self.groupBox1)
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
spacerItem = QtGui.QSpacerItem(125, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem2 = QtGui.QSpacerItem(125, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_3.addItem(spacerItem, 0, 0, 1, 1) self.gridLayout_3.addItem(spacerItem2, 0, 0, 1, 1)
self.label = QtGui.QLabel(self.groupBox1) self.label = QtGui.QLabel(self.groupBox1)
self.label.setObjectName(_fromUtf8("label")) self.label.setObjectName(_fromUtf8("label"))
self.gridLayout_3.addWidget(self.label, 0, 1, 1, 1) self.gridLayout_3.addWidget(self.label, 0, 1, 1, 1)
@ -120,12 +140,6 @@ class Ui_settingsDialog(object):
self.label_2 = QtGui.QLabel(self.groupBox_2) self.label_2 = QtGui.QLabel(self.groupBox_2)
self.label_2.setObjectName(_fromUtf8("label_2")) self.label_2.setObjectName(_fromUtf8("label_2"))
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1) self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
self.comboBoxProxyType = QtGui.QComboBox(self.groupBox_2)
self.comboBoxProxyType.setObjectName(_fromUtf8("comboBoxProxyType"))
self.comboBoxProxyType.addItem(_fromUtf8(""))
self.comboBoxProxyType.addItem(_fromUtf8(""))
self.comboBoxProxyType.addItem(_fromUtf8(""))
self.gridLayout_2.addWidget(self.comboBoxProxyType, 0, 1, 1, 1)
self.label_3 = QtGui.QLabel(self.groupBox_2) self.label_3 = QtGui.QLabel(self.groupBox_2)
self.label_3.setObjectName(_fromUtf8("label_3")) self.label_3.setObjectName(_fromUtf8("label_3"))
self.gridLayout_2.addWidget(self.label_3, 1, 1, 1, 1) self.gridLayout_2.addWidget(self.label_3, 1, 1, 1, 1)
@ -160,9 +174,15 @@ class Ui_settingsDialog(object):
self.checkBoxSocksListen = QtGui.QCheckBox(self.groupBox_2) self.checkBoxSocksListen = QtGui.QCheckBox(self.groupBox_2)
self.checkBoxSocksListen.setObjectName(_fromUtf8("checkBoxSocksListen")) self.checkBoxSocksListen.setObjectName(_fromUtf8("checkBoxSocksListen"))
self.gridLayout_2.addWidget(self.checkBoxSocksListen, 3, 1, 1, 4) self.gridLayout_2.addWidget(self.checkBoxSocksListen, 3, 1, 1, 4)
self.comboBoxProxyType = QtGui.QComboBox(self.groupBox_2)
self.comboBoxProxyType.setObjectName(_fromUtf8("comboBoxProxyType"))
self.comboBoxProxyType.addItem(_fromUtf8(""))
self.comboBoxProxyType.addItem(_fromUtf8(""))
self.comboBoxProxyType.addItem(_fromUtf8(""))
self.gridLayout_2.addWidget(self.comboBoxProxyType, 0, 1, 1, 1)
self.gridLayout_4.addWidget(self.groupBox_2, 1, 0, 1, 1) self.gridLayout_4.addWidget(self.groupBox_2, 1, 0, 1, 1)
spacerItem1 = QtGui.QSpacerItem(20, 70, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) spacerItem3 = QtGui.QSpacerItem(20, 70, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_4.addItem(spacerItem1, 2, 0, 1, 1) self.gridLayout_4.addItem(spacerItem3, 2, 0, 1, 1)
self.tabWidgetSettings.addTab(self.tabNetworkSettings, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tabNetworkSettings, _fromUtf8(""))
self.tab = QtGui.QWidget() self.tab = QtGui.QWidget()
self.tab.setObjectName(_fromUtf8("tab")) self.tab.setObjectName(_fromUtf8("tab"))
@ -172,8 +192,8 @@ class Ui_settingsDialog(object):
self.label_8.setWordWrap(True) self.label_8.setWordWrap(True)
self.label_8.setObjectName(_fromUtf8("label_8")) self.label_8.setObjectName(_fromUtf8("label_8"))
self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3) self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3)
spacerItem2 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem4 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_6.addItem(spacerItem2, 1, 0, 1, 1) self.gridLayout_6.addItem(spacerItem4, 1, 0, 1, 1)
self.label_9 = QtGui.QLabel(self.tab) self.label_9 = QtGui.QLabel(self.tab)
self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_9.setObjectName(_fromUtf8("label_9")) self.label_9.setObjectName(_fromUtf8("label_9"))
@ -187,8 +207,8 @@ class Ui_settingsDialog(object):
self.lineEditTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215)) self.lineEditTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
self.lineEditTotalDifficulty.setObjectName(_fromUtf8("lineEditTotalDifficulty")) self.lineEditTotalDifficulty.setObjectName(_fromUtf8("lineEditTotalDifficulty"))
self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1) self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1)
spacerItem3 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem5 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_6.addItem(spacerItem3, 3, 0, 1, 1) self.gridLayout_6.addItem(spacerItem5, 3, 0, 1, 1)
self.label_11 = QtGui.QLabel(self.tab) self.label_11 = QtGui.QLabel(self.tab)
self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_11.setObjectName(_fromUtf8("label_11")) self.label_11.setObjectName(_fromUtf8("label_11"))
@ -219,8 +239,8 @@ class Ui_settingsDialog(object):
self.label_15.setWordWrap(True) self.label_15.setWordWrap(True)
self.label_15.setObjectName(_fromUtf8("label_15")) self.label_15.setObjectName(_fromUtf8("label_15"))
self.gridLayout_7.addWidget(self.label_15, 0, 0, 1, 3) self.gridLayout_7.addWidget(self.label_15, 0, 0, 1, 3)
spacerItem4 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem6 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_7.addItem(spacerItem4, 1, 0, 1, 1) self.gridLayout_7.addItem(spacerItem6, 1, 0, 1, 1)
self.label_13 = QtGui.QLabel(self.tab_2) self.label_13 = QtGui.QLabel(self.tab_2)
self.label_13.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_13.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
@ -235,8 +255,8 @@ class Ui_settingsDialog(object):
self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215)) self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
self.lineEditMaxAcceptableTotalDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableTotalDifficulty")) self.lineEditMaxAcceptableTotalDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableTotalDifficulty"))
self.gridLayout_7.addWidget(self.lineEditMaxAcceptableTotalDifficulty, 1, 2, 1, 1) self.gridLayout_7.addWidget(self.lineEditMaxAcceptableTotalDifficulty, 1, 2, 1, 1)
spacerItem5 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem7 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_7.addItem(spacerItem5, 2, 0, 1, 1) self.gridLayout_7.addItem(spacerItem7, 2, 0, 1, 1)
self.label_14 = QtGui.QLabel(self.tab_2) self.label_14 = QtGui.QLabel(self.tab_2)
self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_14.setObjectName(_fromUtf8("label_14")) self.label_14.setObjectName(_fromUtf8("label_14"))
@ -250,15 +270,15 @@ class Ui_settingsDialog(object):
self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215)) self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableSmallMessageDifficulty")) self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableSmallMessageDifficulty"))
self.gridLayout_7.addWidget(self.lineEditMaxAcceptableSmallMessageDifficulty, 2, 2, 1, 1) self.gridLayout_7.addWidget(self.lineEditMaxAcceptableSmallMessageDifficulty, 2, 2, 1, 1)
spacerItem6 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) spacerItem8 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_7.addItem(spacerItem6, 3, 1, 1, 1) self.gridLayout_7.addItem(spacerItem8, 3, 1, 1, 1)
self.tabWidgetSettings.addTab(self.tab_2, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tab_2, _fromUtf8(""))
self.tabNamecoin = QtGui.QWidget() self.tabNamecoin = QtGui.QWidget()
self.tabNamecoin.setObjectName(_fromUtf8("tabNamecoin")) self.tabNamecoin.setObjectName(_fromUtf8("tabNamecoin"))
self.gridLayout_8 = QtGui.QGridLayout(self.tabNamecoin) self.gridLayout_8 = QtGui.QGridLayout(self.tabNamecoin)
self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem7, 2, 0, 1, 1) self.gridLayout_8.addItem(spacerItem9, 2, 0, 1, 1)
self.label_16 = QtGui.QLabel(self.tabNamecoin) self.label_16 = QtGui.QLabel(self.tabNamecoin)
self.label_16.setWordWrap(True) self.label_16.setWordWrap(True)
self.label_16.setObjectName(_fromUtf8("label_16")) self.label_16.setObjectName(_fromUtf8("label_16"))
@ -270,10 +290,10 @@ class Ui_settingsDialog(object):
self.lineEditNamecoinHost = QtGui.QLineEdit(self.tabNamecoin) self.lineEditNamecoinHost = QtGui.QLineEdit(self.tabNamecoin)
self.lineEditNamecoinHost.setObjectName(_fromUtf8("lineEditNamecoinHost")) self.lineEditNamecoinHost.setObjectName(_fromUtf8("lineEditNamecoinHost"))
self.gridLayout_8.addWidget(self.lineEditNamecoinHost, 2, 2, 1, 1) self.gridLayout_8.addWidget(self.lineEditNamecoinHost, 2, 2, 1, 1)
spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem8, 3, 0, 1, 1) self.gridLayout_8.addItem(spacerItem10, 3, 0, 1, 1)
spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem9, 4, 0, 1, 1) self.gridLayout_8.addItem(spacerItem11, 4, 0, 1, 1)
self.label_18 = QtGui.QLabel(self.tabNamecoin) self.label_18 = QtGui.QLabel(self.tabNamecoin)
self.label_18.setEnabled(True) self.label_18.setEnabled(True)
self.label_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
@ -282,8 +302,8 @@ class Ui_settingsDialog(object):
self.lineEditNamecoinPort = QtGui.QLineEdit(self.tabNamecoin) self.lineEditNamecoinPort = QtGui.QLineEdit(self.tabNamecoin)
self.lineEditNamecoinPort.setObjectName(_fromUtf8("lineEditNamecoinPort")) self.lineEditNamecoinPort.setObjectName(_fromUtf8("lineEditNamecoinPort"))
self.gridLayout_8.addWidget(self.lineEditNamecoinPort, 3, 2, 1, 1) self.gridLayout_8.addWidget(self.lineEditNamecoinPort, 3, 2, 1, 1)
spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) spacerItem12 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_8.addItem(spacerItem10, 8, 1, 1, 1) self.gridLayout_8.addItem(spacerItem12, 8, 1, 1, 1)
self.labelNamecoinUser = QtGui.QLabel(self.tabNamecoin) self.labelNamecoinUser = QtGui.QLabel(self.tabNamecoin)
self.labelNamecoinUser.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelNamecoinUser.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.labelNamecoinUser.setObjectName(_fromUtf8("labelNamecoinUser")) self.labelNamecoinUser.setObjectName(_fromUtf8("labelNamecoinUser"))
@ -291,8 +311,8 @@ class Ui_settingsDialog(object):
self.lineEditNamecoinUser = QtGui.QLineEdit(self.tabNamecoin) self.lineEditNamecoinUser = QtGui.QLineEdit(self.tabNamecoin)
self.lineEditNamecoinUser.setObjectName(_fromUtf8("lineEditNamecoinUser")) self.lineEditNamecoinUser.setObjectName(_fromUtf8("lineEditNamecoinUser"))
self.gridLayout_8.addWidget(self.lineEditNamecoinUser, 4, 2, 1, 1) self.gridLayout_8.addWidget(self.lineEditNamecoinUser, 4, 2, 1, 1)
spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem11, 5, 0, 1, 1) self.gridLayout_8.addItem(spacerItem13, 5, 0, 1, 1)
self.labelNamecoinPassword = QtGui.QLabel(self.tabNamecoin) self.labelNamecoinPassword = QtGui.QLabel(self.tabNamecoin)
self.labelNamecoinPassword.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelNamecoinPassword.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.labelNamecoinPassword.setObjectName(_fromUtf8("labelNamecoinPassword")) self.labelNamecoinPassword.setObjectName(_fromUtf8("labelNamecoinPassword"))
@ -347,6 +367,16 @@ class Ui_settingsDialog(object):
def retranslateUi(self, settingsDialog): def retranslateUi(self, settingsDialog):
settingsDialog.setWindowTitle(_translate("settingsDialog", "Settings", None)) settingsDialog.setWindowTitle(_translate("settingsDialog", "Settings", None))
self.groupBox.setTitle(_translate("settingsDialog", "Interface Language", None))
self.languageComboBox.setItemText(0, _translate("settingsDialog", "System Settings", "system"))
self.languageComboBox.setItemText(1, _translate("settingsDialog", "English", "en"))
self.languageComboBox.setItemText(2, _translate("settingsDialog", "Esperanto", "eo"))
self.languageComboBox.setItemText(3, _translate("settingsDialog", "Français", "fr"))
self.languageComboBox.setItemText(4, _translate("settingsDialog", "Deutsch", "de"))
self.languageComboBox.setItemText(5, _translate("settingsDialog", "Españl", "es"))
self.languageComboBox.setItemText(6, _translate("settingsDialog", "русский язык", "ru"))
self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate"))
self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other"))
self.checkBoxMinimizeToTray.setText(_translate("settingsDialog", "Minimize to tray", None)) self.checkBoxMinimizeToTray.setText(_translate("settingsDialog", "Minimize to tray", None))
self.checkBoxStartOnLogon.setText(_translate("settingsDialog", "Start Bitmessage on user login", None)) self.checkBoxStartOnLogon.setText(_translate("settingsDialog", "Start Bitmessage on user login", None))
self.checkBoxShowTrayNotifications.setText(_translate("settingsDialog", "Show notification when message received", None)) self.checkBoxShowTrayNotifications.setText(_translate("settingsDialog", "Show notification when message received", None))
@ -354,16 +384,6 @@ class Ui_settingsDialog(object):
self.checkBoxStartInTray.setText(_translate("settingsDialog", "Start Bitmessage in the tray (don\'t show main window)", None)) self.checkBoxStartInTray.setText(_translate("settingsDialog", "Start Bitmessage in the tray (don\'t show main window)", None))
self.PortableModeDescription.setText(_translate("settingsDialog", "In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.", None)) self.PortableModeDescription.setText(_translate("settingsDialog", "In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.", None))
self.checkBoxWillinglySendToMobile.setText(_translate("settingsDialog", "Willingly include unencrypted destination address when sending to a mobile device", None)) self.checkBoxWillinglySendToMobile.setText(_translate("settingsDialog", "Willingly include unencrypted destination address when sending to a mobile device", None))
self.groupBox.setTitle(_translate("settingsDialog", "Interface Language", None))
self.languageComboBox.setItemText(0, _translate("settingsDialog", "System Settings", "system"))
self.languageComboBox.setItemText(1, _translate("settingsDialog", "English", "en"))
self.languageComboBox.setItemText(2, _translate("settingsDialog", "Esperanto", "eo"))
self.languageComboBox.setItemText(3, _translate("settingsDialog", "French", "fr"))
self.languageComboBox.setItemText(4, _translate("settingsDialog", "German", "de"))
self.languageComboBox.setItemText(5, _translate("settingsDialog", "Spanish", "es"))
self.languageComboBox.setItemText(6, _translate("settingsDialog", "Russian", "ru"))
self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate"))
self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other"))
self.groupBox_3.setTitle(_translate("settingsDialog", "Identicons (with example image)", None)) self.groupBox_3.setTitle(_translate("settingsDialog", "Identicons (with example image)", None))
self.checkBoxLoadAvatars.setText(_translate("settingsDialog", "Load avatar images", None)) self.checkBoxLoadAvatars.setText(_translate("settingsDialog", "Load avatar images", None))
self.lineEditIdenticonSuffix.setToolTip(_translate("settingsDialog", "<html><head/><body><p>The content of this text field will be appended to the BM-address before creating the hash for the identicons. By default it is filled with a random string to make the identicons in your client unique, otherwise the identicon could be an attack vector if an adversary creates an address resulting in a similar identicon. If you keep this string (or any other random or non-random string) you will be able to keep the same identicons.</p></body></html>", None)) self.lineEditIdenticonSuffix.setToolTip(_translate("settingsDialog", "<html><head/><body><p>The content of this text field will be appended to the BM-address before creating the hash for the identicons. By default it is filled with a random string to make the identicons in your client unique, otherwise the identicon could be an attack vector if an adversary creates an address resulting in a similar identicon. If you keep this string (or any other random or non-random string) you will be able to keep the same identicons.</p></body></html>", None))
@ -372,15 +392,15 @@ class Ui_settingsDialog(object):
self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None)) self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None))
self.groupBox_2.setTitle(_translate("settingsDialog", "Proxy server / Tor", None)) self.groupBox_2.setTitle(_translate("settingsDialog", "Proxy server / Tor", None))
self.label_2.setText(_translate("settingsDialog", "Type:", None)) self.label_2.setText(_translate("settingsDialog", "Type:", None))
self.comboBoxProxyType.setItemText(0, _translate("settingsDialog", "none", None))
self.comboBoxProxyType.setItemText(1, _translate("settingsDialog", "SOCKS4a", None))
self.comboBoxProxyType.setItemText(2, _translate("settingsDialog", "SOCKS5", None))
self.label_3.setText(_translate("settingsDialog", "Server hostname:", None)) self.label_3.setText(_translate("settingsDialog", "Server hostname:", None))
self.label_4.setText(_translate("settingsDialog", "Port:", None)) self.label_4.setText(_translate("settingsDialog", "Port:", None))
self.checkBoxAuthentication.setText(_translate("settingsDialog", "Authentication", None)) self.checkBoxAuthentication.setText(_translate("settingsDialog", "Authentication", None))
self.label_5.setText(_translate("settingsDialog", "Username:", None)) self.label_5.setText(_translate("settingsDialog", "Username:", None))
self.label_6.setText(_translate("settingsDialog", "Pass:", None)) self.label_6.setText(_translate("settingsDialog", "Pass:", None))
self.checkBoxSocksListen.setText(_translate("settingsDialog", "Listen for incoming connections when using proxy", None)) self.checkBoxSocksListen.setText(_translate("settingsDialog", "Listen for incoming connections when using proxy", None))
self.comboBoxProxyType.setItemText(0, _translate("settingsDialog", "none", None))
self.comboBoxProxyType.setItemText(1, _translate("settingsDialog", "SOCKS4a", None))
self.comboBoxProxyType.setItemText(2, _translate("settingsDialog", "SOCKS5", None))
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNetworkSettings), _translate("settingsDialog", "Network Settings", None)) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNetworkSettings), _translate("settingsDialog", "Network Settings", None))
self.label_8.setText(_translate("settingsDialog", "When someone sends you a message, their computer must first complete some work. The difficulty of this work, by default, is 1. You may raise this default for new addresses you create by changing the values here. Any new addresses you create will require senders to meet the higher difficulty. There is one exception: if you add a friend or acquaintance to your address book, Bitmessage will automatically notify them when you next send a message that they need only complete the minimum amount of work: difficulty 1. ", None)) self.label_8.setText(_translate("settingsDialog", "When someone sends you a message, their computer must first complete some work. The difficulty of this work, by default, is 1. You may raise this default for new addresses you create by changing the values here. Any new addresses you create will require senders to meet the higher difficulty. There is one exception: if you add a friend or acquaintance to your address book, Bitmessage will automatically notify them when you next send a message that they need only complete the minimum amount of work: difficulty 1. ", None))
self.label_9.setText(_translate("settingsDialog", "Total difficulty:", None)) self.label_9.setText(_translate("settingsDialog", "Total difficulty:", None))

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>567</width> <width>600</width>
<height>343</height> <height>407</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -37,6 +37,70 @@
<string>User Interface</string> <string>User Interface</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="7" column="1" rowspan="4">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Interface Language</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="languageComboBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string comment="system">System Settings</string>
</property>
</item>
<item>
<property name="text">
<string comment="en">English</string>
</property>
</item>
<item>
<property name="text">
<string comment="eo">Esperanto</string>
</property>
</item>
<item>
<property name="text">
<string comment="fr">Français</string>
</property>
</item>
<item>
<property name="text">
<string comment="de">Deutsch</string>
</property>
</item>
<item>
<property name="text">
<string comment="es">Españl</string>
</property>
</item>
<item>
<property name="text">
<string comment="ru">русский язык</string>
</property>
</item>
<item>
<property name="text">
<string comment="en_pirate">Pirate English</string>
</property>
</item>
<item>
<property name="text">
<string comment="other">Other (set in keys.dat)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="checkBoxMinimizeToTray"> <widget class="QCheckBox" name="checkBoxMinimizeToTray">
<property name="text"> <property name="text">
@ -77,6 +141,12 @@
</item> </item>
<item row="5" column="0" colspan="2"> <item row="5" column="0" colspan="2">
<widget class="QLabel" name="PortableModeDescription"> <widget class="QLabel" name="PortableModeDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</string> <string>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</string>
</property> </property>
@ -92,112 +162,79 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1" rowspan="4"> <item row="7" column="0" rowspan="5">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox_3">
<property name="title"> <property name="title">
<string>Interface Language</string> <string>Identicons (with example image)</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <property name="alignment">
<item> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<widget class="QComboBox" name="languageComboBox"> </property>
<item> <property name="flat">
<property name="text"> <bool>false</bool>
<string comment="system">System Settings</string> </property>
</property> <property name="checkable">
</item> <bool>false</bool>
<item> </property>
<property name="text"> <layout class="QGridLayout" name="gridLayout_9">
<string comment="en">English</string> <item row="1" column="0">
</property> <widget class="QCheckBox" name="checkBoxLoadAvatars">
</item> <property name="text">
<item> <string>Load avatar images</string>
<property name="text"> </property>
<string comment="eo">Esperanto</string> </widget>
</property> </item>
</item> <item row="1" column="1">
<item> <widget class="QLineEdit" name="lineEditIdenticonSuffix">
<property name="text"> <property name="toolTip">
<string comment="fr">French</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The content of this text field will be appended to the BM-address before creating the hash for the identicons. By default it is filled with a random string to make the identicons in your client unique, otherwise the identicon could be an attack vector if an adversary creates an address resulting in a similar identicon. If you keep this string (or any other random or non-random string) you will be able to keep the same identicons.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</item> </widget>
<item> </item>
<property name="text"> <item row="0" column="0" colspan="2">
<string comment="de">German</string> <widget class="QComboBox" name="comboBoxIdenticonStyle">
</property> <property name="sizePolicy">
</item> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<item> <horstretch>0</horstretch>
<property name="text"> <verstretch>0</verstretch>
<string comment="es">Spanish</string> </sizepolicy>
</property> </property>
</item> <property name="iconSize">
<item> <size>
<property name="text"> <width>24</width>
<string comment="ru">Russian</string> <height>24</height>
</property> </size>
</item> </property>
<item>
<property name="text">
<string comment="en_pirate">Pirate English</string>
</property>
</item>
<item>
<property name="text">
<string comment="other">Other (set in keys.dat)</string>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="7" column="0" rowspan="4"> <item row="12" column="0">
<widget class="QGroupBox" name="groupBox_3"> <spacer name="verticalSpacer_5">
<property name="title"> <property name="orientation">
<string>Identicons (with example image)</string> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QComboBox" name="comboBoxIdenticonStyle"> <property name="sizeHint" stdset="0">
<property name="geometry"> <size>
<rect> <width>20</width>
<x>20</x> <height>40</height>
<y>20</y> </size>
<width>251</width> </property>
<height>31</height> </spacer>
</rect> </item>
</property> <item row="11" column="1" rowspan="2">
<property name="iconSize"> <spacer name="verticalSpacer_2">
<size> <property name="orientation">
<width>24</width> <enum>Qt::Vertical</enum>
<height>24</height> </property>
</size> <property name="sizeHint" stdset="0">
</property> <size>
</widget> <width>20</width>
<widget class="QCheckBox" name="checkBoxLoadAvatars"> <height>40</height>
<property name="geometry"> </size>
<rect> </property>
<x>20</x> </spacer>
<y>50</y>
<width>121</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Load avatar images</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditIdenticonSuffix">
<property name="geometry">
<rect>
<x>140</x>
<y>50</y>
<width>131</width>
<height>16</height>
</rect>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The content of this text field will be appended to the BM-address before creating the hash for the identicons. By default it is filled with a random string to make the identicons in your client unique, otherwise the identicon could be an attack vector if an adversary creates an address resulting in a similar identicon. If you keep this string (or any other random or non-random string) you will be able to keep the same identicons.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -258,25 +295,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxProxyType">
<item>
<property name="text">
<string>none</string>
</property>
</item>
<item>
<property name="text">
<string>SOCKS4a</string>
</property>
</item>
<item>
<property name="text">
<string>SOCKS5</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
@ -345,6 +363,25 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxProxyType">
<item>
<property name="text">
<string>none</string>
</property>
</item>
<item>
<property name="text">
<string>SOCKS4a</string>
</property>
</item>
<item>
<property name="text">
<string>SOCKS5</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -1,16 +1,19 @@
from setuptools import setup from setuptools import setup
name = "Bitmessage" name = "Bitmessage"
version = "0.3.4" version = "0.3.5"
mainscript = ["bitmessagemain.py"] mainscript = ["bitmessagemain.py"]
setup( setup(
name = name, name = name,
version = version, version = version,
app = mainscript, app = mainscript,
setup_requires = ["py2app"], setup_requires = ["py2app"],
options = dict(py2app=dict( options = dict(
resources = ["images"], py2app = dict(
iconfile = "images/bitmessage.icns" resources = ["images"],
)) includes = ['sip', 'PyQt4._qt'],
iconfile = "images/bitmessage.icns"
)
)
) )

View File

@ -1,38 +0,0 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
# cody by linker.lin@me.com
__author__ = 'linkerlin'
import threading
import Queue
import time
class bgWorker(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.q = Queue.Queue()
self.setDaemon(True)
def post(self,job):
self.q.put(job)
def run(self):
while 1:
job=None
try:
job = self.q.get(block=True)
if job:
job()
except Exception as ex:
print "Error,job exception:",ex.message,type(ex)
time.sleep(0.05)
else:
#print "job: ", job, " done"
pass
finally:
time.sleep(0.05)
bgworker = bgWorker()
bgworker.start()

View File

@ -0,0 +1,45 @@
# objectHashHolder is a timer-driven thread. One objectHashHolder thread is used
# by each sendDataThread. The sendDataThread uses it whenever it needs to
# advertise an object to peers in an inv message, or advertise a peer to other
# peers in an addr message. Instead of sending them out immediately, it must
# wait a random number of seconds for each connection so that different peers
# get different objects at different times. Thus an attacker who is
# connecting to many network nodes who receives a message first from Alice
# cannot be sure if Alice is the node who originated the message.
import random
import time
import threading
class objectHashHolder(threading.Thread):
def __init__(self, sendDataThreadMailbox):
threading.Thread.__init__(self)
self.shutdown = False
self.sendDataThreadMailbox = sendDataThreadMailbox # This queue is used to submit data back to our associated sendDataThread.
self.collectionOfHashLists = {}
self.collectionOfPeerLists = {}
for i in range(10):
self.collectionOfHashLists[i] = []
self.collectionOfPeerLists[i] = []
def run(self):
iterator = 0
while not self.shutdown:
if len(self.collectionOfHashLists[iterator]) > 0:
self.sendDataThreadMailbox.put((0, 'sendinv', self.collectionOfHashLists[iterator]))
self.collectionOfHashLists[iterator] = []
if len(self.collectionOfPeerLists[iterator]) > 0:
self.sendDataThreadMailbox.put((0, 'sendaddr', self.collectionOfPeerLists[iterator]))
self.collectionOfPeerLists[iterator] = []
iterator += 1
iterator %= 10
time.sleep(1)
def holdHash(self,hash):
self.collectionOfHashLists[random.randrange(0, 10)].append(hash)
def holdPeer(self,peerDetails):
self.collectionOfPeerLists[random.randrange(0, 10)].append(peerDetails)
def close(self):
self.shutdown = True

View File

@ -25,7 +25,7 @@ class outgoingSynSender(threading.Thread):
def run(self): def run(self):
while shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'): while shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
time.sleep(2) time.sleep(2)
while True: while shared.safeConfigGetBoolean('bitmessagesettings', 'sendoutgoingconnections'):
while len(self.selfInitiatedConnections[self.streamNumber]) >= 8: # maximum number of outgoing connections = 8 while len(self.selfInitiatedConnections[self.streamNumber]) >= 8: # maximum number of outgoing connections = 8
time.sleep(10) time.sleep(10)
if shared.shutdown: if shared.shutdown:

View File

@ -5,7 +5,6 @@ import threading
import shared import shared
import hashlib import hashlib
import socket import socket
import pickle
import random import random
from struct import unpack, pack from struct import unpack, pack
import sys import sys
@ -19,8 +18,10 @@ import helper_generic
import helper_bitcoin import helper_bitcoin
import helper_inbox import helper_inbox
import helper_sent import helper_sent
from helper_sql import *
import tr import tr
#from bitmessagemain import shared.lengthOfTimeToLeaveObjectsInInventory, shared.lengthOfTimeToHoldOnToAllPubkeys, shared.maximumAgeOfAnObjectThatIAmWillingToAccept, shared.maximumAgeOfObjectsThatIAdvertiseToOthers, shared.maximumAgeOfNodesThatIAdvertiseToOthers, shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer, shared.neededPubkeys from debug import logger
#from bitmessagemain import shared.lengthOfTimeToLeaveObjectsInInventory, shared.lengthOfTimeToHoldOnToAllPubkeys, shared.maximumAgeOfAnObjectThatIAmWillingToAccept, shared.maximumAgeOfObjectsThatIAdvertiseToOthers, shared.maximumAgeOfNodesThatIAdvertiseToOthers, shared.numberOfObjectsThatWeHaveYetToGetPerPeer, shared.neededPubkeys
# This thread is created either by the synSenderThread(for outgoing # This thread is created either by the synSenderThread(for outgoing
# connections) or the singleListenerThread(for incoming connectiosn). # connections) or the singleListenerThread(for incoming connectiosn).
@ -45,7 +46,7 @@ class receiveDataThread(threading.Thread):
self.peer = shared.Peer(HOST, port) self.peer = shared.Peer(HOST, port)
self.streamNumber = streamNumber self.streamNumber = streamNumber
self.payloadLength = 0 # This is the protocol payload length thus it doesn't include the 24 byte message header self.payloadLength = 0 # This is the protocol payload length thus it doesn't include the 24 byte message header
self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave = {} self.objectsThatWeHaveYetToGetFromThisPeer = {}
self.selfInitiatedConnections = selfInitiatedConnections self.selfInitiatedConnections = selfInitiatedConnections
shared.connectedHostsList[ shared.connectedHostsList[
self.peer.host] = 0 # The very fact that this receiveData thread exists shows that we are connected to the remote host. Let's add it to this list so that an outgoingSynSender thread doesn't try to connect to it. self.peer.host] = 0 # The very fact that this receiveData thread exists shows that we are connected to the remote host. Let's add it to this list so that an outgoingSynSender thread doesn't try to connect to it.
@ -89,7 +90,6 @@ class receiveDataThread(threading.Thread):
del self.selfInitiatedConnections[self.streamNumber][self] del self.selfInitiatedConnections[self.streamNumber][self]
with shared.printLock: with shared.printLock:
print 'removed self (a receiveDataThread) from selfInitiatedConnections' print 'removed self (a receiveDataThread) from selfInitiatedConnections'
except: except:
pass pass
shared.broadcastToSendDataQueues((0, 'shutdown', self.peer)) shared.broadcastToSendDataQueues((0, 'shutdown', self.peer))
@ -100,7 +100,7 @@ class receiveDataThread(threading.Thread):
print 'Could not delete', self.peer.host, 'from shared.connectedHostsList.', err print 'Could not delete', self.peer.host, 'from shared.connectedHostsList.', err
try: try:
del shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer[ del shared.numberOfObjectsThatWeHaveYetToGetPerPeer[
self.peer] self.peer]
except: except:
pass pass
@ -171,52 +171,52 @@ class receiveDataThread(threading.Thread):
self.data = self.data[ self.data = self.data[
self.payloadLength + 24:] # take this message out and then process the next message self.payloadLength + 24:] # take this message out and then process the next message
if self.data == '': if self.data == '':
while len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) > 0: while len(self.objectsThatWeHaveYetToGetFromThisPeer) > 0:
random.seed() shared.numberOfInventoryLookupsPerformed += 1
objectHash, = random.sample( objectHash, = random.sample(
self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave, 1) self.objectsThatWeHaveYetToGetFromThisPeer, 1)
if objectHash in shared.inventory: if objectHash in shared.inventory:
with shared.printLock: with shared.printLock:
print 'Inventory (in memory) already has object listed in inv message.' print 'Inventory (in memory) already has object listed in inv message.'
del self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave[ del self.objectsThatWeHaveYetToGetFromThisPeer[
objectHash] objectHash]
elif shared.isInSqlInventory(objectHash): elif shared.isInSqlInventory(objectHash):
if shared.verbose >= 3: if shared.verbose >= 3:
with shared.printLock: with shared.printLock:
print 'Inventory (SQL on disk) already has object listed in inv message.' print 'Inventory (SQL on disk) already has object listed in inv message.'
del self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave[ del self.objectsThatWeHaveYetToGetFromThisPeer[
objectHash] objectHash]
else: else:
self.sendgetdata(objectHash) self.sendgetdata(objectHash)
del self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave[ del self.objectsThatWeHaveYetToGetFromThisPeer[
objectHash] # It is possible that the remote node doesn't respond with the object. In that case, we'll very likely get it from someone else anyway. objectHash] # It is possible that the remote node doesn't respond with the object. In that case, we'll very likely get it from someone else anyway.
if len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) == 0: if len(self.objectsThatWeHaveYetToGetFromThisPeer) == 0:
with shared.printLock: with shared.printLock:
print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave is now', len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToGetFromThisPeer is now', len(self.objectsThatWeHaveYetToGetFromThisPeer)
try: try:
del shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer[ del shared.numberOfObjectsThatWeHaveYetToGetPerPeer[
self.peer] # this data structure is maintained so that we can keep track of how many total objects, across all connections, are currently outstanding. If it goes too high it can indicate that we are under attack by multiple nodes working together. self.peer] # this data structure is maintained so that we can keep track of how many total objects, across all connections, are currently outstanding. If it goes too high it can indicate that we are under attack by multiple nodes working together.
except: except:
pass pass
break break
if len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) == 0: if len(self.objectsThatWeHaveYetToGetFromThisPeer) == 0:
with shared.printLock: with shared.printLock:
print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave is now', len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToGetFromThisPeer is now', len(self.objectsThatWeHaveYetToGetFromThisPeer)
try: try:
del shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer[ del shared.numberOfObjectsThatWeHaveYetToGetPerPeer[
self.peer] # this data structure is maintained so that we can keep track of how many total objects, across all connections, are currently outstanding. If it goes too high it can indicate that we are under attack by multiple nodes working together. self.peer] # this data structure is maintained so that we can keep track of how many total objects, across all connections, are currently outstanding. If it goes too high it can indicate that we are under attack by multiple nodes working together.
except: except:
pass pass
if len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) > 0: if len(self.objectsThatWeHaveYetToGetFromThisPeer) > 0:
with shared.printLock: with shared.printLock:
print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave is now', len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) print '(concerning', str(self.peer) + ')', 'number of objectsThatWeHaveYetToGetFromThisPeer is now', len(self.objectsThatWeHaveYetToGetFromThisPeer)
shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer[self.peer] = len( shared.numberOfObjectsThatWeHaveYetToGetPerPeer[self.peer] = len(
self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) # this data structure is maintained so that we can keep track of how many total objects, across all connections, are currently outstanding. If it goes too high it can indicate that we are under attack by multiple nodes working together. self.objectsThatWeHaveYetToGetFromThisPeer) # this data structure is maintained so that we can keep track of how many total objects, across all connections, are currently outstanding. If it goes too high it can indicate that we are under attack by multiple nodes working together.
if len(self.ackDataThatWeHaveYetToSend) > 0: if len(self.ackDataThatWeHaveYetToSend) > 0:
self.data = self.ackDataThatWeHaveYetToSend.pop() self.data = self.ackDataThatWeHaveYetToSend.pop()
self.processData() self.processData()
@ -256,20 +256,23 @@ class receiveDataThread(threading.Thread):
def connectionFullyEstablished(self): def connectionFullyEstablished(self):
self.connectionIsOrWasFullyEstablished = True self.connectionIsOrWasFullyEstablished = True
if not self.initiatedConnection: if not self.initiatedConnection:
shared.clientHasReceivedIncomingConnections = True
shared.UISignalQueue.put(('setStatusIcon', 'green')) shared.UISignalQueue.put(('setStatusIcon', 'green'))
self.sock.settimeout( self.sock.settimeout(
600) # We'll send out a pong every 5 minutes to make sure the connection stays alive if there has been no other traffic to send lately. 600) # We'll send out a pong every 5 minutes to make sure the connection stays alive if there has been no other traffic to send lately.
shared.UISignalQueue.put(('updateNetworkStatusTab', 'no data')) shared.UISignalQueue.put(('updateNetworkStatusTab', 'no data'))
remoteNodeSeenTime = shared.knownNodes[
self.streamNumber][self.peer]
with shared.printLock: with shared.printLock:
print 'Connection fully established with', self.peer print 'Connection fully established with', self.peer
print 'The size of the connectedHostsList is now', len(shared.connectedHostsList) print 'The size of the connectedHostsList is now', len(shared.connectedHostsList)
print 'The length of sendDataQueues is now:', len(shared.sendDataQueues) print 'The length of sendDataQueues is now:', len(shared.sendDataQueues)
print 'broadcasting addr from within connectionFullyEstablished function.' print 'broadcasting addr from within connectionFullyEstablished function.'
self.broadcastaddr([(int(time.time()), self.streamNumber, 1, self.peer.host, #self.broadcastaddr([(int(time.time()), self.streamNumber, 1, self.peer.host,
self.peer.port)]) # This lets all of our peers know about this new node. # self.remoteNodeIncomingPort)]) # This lets all of our peers know about this new node.
dataToSend = (int(time.time()), self.streamNumber, 1, self.peer.host, self.remoteNodeIncomingPort)
shared.broadcastToSendDataQueues((
self.streamNumber, 'advertisepeer', dataToSend))
self.sendaddr() # This is one large addr message to this one peer. self.sendaddr() # This is one large addr message to this one peer.
if not self.initiatedConnection and len(shared.connectedHostsList) > 200: if not self.initiatedConnection and len(shared.connectedHostsList) > 200:
with shared.printLock: with shared.printLock:
@ -280,16 +283,13 @@ class receiveDataThread(threading.Thread):
self.sendBigInv() self.sendBigInv()
def sendBigInv(self): def sendBigInv(self):
shared.sqlLock.acquire()
# Select all hashes which are younger than two days old and in this # Select all hashes which are younger than two days old and in this
# stream. # stream.
t = (int(time.time()) - shared.maximumAgeOfObjectsThatIAdvertiseToOthers, int( queryreturn = sqlQuery(
time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys, self.streamNumber) '''SELECT hash FROM inventory WHERE ((receivedtime>? and objecttype<>'pubkey') or (receivedtime>? and objecttype='pubkey')) and streamnumber=?''',
shared.sqlSubmitQueue.put( int(time.time()) - shared.maximumAgeOfObjectsThatIAdvertiseToOthers,
'''SELECT hash FROM inventory WHERE ((receivedtime>? and objecttype<>'pubkey') or (receivedtime>? and objecttype='pubkey')) and streamnumber=?''') int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys,
shared.sqlSubmitQueue.put(t) self.streamNumber)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
bigInvList = {} bigInvList = {}
for row in queryreturn: for row in queryreturn:
hash, = row hash, = row
@ -297,11 +297,12 @@ class receiveDataThread(threading.Thread):
bigInvList[hash] = 0 bigInvList[hash] = 0
# We also have messages in our inventory in memory (which is a python # We also have messages in our inventory in memory (which is a python
# dictionary). Let's fetch those too. # dictionary). Let's fetch those too.
for hash, storedValue in shared.inventory.items(): with shared.inventoryLock:
if hash not in self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware: for hash, storedValue in shared.inventory.items():
objectType, streamNumber, payload, receivedTime = storedValue if hash not in self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware:
if streamNumber == self.streamNumber and receivedTime > int(time.time()) - shared.maximumAgeOfObjectsThatIAdvertiseToOthers: objectType, streamNumber, payload, receivedTime = storedValue
bigInvList[hash] = 0 if streamNumber == self.streamNumber and receivedTime > int(time.time()) - shared.maximumAgeOfObjectsThatIAdvertiseToOthers:
bigInvList[hash] = 0
numberOfObjectsInInvMessage = 0 numberOfObjectsInInvMessage = 0
payload = '' payload = ''
# Now let us start appending all of these hashes together. They will be # Now let us start appending all of these hashes together. They will be
@ -376,6 +377,7 @@ class receiveDataThread(threading.Thread):
print 'The stream number encoded in this broadcast message (' + str(streamNumber) + ') does not match the stream number on which it was received. Ignoring it.' print 'The stream number encoded in this broadcast message (' + str(streamNumber) + ') does not match the stream number on which it was received. Ignoring it.'
return return
shared.numberOfInventoryLookupsPerformed += 1
shared.inventoryLock.acquire() shared.inventoryLock.acquire()
self.inventoryHash = calculateInventoryHash(data) self.inventoryHash = calculateInventoryHash(data)
if self.inventoryHash in shared.inventory: if self.inventoryHash in shared.inventory:
@ -390,10 +392,12 @@ class receiveDataThread(threading.Thread):
objectType = 'broadcast' objectType = 'broadcast'
shared.inventory[self.inventoryHash] = ( shared.inventory[self.inventoryHash] = (
objectType, self.streamNumber, data, embeddedTime) objectType, self.streamNumber, data, embeddedTime)
shared.inventorySets[self.streamNumber].add(self.inventoryHash)
shared.inventoryLock.release() shared.inventoryLock.release()
self.broadcastinv(self.inventoryHash) self.broadcastinv(self.inventoryHash)
shared.numberOfBroadcastsProcessed += 1
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'incrementNumberOfBroadcastsProcessed', 'no data')) 'updateNumberOfBroadcastsProcessed', 'no data'))
self.processbroadcast( self.processbroadcast(
readPosition, data) # When this function returns, we will have either successfully processed this broadcast because we are interested in it, ignored it because we aren't interested in it, or found problem with the broadcast that warranted ignoring it. readPosition, data) # When this function returns, we will have either successfully processed this broadcast because we are interested in it, ignored it because we aren't interested in it, or found problem with the broadcast that warranted ignoring it.
@ -505,15 +509,12 @@ class receiveDataThread(threading.Thread):
# won't be able to send this pubkey to others (without doing # won't be able to send this pubkey to others (without doing
# the proof of work ourselves, which this program is programmed # the proof of work ourselves, which this program is programmed
# to not do.) # to not do.)
t = (ripe.digest(), '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' + '\xFF\xFF\xFF\xFF' + data[ sqlExecute(
beginningOfPubkeyPosition:endOfPubkeyPosition], int(time.time()), 'yes') '''INSERT INTO pubkeys VALUES (?,?,?,?)''',
shared.sqlLock.acquire() ripe.digest(),
shared.sqlSubmitQueue.put( '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' + '\xFF\xFF\xFF\xFF' + data[beginningOfPubkeyPosition:endOfPubkeyPosition],
'''INSERT INTO pubkeys VALUES (?,?,?,?)''') int(time.time()),
shared.sqlSubmitQueue.put(t) 'yes')
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# shared.workerQueue.put(('newpubkey',(sendersAddressVersion,sendersStream,ripe.digest()))) # shared.workerQueue.put(('newpubkey',(sendersAddressVersion,sendersStream,ripe.digest())))
# This will check to see whether we happen to be awaiting this # This will check to see whether we happen to be awaiting this
# pubkey in order to send a message. If we are, it will do the # pubkey in order to send a message. If we are, it will do the
@ -655,15 +656,11 @@ class receiveDataThread(threading.Thread):
# Let's store the public key in case we want to reply to this # Let's store the public key in case we want to reply to this
# person. # person.
t = (ripe.digest(), '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' + '\xFF\xFF\xFF\xFF' + decryptedData[ sqlExecute('''INSERT INTO pubkeys VALUES (?,?,?,?)''',
beginningOfPubkeyPosition:endOfPubkeyPosition], int(time.time()), 'yes') ripe.digest(),
shared.sqlLock.acquire() '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' + '\xFF\xFF\xFF\xFF' + decryptedData[beginningOfPubkeyPosition:endOfPubkeyPosition],
shared.sqlSubmitQueue.put( int(time.time()),
'''INSERT INTO pubkeys VALUES (?,?,?,?)''') 'yes')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# shared.workerQueue.put(('newpubkey',(sendersAddressVersion,sendersStream,ripe.digest()))) # shared.workerQueue.put(('newpubkey',(sendersAddressVersion,sendersStream,ripe.digest())))
# This will check to see whether we happen to be awaiting this # This will check to see whether we happen to be awaiting this
# pubkey in order to send a message. If we are, it will do the POW # pubkey in order to send a message. If we are, it will do the POW
@ -745,6 +742,7 @@ class receiveDataThread(threading.Thread):
return return
readPosition += streamNumberAsClaimedByMsgLength readPosition += streamNumberAsClaimedByMsgLength
self.inventoryHash = calculateInventoryHash(data) self.inventoryHash = calculateInventoryHash(data)
shared.numberOfInventoryLookupsPerformed += 1
shared.inventoryLock.acquire() shared.inventoryLock.acquire()
if self.inventoryHash in shared.inventory: if self.inventoryHash in shared.inventory:
print 'We have already received this msg message. Ignoring.' print 'We have already received this msg message. Ignoring.'
@ -758,10 +756,12 @@ class receiveDataThread(threading.Thread):
objectType = 'msg' objectType = 'msg'
shared.inventory[self.inventoryHash] = ( shared.inventory[self.inventoryHash] = (
objectType, self.streamNumber, data, embeddedTime) objectType, self.streamNumber, data, embeddedTime)
shared.inventorySets[self.streamNumber].add(self.inventoryHash)
shared.inventoryLock.release() shared.inventoryLock.release()
self.broadcastinv(self.inventoryHash) self.broadcastinv(self.inventoryHash)
shared.numberOfMessagesProcessed += 1
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'incrementNumberOfMessagesProcessed', 'no data')) 'updateNumberOfMessagesProcessed', 'no data'))
self.processmsg( self.processmsg(
readPosition, data) # When this function returns, we will have either successfully processed the message bound for us, ignored it because it isn't bound for us, or found problem with the message that warranted ignoring it. readPosition, data) # When this function returns, we will have either successfully processed the message bound for us, ignored it because it isn't bound for us, or found problem with the message that warranted ignoring it.
@ -799,14 +799,8 @@ class receiveDataThread(threading.Thread):
print 'This msg IS an acknowledgement bound for me.' print 'This msg IS an acknowledgement bound for me.'
del shared.ackdataForWhichImWatching[encryptedData[readPosition:]] del shared.ackdataForWhichImWatching[encryptedData[readPosition:]]
t = ('ackreceived', encryptedData[readPosition:]) sqlExecute('UPDATE sent SET status=? WHERE ackdata=?',
shared.sqlLock.acquire() 'ackreceived', encryptedData[readPosition:])
shared.sqlSubmitQueue.put(
'UPDATE sent SET status=? WHERE ackdata=?')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (encryptedData[readPosition:], tr.translateText("MainWindow",'Acknowledgement of the message received. %1').arg(unicode( shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (encryptedData[readPosition:], tr.translateText("MainWindow",'Acknowledgement of the message received. %1').arg(unicode(
time.strftime(shared.config.get('bitmessagesettings', 'timeformat'), time.localtime(int(time.time()))), 'utf-8'))))) time.strftime(shared.config.get('bitmessagesettings', 'timeformat'), time.localtime(int(time.time()))), 'utf-8')))))
return return
@ -929,15 +923,12 @@ class receiveDataThread(threading.Thread):
ripe.update(sha.digest()) ripe.update(sha.digest())
# Let's store the public key in case we want to reply to this # Let's store the public key in case we want to reply to this
# person. # person.
t = (ripe.digest(), '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' + '\xFF\xFF\xFF\xFF' + decryptedData[ sqlExecute(
messageVersionLength:endOfThePublicKeyPosition], int(time.time()), 'yes') '''INSERT INTO pubkeys VALUES (?,?,?,?)''',
shared.sqlLock.acquire() ripe.digest(),
shared.sqlSubmitQueue.put( '\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF' + '\xFF\xFF\xFF\xFF' + decryptedData[messageVersionLength:endOfThePublicKeyPosition],
'''INSERT INTO pubkeys VALUES (?,?,?,?)''') int(time.time()),
shared.sqlSubmitQueue.put(t) 'yes')
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# shared.workerQueue.put(('newpubkey',(sendersAddressVersionNumber,sendersStreamNumber,ripe.digest()))) # shared.workerQueue.put(('newpubkey',(sendersAddressVersionNumber,sendersStreamNumber,ripe.digest())))
# This will check to see whether we happen to be awaiting this # This will check to see whether we happen to be awaiting this
# pubkey in order to send a message. If we are, it will do the POW # pubkey in order to send a message. If we are, it will do the POW
@ -959,26 +950,18 @@ class receiveDataThread(threading.Thread):
return return
blockMessage = False # Gets set to True if the user shouldn't see the message according to black or white lists. blockMessage = False # Gets set to True if the user shouldn't see the message according to black or white lists.
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': # If we are using a blacklist if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': # If we are using a blacklist
t = (fromAddress,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''SELECT label FROM blacklist where address=? and enabled='1' ''',
shared.sqlSubmitQueue.put( fromAddress)
'''SELECT label FROM blacklist where address=? and enabled='1' ''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
with shared.printLock: with shared.printLock:
print 'Message ignored because address is in blacklist.' print 'Message ignored because address is in blacklist.'
blockMessage = True blockMessage = True
else: # We're using a whitelist else: # We're using a whitelist
t = (fromAddress,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''SELECT label FROM whitelist where address=? and enabled='1' ''',
shared.sqlSubmitQueue.put( toAddress)
'''SELECT label FROM whitelist where address=? and enabled='1' ''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
print 'Message ignored because address not in whitelist.' print 'Message ignored because address not in whitelist.'
blockMessage = True blockMessage = True
@ -1108,14 +1091,9 @@ class receiveDataThread(threading.Thread):
if toRipe in shared.neededPubkeys: if toRipe in shared.neededPubkeys:
print 'We have been awaiting the arrival of this pubkey.' print 'We have been awaiting the arrival of this pubkey.'
del shared.neededPubkeys[toRipe] del shared.neededPubkeys[toRipe]
t = (toRipe,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='doingmsgpow' WHERE toripe=? AND (status='awaitingpubkey' or status='doingpubkeypow') and folder='sent' ''',
shared.sqlSubmitQueue.put( toRipe)
'''UPDATE sent SET status='doingmsgpow' WHERE toripe=? AND (status='awaitingpubkey' or status='doingpubkeypow') and folder='sent' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.workerQueue.put(('sendmessage', '')) shared.workerQueue.put(('sendmessage', ''))
else: else:
with shared.printLock: with shared.printLock:
@ -1163,6 +1141,7 @@ class receiveDataThread(threading.Thread):
print 'stream number embedded in this pubkey doesn\'t match our stream number. Ignoring.' print 'stream number embedded in this pubkey doesn\'t match our stream number. Ignoring.'
return return
shared.numberOfInventoryLookupsPerformed += 1
inventoryHash = calculateInventoryHash(data) inventoryHash = calculateInventoryHash(data)
shared.inventoryLock.acquire() shared.inventoryLock.acquire()
if inventoryHash in shared.inventory: if inventoryHash in shared.inventory:
@ -1176,10 +1155,12 @@ class receiveDataThread(threading.Thread):
objectType = 'pubkey' objectType = 'pubkey'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, self.streamNumber, data, embeddedTime) objectType, self.streamNumber, data, embeddedTime)
shared.inventorySets[self.streamNumber].add(inventoryHash)
shared.inventoryLock.release() shared.inventoryLock.release()
self.broadcastinv(inventoryHash) self.broadcastinv(inventoryHash)
shared.numberOfPubkeysProcessed += 1
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'incrementNumberOfPubkeysProcessed', 'no data')) 'updateNumberOfPubkeysProcessed', 'no data'))
self.processpubkey(data) self.processpubkey(data)
@ -1216,7 +1197,7 @@ class receiveDataThread(threading.Thread):
if addressVersion == 0: if addressVersion == 0:
print '(Within processpubkey) addressVersion of 0 doesn\'t make sense.' print '(Within processpubkey) addressVersion of 0 doesn\'t make sense.'
return return
if addressVersion >= 4 or addressVersion == 1: if addressVersion > 3 or addressVersion == 1:
with shared.printLock: with shared.printLock:
print 'This version of Bitmessage cannot handle version', addressVersion, 'addresses.' print 'This version of Bitmessage cannot handle version', addressVersion, 'addresses.'
@ -1250,13 +1231,8 @@ class receiveDataThread(threading.Thread):
print 'publicEncryptionKey in hex:', publicEncryptionKey.encode('hex') print 'publicEncryptionKey in hex:', publicEncryptionKey.encode('hex')
t = (ripe,) queryreturn = sqlQuery(
shared.sqlLock.acquire() '''SELECT usedpersonally FROM pubkeys WHERE hash=? AND usedpersonally='yes' ''', ripe)
shared.sqlSubmitQueue.put(
'''SELECT usedpersonally FROM pubkeys WHERE hash=? AND usedpersonally='yes' ''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: # if this pubkey is already in our database and if we have used it personally: if queryreturn != []: # if this pubkey is already in our database and if we have used it personally:
print 'We HAVE used this pubkey personally. Updating time.' print 'We HAVE used this pubkey personally. Updating time.'
t = (ripe, data, embeddedTime, 'yes') t = (ripe, data, embeddedTime, 'yes')
@ -1264,13 +1240,7 @@ class receiveDataThread(threading.Thread):
print 'We have NOT used this pubkey personally. Inserting in database.' print 'We have NOT used this pubkey personally. Inserting in database.'
t = (ripe, data, embeddedTime, 'no') t = (ripe, data, embeddedTime, 'no')
# This will also update the embeddedTime. # This will also update the embeddedTime.
shared.sqlLock.acquire() sqlExecute('''INSERT INTO pubkeys VALUES (?,?,?,?)''', *t)
shared.sqlSubmitQueue.put(
'''INSERT INTO pubkeys VALUES (?,?,?,?)''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# shared.workerQueue.put(('newpubkey',(addressVersion,streamNumber,ripe))) # shared.workerQueue.put(('newpubkey',(addressVersion,streamNumber,ripe)))
self.possibleNewPubkey(ripe) self.possibleNewPubkey(ripe)
if addressVersion == 3: if addressVersion == 3:
@ -1319,13 +1289,7 @@ class receiveDataThread(threading.Thread):
print 'publicEncryptionKey in hex:', publicEncryptionKey.encode('hex') print 'publicEncryptionKey in hex:', publicEncryptionKey.encode('hex')
t = (ripe,) queryreturn = sqlQuery('''SELECT usedpersonally FROM pubkeys WHERE hash=? AND usedpersonally='yes' ''', ripe)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''SELECT usedpersonally FROM pubkeys WHERE hash=? AND usedpersonally='yes' ''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: # if this pubkey is already in our database and if we have used it personally: if queryreturn != []: # if this pubkey is already in our database and if we have used it personally:
print 'We HAVE used this pubkey personally. Updating time.' print 'We HAVE used this pubkey personally. Updating time.'
t = (ripe, data, embeddedTime, 'yes') t = (ripe, data, embeddedTime, 'yes')
@ -1333,13 +1297,7 @@ class receiveDataThread(threading.Thread):
print 'We have NOT used this pubkey personally. Inserting in database.' print 'We have NOT used this pubkey personally. Inserting in database.'
t = (ripe, data, embeddedTime, 'no') t = (ripe, data, embeddedTime, 'no')
# This will also update the embeddedTime. # This will also update the embeddedTime.
shared.sqlLock.acquire() sqlExecute('''INSERT INTO pubkeys VALUES (?,?,?,?)''', *t)
shared.sqlSubmitQueue.put(
'''INSERT INTO pubkeys VALUES (?,?,?,?)''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
# shared.workerQueue.put(('newpubkey',(addressVersion,streamNumber,ripe))) # shared.workerQueue.put(('newpubkey',(addressVersion,streamNumber,ripe)))
self.possibleNewPubkey(ripe) self.possibleNewPubkey(ripe)
@ -1378,6 +1336,7 @@ class receiveDataThread(threading.Thread):
return return
readPosition += streamNumberLength readPosition += streamNumberLength
shared.numberOfInventoryLookupsPerformed += 1
inventoryHash = calculateInventoryHash(data) inventoryHash = calculateInventoryHash(data)
shared.inventoryLock.acquire() shared.inventoryLock.acquire()
if inventoryHash in shared.inventory: if inventoryHash in shared.inventory:
@ -1392,6 +1351,7 @@ class receiveDataThread(threading.Thread):
objectType = 'getpubkey' objectType = 'getpubkey'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, self.streamNumber, data, embeddedTime) objectType, self.streamNumber, data, embeddedTime)
shared.inventorySets[self.streamNumber].add(inventoryHash)
shared.inventoryLock.release() shared.inventoryLock.release()
# This getpubkey request is valid so far. Forward to peers. # This getpubkey request is valid so far. Forward to peers.
self.broadcastinv(inventoryHash) self.broadcastinv(inventoryHash)
@ -1450,13 +1410,13 @@ class receiveDataThread(threading.Thread):
# We have received an inv message # We have received an inv message
def recinv(self, data): def recinv(self, data):
totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave = 0 # ..from all peers, counting duplicates seperately (because they take up memory) totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers = 0 # this counts duplicates seperately because they take up memory
if len(shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer) > 0: if len(shared.numberOfObjectsThatWeHaveYetToGetPerPeer) > 0:
for key, value in shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer.items(): for key, value in shared.numberOfObjectsThatWeHaveYetToGetPerPeer.items():
totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave += value totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers += value
with shared.printLock: with shared.printLock:
print 'number of keys(hosts) in shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer:', len(shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer) print 'number of keys(hosts) in shared.numberOfObjectsThatWeHaveYetToGetPerPeer:', len(shared.numberOfObjectsThatWeHaveYetToGetPerPeer)
print 'totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave = ', totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave print 'totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers = ', totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers
numberOfItemsInInv, lengthOfVarint = decodeVarint(data[:10]) numberOfItemsInInv, lengthOfVarint = decodeVarint(data[:10])
if numberOfItemsInInv > 50000: if numberOfItemsInInv > 50000:
@ -1466,36 +1426,41 @@ class receiveDataThread(threading.Thread):
print 'inv message doesn\'t contain enough data. Ignoring.' print 'inv message doesn\'t contain enough data. Ignoring.'
return return
if numberOfItemsInInv == 1: # we'll just request this data from the person who advertised the object. if numberOfItemsInInv == 1: # we'll just request this data from the person who advertised the object.
if totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave > 200000 and len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) > 1000: # inv flooding attack mitigation if totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers > 200000 and len(self.objectsThatWeHaveYetToGetFromThisPeer) > 1000: # inv flooding attack mitigation
with shared.printLock: with shared.printLock:
print 'We already have', totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave, 'items yet to retrieve from peers and over 1000 from this node in particular. Ignoring this inv message.' print 'We already have', totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers, 'items yet to retrieve from peers and over 1000 from this node in particular. Ignoring this inv message.'
return return
self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware[ self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware[
data[lengthOfVarint:32 + lengthOfVarint]] = 0 data[lengthOfVarint:32 + lengthOfVarint]] = 0
shared.numberOfInventoryLookupsPerformed += 1
if data[lengthOfVarint:32 + lengthOfVarint] in shared.inventory: if data[lengthOfVarint:32 + lengthOfVarint] in shared.inventory:
with shared.printLock: with shared.printLock:
print 'Inventory (in memory) has inventory item already.' print 'Inventory (in memory) has inventory item already.'
elif shared.isInSqlInventory(data[lengthOfVarint:32 + lengthOfVarint]): elif shared.isInSqlInventory(data[lengthOfVarint:32 + lengthOfVarint]):
print 'Inventory (SQL on disk) has inventory item already.' print 'Inventory (SQL on disk) has inventory item already.'
else: else:
self.sendgetdata(data[lengthOfVarint:32 + lengthOfVarint]) self.sendgetdata(data[lengthOfVarint:32 + lengthOfVarint])
else: else:
print 'inv message lists', numberOfItemsInInv, 'objects.' # There are many items listed in this inv message. Let us create a
for i in range(numberOfItemsInInv): # upon finishing dealing with an incoming message, the receiveDataThread will request a random object from the peer. This way if we get multiple inv messages from multiple peers which list mostly the same objects, we will make getdata requests for different random objects from the various peers. # 'set' of objects we are aware of and a set of objects in this inv
if len(data[lengthOfVarint + (32 * i):32 + lengthOfVarint + (32 * i)]) == 32: # The length of an inventory hash should be 32. If it isn't 32 then the remote node is either badly programmed or behaving nefariously. # message so that we can diff one from the other cheaply.
if totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave > 200000 and len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) > 1000: # inv flooding attack mitigation startTime = time.time()
with shared.printLock: advertisedSet = set()
print 'We already have', totalNumberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave, 'items yet to retrieve from peers and over', len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave), 'from this node in particular. Ignoring the rest of this inv message.' for i in range(numberOfItemsInInv):
advertisedSet.add(data[lengthOfVarint + (32 * i):32 + lengthOfVarint + (32 * i)])
break objectsNewToMe = advertisedSet - shared.inventorySets[self.streamNumber]
self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware[data[ logger.info('inv message lists %s objects. Of those %s are new to me. It took %s seconds to figure that out.', numberOfItemsInInv, len(objectsNewToMe), time.time()-startTime)
lengthOfVarint + (32 * i):32 + lengthOfVarint + (32 * i)]] = 0 for item in objectsNewToMe:
self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave[ if totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers > 200000 and len(self.objectsThatWeHaveYetToGetFromThisPeer) > 1000: # inv flooding attack mitigation
data[lengthOfVarint + (32 * i):32 + lengthOfVarint + (32 * i)]] = 0 with shared.printLock:
shared.numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer[ print 'We already have', totalNumberOfobjectsThatWeHaveYetToGetFromAllPeers, 'items yet to retrieve from peers and over', len(self.objectsThatWeHaveYetToGetFromThisPeer), 'from this node in particular. Ignoring the rest of this inv message.'
self.peer] = len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) break
self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware[item] = 0 # helps us keep from sending inv messages to peers that already know about the objects listed therein
self.objectsThatWeHaveYetToGetFromThisPeer[item] = 0 # upon finishing dealing with an incoming message, the receiveDataThread will request a random object of from peer out of this data structure. This way if we get multiple inv messages from multiple peers which list mostly the same objects, we will make getdata requests for different random objects from the various peers.
if len(self.objectsThatWeHaveYetToGetFromThisPeer) > 0:
shared.numberOfObjectsThatWeHaveYetToGetPerPeer[
self.peer] = len(self.objectsThatWeHaveYetToGetFromThisPeer)
# Send a getdata message to our peer to request the object with the given # Send a getdata message to our peer to request the object with the given
# hash # hash
@ -1530,19 +1495,18 @@ class receiveDataThread(threading.Thread):
with shared.printLock: with shared.printLock:
print 'received getdata request for item:', hash.encode('hex') print 'received getdata request for item:', hash.encode('hex')
# print 'inventory is', shared.inventory shared.numberOfInventoryLookupsPerformed += 1
shared.inventoryLock.acquire()
if hash in shared.inventory: if hash in shared.inventory:
objectType, streamNumber, payload, receivedTime = shared.inventory[ objectType, streamNumber, payload, receivedTime = shared.inventory[
hash] hash]
shared.inventoryLock.release()
self.sendData(objectType, payload) self.sendData(objectType, payload)
else: else:
t = (hash,) shared.inventoryLock.release()
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put( '''select objecttype, payload from inventory where hash=?''',
'''select objecttype, payload from inventory where hash=?''') hash)
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
objectType, payload = row objectType, payload = row
@ -1587,16 +1551,16 @@ class receiveDataThread(threading.Thread):
print 'sock.sendall error:', err print 'sock.sendall error:', err
# Send an inv message with just one hash to all of our peers # Advertise this object to all of our peers
def broadcastinv(self, hash): def broadcastinv(self, hash):
with shared.printLock: with shared.printLock:
print 'broadcasting inv with hash:', hash.encode('hex') print 'broadcasting inv with hash:', hash.encode('hex')
shared.broadcastToSendDataQueues((self.streamNumber, 'sendinv', hash)) shared.broadcastToSendDataQueues((self.streamNumber, 'advertiseobject', hash))
# We have received an addr message. # We have received an addr message.
def recaddr(self, data): def recaddr(self, data):
listOfAddressDetailsToBroadcastToPeers = [] #listOfAddressDetailsToBroadcastToPeers = []
numberOfAddressesIncluded = 0 numberOfAddressesIncluded = 0
numberOfAddressesIncluded, lengthOfNumberOfAddresses = decodeVarint( numberOfAddressesIncluded, lengthOfNumberOfAddresses = decodeVarint(
data[:10]) data[:10])
@ -1605,220 +1569,113 @@ class receiveDataThread(threading.Thread):
with shared.printLock: with shared.printLock:
print 'addr message contains', numberOfAddressesIncluded, 'IP addresses.' print 'addr message contains', numberOfAddressesIncluded, 'IP addresses.'
if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0:
return
if len(data) != lengthOfNumberOfAddresses + (38 * numberOfAddressesIncluded):
print 'addr message does not contain the correct amount of data. Ignoring.'
return
if self.remoteProtocolVersion == 1: for i in range(0, numberOfAddressesIncluded):
if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0: try:
return if data[20 + lengthOfNumberOfAddresses + (38 * i):32 + lengthOfNumberOfAddresses + (38 * i)] != '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF':
if len(data) != lengthOfNumberOfAddresses + (34 * numberOfAddressesIncluded):
print 'addr message does not contain the correct amount of data. Ignoring.'
return
needToWriteKnownNodesToDisk = False
for i in range(0, numberOfAddressesIncluded):
try:
if data[16 + lengthOfNumberOfAddresses + (34 * i):28 + lengthOfNumberOfAddresses + (34 * i)] != '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF':
with shared.printLock:
print 'Skipping IPv6 address.', repr(data[16 + lengthOfNumberOfAddresses + (34 * i):28 + lengthOfNumberOfAddresses + (34 * i)])
continue
except Exception as err:
with shared.printLock: with shared.printLock:
sys.stderr.write( print 'Skipping IPv6 address.', repr(data[20 + lengthOfNumberOfAddresses + (38 * i):32 + lengthOfNumberOfAddresses + (38 * i)])
'ERROR TRYING TO UNPACK recaddr (to test for an IPv6 address). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however.
try:
recaddrStream, = unpack('>I', data[4 + lengthOfNumberOfAddresses + (
34 * i):8 + lengthOfNumberOfAddresses + (34 * i)])
except Exception as err:
with shared.printLock:
sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (recaddrStream). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however.
if recaddrStream == 0:
continue continue
if recaddrStream != self.streamNumber and recaddrStream != (self.streamNumber * 2) and recaddrStream != ((self.streamNumber * 2) + 1): # if the embedded stream number is not in my stream or either of my child streams then ignore it. Someone might be trying funny business. except Exception as err:
continue with shared.printLock:
try: sys.stderr.write(
recaddrServices, = unpack('>Q', data[8 + lengthOfNumberOfAddresses + ( 'ERROR TRYING TO UNPACK recaddr (to test for an IPv6 address). Message: %s\n' % str(err))
34 * i):16 + lengthOfNumberOfAddresses + (34 * i)])
except Exception as err:
with shared.printLock:
sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (recaddrServices). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however. break # giving up on unpacking any more. We should still be connected however.
try: try:
recaddrPort, = unpack('>H', data[32 + lengthOfNumberOfAddresses + ( recaddrStream, = unpack('>I', data[8 + lengthOfNumberOfAddresses + (
34 * i):34 + lengthOfNumberOfAddresses + (34 * i)]) 38 * i):12 + lengthOfNumberOfAddresses + (38 * i)])
except Exception as err: except Exception as err:
with shared.printLock: with shared.printLock:
sys.stderr.write( sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (recaddrPort). Message: %s\n' % str(err)) 'ERROR TRYING TO UNPACK recaddr (recaddrStream). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however. break # giving up on unpacking any more. We should still be connected however.
# print 'Within recaddr(): IP', recaddrIP, ', Port', if recaddrStream == 0:
# recaddrPort, ', i', i continue
hostFromAddrMessage = socket.inet_ntoa(data[ if recaddrStream != self.streamNumber and recaddrStream != (self.streamNumber * 2) and recaddrStream != ((self.streamNumber * 2) + 1): # if the embedded stream number is not in my stream or either of my child streams then ignore it. Someone might be trying funny business.
28 + lengthOfNumberOfAddresses + (34 * i):32 + lengthOfNumberOfAddresses + (34 * i)]) continue
# print 'hostFromAddrMessage', hostFromAddrMessage try:
if data[28 + lengthOfNumberOfAddresses + (34 * i)] == '\x7F': recaddrServices, = unpack('>Q', data[12 + lengthOfNumberOfAddresses + (
print 'Ignoring IP address in loopback range:', hostFromAddrMessage 38 * i):20 + lengthOfNumberOfAddresses + (38 * i)])
continue except Exception as err:
if helper_generic.isHostInPrivateIPRange(hostFromAddrMessage): with shared.printLock:
print 'Ignoring IP address in private range:', hostFromAddrMessage sys.stderr.write(
continue 'ERROR TRYING TO UNPACK recaddr (recaddrServices). Message: %s\n' % str(err))
timeSomeoneElseReceivedMessageFromThisNode, = unpack('>I', data[lengthOfNumberOfAddresses + (
34 * i):4 + lengthOfNumberOfAddresses + (34 * i)]) # This is the 'time' value in the received addr message. break # giving up on unpacking any more. We should still be connected however.
if recaddrStream not in shared.knownNodes: # knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it.
shared.knownNodesLock.acquire() try:
shared.knownNodes[recaddrStream] = {} recaddrPort, = unpack('>H', data[36 + lengthOfNumberOfAddresses + (
shared.knownNodesLock.release() 38 * i):38 + lengthOfNumberOfAddresses + (38 * i)])
peerFromAddrMessage = shared.Peer(hostFromAddrMessage, recaddrPort) except Exception as err:
if peerFromAddrMessage not in shared.knownNodes[recaddrStream]: with shared.printLock:
if len(shared.knownNodes[recaddrStream]) < 20000 and timeSomeoneElseReceivedMessageFromThisNode > (int(time.time()) - 10800) and timeSomeoneElseReceivedMessageFromThisNode < (int(time.time()) + 10800): # If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now. sys.stderr.write(
shared.knownNodesLock.acquire() 'ERROR TRYING TO UNPACK recaddr (recaddrPort). Message: %s\n' % str(err))
shared.knownNodes[recaddrStream][peerFromAddrMessage] = timeSomeoneElseReceivedMessageFromThisNode
shared.knownNodesLock.release() break # giving up on unpacking any more. We should still be connected however.
needToWriteKnownNodesToDisk = True # print 'Within recaddr(): IP', recaddrIP, ', Port',
hostDetails = ( # recaddrPort, ', i', i
timeSomeoneElseReceivedMessageFromThisNode, hostFromAddrMessage = socket.inet_ntoa(data[
recaddrStream, recaddrServices, hostFromAddrMessage, recaddrPort) 32 + lengthOfNumberOfAddresses + (38 * i):36 + lengthOfNumberOfAddresses + (38 * i)])
listOfAddressDetailsToBroadcastToPeers.append( # print 'hostFromAddrMessage', hostFromAddrMessage
hostDetails) if data[32 + lengthOfNumberOfAddresses + (38 * i)] == '\x7F':
else: print 'Ignoring IP address in loopback range:', hostFromAddrMessage
timeLastReceivedMessageFromThisNode = shared.knownNodes[recaddrStream][ continue
peerFromAddrMessage] # PORT in this case is either the port we used to connect to the remote node, or the port that was specified by someone else in a past addr message. if data[32 + lengthOfNumberOfAddresses + (38 * i)] == '\x0A':
if (timeLastReceivedMessageFromThisNode < timeSomeoneElseReceivedMessageFromThisNode) and (timeSomeoneElseReceivedMessageFromThisNode < int(time.time())): print 'Ignoring IP address in private range:', hostFromAddrMessage
shared.knownNodesLock.acquire() continue
shared.knownNodes[recaddrStream][peerFromAddrMessage] = timeSomeoneElseReceivedMessageFromThisNode if data[32 + lengthOfNumberOfAddresses + (38 * i):34 + lengthOfNumberOfAddresses + (38 * i)] == '\xC0A8':
shared.knownNodesLock.release() print 'Ignoring IP address in private range:', hostFromAddrMessage
if needToWriteKnownNodesToDisk: # Runs if any nodes were new to us. Also, share those nodes with our peers. continue
timeSomeoneElseReceivedMessageFromThisNode, = unpack('>Q', data[lengthOfNumberOfAddresses + (
38 * i):8 + lengthOfNumberOfAddresses + (38 * i)]) # This is the 'time' value in the received addr message. 64-bit.
if recaddrStream not in shared.knownNodes: # knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it.
shared.knownNodesLock.acquire() shared.knownNodesLock.acquire()
output = open(shared.appdata + 'knownnodes.dat', 'wb') shared.knownNodes[recaddrStream] = {}
pickle.dump(shared.knownNodes, output)
output.close()
shared.knownNodesLock.release() shared.knownNodesLock.release()
self.broadcastaddr( peerFromAddrMessage = shared.Peer(hostFromAddrMessage, recaddrPort)
listOfAddressDetailsToBroadcastToPeers) # no longer broadcast if peerFromAddrMessage not in shared.knownNodes[recaddrStream]:
with shared.printLock: if len(shared.knownNodes[recaddrStream]) < 20000 and timeSomeoneElseReceivedMessageFromThisNode > (int(time.time()) - 10800) and timeSomeoneElseReceivedMessageFromThisNode < (int(time.time()) + 10800): # If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now.
print 'knownNodes currently has', len(shared.knownNodes[self.streamNumber]), 'nodes for this stream.'
elif self.remoteProtocolVersion >= 2: # The difference is that in protocol version 2, network addresses use 64 bit times rather than 32 bit times.
if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0:
return
if len(data) != lengthOfNumberOfAddresses + (38 * numberOfAddressesIncluded):
print 'addr message does not contain the correct amount of data. Ignoring.'
return
needToWriteKnownNodesToDisk = False
for i in range(0, numberOfAddressesIncluded):
try:
if data[20 + lengthOfNumberOfAddresses + (38 * i):32 + lengthOfNumberOfAddresses + (38 * i)] != '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF':
with shared.printLock:
print 'Skipping IPv6 address.', repr(data[20 + lengthOfNumberOfAddresses + (38 * i):32 + lengthOfNumberOfAddresses + (38 * i)])
continue
except Exception as err:
with shared.printLock:
sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (to test for an IPv6 address). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however.
try:
recaddrStream, = unpack('>I', data[8 + lengthOfNumberOfAddresses + (
38 * i):12 + lengthOfNumberOfAddresses + (38 * i)])
except Exception as err:
with shared.printLock:
sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (recaddrStream). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however.
if recaddrStream == 0:
continue
if recaddrStream != self.streamNumber and recaddrStream != (self.streamNumber * 2) and recaddrStream != ((self.streamNumber * 2) + 1): # if the embedded stream number is not in my stream or either of my child streams then ignore it. Someone might be trying funny business.
continue
try:
recaddrServices, = unpack('>Q', data[12 + lengthOfNumberOfAddresses + (
38 * i):20 + lengthOfNumberOfAddresses + (38 * i)])
except Exception as err:
with shared.printLock:
sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (recaddrServices). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however.
try:
recaddrPort, = unpack('>H', data[36 + lengthOfNumberOfAddresses + (
38 * i):38 + lengthOfNumberOfAddresses + (38 * i)])
except Exception as err:
with shared.printLock:
sys.stderr.write(
'ERROR TRYING TO UNPACK recaddr (recaddrPort). Message: %s\n' % str(err))
break # giving up on unpacking any more. We should still be connected however.
# print 'Within recaddr(): IP', recaddrIP, ', Port',
# recaddrPort, ', i', i
hostFromAddrMessage = socket.inet_ntoa(data[
32 + lengthOfNumberOfAddresses + (38 * i):36 + lengthOfNumberOfAddresses + (38 * i)])
# print 'hostFromAddrMessage', hostFromAddrMessage
if data[32 + lengthOfNumberOfAddresses + (38 * i)] == '\x7F':
print 'Ignoring IP address in loopback range:', hostFromAddrMessage
continue
if data[32 + lengthOfNumberOfAddresses + (38 * i)] == '\x0A':
print 'Ignoring IP address in private range:', hostFromAddrMessage
continue
if data[32 + lengthOfNumberOfAddresses + (38 * i):34 + lengthOfNumberOfAddresses + (38 * i)] == '\xC0A8':
print 'Ignoring IP address in private range:', hostFromAddrMessage
continue
timeSomeoneElseReceivedMessageFromThisNode, = unpack('>Q', data[lengthOfNumberOfAddresses + (
38 * i):8 + lengthOfNumberOfAddresses + (38 * i)]) # This is the 'time' value in the received addr message. 64-bit.
if recaddrStream not in shared.knownNodes: # knownNodes is a dictionary of dictionaries with one outer dictionary for each stream. If the outer stream dictionary doesn't exist yet then we must make it.
shared.knownNodesLock.acquire() shared.knownNodesLock.acquire()
shared.knownNodes[recaddrStream] = {} shared.knownNodes[recaddrStream][peerFromAddrMessage] = (
timeSomeoneElseReceivedMessageFromThisNode)
shared.knownNodesLock.release() shared.knownNodesLock.release()
peerFromAddrMessage = shared.Peer(hostFromAddrMessage, recaddrPort) with shared.printLock:
if peerFromAddrMessage not in shared.knownNodes[recaddrStream]: print 'added new node', peerFromAddrMessage, 'to knownNodes in stream', recaddrStream
if len(shared.knownNodes[recaddrStream]) < 20000 and timeSomeoneElseReceivedMessageFromThisNode > (int(time.time()) - 10800) and timeSomeoneElseReceivedMessageFromThisNode < (int(time.time()) + 10800): # If we have more than 20000 nodes in our list already then just forget about adding more. Also, make sure that the time that someone else received a message from this node is within three hours from now.
shared.knownNodesLock.acquire()
shared.knownNodes[recaddrStream][peerFromAddrMessage] = (
timeSomeoneElseReceivedMessageFromThisNode)
shared.knownNodesLock.release()
with shared.printLock:
print 'added new node', peerFromAddrMessage, 'to knownNodes in stream', recaddrStream
needToWriteKnownNodesToDisk = True shared.needToWriteKnownNodesToDisk = True
hostDetails = ( hostDetails = (
timeSomeoneElseReceivedMessageFromThisNode, timeSomeoneElseReceivedMessageFromThisNode,
recaddrStream, recaddrServices, hostFromAddrMessage, recaddrPort) recaddrStream, recaddrServices, hostFromAddrMessage, recaddrPort)
listOfAddressDetailsToBroadcastToPeers.append( #listOfAddressDetailsToBroadcastToPeers.append(hostDetails)
hostDetails) shared.broadcastToSendDataQueues((
else: self.streamNumber, 'advertisepeer', hostDetails))
timeLastReceivedMessageFromThisNode = shared.knownNodes[recaddrStream][ else:
peerFromAddrMessage] # PORT in this case is either the port we used to connect to the remote node, or the port that was specified by someone else in a past addr message. timeLastReceivedMessageFromThisNode = shared.knownNodes[recaddrStream][
if (timeLastReceivedMessageFromThisNode < timeSomeoneElseReceivedMessageFromThisNode) and (timeSomeoneElseReceivedMessageFromThisNode < int(time.time())): peerFromAddrMessage] # PORT in this case is either the port we used to connect to the remote node, or the port that was specified by someone else in a past addr message.
shared.knownNodesLock.acquire() if (timeLastReceivedMessageFromThisNode < timeSomeoneElseReceivedMessageFromThisNode) and (timeSomeoneElseReceivedMessageFromThisNode < int(time.time())):
shared.knownNodes[recaddrStream][peerFromAddrMessage] = timeSomeoneElseReceivedMessageFromThisNode shared.knownNodesLock.acquire()
shared.knownNodesLock.release() shared.knownNodes[recaddrStream][peerFromAddrMessage] = timeSomeoneElseReceivedMessageFromThisNode
if needToWriteKnownNodesToDisk: # Runs if any nodes were new to us. Also, share those nodes with our peers. shared.knownNodesLock.release()
shared.knownNodesLock.acquire()
output = open(shared.appdata + 'knownnodes.dat', 'wb') #if listOfAddressDetailsToBroadcastToPeers != []:
pickle.dump(shared.knownNodes, output) # self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers)
output.close() with shared.printLock:
shared.knownNodesLock.release() print 'knownNodes currently has', len(shared.knownNodes[self.streamNumber]), 'nodes for this stream.'
self.broadcastaddr(listOfAddressDetailsToBroadcastToPeers)
with shared.printLock:
print 'knownNodes currently has', len(shared.knownNodes[self.streamNumber]), 'nodes for this stream.'
# Function runs when we want to broadcast an addr message to all of our # Function runs when we want to broadcast an addr message to all of our
# peers. Runs when we learn of nodes that we didn't previously know about # peers. Runs when we learn of nodes that we didn't previously know about
# and want to share them with our peers. # and want to share them with our peers.
def broadcastaddr(self, listOfAddressDetailsToBroadcastToPeers): """def broadcastaddr(self, listOfAddressDetailsToBroadcastToPeers):
numberOfAddressesInAddrMessage = len( numberOfAddressesInAddrMessage = len(
listOfAddressDetailsToBroadcastToPeers) listOfAddressDetailsToBroadcastToPeers)
payload = '' payload = ''
@ -1844,7 +1701,7 @@ class receiveDataThread(threading.Thread):
print 'Broadcasting addr with', numberOfAddressesInAddrMessage, 'entries.' print 'Broadcasting addr with', numberOfAddressesInAddrMessage, 'entries.'
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
self.streamNumber, 'sendaddr', datatosend)) self.streamNumber, 'sendaddr', datatosend))"""
# Send a big addr message to our peer # Send a big addr message to our peer
def sendaddr(self): def sendaddr(self):
@ -1859,7 +1716,6 @@ class receiveDataThread(threading.Thread):
shared.knownNodesLock.acquire() shared.knownNodesLock.acquire()
if len(shared.knownNodes[self.streamNumber]) > 0: if len(shared.knownNodes[self.streamNumber]) > 0:
for i in range(500): for i in range(500):
random.seed()
peer, = random.sample(shared.knownNodes[self.streamNumber], 1) peer, = random.sample(shared.knownNodes[self.streamNumber], 1)
if helper_generic.isHostInPrivateIPRange(peer.host): if helper_generic.isHostInPrivateIPRange(peer.host):
continue continue
@ -1867,7 +1723,6 @@ class receiveDataThread(threading.Thread):
self.streamNumber][peer] self.streamNumber][peer]
if len(shared.knownNodes[self.streamNumber * 2]) > 0: if len(shared.knownNodes[self.streamNumber * 2]) > 0:
for i in range(250): for i in range(250):
random.seed()
peer, = random.sample(shared.knownNodes[ peer, = random.sample(shared.knownNodes[
self.streamNumber * 2], 1) self.streamNumber * 2], 1)
if helper_generic.isHostInPrivateIPRange(peer.host): if helper_generic.isHostInPrivateIPRange(peer.host):
@ -1876,7 +1731,6 @@ class receiveDataThread(threading.Thread):
self.streamNumber * 2][peer] self.streamNumber * 2][peer]
if len(shared.knownNodes[(self.streamNumber * 2) + 1]) > 0: if len(shared.knownNodes[(self.streamNumber * 2) + 1]) > 0:
for i in range(250): for i in range(250):
random.seed()
peer, = random.sample(shared.knownNodes[ peer, = random.sample(shared.knownNodes[
(self.streamNumber * 2) + 1], 1) (self.streamNumber * 2) + 1], 1)
if helper_generic.isHostInPrivateIPRange(peer.host): if helper_generic.isHostInPrivateIPRange(peer.host):
@ -1995,10 +1849,8 @@ class receiveDataThread(threading.Thread):
self.peer, self.remoteProtocolVersion))) self.peer, self.remoteProtocolVersion)))
shared.knownNodesLock.acquire() shared.knownNodesLock.acquire()
shared.knownNodes[self.streamNumber][self.peer] = int(time.time()) shared.knownNodes[self.streamNumber][shared.Peer(self.peer.host, self.remoteNodeIncomingPort)] = int(time.time())
output = open(shared.appdata + 'knownnodes.dat', 'wb') shared.needToWriteKnownNodesToDisk = True
pickle.dump(shared.knownNodes, output)
output.close()
shared.knownNodesLock.release() shared.knownNodesLock.release()
self.sendverack() self.sendverack()

View File

@ -8,7 +8,8 @@ import random
import sys import sys
import socket import socket
#import bitmessagemain from class_objectHashHolder import *
from addresses import *
# Every connection to a peer has a sendDataThread (and also a # Every connection to a peer has a sendDataThread (and also a
# receiveDataThread). # receiveDataThread).
@ -22,6 +23,9 @@ class sendDataThread(threading.Thread):
print 'The length of sendDataQueues at sendDataThread init is:', len(shared.sendDataQueues) print 'The length of sendDataQueues at sendDataThread init is:', len(shared.sendDataQueues)
self.data = '' self.data = ''
self.objectHashHolderInstance = objectHashHolder(self.mailbox)
self.objectHashHolderInstance.start()
def setup( def setup(
self, self,
@ -98,15 +102,31 @@ class sendDataThread(threading.Thread):
print 'setting the remote node\'s protocol version in the sendData thread (ID:', id(self), ') to', specifiedRemoteProtocolVersion print 'setting the remote node\'s protocol version in the sendData thread (ID:', id(self), ') to', specifiedRemoteProtocolVersion
self.remoteProtocolVersion = specifiedRemoteProtocolVersion self.remoteProtocolVersion = specifiedRemoteProtocolVersion
elif command == 'advertisepeer':
self.objectHashHolderInstance.holdPeer(data)
elif command == 'sendaddr': elif command == 'sendaddr':
numberOfAddressesInAddrMessage = len(
data)
payload = ''
for hostDetails in data:
timeLastReceivedMessageFromThisNode, streamNumber, services, host, port = hostDetails
payload += pack(
'>Q', timeLastReceivedMessageFromThisNode) # now uses 64-bit time
payload += pack('>I', streamNumber)
payload += pack(
'>q', services) # service bit flags offered by this node
payload += '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF' + \
socket.inet_aton(host)
payload += pack('>H', port)
payload = encodeVarint(numberOfAddressesInAddrMessage) + payload
datatosend = '\xE9\xBE\xB4\xD9addr\x00\x00\x00\x00\x00\x00\x00\x00'
datatosend = datatosend + pack('>L', len(payload)) # payload length
datatosend = datatosend + hashlib.sha512(payload).digest()[0:4]
datatosend = datatosend + payload
try: try:
# To prevent some network analysis, 'leak' the data out self.sock.sendall(datatosend)
# to our peer after waiting a random amount of time
# unless we have a long list of messages in our queue
# to send.
random.seed()
time.sleep(random.randrange(0, 10))
self.sock.sendall(data)
self.lastTimeISentData = int(time.time()) self.lastTimeISentData = int(time.time())
except: except:
print 'sendaddr: self.sock.sendall failed' print 'sendaddr: self.sock.sendall failed'
@ -118,17 +138,19 @@ class sendDataThread(threading.Thread):
shared.sendDataQueues.remove(self.mailbox) shared.sendDataQueues.remove(self.mailbox)
print 'sendDataThread thread (ID:', str(id(self)) + ') ending now. Was connected to', self.peer print 'sendDataThread thread (ID:', str(id(self)) + ') ending now. Was connected to', self.peer
break break
elif command == 'advertiseobject':
self.objectHashHolderInstance.holdHash(data)
elif command == 'sendinv': elif command == 'sendinv':
if data not in self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware: payload = ''
payload = '\x01' + data for hash in data:
if hash not in self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware:
payload += hash
if payload != '':
payload = encodeVarint(len(payload)/32) + payload
headerData = '\xe9\xbe\xb4\xd9' # magic bits, slighly different from Bitcoin's magic bits. headerData = '\xe9\xbe\xb4\xd9' # magic bits, slighly different from Bitcoin's magic bits.
headerData += 'inv\x00\x00\x00\x00\x00\x00\x00\x00\x00' headerData += 'inv\x00\x00\x00\x00\x00\x00\x00\x00\x00'
headerData += pack('>L', len(payload)) headerData += pack('>L', len(payload))
headerData += hashlib.sha512(payload).digest()[:4] headerData += hashlib.sha512(payload).digest()[:4]
# To prevent some network analysis, 'leak' the data out
# to our peer after waiting a random amount of time
random.seed()
time.sleep(random.randrange(0, 10))
try: try:
self.sock.sendall(headerData + payload) self.sock.sendall(headerData + payload)
self.lastTimeISentData = int(time.time()) self.lastTimeISentData = int(time.time())
@ -167,4 +189,4 @@ class sendDataThread(threading.Thread):
with shared.printLock: with shared.printLock:
print 'sendDataThread ID:', id(self), 'ignoring command', command, 'because the thread is not in stream', deststream print 'sendDataThread ID:', id(self), 'ignoring command', command, 'because the thread is not in stream', deststream
self.objectHashHolderInstance.close()

View File

@ -2,10 +2,16 @@ import threading
import shared import shared
import time import time
import sys import sys
import pickle
import tr#anslate
from helper_sql import *
from debug import logger
'''The singleCleaner class is a timer-driven thread that cleans data structures to free memory, resends messages when a remote node doesn't respond, and sends pong messages to keep connections alive if the network isn't busy. '''The singleCleaner class is a timer-driven thread that cleans data structures to free memory, resends messages when a remote node doesn't respond, and sends pong messages to keep connections alive if the network isn't busy.
It cleans these data structures in memory: It cleans these data structures in memory:
inventory (moves data to the on-disk sql database) inventory (moves data to the on-disk sql database)
inventorySets (clears then reloads data out of sql database)
It cleans these tables on the disk: It cleans these tables on the disk:
inventory (clears data more than 2 days and 12 hours old) inventory (clears data more than 2 days and 12 hours old)
@ -27,21 +33,24 @@ class singleCleaner(threading.Thread):
timeWeLastClearedInventoryAndPubkeysTables = 0 timeWeLastClearedInventoryAndPubkeysTables = 0
while True: while True:
shared.sqlLock.acquire()
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'updateStatusBar', 'Doing housekeeping (Flushing inventory in memory to disk...)')) 'updateStatusBar', 'Doing housekeeping (Flushing inventory in memory to disk...)'))
for hash, storedValue in shared.inventory.items():
objectType, streamNumber, payload, receivedTime = storedValue with shared.inventoryLock: # If you use both the inventoryLock and the sqlLock, always use the inventoryLock OUTSIDE of the sqlLock.
if int(time.time()) - 3600 > receivedTime: with SqlBulkExecute() as sql:
t = (hash, objectType, streamNumber, payload, receivedTime,'') for hash, storedValue in shared.inventory.items():
shared.sqlSubmitQueue.put( objectType, streamNumber, payload, receivedTime = storedValue
'''INSERT INTO inventory VALUES (?,?,?,?,?,?)''') if int(time.time()) - 3600 > receivedTime:
shared.sqlSubmitQueue.put(t) sql.execute(
shared.sqlReturnQueue.get() '''INSERT INTO inventory VALUES (?,?,?,?,?,?)''',
del shared.inventory[hash] hash,
shared.sqlSubmitQueue.put('commit') objectType,
streamNumber,
payload,
receivedTime,
'')
del shared.inventory[hash]
shared.UISignalQueue.put(('updateStatusBar', '')) shared.UISignalQueue.put(('updateStatusBar', ''))
shared.sqlLock.release()
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
0, 'pong', 'no data')) # commands the sendData threads to send out a pong message if they haven't sent anything else in the last five minutes. The socket timeout-time is 10 minutes. 0, 'pong', 'no data')) # commands the sendData threads to send out a pong message if they haven't sent anything else in the last five minutes. The socket timeout-time is 10 minutes.
# If we are running as a daemon then we are going to fill up the UI # If we are running as a daemon then we are going to fill up the UI
@ -53,29 +62,20 @@ class singleCleaner(threading.Thread):
timeWeLastClearedInventoryAndPubkeysTables = int(time.time()) timeWeLastClearedInventoryAndPubkeysTables = int(time.time())
# inventory (moves data from the inventory data structure to # inventory (moves data from the inventory data structure to
# the on-disk sql database) # the on-disk sql database)
shared.sqlLock.acquire()
# inventory (clears pubkeys after 28 days and everything else # inventory (clears pubkeys after 28 days and everything else
# after 2 days and 12 hours) # after 2 days and 12 hours)
t = (int(time.time()) - shared.lengthOfTimeToLeaveObjectsInInventory, int( sqlExecute(
time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys) '''DELETE FROM inventory WHERE (receivedtime<? AND objecttype<>'pubkey') OR (receivedtime<? AND objecttype='pubkey') ''',
shared.sqlSubmitQueue.put( int(time.time()) - shared.lengthOfTimeToLeaveObjectsInInventory,
'''DELETE FROM inventory WHERE (receivedtime<? AND objecttype<>'pubkey') OR (receivedtime<? AND objecttype='pubkey') ''') int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys)
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
# pubkeys # pubkeys
t = (int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys,) sqlExecute(
shared.sqlSubmitQueue.put( '''DELETE FROM pubkeys WHERE time<? AND usedpersonally='no' ''',
'''DELETE FROM pubkeys WHERE time<? AND usedpersonally='no' ''') int(time.time()) - shared.lengthOfTimeToHoldOnToAllPubkeys)
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
t = () queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''select toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber FROM sent WHERE ((status='awaitingpubkey' OR status='msgsent') AND folder='sent') ''') # If the message's folder='trash' then we'll ignore it. '''select toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber FROM sent WHERE ((status='awaitingpubkey' OR status='msgsent') AND folder='sent') ''') # If the message's folder='trash' then we'll ignore it.
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
for row in queryreturn: for row in queryreturn:
if len(row) < 5: if len(row) < 5:
with shared.printLock: with shared.printLock:
@ -96,27 +96,52 @@ class singleCleaner(threading.Thread):
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'updateStatusBar', 'Doing work necessary to again attempt to request a public key...')) 'updateStatusBar', 'Doing work necessary to again attempt to request a public key...'))
t = (int( t = ()
time.time()), pubkeyretrynumber + 1, toripe) sqlExecute(
shared.sqlSubmitQueue.put( '''UPDATE sent SET lastactiontime=?, pubkeyretrynumber=?, status='msgqueued' WHERE toripe=?''',
'''UPDATE sent SET lastactiontime=?, pubkeyretrynumber=?, status='msgqueued' WHERE toripe=?''') int(time.time()),
shared.sqlSubmitQueue.put(t) pubkeyretrynumber + 1,
shared.sqlReturnQueue.get() toripe)
shared.sqlSubmitQueue.put('commit')
shared.workerQueue.put(('sendmessage', '')) shared.workerQueue.put(('sendmessage', ''))
else: # status == msgsent else: # status == msgsent
if int(time.time()) - lastactiontime > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (msgretrynumber))): if int(time.time()) - lastactiontime > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (msgretrynumber))):
print 'It has been a long time and we haven\'t heard an acknowledgement to our msg. Sending again.' print 'It has been a long time and we haven\'t heard an acknowledgement to our msg. Sending again.'
t = (int( sqlExecute(
time.time()), msgretrynumber + 1, 'msgqueued', ackdata) '''UPDATE sent SET lastactiontime=?, msgretrynumber=?, status=? WHERE ackdata=?''',
shared.sqlSubmitQueue.put( int(time.time()),
'''UPDATE sent SET lastactiontime=?, msgretrynumber=?, status=? WHERE ackdata=?''') msgretrynumber + 1,
shared.sqlSubmitQueue.put(t) 'msgqueued',
shared.sqlReturnQueue.get() ackdata)
shared.sqlSubmitQueue.put('commit')
shared.workerQueue.put(('sendmessage', '')) shared.workerQueue.put(('sendmessage', ''))
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'updateStatusBar', 'Doing work necessary to again attempt to deliver a message...')) 'updateStatusBar', 'Doing work necessary to again attempt to deliver a message...'))
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release() # Let's also clear and reload shared.inventorySets to keep it from
# taking up an unnecessary amount of memory.
for streamNumber in shared.inventorySets:
shared.inventorySets[streamNumber] = set()
queryData = sqlQuery('''SELECT hash FROM inventory WHERE streamnumber=?''', streamNumber)
for row in queryData:
shared.inventorySets[streamNumber].add(row[0])
with shared.inventoryLock:
for hash, storedValue in shared.inventory.items():
objectType, streamNumber, payload, receivedTime = storedValue
if streamNumber in shared.inventorySets:
shared.inventorySets[streamNumber].add(hash)
# Let us write out the knowNodes to disk if there is anything new to write out.
if shared.needToWriteKnownNodesToDisk:
shared.knownNodesLock.acquire()
output = open(shared.appdata + 'knownnodes.dat', 'wb')
try:
pickle.dump(shared.knownNodes, output)
output.close()
except Exception as err:
if "Errno 28" in str(err):
logger.fatal('(while receiveDataThread shared.needToWriteKnownNodesToDisk) Alert: Your disk or data storage volume is full. ')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
shared.knownNodesLock.release()
shared.needToWriteKnownNodesToDisk = False
time.sleep(300) time.sleep(300)

View File

@ -10,6 +10,7 @@ import sys
from class_addressGenerator import pointMult from class_addressGenerator import pointMult
import tr import tr
from debug import logger from debug import logger
from helper_sql import *
# This thread, of which there is only one, does the heavy lifting: # This thread, of which there is only one, does the heavy lifting:
# calculating POWs. # calculating POWs.
@ -22,35 +23,23 @@ class singleWorker(threading.Thread):
threading.Thread.__init__(self) threading.Thread.__init__(self)
def run(self): def run(self):
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT toripe FROM sent WHERE ((status='awaitingpubkey' OR status='doingpubkeypow') AND folder='sent')''') '''SELECT toripe FROM sent WHERE ((status='awaitingpubkey' OR status='doingpubkeypow') AND folder='sent')''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
toripe, = row toripe, = row
shared.neededPubkeys[toripe] = 0 shared.neededPubkeys[toripe] = 0
# Initialize the shared.ackdataForWhichImWatching data structure using data # Initialize the shared.ackdataForWhichImWatching data structure using data
# from the sql database. # from the sql database.
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT ackdata FROM sent where (status='msgsent' OR status='doingmsgpow')''') '''SELECT ackdata FROM sent where (status='msgsent' OR status='doingmsgpow')''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
ackdata, = row ackdata, = row
print 'Watching for ackdata', ackdata.encode('hex') print 'Watching for ackdata', ackdata.encode('hex')
shared.ackdataForWhichImWatching[ackdata] = 0 shared.ackdataForWhichImWatching[ackdata] = 0
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT DISTINCT toaddress FROM sent WHERE (status='doingpubkeypow' AND folder='sent')''') '''SELECT DISTINCT toaddress FROM sent WHERE (status='doingpubkeypow' AND folder='sent')''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
toaddress, = row toaddress, = row
self.requestPubKey(toaddress) self.requestPubKey(toaddress)
@ -162,12 +151,13 @@ class singleWorker(threading.Thread):
objectType = 'pubkey' objectType = 'pubkey'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, streamNumber, payload, embeddedTime) objectType, streamNumber, payload, embeddedTime)
shared.inventorySets[streamNumber].add(inventoryHash)
with shared.printLock: with shared.printLock:
print 'broadcasting inv with hash:', inventoryHash.encode('hex') print 'broadcasting inv with hash:', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
shared.UISignalQueue.put(('updateStatusBar', '')) shared.UISignalQueue.put(('updateStatusBar', ''))
shared.config.set( shared.config.set(
myAddress, 'lastpubkeysendtime', str(int(time.time()))) myAddress, 'lastpubkeysendtime', str(int(time.time())))
@ -235,12 +225,13 @@ class singleWorker(threading.Thread):
objectType = 'pubkey' objectType = 'pubkey'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, streamNumber, payload, embeddedTime) objectType, streamNumber, payload, embeddedTime)
shared.inventorySets[streamNumber].add(inventoryHash)
with shared.printLock: with shared.printLock:
print 'broadcasting inv with hash:', inventoryHash.encode('hex') print 'broadcasting inv with hash:', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
shared.UISignalQueue.put(('updateStatusBar', '')) shared.UISignalQueue.put(('updateStatusBar', ''))
# If this is a chan address then we won't send out the pubkey over the # If this is a chan address then we won't send out the pubkey over the
# network but rather will only store it in our pubkeys table so that # network but rather will only store it in our pubkeys table so that
@ -248,26 +239,19 @@ class singleWorker(threading.Thread):
if shared.safeConfigGetBoolean(myAddress, 'chan'): if shared.safeConfigGetBoolean(myAddress, 'chan'):
payload = '\x00' * 8 + payload # Attach a fake nonce on the front payload = '\x00' * 8 + payload # Attach a fake nonce on the front
# just so that it is in the correct format. # just so that it is in the correct format.
t = (hash,payload,embeddedTime,'yes') sqlExecute('''INSERT INTO pubkeys VALUES (?,?,?,?)''',
shared.sqlLock.acquire() hash,
shared.sqlSubmitQueue.put('''INSERT INTO pubkeys VALUES (?,?,?,?)''') payload,
shared.sqlSubmitQueue.put(t) embeddedTime,
shared.sqlReturnQueue.get() 'yes')
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.config.set( shared.config.set(
myAddress, 'lastpubkeysendtime', str(int(time.time()))) myAddress, 'lastpubkeysendtime', str(int(time.time())))
with open(shared.appdata + 'keys.dat', 'wb') as configfile: with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile) shared.config.write(configfile)
def sendBroadcast(self): def sendBroadcast(self):
shared.sqlLock.acquire() queryreturn = sqlQuery(
t = ('broadcastqueued',) '''SELECT fromaddress, subject, message, ackdata FROM sent WHERE status=? and folder='sent' ''', 'broadcastqueued')
shared.sqlSubmitQueue.put(
'''SELECT fromaddress, subject, message, ackdata FROM sent WHERE status=? and folder='sent' ''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: for row in queryreturn:
fromaddress, subject, body, ackdata = row fromaddress, subject, body, ackdata = row
status, addressVersionNumber, streamNumber, ripe = decodeAddress( status, addressVersionNumber, streamNumber, ripe = decodeAddress(
@ -345,89 +329,60 @@ class singleWorker(threading.Thread):
objectType = 'broadcast' objectType = 'broadcast'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, streamNumber, payload, int(time.time())) objectType, streamNumber, payload, int(time.time()))
shared.inventorySets[streamNumber].add(inventoryHash)
with shared.printLock: with shared.printLock:
print 'sending inv (within sendBroadcast function) for object:', inventoryHash.encode('hex') print 'sending inv (within sendBroadcast function) for object:', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Broadcast sent on %1").arg(unicode( shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Broadcast sent on %1").arg(unicode(
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8'))))) strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8')))))
# Update the status of the message in the 'sent' table to have # Update the status of the message in the 'sent' table to have
# a 'broadcastsent' status # a 'broadcastsent' status
shared.sqlLock.acquire() sqlExecute(
t = (inventoryHash,'broadcastsent', int( 'UPDATE sent SET msgid=?, status=?, lastactiontime=? WHERE ackdata=?',
time.time()), ackdata) inventoryHash,
shared.sqlSubmitQueue.put( 'broadcastsent',
'UPDATE sent SET msgid=?, status=?, lastactiontime=? WHERE ackdata=?') int(time.time()),
shared.sqlSubmitQueue.put(t) ackdata)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
def sendMsg(self): def sendMsg(self):
# Check to see if there are any messages queued to be sent # Check to see if there are any messages queued to be sent
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put(
'''SELECT DISTINCT toaddress FROM sent WHERE (status='msgqueued' AND folder='sent')''') '''SELECT DISTINCT toaddress FROM sent WHERE (status='msgqueued' AND folder='sent')''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: # For each address to which we need to send a message, check to see if we have its pubkey already. for row in queryreturn: # For each address to which we need to send a message, check to see if we have its pubkey already.
toaddress, = row toaddress, = row
toripe = decodeAddress(toaddress)[3] toripe = decodeAddress(toaddress)[3]
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put( '''SELECT hash FROM pubkeys WHERE hash=? ''', toripe)
'''SELECT hash FROM pubkeys WHERE hash=? ''')
shared.sqlSubmitQueue.put((toripe,))
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn != []: # If we have the needed pubkey, set the status to doingmsgpow (we'll do it further down) if queryreturn != []: # If we have the needed pubkey, set the status to doingmsgpow (we'll do it further down)
t = (toaddress,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='doingmsgpow' WHERE toaddress=? AND status='msgqueued' ''',
shared.sqlSubmitQueue.put( toaddress)
'''UPDATE sent SET status='doingmsgpow' WHERE toaddress=? AND status='msgqueued' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
else: # We don't have the needed pubkey. Set the status to 'awaitingpubkey' and request it if we haven't already else: # We don't have the needed pubkey. Set the status to 'awaitingpubkey' and request it if we haven't already
if toripe in shared.neededPubkeys: if toripe in shared.neededPubkeys:
# We already sent a request for the pubkey # We already sent a request for the pubkey
t = (toaddress,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='awaitingpubkey' WHERE toaddress=? AND status='msgqueued' ''', toaddress)
shared.sqlSubmitQueue.put(
'''UPDATE sent SET status='awaitingpubkey' WHERE toaddress=? AND status='msgqueued' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('updateSentItemStatusByHash', ( shared.UISignalQueue.put(('updateSentItemStatusByHash', (
toripe, tr.translateText("MainWindow",'Encryption key was requested earlier.')))) toripe, tr.translateText("MainWindow",'Encryption key was requested earlier.'))))
else: else:
# We have not yet sent a request for the pubkey # We have not yet sent a request for the pubkey
t = (toaddress,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='doingpubkeypow' WHERE toaddress=? AND status='msgqueued' ''',
shared.sqlSubmitQueue.put( toaddress)
'''UPDATE sent SET status='doingpubkeypow' WHERE toaddress=? AND status='msgqueued' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('updateSentItemStatusByHash', ( shared.UISignalQueue.put(('updateSentItemStatusByHash', (
toripe, tr.translateText("MainWindow",'Sending a request for the recipient\'s encryption key.')))) toripe, tr.translateText("MainWindow",'Sending a request for the recipient\'s encryption key.'))))
self.requestPubKey(toaddress) self.requestPubKey(toaddress)
shared.sqlLock.acquire()
# Get all messages that are ready to be sent, and also all messages # Get all messages that are ready to be sent, and also all messages
# which we have sent in the last 28 days which were previously marked # which we have sent in the last 28 days which were previously marked
# as 'toodifficult'. If the user as raised the maximum acceptable # as 'toodifficult'. If the user as raised the maximum acceptable
# difficulty then those messages may now be sendable. # difficulty then those messages may now be sendable.
shared.sqlSubmitQueue.put( queryreturn = sqlQuery(
'''SELECT toaddress, toripe, fromaddress, subject, message, ackdata, status FROM sent WHERE (status='doingmsgpow' or status='forcepow' or (status='toodifficult' and lastactiontime>?)) and folder='sent' ''') '''SELECT toaddress, toripe, fromaddress, subject, message, ackdata, status FROM sent WHERE (status='doingmsgpow' or status='forcepow' or (status='toodifficult' and lastactiontime>?)) and folder='sent' ''',
shared.sqlSubmitQueue.put((int(time.time()) - 2419200,)) int(time.time()) - 2419200)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
for row in queryreturn: # For each message we need to send.. for row in queryreturn: # For each message we need to send..
toaddress, toripe, fromaddress, subject, message, ackdata, status = row toaddress, toripe, fromaddress, subject, message, ackdata, status = row
# There is a remote possibility that we may no longer have the # There is a remote possibility that we may no longer have the
@ -436,12 +391,9 @@ class singleWorker(threading.Thread):
# user sends a message but doesn't let the POW function finish, # user sends a message but doesn't let the POW function finish,
# then leaves their client off for a long time which could cause # then leaves their client off for a long time which could cause
# the needed pubkey to expire and be deleted. # the needed pubkey to expire and be deleted.
shared.sqlLock.acquire() queryreturn = sqlQuery(
shared.sqlSubmitQueue.put( '''SELECT hash FROM pubkeys WHERE hash=? ''',
'''SELECT hash FROM pubkeys WHERE hash=? ''') toripe)
shared.sqlSubmitQueue.put((toripe,))
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == [] and toripe not in shared.neededPubkeys: if queryreturn == [] and toripe not in shared.neededPubkeys:
# We no longer have the needed pubkey and we haven't requested # We no longer have the needed pubkey and we haven't requested
# it. # it.
@ -449,14 +401,8 @@ class singleWorker(threading.Thread):
sys.stderr.write( sys.stderr.write(
'For some reason, the status of a message in our outbox is \'doingmsgpow\' even though we lack the pubkey. Here is the RIPE hash of the needed pubkey: %s\n' % toripe.encode('hex')) 'For some reason, the status of a message in our outbox is \'doingmsgpow\' even though we lack the pubkey. Here is the RIPE hash of the needed pubkey: %s\n' % toripe.encode('hex'))
t = (toaddress,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='msgqueued' WHERE toaddress=? AND status='doingmsgpow' ''', toaddress)
shared.sqlSubmitQueue.put(
'''UPDATE sent SET status='msgqueued' WHERE toaddress=? AND status='doingmsgpow' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('updateSentItemStatusByHash', ( shared.UISignalQueue.put(('updateSentItemStatusByHash', (
toripe, tr.translateText("MainWindow",'Sending a request for the recipient\'s encryption key.')))) toripe, tr.translateText("MainWindow",'Sending a request for the recipient\'s encryption key.'))))
self.requestPubKey(toaddress) self.requestPubKey(toaddress)
@ -475,21 +421,15 @@ class singleWorker(threading.Thread):
# mark the pubkey as 'usedpersonally' so that we don't ever delete # mark the pubkey as 'usedpersonally' so that we don't ever delete
# it. # it.
shared.sqlLock.acquire() sqlExecute(
t = (toripe,) '''UPDATE pubkeys SET usedpersonally='yes' WHERE hash=?''',
shared.sqlSubmitQueue.put( toripe)
'''UPDATE pubkeys SET usedpersonally='yes' WHERE hash=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
# Let us fetch the recipient's public key out of our database. If # Let us fetch the recipient's public key out of our database. If
# the required proof of work difficulty is too hard then we'll # the required proof of work difficulty is too hard then we'll
# abort. # abort.
shared.sqlSubmitQueue.put( queryreturn = sqlQuery(
'SELECT transmitdata FROM pubkeys WHERE hash=?') 'SELECT transmitdata FROM pubkeys WHERE hash=?',
shared.sqlSubmitQueue.put((toripe,)) toripe)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
with shared.printLock: with shared.printLock:
sys.stderr.write( sys.stderr.write(
@ -535,6 +475,8 @@ class singleWorker(threading.Thread):
pubEncryptionKeyBase256 = pubkeyPayload[ pubEncryptionKeyBase256 = pubkeyPayload[
readPosition:readPosition + 64] readPosition:readPosition + 64]
readPosition += 64 readPosition += 64
# Let us fetch the amount of work required by the recipient.
if toAddressVersionNumber == 2: if toAddressVersionNumber == 2:
requiredAverageProofOfWorkNonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte requiredAverageProofOfWorkNonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte
requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes requiredPayloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
@ -557,18 +499,14 @@ class singleWorker(threading.Thread):
if (requiredAverageProofOfWorkNonceTrialsPerByte > shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') and shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') != 0) or (requiredPayloadLengthExtraBytes > shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') and shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') != 0): if (requiredAverageProofOfWorkNonceTrialsPerByte > shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') and shared.config.getint('bitmessagesettings', 'maxacceptablenoncetrialsperbyte') != 0) or (requiredPayloadLengthExtraBytes > shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') and shared.config.getint('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') != 0):
# The demanded difficulty is more than we are willing # The demanded difficulty is more than we are willing
# to do. # to do.
shared.sqlLock.acquire() sqlExecute(
t = (ackdata,) '''UPDATE sent SET status='toodifficult' WHERE ackdata=? ''',
shared.sqlSubmitQueue.put( ackdata)
'''UPDATE sent SET status='toodifficult' WHERE ackdata=? ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Problem: The work demanded by the recipient (%1 and %2) is more difficult than you are willing to do.").arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float( shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Problem: The work demanded by the recipient (%1 and %2) is more difficult than you are willing to do.").arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(
requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)).arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8'))))) requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)).arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8')))))
continue continue
embeddedTime = pack('>Q', (int(time.time()) + random.randrange( embeddedTime = pack('>Q', (int(time.time()) + random.randrange(
-300, 300))) # the current time plus or minus five minutes. We will use this time both for our message and for the ackdata packed within our message. -300, 300))) # the current time plus or minus five minutes. We will use this time both for our message and for the ackdata packed within our message.
if fromAddressVersionNumber == 2: if fromAddressVersionNumber == 2:
@ -691,13 +629,7 @@ class singleWorker(threading.Thread):
try: try:
encrypted = highlevelcrypto.encrypt(payload,"04"+pubEncryptionKeyBase256.encode('hex')) encrypted = highlevelcrypto.encrypt(payload,"04"+pubEncryptionKeyBase256.encode('hex'))
except: except:
shared.sqlLock.acquire() sqlExecute('''UPDATE sent SET status='badkey' WHERE ackdata=?''', ackdata)
t = (ackdata,)
shared.sqlSubmitQueue.put('''UPDATE sent SET status='badkey' WHERE ackdata=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr.translateText("MainWindow",'Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1').arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(time.time()))),'utf-8'))))) shared.UISignalQueue.put(('updateSentItemStatusByAckdata',(ackdata,tr.translateText("MainWindow",'Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1').arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(time.time()))),'utf-8')))))
continue continue
encryptedPayload = embeddedTime + encodeVarint(toStreamNumber) + encrypted encryptedPayload = embeddedTime + encodeVarint(toStreamNumber) + encrypted
@ -721,6 +653,7 @@ class singleWorker(threading.Thread):
objectType = 'msg' objectType = 'msg'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, toStreamNumber, encryptedPayload, int(time.time())) objectType, toStreamNumber, encryptedPayload, int(time.time()))
shared.inventorySets[toStreamNumber].add(inventoryHash)
if shared.safeConfigGetBoolean(toaddress, 'chan'): if shared.safeConfigGetBoolean(toaddress, 'chan'):
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Message sent. Sent on %1").arg(unicode( shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Message sent. Sent on %1").arg(unicode(
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8'))))) strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8')))))
@ -730,7 +663,7 @@ class singleWorker(threading.Thread):
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8'))))) strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))), 'utf-8')))))
print 'Broadcasting inv for my msg(within sendmsg function):', inventoryHash.encode('hex') print 'Broadcasting inv for my msg(within sendmsg function):', inventoryHash.encode('hex')
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
# Update the status of the message in the 'sent' table to have a # Update the status of the message in the 'sent' table to have a
# 'msgsent' status or 'msgsentnoackexpected' status. # 'msgsent' status or 'msgsentnoackexpected' status.
@ -738,13 +671,8 @@ class singleWorker(threading.Thread):
newStatus = 'msgsentnoackexpected' newStatus = 'msgsentnoackexpected'
else: else:
newStatus = 'msgsent' newStatus = 'msgsent'
shared.sqlLock.acquire() sqlExecute('''UPDATE sent SET msgid=?, status=? WHERE ackdata=?''',
t = (inventoryHash,newStatus,ackdata,) inventoryHash,newStatus,ackdata)
shared.sqlSubmitQueue.put('''UPDATE sent SET msgid=?, status=? WHERE ackdata=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
def requestPubKey(self, toAddress): def requestPubKey(self, toAddress):
toStatus, addressVersionNumber, streamNumber, ripe = decodeAddress( toStatus, addressVersionNumber, streamNumber, ripe = decodeAddress(
@ -782,18 +710,14 @@ class singleWorker(threading.Thread):
objectType = 'getpubkey' objectType = 'getpubkey'
shared.inventory[inventoryHash] = ( shared.inventory[inventoryHash] = (
objectType, streamNumber, payload, int(time.time())) objectType, streamNumber, payload, int(time.time()))
shared.inventorySets[streamNumber].add(inventoryHash)
print 'sending inv (for the getpubkey message)' print 'sending inv (for the getpubkey message)'
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'sendinv', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
t = (toAddress,) sqlExecute(
shared.sqlLock.acquire() '''UPDATE sent SET status='awaitingpubkey' WHERE toaddress=? AND status='doingpubkeypow' ''',
shared.sqlSubmitQueue.put( toAddress)
'''UPDATE sent SET status='awaitingpubkey' WHERE toaddress=? AND status='doingpubkeypow' ''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(( shared.UISignalQueue.put((
'updateStatusBar', tr.translateText("MainWindow",'Broacasting the public key request. This program will auto-retry if they are offline.'))) 'updateStatusBar', tr.translateText("MainWindow",'Broacasting the public key request. This program will auto-retry if they are offline.')))

View File

@ -7,6 +7,7 @@ import sys
import os import os
from debug import logger from debug import logger
from namecoin import ensureNamecoinOptions from namecoin import ensureNamecoinOptions
import tr#anslate
# This thread exists because SQLITE3 is so un-threadsafe that we must # This thread exists because SQLITE3 is so un-threadsafe that we must
# submit queries to it and it puts results back in a different queue. They # submit queries to it and it puts results back in a different queue. They
@ -18,7 +19,7 @@ class sqlThread(threading.Thread):
def __init__(self): def __init__(self):
threading.Thread.__init__(self) threading.Thread.__init__(self)
def run(self): def run(self):
self.conn = sqlite3.connect(shared.appdata + 'messages.dat') self.conn = sqlite3.connect(shared.appdata + 'messages.dat')
self.conn.text_factory = str self.conn.text_factory = str
self.cur = self.conn.cursor() self.cur = self.conn.cursor()
@ -60,11 +61,10 @@ class sqlThread(threading.Thread):
self.cur.execute( '''INSERT INTO settings VALUES('lastvacuumtime',?)''', ( self.cur.execute( '''INSERT INTO settings VALUES('lastvacuumtime',?)''', (
int(time.time()),)) int(time.time()),))
self.conn.commit() self.conn.commit()
print 'Created messages database file' logger.info('Created messages database file')
except Exception as err: except Exception as err:
if str(err) == 'table inbox already exists': if str(err) == 'table inbox already exists':
with shared.printLock: logger.debug('Database file already exists.')
print 'Database file already exists.'
else: else:
sys.stderr.write( sys.stderr.write(
@ -146,13 +146,13 @@ class sqlThread(threading.Thread):
self.cur.execute(item, parameters) self.cur.execute(item, parameters)
if self.cur.fetchall() == []: if self.cur.fetchall() == []:
# The settings table doesn't exist. We need to make it. # The settings table doesn't exist. We need to make it.
print 'In messages.dat database, creating new \'settings\' table.' logger.debug('In messages.dat database, creating new \'settings\' table.')
self.cur.execute( self.cur.execute(
'''CREATE TABLE settings (key text, value blob, UNIQUE(key) ON CONFLICT REPLACE)''' ) '''CREATE TABLE settings (key text, value blob, UNIQUE(key) ON CONFLICT REPLACE)''' )
self.cur.execute( '''INSERT INTO settings VALUES('version','1')''') self.cur.execute( '''INSERT INTO settings VALUES('version','1')''')
self.cur.execute( '''INSERT INTO settings VALUES('lastvacuumtime',?)''', ( self.cur.execute( '''INSERT INTO settings VALUES('lastvacuumtime',?)''', (
int(time.time()),)) int(time.time()),))
print 'In messages.dat database, removing an obsolete field from the pubkeys table.' logger.debug('In messages.dat database, removing an obsolete field from the pubkeys table.')
self.cur.execute( self.cur.execute(
'''CREATE TEMPORARY TABLE pubkeys_backup(hash blob, transmitdata blob, time int, usedpersonally text, UNIQUE(hash) ON CONFLICT REPLACE);''') '''CREATE TEMPORARY TABLE pubkeys_backup(hash blob, transmitdata blob, time int, usedpersonally text, UNIQUE(hash) ON CONFLICT REPLACE);''')
self.cur.execute( self.cur.execute(
@ -163,17 +163,17 @@ class sqlThread(threading.Thread):
self.cur.execute( self.cur.execute(
'''INSERT INTO pubkeys SELECT hash, transmitdata, time, usedpersonally FROM pubkeys_backup;''') '''INSERT INTO pubkeys SELECT hash, transmitdata, time, usedpersonally FROM pubkeys_backup;''')
self.cur.execute( '''DROP TABLE pubkeys_backup;''') self.cur.execute( '''DROP TABLE pubkeys_backup;''')
print 'Deleting all pubkeys from inventory. They will be redownloaded and then saved with the correct times.' logger.debug('Deleting all pubkeys from inventory. They will be redownloaded and then saved with the correct times.')
self.cur.execute( self.cur.execute(
'''delete from inventory where objecttype = 'pubkey';''') '''delete from inventory where objecttype = 'pubkey';''')
print 'replacing Bitmessage announcements mailing list with a new one.' logger.debug('replacing Bitmessage announcements mailing list with a new one.')
self.cur.execute( self.cur.execute(
'''delete from subscriptions where address='BM-BbkPSZbzPwpVcYZpU4yHwf9ZPEapN5Zx' ''') '''delete from subscriptions where address='BM-BbkPSZbzPwpVcYZpU4yHwf9ZPEapN5Zx' ''')
self.cur.execute( self.cur.execute(
'''INSERT INTO subscriptions VALUES('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''') '''INSERT INTO subscriptions VALUES('Bitmessage new releases/announcements','BM-GtovgYdgs7qXPkoYaRgrLFuFKz1SFpsw',1)''')
print 'Commiting.' logger.debug('Commiting.')
self.conn.commit() self.conn.commit()
print 'Vacuuming message.dat. You might notice that the file size gets much smaller.' logger.debug('Vacuuming message.dat. You might notice that the file size gets much smaller.')
self.cur.execute( ''' VACUUM ''') self.cur.execute( ''' VACUUM ''')
# After code refactoring, the possible status values for sent messages # After code refactoring, the possible status values for sent messages
@ -205,6 +205,14 @@ class sqlThread(threading.Thread):
item = '''update settings set value=? WHERE key='version';''' item = '''update settings set value=? WHERE key='version';'''
parameters = (2,) parameters = (2,)
self.cur.execute(item, parameters) self.cur.execute(item, parameters)
if not shared.config.has_option('bitmessagesettings', 'userlocale'):
shared.config.set('bitmessagesettings', 'userlocale', 'system')
if not shared.config.has_option('bitmessagesettings', 'sendoutgoingconnections'):
shared.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True')
# Are you hoping to add a new option to the keys.dat file of existing
# Bitmessage users? Add it right above this line!
try: try:
testpayload = '\x00\x00' testpayload = '\x00\x00'
@ -219,11 +227,19 @@ class sqlThread(threading.Thread):
self.cur.execute('''DELETE FROM pubkeys WHERE hash='1234' ''') self.cur.execute('''DELETE FROM pubkeys WHERE hash='1234' ''')
self.conn.commit() self.conn.commit()
if transmitdata == '': if transmitdata == '':
sys.stderr.write('Problem: The version of SQLite you have cannot store Null values. Please download and install the latest revision of your version of Python (for example, the latest Python 2.7 revision) and try again.\n') logger.fatal('Problem: The version of SQLite you have cannot store Null values. Please download and install the latest revision of your version of Python (for example, the latest Python 2.7 revision) and try again.\n')
sys.stderr.write('PyBitmessage will now exit very abruptly. You may now see threading errors related to this abrupt exit but the problem you need to solve is related to SQLite.\n\n') logger.fatal('PyBitmessage will now exit very abruptly. You may now see threading errors related to this abrupt exit but the problem you need to solve is related to SQLite.\n\n')
os._exit(0) os._exit(0)
except Exception as err: except Exception as err:
print err if str(err) == 'database or disk is full':
logger.fatal('(While null value test) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
else:
return
else:
logger.error(err)
# Let us check to see the last time we vaccumed the messages.dat file. # Let us check to see the last time we vaccumed the messages.dat file.
# If it has been more than a month let's do it now. # If it has been more than a month let's do it now.
@ -234,8 +250,17 @@ class sqlThread(threading.Thread):
for row in queryreturn: for row in queryreturn:
value, = row value, = row
if int(value) < int(time.time()) - 2592000: if int(value) < int(time.time()) - 2592000:
print 'It has been a long time since the messages.dat file has been vacuumed. Vacuuming now...' logger.info('It has been a long time since the messages.dat file has been vacuumed. Vacuuming now...')
self.cur.execute( ''' VACUUM ''') try:
self.cur.execute( ''' VACUUM ''')
except Exception as err:
if str(err) == 'database or disk is full':
logger.fatal('(While VACUUM) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
else:
return
item = '''update settings set value=? WHERE key='lastvacuumtime';''' item = '''update settings set value=? WHERE key='lastvacuumtime';'''
parameters = (int(time.time()),) parameters = (int(time.time()),)
self.cur.execute(item, parameters) self.cur.execute(item, parameters)
@ -243,18 +268,34 @@ class sqlThread(threading.Thread):
while True: while True:
item = shared.sqlSubmitQueue.get() item = shared.sqlSubmitQueue.get()
if item == 'commit': if item == 'commit':
self.conn.commit() try:
self.conn.commit()
except Exception as err:
if str(err) == 'database or disk is full':
logger.fatal('(While committing) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
else:
return
elif item == 'exit': elif item == 'exit':
self.conn.close() self.conn.close()
with shared.printLock: logger.info('sqlThread exiting gracefully.')
print 'sqlThread exiting gracefully.'
return return
elif item == 'movemessagstoprog': elif item == 'movemessagstoprog':
with shared.printLock: logger.debug('the sqlThread is moving the messages.dat file to the local program directory.')
print 'the sqlThread is moving the messages.dat file to the local program directory.'
self.conn.commit() try:
self.conn.commit()
except Exception as err:
if str(err) == 'database or disk is full':
logger.fatal('(while movemessagstoprog) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
else:
return
self.conn.close() self.conn.close()
shutil.move( shutil.move(
shared.lookupAppdataFolder() + 'messages.dat', 'messages.dat') shared.lookupAppdataFolder() + 'messages.dat', 'messages.dat')
@ -262,10 +303,18 @@ class sqlThread(threading.Thread):
self.conn.text_factory = str self.conn.text_factory = str
self.cur = self.conn.cursor() self.cur = self.conn.cursor()
elif item == 'movemessagstoappdata': elif item == 'movemessagstoappdata':
with shared.printLock: logger.debug('the sqlThread is moving the messages.dat file to the Appdata folder.')
print 'the sqlThread is moving the messages.dat file to the Appdata folder.'
self.conn.commit() try:
self.conn.commit()
except Exception as err:
if str(err) == 'database or disk is full':
logger.fatal('(while movemessagstoappdata) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
else:
return
self.conn.close() self.conn.close()
shutil.move( shutil.move(
'messages.dat', shared.lookupAppdataFolder() + 'messages.dat') 'messages.dat', shared.lookupAppdataFolder() + 'messages.dat')
@ -276,7 +325,16 @@ class sqlThread(threading.Thread):
self.cur.execute('''delete from inbox where folder='trash' ''') self.cur.execute('''delete from inbox where folder='trash' ''')
self.cur.execute('''delete from sent where folder='trash' ''') self.cur.execute('''delete from sent where folder='trash' ''')
self.conn.commit() self.conn.commit()
self.cur.execute( ''' VACUUM ''') try:
self.cur.execute( ''' VACUUM ''')
except Exception as err:
if str(err) == 'database or disk is full':
logger.fatal('(while deleteandvacuume) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
if shared.daemon:
os._exit(0)
else:
return
else: else:
parameters = shared.sqlSubmitQueue.get() parameters = shared.sqlSubmitQueue.get()
# print 'item', item # print 'item', item
@ -284,10 +342,16 @@ class sqlThread(threading.Thread):
try: try:
self.cur.execute(item, parameters) self.cur.execute(item, parameters)
except Exception as err: except Exception as err:
with shared.printLock: if str(err) == 'database or disk is full':
sys.stderr.write('\nMajor error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "' + str( logger.fatal('(while cur.execute) Alert: Your disk or data storage volume is full. sqlThread will now exit.')
item) + '" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: ' + str(repr(parameters)) + '\nHere is the actual error message thrown by the sqlThread: ' + str(err) + '\n') shared.UISignalQueue.put(('alert', (tr.translateText("MainWindow", "Disk full"), tr.translateText("MainWindow", 'Alert: Your disk or data storage volume is full. Bitmessage will now exit.'), True)))
sys.stderr.write('This program shall now abruptly exit!\n') if shared.daemon:
os._exit(0)
else:
return
else:
logger.fatal('Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "%s" Here are the parameters; you might want to censor this data with asterisks (***) as it can contain private information: %s. Here is the actual error message thrown by the sqlThread: %s', str(item), str(repr(parameters)), str(err))
logger.fatal('This program shall now abruptly exit!')
os._exit(0) os._exit(0)

View File

@ -1,22 +1,10 @@
from helper_sql import *
import shared import shared
def insert(t): def insert(t):
shared.sqlLock.acquire() sqlExecute('''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?)''', *t)
shared.sqlSubmitQueue.put(
'''INSERT INTO inbox VALUES (?,?,?,?,?,?,?,?,?)''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
def trash(msgid): def trash(msgid):
t = (msgid,) sqlExecute('''UPDATE inbox SET folder='trash' WHERE msgid=?''', msgid)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put(
'''UPDATE inbox SET folder='trash' WHERE msgid=?''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
shared.UISignalQueue.put(('removeInboxRowByMsgid',msgid)) shared.UISignalQueue.put(('removeInboxRowByMsgid',msgid))

View File

@ -1,11 +1,4 @@
import shared from helper_sql import *
def insert(t): def insert(t):
shared.sqlLock.acquire() sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
shared.sqlSubmitQueue.put(
'''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''')
shared.sqlSubmitQueue.put(t)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()

66
src/helper_sql.py Normal file
View File

@ -0,0 +1,66 @@
import threading
import Queue
sqlSubmitQueue = Queue.Queue() #SQLITE3 is so thread-unsafe that they won't even let you call it from different threads using your own locks. SQL objects can only be called from one thread.
sqlReturnQueue = Queue.Queue()
sqlLock = threading.Lock()
def sqlQuery(sqlStatement, *args):
sqlLock.acquire()
sqlSubmitQueue.put(sqlStatement)
if args == ():
sqlSubmitQueue.put('')
else:
sqlSubmitQueue.put(args)
queryreturn = sqlReturnQueue.get()
sqlLock.release()
return queryreturn
def sqlExecute(sqlStatement, *args):
sqlLock.acquire()
sqlSubmitQueue.put(sqlStatement)
if args == ():
sqlSubmitQueue.put('')
else:
sqlSubmitQueue.put(args)
sqlReturnQueue.get()
sqlSubmitQueue.put('commit')
sqlLock.release()
def sqlStoredProcedure(procName):
sqlLock.acquire()
sqlSubmitQueue.put(procName)
sqlLock.release()
class SqlBulkExecute:
def __enter__(self):
sqlLock.acquire()
return self
def __exit__(self, type, value, traceback):
sqlSubmitQueue.put('commit')
sqlLock.release()
def execute(self, sqlStatement, *args):
sqlSubmitQueue.put(sqlStatement)
if args == ():
sqlSubmitQueue.put('')
else:
sqlSubmitQueue.put(args)
sqlReturnQueue.get()
def query(self, sqlStatement, *args):
sqlSubmitQueue.put(sqlStatement)
if args == ():
sqlSubmitQueue.put('')
else:
sqlSubmitQueue.put(args)
return sqlReturnQueue.get()

View File

@ -9,84 +9,104 @@ from namecoin import ensureNamecoinOptions
storeConfigFilesInSameDirectoryAsProgramByDefault = False # The user may de-select Portable Mode in the settings if they want the config files to stay in the application data folder. storeConfigFilesInSameDirectoryAsProgramByDefault = False # The user may de-select Portable Mode in the settings if they want the config files to stay in the application data folder.
def loadConfig(): def loadConfig():
# First try to load the config file (the keys.dat file) from the program if shared.appdata:
# directory
shared.config.read('keys.dat')
try:
shared.config.get('bitmessagesettings', 'settingsversion')
print 'Loading config files from same directory as program'
shared.appdata = ''
except:
# Could not load the keys.dat file in the program directory. Perhaps it
# is in the appdata directory.
shared.appdata = shared.lookupAppdataFolder()
shared.config = ConfigParser.SafeConfigParser()
shared.config.read(shared.appdata + 'keys.dat') shared.config.read(shared.appdata + 'keys.dat')
#shared.appdata must have been specified as a startup option.
try: try:
shared.config.get('bitmessagesettings', 'settingsversion') shared.config.get('bitmessagesettings', 'settingsversion')
print 'Loading existing config files from', shared.appdata print 'Loading config files from directory specified on startup: ' + shared.appdata
needToCreateKeysFile = False
except: except:
# This appears to be the first time running the program; there is needToCreateKeysFile = True
# no config file (or it cannot be accessed). Create config file.
shared.config.add_section('bitmessagesettings')
shared.config.set('bitmessagesettings', 'settingsversion', '6')
shared.config.set('bitmessagesettings', 'port', '8444')
shared.config.set(
'bitmessagesettings', 'timeformat', '%%a, %%d %%b %%Y %%I:%%M %%p')
shared.config.set('bitmessagesettings', 'blackwhitelist', 'black')
shared.config.set('bitmessagesettings', 'startonlogon', 'false')
if 'linux' in sys.platform:
shared.config.set(
'bitmessagesettings', 'minimizetotray', 'false')
# This isn't implimented yet and when True on
# Ubuntu causes Bitmessage to disappear while
# running when minimized.
else:
shared.config.set(
'bitmessagesettings', 'minimizetotray', 'true')
shared.config.set(
'bitmessagesettings', 'showtraynotifications', 'true')
shared.config.set('bitmessagesettings', 'startintray', 'false')
shared.config.set('bitmessagesettings', 'socksproxytype', 'none')
shared.config.set(
'bitmessagesettings', 'sockshostname', 'localhost')
shared.config.set('bitmessagesettings', 'socksport', '9050')
shared.config.set(
'bitmessagesettings', 'socksauthentication', 'false')
shared.config.set(
'bitmessagesettings', 'sockslisten', 'false')
shared.config.set('bitmessagesettings', 'socksusername', '')
shared.config.set('bitmessagesettings', 'sockspassword', '')
shared.config.set('bitmessagesettings', 'keysencrypted', 'false')
shared.config.set(
'bitmessagesettings', 'messagesencrypted', 'false')
shared.config.set('bitmessagesettings', 'defaultnoncetrialsperbyte', str(
shared.networkDefaultProofOfWorkNonceTrialsPerByte))
shared.config.set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str(
shared.networkDefaultPayloadLengthExtraBytes))
shared.config.set('bitmessagesettings', 'minimizeonclose', 'false')
shared.config.set(
'bitmessagesettings', 'maxacceptablenoncetrialsperbyte', '0')
shared.config.set(
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0')
shared.config.set('bitmessagesettings', 'dontconnect', 'true')
shared.config.set('bitmessagesettings', 'userlocale', 'system')
shared.config.set('bitmessagesettings', 'identicon', 'None')
import random, string
shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons
shared.config.set('bitmessagesettings', 'avatars', 'false')
ensureNamecoinOptions()
if storeConfigFilesInSameDirectoryAsProgramByDefault: else:
# Just use the same directory as the program and forget about shared.config.read('keys.dat')
# the appdata folder try:
shared.appdata = '' shared.config.get('bitmessagesettings', 'settingsversion')
print 'Creating new config files in same directory as program.' print 'Loading config files from same directory as program.'
else: needToCreateKeysFile = False
print 'Creating new config files in', shared.appdata shared.appdata = ''
if not os.path.exists(shared.appdata): except:
os.makedirs(shared.appdata) # Could not load the keys.dat file in the program directory. Perhaps it
if not sys.platform.startswith('win'): # is in the appdata directory.
os.umask(0o077) shared.appdata = shared.lookupAppdataFolder()
with open(shared.appdata + 'keys.dat', 'wb') as configfile: shared.config.read(shared.appdata + 'keys.dat')
shared.config.write(configfile) try:
shared.config.get('bitmessagesettings', 'settingsversion')
print 'Loading existing config files from', shared.appdata
needToCreateKeysFile = False
except:
needToCreateKeysFile = True
if needToCreateKeysFile:
# This appears to be the first time running the program; there is
# no config file (or it cannot be accessed). Create config file.
shared.config.add_section('bitmessagesettings')
shared.config.set('bitmessagesettings', 'settingsversion', '6')
shared.config.set('bitmessagesettings', 'port', '8444')
shared.config.set(
'bitmessagesettings', 'timeformat', '%%a, %%d %%b %%Y %%I:%%M %%p')
shared.config.set('bitmessagesettings', 'blackwhitelist', 'black')
shared.config.set('bitmessagesettings', 'startonlogon', 'false')
if 'linux' in sys.platform:
shared.config.set(
'bitmessagesettings', 'minimizetotray', 'false')
# This isn't implimented yet and when True on
# Ubuntu causes Bitmessage to disappear while
# running when minimized.
else:
shared.config.set(
'bitmessagesettings', 'minimizetotray', 'true')
shared.config.set(
'bitmessagesettings', 'showtraynotifications', 'true')
shared.config.set('bitmessagesettings', 'startintray', 'false')
shared.config.set('bitmessagesettings', 'socksproxytype', 'none')
shared.config.set(
'bitmessagesettings', 'sockshostname', 'localhost')
shared.config.set('bitmessagesettings', 'socksport', '9050')
shared.config.set(
'bitmessagesettings', 'socksauthentication', 'false')
shared.config.set(
'bitmessagesettings', 'sockslisten', 'false')
shared.config.set('bitmessagesettings', 'socksusername', '')
shared.config.set('bitmessagesettings', 'sockspassword', '')
shared.config.set('bitmessagesettings', 'keysencrypted', 'false')
shared.config.set(
'bitmessagesettings', 'messagesencrypted', 'false')
shared.config.set('bitmessagesettings', 'defaultnoncetrialsperbyte', str(
shared.networkDefaultProofOfWorkNonceTrialsPerByte))
shared.config.set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str(
shared.networkDefaultPayloadLengthExtraBytes))
shared.config.set('bitmessagesettings', 'minimizeonclose', 'false')
shared.config.set(
'bitmessagesettings', 'maxacceptablenoncetrialsperbyte', '0')
shared.config.set(
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0')
shared.config.set('bitmessagesettings', 'dontconnect', 'true')
shared.config.set('bitmessagesettings', 'userlocale', 'system')
shared.config.set('bitmessagesettings', 'identicon', 'None')
import random, string
shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons
shared.config.set('bitmessagesettings', 'avatars', 'false')
# Are you hoping to add a new option to the keys.dat file? You're in
# the right place for adding it to users who install the software for
# the first time. But you must also add it to the keys.dat file of
# existing users. To do that, search the class_sqlThread.py file for the
# text: "right above this line!"
ensureNamecoinOptions()
if storeConfigFilesInSameDirectoryAsProgramByDefault:
# Just use the same directory as the program and forget about
# the appdata folder
shared.appdata = ''
print 'Creating new config files in same directory as program.'
else:
print 'Creating new config files in', shared.appdata
if not os.path.exists(shared.appdata):
os.makedirs(shared.appdata)
if not sys.platform.startswith('win'):
os.umask(0o077)
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)

View File

@ -139,7 +139,7 @@ class namecoinConnection (object):
assert False assert False
except Exception as exc: except Exception as exc:
print "Exception testing the namecoin connection:\n%s" % str (exc) print "Namecoin connection test: %s" % str (exc)
return ('failed', "The connection to namecoin failed.") return ('failed', "The connection to namecoin failed.")
# Helper routine that actually performs an JSON RPC call. # Helper routine that actually performs an JSON RPC call.
@ -270,7 +270,7 @@ def ensureNamecoinOptions ():
nmc.close () nmc.close ()
except Exception as exc: except Exception as exc:
print "Failure reading namecoin config file: %s" % str (exc) print "Could not read the Namecoin config file probably because you don't have Namecoin installed. That's ok; we don't really need it. Detailed error message: %s" % str (exc)
# If still nothing found, set empty at least. # If still nothing found, set empty at least.
if (not hasUser): if (not hasUser):

View File

@ -4,7 +4,7 @@
import hashlib import hashlib
from struct import unpack, pack from struct import unpack, pack
import sys import sys
from shared import config from shared import config, frozen
#import os #import os
def _set_idle(): def _set_idle():
@ -24,7 +24,7 @@ def _set_idle():
def _pool_worker(nonce, initialHash, target, pool_size): def _pool_worker(nonce, initialHash, target, pool_size):
_set_idle() _set_idle()
trialValue = 99999999999999999999 trialValue = float('inf')
while trialValue > target: while trialValue > target:
nonce += pool_size nonce += pool_size
trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + initialHash).digest()).digest()[0:8]) trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + initialHash).digest()).digest()[0:8])
@ -32,7 +32,7 @@ def _pool_worker(nonce, initialHash, target, pool_size):
def _doSafePoW(target, initialHash): def _doSafePoW(target, initialHash):
nonce = 0 nonce = 0
trialValue = 99999999999999999999 trialValue = float('inf')
while trialValue > target: while trialValue > target:
nonce += 1 nonce += 1
trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + initialHash).digest()).digest()[0:8]) trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + initialHash).digest()).digest()[0:8])
@ -71,7 +71,7 @@ def _doFastPoW(target, initialHash):
time.sleep(0.2) time.sleep(0.2)
def run(target, initialHash): def run(target, initialHash):
if 'linux' in sys.platform: if frozen == "macosx_app" or not frozen:
return _doFastPoW(target, initialHash) return _doFastPoW(target, initialHash)
else: else:
return _doSafePoW(target, initialHash) return _doSafePoW(target, initialHash)

View File

@ -20,13 +20,14 @@ import sys
import stat import stat
import threading import threading
import time import time
from os import path, environ
# Project imports. # Project imports.
from addresses import * from addresses import *
import highlevelcrypto import highlevelcrypto
import shared import shared
import helper_startup import helper_startup
from helper_sql import *
config = ConfigParser.SafeConfigParser() config = ConfigParser.SafeConfigParser()
@ -35,9 +36,6 @@ MyECSubscriptionCryptorObjects = {}
myAddressesByHash = {} #The key in this dictionary is the RIPE hash which is encoded in an address and value is the address itself. myAddressesByHash = {} #The key in this dictionary is the RIPE hash which is encoded in an address and value is the address itself.
broadcastSendersForWhichImWatching = {} broadcastSendersForWhichImWatching = {}
workerQueue = Queue.Queue() workerQueue = Queue.Queue()
sqlSubmitQueue = Queue.Queue() #SQLITE3 is so thread-unsafe that they won't even let you call it from different threads using your own locks. SQL objects can only be called from one thread.
sqlReturnQueue = Queue.Queue()
sqlLock = threading.Lock()
UISignalQueue = Queue.Queue() UISignalQueue = Queue.Queue()
addressGeneratorQueue = Queue.Queue() addressGeneratorQueue = Queue.Queue()
knownNodesLock = threading.Lock() knownNodesLock = threading.Lock()
@ -55,7 +53,7 @@ alreadyAttemptedConnectionsList = {
alreadyAttemptedConnectionsListLock = threading.Lock() alreadyAttemptedConnectionsListLock = threading.Lock()
alreadyAttemptedConnectionsListResetTime = int( alreadyAttemptedConnectionsListResetTime = int(
time.time()) # used to clear out the alreadyAttemptedConnectionsList periodically so that we will retry connecting to hosts to which we have already tried to connect. time.time()) # used to clear out the alreadyAttemptedConnectionsList periodically so that we will retry connecting to hosts to which we have already tried to connect.
numberOfObjectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHavePerPeer = {} numberOfObjectsThatWeHaveYetToGetPerPeer = {}
neededPubkeys = {} neededPubkeys = {}
eightBytesOfRandomDataUsedToDetectConnectionsToSelf = pack( eightBytesOfRandomDataUsedToDetectConnectionsToSelf = pack(
'>Q', random.randrange(1, 18446744073709551615)) '>Q', random.randrange(1, 18446744073709551615))
@ -64,6 +62,14 @@ successfullyDecryptMessageTimings = [
apiAddressGeneratorReturnQueue = Queue.Queue( apiAddressGeneratorReturnQueue = Queue.Queue(
) # The address generator thread uses this queue to get information back to the API thread. ) # The address generator thread uses this queue to get information back to the API thread.
ackdataForWhichImWatching = {} ackdataForWhichImWatching = {}
clientHasReceivedIncomingConnections = False #used by API command clientStatus
numberOfMessagesProcessed = 0
numberOfBroadcastsProcessed = 0
numberOfPubkeysProcessed = 0
numberOfInventoryLookupsPerformed = 0
daemon = False
inventorySets = {} # key = streamNumer, value = a set which holds the inventory object hashes that we are aware of. This is used whenever we receive an inv message from a peer to check to see what items are new to us. We don't delete things out of it; instead, the singleCleaner thread clears and refills it every couple hours.
needToWriteKnownNodesToDisk = False # If True, the singleCleaner will write it to disk eventually.
#If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them! #If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them!
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work. networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
@ -74,13 +80,13 @@ networkDefaultPayloadLengthExtraBytes = 14000 #To make sending short messages a
# namecoin integration to "namecoind". # namecoin integration to "namecoind".
namecoinDefaultRpcPort = "8336" namecoinDefaultRpcPort = "8336"
# When using py2exe or py2app, the variable frozen is added to the sys
# namespace. This can be used to setup a different code path for
# binary distributions vs source distributions.
frozen = getattr(sys,'frozen', None)
def isInSqlInventory(hash): def isInSqlInventory(hash):
t = (hash,) queryreturn = sqlQuery('''select hash from inventory where hash=?''', hash)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''select hash from inventory where hash=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn == []: if queryreturn == []:
return False return False
else: else:
@ -122,7 +128,11 @@ def assembleVersionMessage(remoteHost, remotePort, myStreamNumber):
def lookupAppdataFolder(): def lookupAppdataFolder():
APPNAME = "PyBitmessage" APPNAME = "PyBitmessage"
from os import path, environ from os import path, environ
if sys.platform == 'darwin': if "BITMESSAGE_HOME" in environ:
dataFolder = environ["BITMESSAGE_HOME"]
if dataFolder[-1] not in [os.path.sep, os.path.altsep]:
dataFolder += os.path.sep
elif sys.platform == 'darwin':
if "HOME" in environ: if "HOME" in environ:
dataFolder = path.join(os.environ["HOME"], "Library/Application Support/", APPNAME) + '/' dataFolder = path.join(os.environ["HOME"], "Library/Application Support/", APPNAME) + '/'
else: else:
@ -157,41 +167,29 @@ def lookupAppdataFolder():
return dataFolder return dataFolder
def isAddressInMyAddressBook(address): def isAddressInMyAddressBook(address):
t = (address,) queryreturn = sqlQuery(
sqlLock.acquire() '''select address from addressbook where address=?''',
sqlSubmitQueue.put('''select address from addressbook where address=?''') address)
sqlSubmitQueue.put(t)
queryreturn = sqlReturnQueue.get()
sqlLock.release()
return queryreturn != [] return queryreturn != []
#At this point we should really just have a isAddressInMy(book, address)... #At this point we should really just have a isAddressInMy(book, address)...
def isAddressInMySubscriptionsList(address): def isAddressInMySubscriptionsList(address):
t = (str(address),) # As opposed to Qt str queryreturn = sqlQuery(
sqlLock.acquire() '''select * from subscriptions where address=?''',
sqlSubmitQueue.put('''select * from subscriptions where address=?''') str(address))
sqlSubmitQueue.put(t)
queryreturn = sqlReturnQueue.get()
sqlLock.release()
return queryreturn != [] return queryreturn != []
def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address): def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address):
if isAddressInMyAddressBook(address): if isAddressInMyAddressBook(address):
return True return True
sqlLock.acquire() queryreturn = sqlQuery('''SELECT address FROM whitelist where address=? and enabled = '1' ''', address)
sqlSubmitQueue.put('''SELECT address FROM whitelist where address=? and enabled = '1' ''')
sqlSubmitQueue.put((address,))
queryreturn = sqlReturnQueue.get()
sqlLock.release()
if queryreturn <> []: if queryreturn <> []:
return True return True
sqlLock.acquire() queryreturn = sqlQuery(
sqlSubmitQueue.put('''select address from subscriptions where address=? and enabled = '1' ''') '''select address from subscriptions where address=? and enabled = '1' ''',
sqlSubmitQueue.put((address,)) address)
queryreturn = sqlReturnQueue.get()
sqlLock.release()
if queryreturn <> []: if queryreturn <> []:
return True return True
return False return False
@ -235,7 +233,7 @@ def reloadMyAddressHashes():
if isEnabled: if isEnabled:
hasEnabledKeys = True hasEnabledKeys = True
status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile) status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile)
if addressVersionNumber == 2 or addressVersionNumber == 3: if addressVersionNumber == 2 or addressVersionNumber == 3 or addressVersionNumber == 4:
# Returns a simple 32 bytes of information encoded in 64 Hex characters, # Returns a simple 32 bytes of information encoded in 64 Hex characters,
# or null if there was an error. # or null if there was an error.
privEncryptionKey = decodeWalletImportFormat( privEncryptionKey = decodeWalletImportFormat(
@ -246,7 +244,7 @@ def reloadMyAddressHashes():
myAddressesByHash[hash] = addressInKeysFile myAddressesByHash[hash] = addressInKeysFile
else: else:
logger.error('Error in reloadMyAddressHashes: Can\'t handle address versions other than 2 or 3.\n') logger.error('Error in reloadMyAddressHashes: Can\'t handle address versions other than 2, 3, or 4.\n')
if not keyfileSecure: if not keyfileSecure:
fixSensitiveFilePermissions(appdata + 'keys.dat', hasEnabledKeys) fixSensitiveFilePermissions(appdata + 'keys.dat', hasEnabledKeys)
@ -255,11 +253,7 @@ def reloadBroadcastSendersForWhichImWatching():
logger.debug('reloading subscriptions...') logger.debug('reloading subscriptions...')
broadcastSendersForWhichImWatching.clear() broadcastSendersForWhichImWatching.clear()
MyECSubscriptionCryptorObjects.clear() MyECSubscriptionCryptorObjects.clear()
sqlLock.acquire() queryreturn = sqlQuery('SELECT address FROM subscriptions where enabled=1')
sqlSubmitQueue.put('SELECT address FROM subscriptions where enabled=1')
sqlSubmitQueue.put('')
queryreturn = sqlReturnQueue.get()
sqlLock.release()
for row in queryreturn: for row in queryreturn:
address, = row address, = row
status,addressVersionNumber,streamNumber,hash = decodeAddress(address) status,addressVersionNumber,streamNumber,hash = decodeAddress(address)
@ -293,12 +287,8 @@ def doCleanShutdown():
# This one last useless query will guarantee that the previous flush committed before we close # This one last useless query will guarantee that the previous flush committed before we close
# the program. # the program.
sqlLock.acquire() sqlQuery('SELECT address FROM subscriptions')
sqlSubmitQueue.put('SELECT address FROM subscriptions') sqlStoredProcedure('exit')
sqlSubmitQueue.put('')
sqlReturnQueue.get()
sqlSubmitQueue.put('exit')
sqlLock.release()
logger.info('Finished flushing inventory.') logger.info('Finished flushing inventory.')
# Wait long enough to guarantee that any running proof of work worker threads will check the # Wait long enough to guarantee that any running proof of work worker threads will check the
@ -315,20 +305,16 @@ def doCleanShutdown():
def broadcastToSendDataQueues(data): def broadcastToSendDataQueues(data):
# logger.debug('running broadcastToSendDataQueues') # logger.debug('running broadcastToSendDataQueues')
for q in sendDataQueues: for q in sendDataQueues:
q.put((data)) q.put(data)
def flushInventory(): def flushInventory():
#Note that the singleCleanerThread clears out the inventory dictionary from time to time, although it only clears things that have been in the dictionary for a long time. This clears the inventory dictionary Now. #Note that the singleCleanerThread clears out the inventory dictionary from time to time, although it only clears things that have been in the dictionary for a long time. This clears the inventory dictionary Now.
sqlLock.acquire() with SqlBulkExecute() as sql:
for hash, storedValue in inventory.items(): for hash, storedValue in inventory.items():
objectType, streamNumber, payload, receivedTime = storedValue objectType, streamNumber, payload, receivedTime = storedValue
t = (hash,objectType,streamNumber,payload,receivedTime,'') sql.execute('''INSERT INTO inventory VALUES (?,?,?,?,?,?)''',
sqlSubmitQueue.put('''INSERT INTO inventory VALUES (?,?,?,?,?,?)''') hash,objectType,streamNumber,payload,receivedTime,'')
sqlSubmitQueue.put(t) del inventory[hash]
sqlReturnQueue.get()
del inventory[hash]
sqlSubmitQueue.put('commit')
sqlLock.release()
def fixPotentiallyInvalidUTF8Data(text): def fixPotentiallyInvalidUTF8Data(text):
try: try:

View File

@ -1,4 +1,5 @@
import shared import shared
import os
# This is used so that the translateText function can be used when we are in daemon mode and not using any QT functions. # This is used so that the translateText function can be used when we are in daemon mode and not using any QT functions.
class translateClass: class translateClass:

Binary file not shown.

View File

@ -17,7 +17,7 @@
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="165"/> <location filename="../bitmessageqt/__init__.py" line="165"/>
<source>Add sender to your Address Book</source> <source>Add sender to your Address Book</source>
<translation>Absender zum Adressbuch hinzufügen.</translation> <translation>Absender zum Adressbuch hinzufügen</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="269"/> <location filename="../bitmessageqt/__init__.py" line="269"/>
@ -920,7 +920,7 @@ p, li { white-space: pre-wrap; }
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="623"/> <location filename="../bitmessageqt/bitmessageui.py" line="623"/>
<source>Ctrl+Q</source> <source>Ctrl+Q</source>
<translation type="unfinished">Strg+Q</translation> <translation>Strg+Q</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="625"/> <location filename="../bitmessageqt/bitmessageui.py" line="625"/>
@ -1487,7 +1487,7 @@ Die Zufallszahlen-Option ist standard, jedoch haben deterministische Adressen ei
<message> <message>
<location filename="../bitmessageqt/settings.py" line="343"/> <location filename="../bitmessageqt/settings.py" line="343"/>
<source>Override automatic language localization (use countycode or language code, e.g. &apos;en_US&apos; or &apos;en&apos;):</source> <source>Override automatic language localization (use countycode or language code, e.g. &apos;en_US&apos; or &apos;en&apos;):</source>
<translation type="unfinished"></translation> <translation>Automatische Sprachauswahl überschreiben (verwenden Sie den Landescode oder Sprachcode, z.B. &quot;de_DE&quot; oder &quot;de&quot;):</translation>
</message> </message>
</context> </context>
</TS> </TS>

Binary file not shown.

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS><TS version="2.0" language="ru" sourcelanguage="en">
<TS version="2.0" language="ru">
<context> <context>
<name>MainWindow</name> <name>MainWindow</name>
<message> <message>
@ -11,7 +10,6 @@
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="163"/> <location filename="../bitmessageqt/__init__.py" line="163"/>
<source>Reply</source> <source>Reply</source>
<translatorcomment>.</translatorcomment>
<translation>Ответить</translation> <translation>Ответить</translation>
</message> </message>
<message> <message>
@ -35,7 +33,7 @@
<translation>Сохранить сообщение как ...</translation> <translation>Сохранить сообщение как ...</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="573"/> <location filename="../bitmessageqt/bitmessageui.py" line="581"/>
<source>New</source> <source>New</source>
<translation>Новый адрес</translation> <translation>Новый адрес</translation>
</message> </message>
@ -90,7 +88,7 @@
<translation>Форсировать отправку</translation> <translation>Форсировать отправку</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="600"/> <location filename="../bitmessageqt/bitmessageui.py" line="608"/>
<source>Add new entry</source> <source>Add new entry</source>
<translation>Добавить новую запись</translation> <translation>Добавить новую запись</translation>
</message> </message>
@ -122,7 +120,7 @@
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="650"/> <location filename="../bitmessageqt/__init__.py" line="650"/>
<source>Acknowledgement of the message received %1</source> <source>Acknowledgement of the message received %1</source>
<translation>Сообщение доставлено %1</translation> <translation>Сообщение доставлено в %1</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="653"/> <location filename="../bitmessageqt/__init__.py" line="653"/>
@ -157,10 +155,10 @@
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="398"/> <location filename="../bitmessageqt/__init__.py" line="398"/>
<source>Since startup on %1</source> <source>Since startup on %1</source>
<translation>С начала работы %1</translation> <translation>С начала работы в %1</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1344"/> <location filename="../bitmessageqt/__init__.py" line="1351"/>
<source>Not Connected</source> <source>Not Connected</source>
<translation>Не соединено</translation> <translation>Не соединено</translation>
</message> </message>
@ -170,9 +168,9 @@
<translation>Показать Bitmessage</translation> <translation>Показать Bitmessage</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="556"/> <location filename="../bitmessageqt/bitmessageui.py" line="564"/>
<source>Send</source> <source>Send</source>
<translation>Отправка</translation> <translation>Отправить</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="836"/> <location filename="../bitmessageqt/__init__.py" line="836"/>
@ -180,23 +178,23 @@
<translation>Подписки</translation> <translation>Подписки</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="597"/> <location filename="../bitmessageqt/bitmessageui.py" line="605"/>
<source>Address Book</source> <source>Address Book</source>
<translation>Адресная книга</translation> <translation>Адресная книга</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="622"/> <location filename="../bitmessageqt/bitmessageui.py" line="630"/>
<source>Quit</source> <source>Quit</source>
<translation>Выйти</translation> <translation>Выйти</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1130"/> <location filename="../bitmessageqt/__init__.py" line="1140"/>
<source>You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file.</source> <source>You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file.</source>
<translation>Вы можете управлять Вашими ключами, отредактировав файл keys.dat, находящийся в той же папке, что и эта программа. <translation>Вы можете управлять Вашими ключами, отредактировав файл keys.dat, находящийся в той же папке, что и эта программа.
Создайте резервную копию этого файла перед тем как будете его редактировать.</translation> Создайте резервную копию этого файла перед тем как будете его редактировать.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1134"/> <location filename="../bitmessageqt/__init__.py" line="1144"/>
<source>You may manage your keys by editing the keys.dat file stored in <source>You may manage your keys by editing the keys.dat file stored in
%1 %1
It is important that you back up this file.</source> It is important that you back up this file.</source>
@ -205,19 +203,19 @@ It is important that you back up this file.</source>
Создайте резервную копию этого файла перед тем как будете его редактировать.</translation> Создайте резервную копию этого файла перед тем как будете его редактировать.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1141"/> <location filename="../bitmessageqt/__init__.py" line="1151"/>
<source>Open keys.dat?</source> <source>Open keys.dat?</source>
<translation>Открыть файл keys.dat?</translation> <translation>Открыть файл keys.dat?</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1138"/> <location filename="../bitmessageqt/__init__.py" line="1148"/>
<source>You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)</source> <source>You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)</source>
<translation>Вы можете управлять Вашими ключами, отредактировав файл keys.dat, находящийся в той же папке, что и эта программа. <translation>Вы можете управлять Вашими ключами, отредактировав файл keys.dat, находящийся в той же папке, что и эта программа.
Создайте резервную копию этого файла перед тем как будете его редактировать. Хотели бы Вы открыть этот файл сейчас? Создайте резервную копию этого файла перед тем как будете его редактировать. Хотели бы Вы открыть этот файл сейчас?
(пожалуйста, закройте Bitmessage до того как Вы внесете в этот файл какие-либо изменения.)</translation> (пожалуйста, закройте Bitmessage до того как Вы внесете в этот файл какие-либо изменения.)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1141"/> <location filename="../bitmessageqt/__init__.py" line="1151"/>
<source>You may manage your keys by editing the keys.dat file stored in <source>You may manage your keys by editing the keys.dat file stored in
%1 %1
It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)</source> It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)</source>
@ -227,192 +225,192 @@ It is important that you back up this file. Would you like to open the file now?
(пожалуйста, закройте Bitmessage до того как Вы внесете в этот файл какие-либо изменения.)</translation> (пожалуйста, закройте Bitmessage до того как Вы внесете в этот файл какие-либо изменения.)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1147"/> <location filename="../bitmessageqt/__init__.py" line="1157"/>
<source>Delete trash?</source> <source>Delete trash?</source>
<translation>Очистить корзину?</translation> <translation>Очистить корзину?</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1147"/> <location filename="../bitmessageqt/__init__.py" line="1157"/>
<source>Are you sure you want to delete all trashed messages?</source> <source>Are you sure you want to delete all trashed messages?</source>
<translation>Вы уверены, что хотите очистить корзину?</translation> <translation>Вы уверены, что хотите очистить корзину?</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1158"/> <location filename="../bitmessageqt/__init__.py" line="1168"/>
<source>bad passphrase</source> <source>bad passphrase</source>
<translation>Неподходящая секретная фраза</translation> <translation>Неподходящая секретная фраза</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1158"/> <location filename="../bitmessageqt/__init__.py" line="1168"/>
<source>You must type your passphrase. If you don&apos;t have one then this is not the form for you.</source> <source>You must type your passphrase. If you don&apos;t have one then this is not the form for you.</source>
<translation>Вы должны ввести секретную фразу. Если Вы не хотите это делать, то Вы выбрали неправильную опцию.</translation> <translation>Вы должны ввести секретную фразу. Если Вы не хотите это делать, то Вы выбрали неправильную опцию.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1265"/> <location filename="../bitmessageqt/__init__.py" line="1274"/>
<source>Processed %1 person-to-person messages.</source> <source>Processed %1 person-to-person messages.</source>
<translation>Обработано %1 сообщений.</translation> <translation>Обработано %1 сообщений.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1270"/> <location filename="../bitmessageqt/__init__.py" line="1278"/>
<source>Processed %1 broadcast messages.</source> <source>Processed %1 broadcast messages.</source>
<translation>Обработано %1 рассылок.</translation> <translation>Обработано %1 рассылок.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1275"/> <location filename="../bitmessageqt/__init__.py" line="1282"/>
<source>Processed %1 public keys.</source> <source>Processed %1 public keys.</source>
<translation>Обработано %1 открытых ключей.</translation> <translation>Обработано %1 открытых ключей.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1319"/> <location filename="../bitmessageqt/__init__.py" line="1326"/>
<source>Total Connections: %1</source> <source>Total Connections: %1</source>
<translation>Всего соединений: %1</translation> <translation>Всего соединений: %1</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1338"/> <location filename="../bitmessageqt/__init__.py" line="1345"/>
<source>Connection lost</source> <source>Connection lost</source>
<translation>Соединение потеряно</translation> <translation>Соединение потеряно</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1379"/> <location filename="../bitmessageqt/__init__.py" line="1386"/>
<source>Connected</source> <source>Connected</source>
<translation>Соединено</translation> <translation>Соединено</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1425"/> <location filename="../bitmessageqt/__init__.py" line="1432"/>
<source>Message trashed</source> <source>Message trashed</source>
<translation>Сообщение удалено</translation> <translation>Сообщение удалено</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1559"/> <location filename="../bitmessageqt/__init__.py" line="1566"/>
<source>Error: Bitmessage addresses start with BM- Please check %1</source> <source>Error: Bitmessage addresses start with BM- Please check %1</source>
<translation>Ошибка: Bitmessage адреса начинаются с BM- Пожалуйста, проверьте %1</translation> <translation>Ошибка: Bitmessage адреса начинаются с BM- Пожалуйста, проверьте %1</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1562"/> <location filename="../bitmessageqt/__init__.py" line="1569"/>
<source>Error: The address %1 is not typed or copied correctly. Please check it.</source> <source>Error: The address %1 is not typed or copied correctly. Please check it.</source>
<translation>Ошибка: адрес %1 внесен или скопирован неправильно. Пожалуйста, перепроверьте.</translation> <translation>Ошибка: адрес %1 внесен или скопирован неправильно. Пожалуйста, перепроверьте.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1565"/> <location filename="../bitmessageqt/__init__.py" line="1572"/>
<source>Error: The address %1 contains invalid characters. Please check it.</source> <source>Error: The address %1 contains invalid characters. Please check it.</source>
<translation>Ошибка: адрес %1 содержит запрещенные символы. Пожалуйста, перепроверьте.</translation> <translation>Ошибка: адрес %1 содержит запрещенные символы. Пожалуйста, перепроверьте.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1568"/> <location filename="../bitmessageqt/__init__.py" line="1575"/>
<source>Error: The address version in %1 is too high. Either you need to upgrade your Bitmessage software or your acquaintance is being clever.</source> <source>Error: The address version in %1 is too high. Either you need to upgrade your Bitmessage software or your acquaintance is being clever.</source>
<translation>Ошибка: версия адреса в %1 слишком новая. Либо Вам нужно обновить Bitmessage, либо Ваш собеседник дал неправильный адрес.</translation> <translation>Ошибка: версия адреса в %1 слишком новая. Либо Вам нужно обновить Bitmessage, либо Ваш собеседник дал неправильный адрес.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1571"/> <location filename="../bitmessageqt/__init__.py" line="1578"/>
<source>Error: Some data encoded in the address %1 is too short. There might be something wrong with the software of your acquaintance.</source> <source>Error: Some data encoded in the address %1 is too short. There might be something wrong with the software of your acquaintance.</source>
<translation>Ошибка: некоторые данные, закодированные в адресе %1, слишком короткие. Возможно, что-то не так с программой Вашего собеседника.</translation> <translation>Ошибка: некоторые данные, закодированные в адресе %1, слишком короткие. Возможно, что-то не так с программой Вашего собеседника.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1574"/> <location filename="../bitmessageqt/__init__.py" line="1581"/>
<source>Error: Some data encoded in the address %1 is too long. There might be something wrong with the software of your acquaintance.</source> <source>Error: Some data encoded in the address %1 is too long. There might be something wrong with the software of your acquaintance.</source>
<translation>Ошибка: некоторые данные, закодированные в адресе %1, слишком длинные. Возможно, что-то не так с программой Вашего собеседника.</translation> <translation>Ошибка: некоторые данные, закодированные в адресе %1, слишком длинные. Возможно, что-то не так с программой Вашего собеседника.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1577"/> <location filename="../bitmessageqt/__init__.py" line="1584"/>
<source>Error: Something is wrong with the address %1.</source> <source>Error: Something is wrong with the address %1.</source>
<translation>Ошибка: что-то не так с адресом %1.</translation> <translation>Ошибка: что-то не так с адресом %1.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1644"/> <location filename="../bitmessageqt/__init__.py" line="1651"/>
<source>Error: You must specify a From address. If you don&apos;t have one, go to the &apos;Your Identities&apos; tab.</source> <source>Error: You must specify a From address. If you don&apos;t have one, go to the &apos;Your Identities&apos; tab.</source>
<translation>Вы должны указать адрес в поле &quot;От кого&quot;. Вы можете найти Ваш адрес во вкладе &quot;Ваши Адреса&quot;.</translation> <translation>Вы должны указать адрес в поле &quot;От кого&quot;. Вы можете найти Ваш адрес во вкладе &quot;Ваши Адреса&quot;.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1588"/> <location filename="../bitmessageqt/__init__.py" line="1595"/>
<source>Sending to your address</source> <source>Sending to your address</source>
<translation>Отправка на Ваш собственный адрес</translation> <translation>Отправка на Ваш собственный адрес</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1588"/> <location filename="../bitmessageqt/__init__.py" line="1595"/>
<source>Error: One of the addresses to which you are sending a message, %1, is yours. Unfortunately the Bitmessage client cannot process its own messages. Please try running a second client on a different computer or within a VM.</source> <source>Error: One of the addresses to which you are sending a message, %1, is yours. Unfortunately the Bitmessage client cannot process its own messages. Please try running a second client on a different computer or within a VM.</source>
<translation>Ошибка: Один из адресов, на который Вы отправляете сообщение, %1, принадлежит Вам. К сожалению, Bitmessage не может отправлять сообщения самому себе. Попробуйте запустить второго клиента на другом компьютере или на виртуальной машине.</translation> <translation>Ошибка: Один из адресов, на который Вы отправляете сообщение, %1, принадлежит Вам. К сожалению, Bitmessage не может отправлять сообщения самому себе. Попробуйте запустить второго клиента на другом компьютере или на виртуальной машине.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1594"/> <location filename="../bitmessageqt/__init__.py" line="1601"/>
<source>Address version number</source> <source>Address version number</source>
<translation>Версия адреса</translation> <translation>Версия адреса</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1594"/> <location filename="../bitmessageqt/__init__.py" line="1601"/>
<source>Concerning the address %1, Bitmessage cannot understand address version numbers of %2. Perhaps upgrade Bitmessage to the latest version.</source> <source>Concerning the address %1, Bitmessage cannot understand address version numbers of %2. Perhaps upgrade Bitmessage to the latest version.</source>
<translation>По поводу адреса %1: Bitmessage не поддерживаем адреса версии %2. Возможно, Вам нужно обновить клиент Bitmessage.</translation> <translation>По поводу адреса %1: Bitmessage не поддерживаем адреса версии %2. Возможно, Вам нужно обновить клиент Bitmessage.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1598"/> <location filename="../bitmessageqt/__init__.py" line="1605"/>
<source>Stream number</source> <source>Stream number</source>
<translation>Номер потока</translation> <translation>Номер потока</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1598"/> <location filename="../bitmessageqt/__init__.py" line="1605"/>
<source>Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.</source> <source>Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.</source>
<translation>По поводу адреса %1: Bitmessage не поддерживаем стрим номер %2. Возможно, Вам нужно обновить клиент Bitmessage.</translation> <translation>По поводу адреса %1: Bitmessage не поддерживаем стрим номер %2. Возможно, Вам нужно обновить клиент Bitmessage.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1603"/> <location filename="../bitmessageqt/__init__.py" line="1610"/>
<source>Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won&apos;t send until you connect.</source> <source>Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won&apos;t send until you connect.</source>
<translation>Внимание: Вы не подключены к сети. Bitmessage проделает необходимые вычисления, чтобы отправить сообщение, но не отправит его до тех пор, пока Вы не подсоединитесь к сети.</translation> <translation>Внимание: Вы не подключены к сети. Bitmessage проделает необходимые вычисления, чтобы отправить сообщение, но не отправит его до тех пор, пока Вы не подсоединитесь к сети.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1640"/> <location filename="../bitmessageqt/__init__.py" line="1647"/>
<source>Your &apos;To&apos; field is empty.</source> <source>Your &apos;To&apos; field is empty.</source>
<translation>Вы не заполнили поле &apos;Кому&apos;.</translation> <translation>Вы не заполнили поле &apos;Кому&apos;.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1695"/> <location filename="../bitmessageqt/__init__.py" line="1702"/>
<source>Work is queued.</source> <source>Work is queued.</source>
<translation>Вычисления поставлены в очередь.</translation> <translation>Вычисления поставлены в очередь.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1717"/> <location filename="../bitmessageqt/__init__.py" line="1724"/>
<source>Right click one or more entries in your address book and select &apos;Send message to this address&apos;.</source> <source>Right click one or more entries in your address book and select &apos;Send message to this address&apos;.</source>
<translation>Нажмите правую кнопку мышки на каком-либо адресе и выберите &quot;Отправить сообщение на этот адрес&quot;.</translation> <translation>Нажмите правую кнопку мышки на каком-либо адресе и выберите &quot;Отправить сообщение на этот адрес&quot;.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1805"/> <location filename="../bitmessageqt/__init__.py" line="1812"/>
<source>Work is queued. %1</source> <source>Work is queued. %1</source>
<translation>Вычисления поставлены в очередь. %1</translation> <translation>Вычисления поставлены в очередь. %1</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1874"/> <location filename="../bitmessageqt/__init__.py" line="1881"/>
<source>New Message</source> <source>New Message</source>
<translation>Новое сообщение</translation> <translation>Новое сообщение</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1874"/> <location filename="../bitmessageqt/__init__.py" line="1881"/>
<source>From </source> <source>From </source>
<translation>От </translation> <translation>От </translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3282"/> <location filename="../bitmessageqt/__init__.py" line="3301"/>
<source>Address is valid.</source> <source>Address is valid.</source>
<translation>Адрес введен правильно.</translation> <translation>Адрес введен правильно.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2440"/> <location filename="../bitmessageqt/__init__.py" line="2453"/>
<source>Error: You cannot add the same address to your address book twice. Try renaming the existing one if you want.</source> <source>Error: You cannot add the same address to your address book twice. Try renaming the existing one if you want.</source>
<translation>Ошибка: Вы не можете добавлять один и тот же адрес в Адресную Книгу несколько раз. Просто переименуйте существующий адрес.</translation> <translation>Ошибка: Вы не можете добавлять один и тот же адрес в Адресную Книгу несколько раз. Просто переименуйте существующий адрес.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2230"/> <location filename="../bitmessageqt/__init__.py" line="2243"/>
<source>The address you entered was invalid. Ignoring it.</source> <source>The address you entered was invalid. Ignoring it.</source>
<translation>Вы ввели неправильный адрес. Это адрес проигнорирован.</translation> <translation>Вы ввели неправильный адрес. Это адрес проигнорирован.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2610"/> <location filename="../bitmessageqt/__init__.py" line="2623"/>
<source>Error: You cannot add the same address to your subsciptions twice. Perhaps rename the existing one if you want.</source> <source>Error: You cannot add the same address to your subsciptions twice. Perhaps rename the existing one if you want.</source>
<translation>Ошибка: Вы не можете добавлять один и тот же адрес в подписку несколько раз. Просто переименуйте существующую подписку.</translation> <translation>Ошибка: Вы не можете добавлять один и тот же адрес в подписку несколько раз. Просто переименуйте существующую подписку.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2046"/> <location filename="../bitmessageqt/__init__.py" line="2056"/>
<source>Restart</source> <source>Restart</source>
<translation>Перезапустить</translation> <translation>Перезапустить</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2040"/> <location filename="../bitmessageqt/__init__.py" line="2048"/>
<source>You must restart Bitmessage for the port number change to take effect.</source> <source>You must restart Bitmessage for the port number change to take effect.</source>
<translation>Вы должны перезапустить Bitmessage, чтобы смена номера порта имела эффект.</translation> <translation>Вы должны перезапустить Bitmessage, чтобы смена номера порта имела эффект.</translation>
</message> </message>
@ -422,167 +420,167 @@ It is important that you back up this file. Would you like to open the file now?
<translation type="obsolete">Bitmessage будет использовать Ваш прокси в дальнейшем, тем не менее, мы рекомендуем перезапустить Bitmessage в ручную, чтобы закрыть уже существующие соединения.</translation> <translation type="obsolete">Bitmessage будет использовать Ваш прокси в дальнейшем, тем не менее, мы рекомендуем перезапустить Bitmessage в ручную, чтобы закрыть уже существующие соединения.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2227"/> <location filename="../bitmessageqt/__init__.py" line="2240"/>
<source>Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want.</source> <source>Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want.</source>
<translation>Ошибка: Вы не можете добавлять один и тот же адрес в список несколько раз. Просто переименуйте существующий адрес.</translation> <translation>Ошибка: Вы не можете добавлять один и тот же адрес в список несколько раз. Просто переименуйте существующий адрес.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2280"/> <location filename="../bitmessageqt/__init__.py" line="2293"/>
<source>Passphrase mismatch</source> <source>Passphrase mismatch</source>
<translation>Секретная фраза не подходит</translation> <translation>Секретная фраза не подходит</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2280"/> <location filename="../bitmessageqt/__init__.py" line="2293"/>
<source>The passphrase you entered twice doesn&apos;t match. Try again.</source> <source>The passphrase you entered twice doesn&apos;t match. Try again.</source>
<translation>Вы ввели две разные секретные фразы. Пожалуйста, повторите заново.</translation> <translation>Вы ввели две разные секретные фразы. Пожалуйста, повторите заново.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2283"/> <location filename="../bitmessageqt/__init__.py" line="2296"/>
<source>Choose a passphrase</source> <source>Choose a passphrase</source>
<translation>Придумайте секретную фразу</translation> <translation>Придумайте секретную фразу</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2283"/> <location filename="../bitmessageqt/__init__.py" line="2296"/>
<source>You really do need a passphrase.</source> <source>You really do need a passphrase.</source>
<translation>Вы действительно должны ввести секретную фразу.</translation> <translation>Вы действительно должны ввести секретную фразу.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2306"/> <location filename="../bitmessageqt/__init__.py" line="2319"/>
<source>All done. Closing user interface...</source> <source>All done. Closing user interface...</source>
<translation>Программа завершена. Закрываем пользовательский интерфейс...</translation> <translation>Программа завершена. Закрываем пользовательский интерфейс...</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2380"/> <location filename="../bitmessageqt/__init__.py" line="2393"/>
<source>Address is gone</source> <source>Address is gone</source>
<translation>Адрес утерян</translation> <translation>Адрес утерян</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2380"/> <location filename="../bitmessageqt/__init__.py" line="2393"/>
<source>Bitmessage cannot find your address %1. Perhaps you removed it?</source> <source>Bitmessage cannot find your address %1. Perhaps you removed it?</source>
<translation>Bitmessage не может найти Ваш адрес %1. Возможно Вы удалили его?</translation> <translation>Bitmessage не может найти Ваш адрес %1. Возможно Вы удалили его?</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2384"/> <location filename="../bitmessageqt/__init__.py" line="2397"/>
<source>Address disabled</source> <source>Address disabled</source>
<translation>Адрес выключен</translation> <translation>Адрес выключен</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2384"/> <location filename="../bitmessageqt/__init__.py" line="2397"/>
<source>Error: The address from which you are trying to send is disabled. You&apos;ll have to enable it on the &apos;Your Identities&apos; tab before using it.</source> <source>Error: The address from which you are trying to send is disabled. You&apos;ll have to enable it on the &apos;Your Identities&apos; tab before using it.</source>
<translation>Ошибка: адрес, с которого Вы пытаетесь отправить, выключен. Вам нужно будет включить этот адрес во вкладке &quot;Ваши адреса&quot;.</translation> <translation>Ошибка: адрес, с которого Вы пытаетесь отправить, выключен. Вам нужно будет включить этот адрес во вкладке &quot;Ваши адреса&quot;.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2437"/> <location filename="../bitmessageqt/__init__.py" line="2450"/>
<source>Entry added to the Address Book. Edit the label to your liking.</source> <source>Entry added to the Address Book. Edit the label to your liking.</source>
<translation>Запись добавлена в Адресную Книгу. Вы можете ее отредактировать.</translation> <translation>Запись добавлена в Адресную Книгу. Вы можете ее отредактировать.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2502"/> <location filename="../bitmessageqt/__init__.py" line="2515"/>
<source>Moved items to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.</source> <source>Moved items to trash. There is no user interface to view your trash, but it is still on disk if you are desperate to get it back.</source>
<translation>Удалено в корзину. Чтобы попасть в корзину, Вам нужно будет найти файл корзины на диске.</translation> <translation>Удалено в корзину. Чтобы попасть в корзину, Вам нужно будет найти файл корзины на диске.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2476"/> <location filename="../bitmessageqt/__init__.py" line="2489"/>
<source>Save As...</source> <source>Save As...</source>
<translation>Сохранить как ...</translation> <translation>Сохранить как ...</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2485"/> <location filename="../bitmessageqt/__init__.py" line="2498"/>
<source>Write error.</source> <source>Write error.</source>
<translation>Ошибка записи.</translation> <translation>Ошибка записи.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2596"/> <location filename="../bitmessageqt/__init__.py" line="2609"/>
<source>No addresses selected.</source> <source>No addresses selected.</source>
<translation>Вы не выбрали адрес.</translation> <translation>Вы не выбрали адрес.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3063"/> <location filename="../bitmessageqt/__init__.py" line="3082"/>
<source>Options have been disabled because they either aren&apos;t applicable or because they haven&apos;t yet been implemented for your operating system.</source> <source>Options have been disabled because they either aren&apos;t applicable or because they haven&apos;t yet been implemented for your operating system.</source>
<translation>Опции были отключены, потому что ли они либо не подходят, либо еще не выполнены под Вашу операционную систему.</translation> <translation>Опции были отключены, потому что ли они либо не подходят, либо еще не выполнены под Вашу операционную систему.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3264"/> <location filename="../bitmessageqt/__init__.py" line="3283"/>
<source>The address should start with &apos;&apos;BM-&apos;&apos;</source> <source>The address should start with &apos;&apos;BM-&apos;&apos;</source>
<translation>Адрес должен начинаться с &quot;BM-&quot;</translation> <translation>Адрес должен начинаться с &quot;BM-&quot;</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3267"/> <location filename="../bitmessageqt/__init__.py" line="3286"/>
<source>The address is not typed or copied correctly (the checksum failed).</source> <source>The address is not typed or copied correctly (the checksum failed).</source>
<translation>Адрес введен или скопирован неверно (контрольная сумма не сходится).</translation> <translation>Адрес введен или скопирован неверно (контрольная сумма не сходится).</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3270"/> <location filename="../bitmessageqt/__init__.py" line="3289"/>
<source>The version number of this address is higher than this software can support. Please upgrade Bitmessage.</source> <source>The version number of this address is higher than this software can support. Please upgrade Bitmessage.</source>
<translation>Версия этого адреса более поздняя, чем Ваша программа. Пожалуйста, обновите программу Bitmessage.</translation> <translation>Версия этого адреса более поздняя, чем Ваша программа. Пожалуйста, обновите программу Bitmessage.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3273"/> <location filename="../bitmessageqt/__init__.py" line="3292"/>
<source>The address contains invalid characters.</source> <source>The address contains invalid characters.</source>
<translation>Адрес содержит запрещенные символы.</translation> <translation>Адрес содержит запрещенные символы.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3276"/> <location filename="../bitmessageqt/__init__.py" line="3295"/>
<source>Some data encoded in the address is too short.</source> <source>Some data encoded in the address is too short.</source>
<translation>Данные, закодированные в адресе, слишком короткие.</translation> <translation>Данные, закодированные в адресе, слишком короткие.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3279"/> <location filename="../bitmessageqt/__init__.py" line="3298"/>
<source>Some data encoded in the address is too long.</source> <source>Some data encoded in the address is too long.</source>
<translation>Данные, закодированные в адресе, слишком длинные.</translation> <translation>Данные, закодированные в адресе, слишком длинные.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3324"/> <location filename="../bitmessageqt/__init__.py" line="3343"/>
<source>You are using TCP port %1. (This can be changed in the settings).</source> <source>You are using TCP port %1. (This can be changed in the settings).</source>
<translation>Вы используете TCP порт %1 (Его можно поменять в настройках).</translation> <translation>Вы используете TCP порт %1 (Его можно поменять в настройках).</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="524"/> <location filename="../bitmessageqt/bitmessageui.py" line="532"/>
<source>Bitmessage</source> <source>Bitmessage</source>
<translation>Bitmessage</translation> <translation>Bitmessage</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="565"/> <location filename="../bitmessageqt/bitmessageui.py" line="573"/>
<source>To</source> <source>To</source>
<translation>Кому</translation> <translation>Кому</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="567"/> <location filename="../bitmessageqt/bitmessageui.py" line="575"/>
<source>From</source> <source>From</source>
<translation>От кого</translation> <translation>От кого</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="569"/> <location filename="../bitmessageqt/bitmessageui.py" line="577"/>
<source>Subject</source> <source>Subject</source>
<translation>Тема</translation> <translation>Тема</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="539"/> <location filename="../bitmessageqt/bitmessageui.py" line="547"/>
<source>Received</source> <source>Received</source>
<translation>Получено</translation> <translation>Получено</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="540"/> <location filename="../bitmessageqt/bitmessageui.py" line="548"/>
<source>Inbox</source> <source>Inbox</source>
<translation>Входящие</translation> <translation>Входящие</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="541"/> <location filename="../bitmessageqt/bitmessageui.py" line="549"/>
<source>Load from Address book</source> <source>Load from Address book</source>
<translation>Взять из адресной книги</translation> <translation>Взять из адресной книги</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="543"/> <location filename="../bitmessageqt/bitmessageui.py" line="551"/>
<source>Message:</source> <source>Message:</source>
<translation>Сообщение:</translation> <translation>Сообщение:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="544"/> <location filename="../bitmessageqt/bitmessageui.py" line="552"/>
<source>Subject:</source> <source>Subject:</source>
<translation>Тема:</translation> <translation>Тема:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="545"/> <location filename="../bitmessageqt/bitmessageui.py" line="553"/>
<source>Send to one or more specific people</source> <source>Send to one or more specific people</source>
<translation>Отправить одному или нескольким указанным получателям</translation> <translation>Отправить одному или нескольким указанным получателям</translation>
</message> </message>
@ -593,184 +591,184 @@ It is important that you back up this file. Would you like to open the file now?
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <translation type="obsolete">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation> &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="551"/> <location filename="../bitmessageqt/bitmessageui.py" line="559"/>
<source>To:</source> <source>To:</source>
<translation>Кому:</translation> <translation>Кому:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="552"/> <location filename="../bitmessageqt/bitmessageui.py" line="560"/>
<source>From:</source> <source>From:</source>
<translation>От:</translation> <translation>От:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="553"/> <location filename="../bitmessageqt/bitmessageui.py" line="561"/>
<source>Broadcast to everyone who is subscribed to your address</source> <source>Broadcast to everyone who is subscribed to your address</source>
<translation>Рассылка всем, кто подписался на Ваш адрес</translation> <translation>Рассылка всем, кто подписался на Ваш адрес</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="555"/> <location filename="../bitmessageqt/bitmessageui.py" line="563"/>
<source>Be aware that broadcasts are only encrypted with your address. Anyone who knows your address can read them.</source> <source>Be aware that broadcasts are only encrypted with your address. Anyone who knows your address can read them.</source>
<translation>Пожалуйста, учитывайте, что рассылки шифруются лишь Вашим адресом. Любой человек, который знает Ваш адрес, сможет прочитать Вашу рассылку.</translation> <translation>Пожалуйста, учитывайте, что рассылки шифруются лишь Вашим адресом. Любой человек, который знает Ваш адрес, сможет прочитать Вашу рассылку.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="571"/> <location filename="../bitmessageqt/bitmessageui.py" line="579"/>
<source>Status</source> <source>Status</source>
<translation>Статус</translation> <translation>Статус</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="572"/> <location filename="../bitmessageqt/bitmessageui.py" line="580"/>
<source>Sent</source> <source>Sent</source>
<translation>Отправленные</translation> <translation>Отправленные</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="576"/> <location filename="../bitmessageqt/bitmessageui.py" line="584"/>
<source>Label (not shown to anyone)</source> <source>Label (not shown to anyone)</source>
<translation>Название (не показывается никому)</translation> <translation>Имя (не показывается никому)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="605"/> <location filename="../bitmessageqt/bitmessageui.py" line="613"/>
<source>Address</source> <source>Address</source>
<translation>Адрес</translation> <translation>Адрес</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="580"/> <location filename="../bitmessageqt/bitmessageui.py" line="588"/>
<source>Stream</source> <source>Stream</source>
<translation>Поток</translation> <translation>Поток</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="581"/> <location filename="../bitmessageqt/bitmessageui.py" line="589"/>
<source>Your Identities</source> <source>Your Identities</source>
<translation>Ваши Адреса</translation> <translation>Ваши Адреса</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="582"/> <location filename="../bitmessageqt/bitmessageui.py" line="590"/>
<source>Here you can subscribe to &apos;broadcast messages&apos; that are sent by other users. Messages will appear in your Inbox. Addresses here override those on the Blacklist tab.</source> <source>Here you can subscribe to &apos;broadcast messages&apos; that are sent by other users. Messages will appear in your Inbox. Addresses here override those on the Blacklist tab.</source>
<translation>Здесь Вы можете подписаться на рассылки от других пользователей. Все рассылки будут появляться у Вас во Входящих. Вы будете следить за всеми адресами, указанными здесь, даже если они в черном списке.</translation> <translation>Здесь Вы можете подписаться на рассылки от других пользователей. Все рассылки будут появляться у Вас во Входящих. Вы будете следить за всеми адресами, указанными здесь, даже если они в черном списке.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="583"/> <location filename="../bitmessageqt/bitmessageui.py" line="591"/>
<source>Add new Subscription</source> <source>Add new Subscription</source>
<translation>Добавить новую подписку</translation> <translation>Добавить новую подписку</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="586"/> <location filename="../bitmessageqt/bitmessageui.py" line="594"/>
<source>Label</source> <source>Label</source>
<translation>Название</translation> <translation>Имя</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="589"/> <location filename="../bitmessageqt/bitmessageui.py" line="597"/>
<source>Subscriptions</source> <source>Subscriptions</source>
<translation>Подписки</translation> <translation>Подписки</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="590"/> <location filename="../bitmessageqt/bitmessageui.py" line="598"/>
<source>The Address book is useful for adding names or labels to other people&apos;s Bitmessage addresses so that you can recognize them more easily in your inbox. You can add entries here using the &apos;Add&apos; button, or from your inbox by right-clicking on a message.</source> <source>The Address book is useful for adding names or labels to other people&apos;s Bitmessage addresses so that you can recognize them more easily in your inbox. You can add entries here using the &apos;Add&apos; button, or from your inbox by right-clicking on a message.</source>
<translation>Адресная книга удобна для присвоения осмысленных имен Bitmessage адресам Ваших друзей. Вы можете добавлять новые записи с помощью кнопки &quot;Добавить новую запись&quot;, или же правым кликом мышки на сообщении.</translation> <translation>Адресная книга удобна для присвоения осмысленных имен Bitmessage адресам Ваших друзей. Вы можете добавлять новые записи с помощью кнопки &quot;Добавить новую запись&quot;, или же правым кликом мышки на сообщении.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="603"/> <location filename="../bitmessageqt/bitmessageui.py" line="611"/>
<source>Name or Label</source> <source>Name or Label</source>
<translation>Название</translation> <translation>Имя</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="598"/> <location filename="../bitmessageqt/bitmessageui.py" line="606"/>
<source>Use a Blacklist (Allow all incoming messages except those on the Blacklist)</source> <source>Use a Blacklist (Allow all incoming messages except those on the Blacklist)</source>
<translation>Использовать черный список (Разрешить все входящие сообщения, кроме указанных в черном списке)</translation> <translation>Использовать черный список (Разрешить все входящие сообщения, кроме указанных в черном списке)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="599"/> <location filename="../bitmessageqt/bitmessageui.py" line="607"/>
<source>Use a Whitelist (Block all incoming messages except those on the Whitelist)</source> <source>Use a Whitelist (Block all incoming messages except those on the Whitelist)</source>
<translation>Использовать белый список (блокировать все входящие сообщения, кроме указанных в белом списке)</translation> <translation>Использовать белый список (блокировать все входящие сообщения, кроме указанных в белом списке)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="606"/> <location filename="../bitmessageqt/bitmessageui.py" line="614"/>
<source>Blacklist</source> <source>Blacklist</source>
<translation>Черный список</translation> <translation>Черный список</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="608"/> <location filename="../bitmessageqt/bitmessageui.py" line="616"/>
<source>Stream #</source> <source>Stream #</source>
<translation> потока</translation> <translation> потока</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="610"/> <location filename="../bitmessageqt/bitmessageui.py" line="618"/>
<source>Connections</source> <source>Connections</source>
<translation>Соединений</translation> <translation>Соединений</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="611"/> <location filename="../bitmessageqt/bitmessageui.py" line="619"/>
<source>Total connections: 0</source> <source>Total connections: 0</source>
<translation>Всего соединений: 0</translation> <translation>Всего соединений: 0</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="612"/> <location filename="../bitmessageqt/bitmessageui.py" line="620"/>
<source>Since startup at asdf:</source> <source>Since startup at asdf:</source>
<translation>С начала работы программы в asdf:</translation> <translation>С начала работы программы в asdf:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="613"/> <location filename="../bitmessageqt/bitmessageui.py" line="621"/>
<source>Processed 0 person-to-person message.</source> <source>Processed 0 person-to-person message.</source>
<translation>Обработано 0 сообщений.</translation> <translation>Обработано 0 сообщений.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="614"/> <location filename="../bitmessageqt/bitmessageui.py" line="622"/>
<source>Processed 0 public key.</source> <source>Processed 0 public key.</source>
<translation>Обработано 0 открытых ключей.</translation> <translation>Обработано 0 открытых ключей.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="615"/> <location filename="../bitmessageqt/bitmessageui.py" line="623"/>
<source>Processed 0 broadcast.</source> <source>Processed 0 broadcast.</source>
<translation>Обработано 0 рассылок.</translation> <translation>Обработано 0 рассылок.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="616"/> <location filename="../bitmessageqt/bitmessageui.py" line="624"/>
<source>Network Status</source> <source>Network Status</source>
<translation>Статус сети</translation> <translation>Статус сети</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="617"/> <location filename="../bitmessageqt/bitmessageui.py" line="625"/>
<source>File</source> <source>File</source>
<translation>Файл</translation> <translation>Файл</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="627"/> <location filename="../bitmessageqt/bitmessageui.py" line="635"/>
<source>Settings</source> <source>Settings</source>
<translation>Настройки</translation> <translation>Настройки</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="624"/> <location filename="../bitmessageqt/bitmessageui.py" line="632"/>
<source>Help</source> <source>Help</source>
<translation>Помощь</translation> <translation>Помощь</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="620"/> <location filename="../bitmessageqt/bitmessageui.py" line="628"/>
<source>Import keys</source> <source>Import keys</source>
<translation>Импортировать ключи</translation> <translation>Импортировать ключи</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="621"/> <location filename="../bitmessageqt/bitmessageui.py" line="629"/>
<source>Manage keys</source> <source>Manage keys</source>
<translation>Управлять ключами</translation> <translation>Управлять ключами</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="626"/> <location filename="../bitmessageqt/bitmessageui.py" line="634"/>
<source>About</source> <source>About</source>
<translation>О программе</translation> <translation>О программе</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="628"/> <location filename="../bitmessageqt/bitmessageui.py" line="636"/>
<source>Regenerate deterministic addresses</source> <source>Regenerate deterministic addresses</source>
<translation>Сгенерировать заново все адреса</translation> <translation>Сгенерировать заново все адреса</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="629"/> <location filename="../bitmessageqt/bitmessageui.py" line="637"/>
<source>Delete all trashed messages</source> <source>Delete all trashed messages</source>
<translation>Стереть все сообщения из корзины</translation> <translation>Стереть все сообщения из корзины</translation>
</message> </message>
@ -780,130 +778,142 @@ p, li { white-space: pre-wrap; }
<translation>Сообщение отправлено в %1</translation> <translation>Сообщение отправлено в %1</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1197"/> <location filename="../bitmessageqt/__init__.py" line="1207"/>
<source>Chan name needed</source> <source>Chan name needed</source>
<translation>Требуется имя chan-а</translation> <translation>Требуется имя chan-а</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1197"/> <location filename="../bitmessageqt/__init__.py" line="1207"/>
<source>You didn&apos;t enter a chan name.</source> <source>You didn&apos;t enter a chan name.</source>
<translation>Вы не ввели имя chan-a.</translation> <translation>Вы не ввели имя chan-a.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1217"/> <location filename="../bitmessageqt/__init__.py" line="1227"/>
<source>Address already present</source> <source>Address already present</source>
<translation>Адрес уже существует</translation> <translation>Адрес уже существует</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1217"/> <location filename="../bitmessageqt/__init__.py" line="1227"/>
<source>Could not add chan because it appears to already be one of your identities.</source> <source>Could not add chan because it appears to already be one of your identities.</source>
<translation>Не могу добавить chan, потому что это один из Ваших уже существующих адресов.</translation> <translation>Не могу добавить chan, потому что это один из Ваших уже существующих адресов.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1222"/> <location filename="../bitmessageqt/__init__.py" line="1232"/>
<source>Success</source> <source>Success</source>
<translation>Отлично</translation> <translation>Отлично</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1192"/> <location filename="../bitmessageqt/__init__.py" line="1202"/>
<source>Successfully created chan. To let others join your chan, give them the chan name and this Bitmessage address: %1. This address also appears in &apos;Your Identities&apos;.</source> <source>Successfully created chan. To let others join your chan, give them the chan name and this Bitmessage address: %1. This address also appears in &apos;Your Identities&apos;.</source>
<translation>Chan был успешно создан. Чтобы добавить других в сhan, сообщите им имя chan-а и этот Bitmessage адрес: %1. Этот адрес также отображается во вкладке &quot;Ваши Адреса&quot;.</translation> <translation>Chan был успешно создан. Чтобы добавить других в сhan, сообщите им имя chan-а и этот Bitmessage адрес: %1. Этот адрес также отображается во вкладке &quot;Ваши Адреса&quot;.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1201"/> <location filename="../bitmessageqt/__init__.py" line="1211"/>
<source>Address too new</source> <source>Address too new</source>
<translation>Адрес слишком новый</translation> <translation>Адрес слишком новый</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1201"/> <location filename="../bitmessageqt/__init__.py" line="1211"/>
<source>Although that Bitmessage address might be valid, its version number is too new for us to handle. Perhaps you need to upgrade Bitmessage.</source> <source>Although that Bitmessage address might be valid, its version number is too new for us to handle. Perhaps you need to upgrade Bitmessage.</source>
<translation>Этот Bitmessage адрес похож на правильный, но его версия этого адреса слишком новая. Возможно, Вам необходимо обновить программу Bitmessage.</translation> <translation>Этот Bitmessage адрес похож на правильный, но его версия этого адреса слишком новая. Возможно, Вам необходимо обновить программу Bitmessage.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1205"/> <location filename="../bitmessageqt/__init__.py" line="1215"/>
<source>Address invalid</source> <source>Address invalid</source>
<translation>Неправильный адрес</translation> <translation>Неправильный адрес</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1205"/> <location filename="../bitmessageqt/__init__.py" line="1215"/>
<source>That Bitmessage address is not valid.</source> <source>That Bitmessage address is not valid.</source>
<translation>Этот Bitmessage адрес введен неправильно.</translation> <translation>Этот Bitmessage адрес введен неправильно.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1213"/> <location filename="../bitmessageqt/__init__.py" line="1223"/>
<source>Address does not match chan name</source> <source>Address does not match chan name</source>
<translation>Адрес не сходится с именем chan-а</translation> <translation>Адрес не сходится с именем chan-а</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1213"/> <location filename="../bitmessageqt/__init__.py" line="1223"/>
<source>Although the Bitmessage address you entered was valid, it doesn&apos;t match the chan name.</source> <source>Although the Bitmessage address you entered was valid, it doesn&apos;t match the chan name.</source>
<translation>Вы ввели верный адрес Bitmessage, но он не сходится с именем chan-а.</translation> <translation>Вы ввели верный адрес Bitmessage, но он не сходится с именем chan-а.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1222"/> <location filename="../bitmessageqt/__init__.py" line="1232"/>
<source>Successfully joined chan. </source> <source>Successfully joined chan. </source>
<translation>Успешно присоединились к chan-у. </translation> <translation>Успешно присоединились к chan-у. </translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="2046"/> <location filename="../bitmessageqt/__init__.py" line="2056"/>
<source>Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any).</source> <source>Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any).</source>
<translation>Bitmessage будет использовать Ваш прокси, начиная прямо сейчас. Тем не менее Вам имеет смысл перезапустить Bitmessage, чтобы закрыть уже существующие соединения.</translation> <translation>Bitmessage будет использовать Ваш прокси, начиная прямо сейчас. Тем не менее Вам имеет смысл перезапустить Bitmessage, чтобы закрыть уже существующие соединения.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3245"/> <location filename="../bitmessageqt/__init__.py" line="3264"/>
<source>This is a chan address. You cannot use it as a pseudo-mailing list.</source> <source>This is a chan address. You cannot use it as a pseudo-mailing list.</source>
<translation>Это адрес chan-а. Вы не можете его использовать как адрес рассылки.</translation> <translation>Это адрес chan-а. Вы не можете его использовать как адрес рассылки.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="557"/> <location filename="../bitmessageqt/bitmessageui.py" line="565"/>
<source>Search</source> <source>Search</source>
<translation>Поиск</translation> <translation>Поиск</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="558"/> <location filename="../bitmessageqt/bitmessageui.py" line="566"/>
<source>All</source> <source>All</source>
<translation>Всем</translation> <translation>По всем полям</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="562"/> <location filename="../bitmessageqt/bitmessageui.py" line="570"/>
<source>Message</source> <source>Message</source>
<translation>Текст сообщения</translation> <translation>Текст сообщения</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="630"/> <location filename="../bitmessageqt/bitmessageui.py" line="638"/>
<source>Join / Create chan</source> <source>Join / Create chan</source>
<translation>Подсоединиться или создать chan</translation> <translation>Подсоединиться или создать chan</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="173"/> <location filename="../bitmessageqt/__init__.py" line="173"/>
<source>Mark Unread</source> <source>Mark Unread</source>
<translatorcomment>...</translatorcomment> <translation>Отметить как непрочитанное</translation>
<translation type="unfinished">Mark Unread</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="1728"/> <location filename="../bitmessageqt/__init__.py" line="1735"/>
<source>Fetched address from namecoin identity.</source> <source>Fetched address from namecoin identity.</source>
<translation type="unfinished"></translation> <translation>Получить адрес через Namecoin.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/__init__.py" line="3204"/> <location filename="../bitmessageqt/__init__.py" line="3223"/>
<source>Testing...</source> <source>Testing...</source>
<translation type="unfinished"></translation> <translation>Проверяем...</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="542"/> <location filename="../bitmessageqt/bitmessageui.py" line="550"/>
<source>Fetch Namecoin ID</source> <source>Fetch Namecoin ID</source>
<translation type="unfinished"></translation> <translation>Получить Namecoin ID</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="623"/> <location filename="../bitmessageqt/bitmessageui.py" line="631"/>
<source>Ctrl+Q</source> <source>Ctrl+Q</source>
<translation type="unfinished"></translation> <translation>Ctrl+Q</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/bitmessageui.py" line="625"/> <location filename="../bitmessageqt/bitmessageui.py" line="633"/>
<source>F1</source> <source>F1</source>
<translation type="unfinished"></translation> <translation>F1</translation>
</message>
<message>
<location filename="../bitmessageqt/bitmessageui.py" line="554"/>
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:&apos;MS Shell Dlg 2&apos;;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Sans&apos;; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:&apos;MS Shell Dlg 2&apos;;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message> </message>
</context> </context>
<context> <context>
@ -982,7 +992,7 @@ The &apos;Random Number&apos; option is selected by default but deterministic ad
<message> <message>
<location filename="../bitmessageqt/newaddressdialog.py" line="188"/> <location filename="../bitmessageqt/newaddressdialog.py" line="188"/>
<source>Label (not shown to anyone except you)</source> <source>Label (not shown to anyone except you)</source>
<translation>Название (не показывается никому кроме Вас)</translation> <translation>Имя (не показывается никому кроме Вас)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/newaddressdialog.py" line="189"/> <location filename="../bitmessageqt/newaddressdialog.py" line="189"/>
@ -1058,7 +1068,7 @@ The &apos;Random Number&apos; option is selected by default but deterministic ad
<message> <message>
<location filename="../bitmessageqt/newsubscriptiondialog.py" line="58"/> <location filename="../bitmessageqt/newsubscriptiondialog.py" line="58"/>
<source>Label</source> <source>Label</source>
<translation>Название</translation> <translation>Имя</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/newsubscriptiondialog.py" line="59"/> <location filename="../bitmessageqt/newsubscriptiondialog.py" line="59"/>
@ -1111,7 +1121,7 @@ The &apos;Random Number&apos; option is selected by default but deterministic ad
<source>version ?</source> <source>version ?</source>
<translation>версия ?</translation> <translation>версия ?</translation>
</message> </message>
<message utf8="true"> <message encoding="UTF-8">
<location filename="../bitmessageqt/about.py" line="60"/> <location filename="../bitmessageqt/about.py" line="60"/>
<source>Copyright © 2013 Jonathan Warren</source> <source>Copyright © 2013 Jonathan Warren</source>
<translation>Копирайт © 2013 Джонатан Уоррен</translation> <translation>Копирайт © 2013 Джонатан Уоррен</translation>
@ -1132,22 +1142,22 @@ The &apos;Random Number&apos; option is selected by default but deterministic ad
<message> <message>
<location filename="../bitmessageqt/connect.py" line="56"/> <location filename="../bitmessageqt/connect.py" line="56"/>
<source>Bitmessage</source> <source>Bitmessage</source>
<translation type="unfinished">Bitmessage</translation> <translation>Bitmessage</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/connect.py" line="57"/> <location filename="../bitmessageqt/connect.py" line="57"/>
<source>Bitmessage won&apos;t connect to anyone until you let it. </source> <source>Bitmessage won&apos;t connect to anyone until you let it. </source>
<translation type="unfinished"></translation> <translation>Bitmessage не будет соединяться ни с кем, пока Вы не разрешите.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/connect.py" line="58"/> <location filename="../bitmessageqt/connect.py" line="58"/>
<source>Connect now</source> <source>Connect now</source>
<translation type="unfinished"></translation> <translation>Соединиться прямо сейчас</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/connect.py" line="59"/> <location filename="../bitmessageqt/connect.py" line="59"/>
<source>Let me configure special network settings first</source> <source>Let me configure special network settings first</source>
<translation type="unfinished"></translation> <translation>Я хочу сперва настроить сетевые настройки</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1241,7 +1251,7 @@ The &apos;Random Number&apos; option is selected by default but deterministic ad
<message> <message>
<location filename="../bitmessageqt/newchandialog.py" line="101"/> <location filename="../bitmessageqt/newchandialog.py" line="101"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a name for your chan. If you choose a sufficiently complex chan name (like a strong and unique passphrase) and none of your friends share it publicly then the chan will be secure and private. If you and someone else both create a chan with the same chan name then it is currently very likely that they will be the same chan.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter a name for your chan. If you choose a sufficiently complex chan name (like a strong and unique passphrase) and none of your friends share it publicly then the chan will be secure and private. If you and someone else both create a chan with the same chan name then it is currently very likely that they will be the same chan.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Введите имя Вашего chan-a. Если Вы выберете достаточно сложное имя для chan-а (например, сложную и необычную секретную фразу) и никто из Ваших друзей не опубликует эту фразу, то Вам chan будет надежно зашифрован. Если Вы и кто-то другой независимо создадите chan с полностью идентичным именем, то скорее всего Вы получите в итоге один и тот же chan.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message> </message>
</context> </context>
<context> <context>
@ -1305,214 +1315,268 @@ The &apos;Random Number&apos; option is selected by default but deterministic ad
<context> <context>
<name>settingsDialog</name> <name>settingsDialog</name>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="335"/> <location filename="../bitmessageqt/settings.py" line="339"/>
<source>Settings</source> <source>Settings</source>
<translation>Настройки</translation> <translation>Настройки</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="340"/> <location filename="../bitmessageqt/settings.py" line="341"/>
<source>Start Bitmessage on user login</source> <source>Start Bitmessage on user login</source>
<translation>Запускать Bitmessage при входе в систему</translation> <translation>Запускать Bitmessage при входе в систему</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="336"/> <location filename="../bitmessageqt/settings.py" line="344"/>
<source>Start Bitmessage in the tray (don&apos;t show main window)</source> <source>Start Bitmessage in the tray (don&apos;t show main window)</source>
<translation>Запускать Bitmessage в свернутом виде (не показывать главное окно)</translation> <translation>Запускать Bitmessage в свернутом виде (не показывать главное окно)</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="338"/> <location filename="../bitmessageqt/settings.py" line="340"/>
<source>Minimize to tray</source> <source>Minimize to tray</source>
<translation>Сворачивать в трей</translation> <translation>Сворачивать в трей</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="337"/> <location filename="../bitmessageqt/settings.py" line="342"/>
<source>Show notification when message received</source> <source>Show notification when message received</source>
<translation>Показывать уведомления при получении новых сообщений</translation> <translation>Показывать уведомления при получении новых сообщений</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="341"/> <location filename="../bitmessageqt/settings.py" line="343"/>
<source>Run in Portable Mode</source> <source>Run in Portable Mode</source>
<translation>Запустить в переносном режиме</translation> <translation>Запустить в переносном режиме</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="339"/> <location filename="../bitmessageqt/settings.py" line="345"/>
<source>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</source> <source>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</source>
<translation>В переносном режиме, все сообщения и конфигурационные файлы сохраняются в той же самой папке что и сама программа. Это делает более удобным использование Bitmessage с USB-флэшки.</translation> <translation>В переносном режиме, все сообщения и конфигурационные файлы сохраняются в той же самой папке что и сама программа. Это делает более удобным использование Bitmessage с USB-флэшки.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="344"/> <location filename="../bitmessageqt/settings.py" line="357"/>
<source>User Interface</source> <source>User Interface</source>
<translation>Пользовательские</translation> <translation>Пользовательские</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="345"/> <location filename="../bitmessageqt/settings.py" line="358"/>
<source>Listening port</source> <source>Listening port</source>
<translation>Порт прослушивания</translation> <translation>Порт прослушивания</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="346"/> <location filename="../bitmessageqt/settings.py" line="359"/>
<source>Listen for connections on port:</source> <source>Listen for connections on port:</source>
<translation>Прослушивать соединения на порту:</translation> <translation>Прослушивать соединения на порту:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="347"/> <location filename="../bitmessageqt/settings.py" line="360"/>
<source>Proxy server / Tor</source> <source>Proxy server / Tor</source>
<translation>Прокси сервер / Tor</translation> <translation>Прокси сервер / Tor</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="348"/> <location filename="../bitmessageqt/settings.py" line="361"/>
<source>Type:</source> <source>Type:</source>
<translation>Тип:</translation> <translation>Тип:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="349"/> <location filename="../bitmessageqt/settings.py" line="362"/>
<source>none</source> <source>none</source>
<translation>отсутствует</translation> <translation>отсутствует</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="350"/> <location filename="../bitmessageqt/settings.py" line="363"/>
<source>SOCKS4a</source> <source>SOCKS4a</source>
<translation>SOCKS4a</translation> <translation>SOCKS4a</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="351"/> <location filename="../bitmessageqt/settings.py" line="364"/>
<source>SOCKS5</source> <source>SOCKS5</source>
<translation>SOCKS5</translation> <translation>SOCKS5</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="352"/> <location filename="../bitmessageqt/settings.py" line="365"/>
<source>Server hostname:</source> <source>Server hostname:</source>
<translation>Адрес сервера:</translation> <translation>Адрес сервера:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="371"/> <location filename="../bitmessageqt/settings.py" line="384"/>
<source>Port:</source> <source>Port:</source>
<translation>Порт:</translation> <translation>Порт:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="354"/> <location filename="../bitmessageqt/settings.py" line="367"/>
<source>Authentication</source> <source>Authentication</source>
<translation>Авторизация</translation> <translation>Авторизация</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="372"/> <location filename="../bitmessageqt/settings.py" line="385"/>
<source>Username:</source> <source>Username:</source>
<translation>Имя пользователя:</translation> <translation>Имя пользователя:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="356"/> <location filename="../bitmessageqt/settings.py" line="369"/>
<source>Pass:</source> <source>Pass:</source>
<translation>Прль:</translation> <translation>Прль:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="358"/> <location filename="../bitmessageqt/settings.py" line="371"/>
<source>Network Settings</source> <source>Network Settings</source>
<translation>Сетевые настройки</translation> <translation>Сетевые настройки</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="359"/> <location filename="../bitmessageqt/settings.py" line="372"/>
<source>When someone sends you a message, their computer must first complete some work. The difficulty of this work, by default, is 1. You may raise this default for new addresses you create by changing the values here. Any new addresses you create will require senders to meet the higher difficulty. There is one exception: if you add a friend or acquaintance to your address book, Bitmessage will automatically notify them when you next send a message that they need only complete the minimum amount of work: difficulty 1. </source> <source>When someone sends you a message, their computer must first complete some work. The difficulty of this work, by default, is 1. You may raise this default for new addresses you create by changing the values here. Any new addresses you create will require senders to meet the higher difficulty. There is one exception: if you add a friend or acquaintance to your address book, Bitmessage will automatically notify them when you next send a message that they need only complete the minimum amount of work: difficulty 1. </source>
<translation>Когда кто-либо отправляет Вам сообщение, его компьютер должен сперва решить определенную вычислительную задачу. Сложность этой задачи по умолчанию равна 1. Вы можете повысить эту сложность для новых адресов, которые Вы создадите, здесь. Таким образом, любые новые адреса, которые Вы создадите, могут требовать от отправителей сложность большую чем 1. Однако, есть одно исключение: если Вы специально добавите Вашего собеседника в адресную книгу, то Bitmessage автоматически уведомит его о том, что для него минимальная сложность будет составлять всегда всего лишь 1.</translation> <translation>Когда кто-либо отправляет Вам сообщение, его компьютер должен сперва решить определенную вычислительную задачу. Сложность этой задачи по умолчанию равна 1. Вы можете повысить эту сложность для новых адресов, которые Вы создадите, здесь. Таким образом, любые новые адреса, которые Вы создадите, могут требовать от отправителей сложность большую чем 1. Однако, есть одно исключение: если Вы специально добавите Вашего собеседника в адресную книгу, то Bitmessage автоматически уведомит его о том, что для него минимальная сложность будет составлять всегда всего лишь 1.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="360"/> <location filename="../bitmessageqt/settings.py" line="373"/>
<source>Total difficulty:</source> <source>Total difficulty:</source>
<translation>Общая сложность:</translation> <translation>Общая сложность:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="361"/> <location filename="../bitmessageqt/settings.py" line="374"/>
<source>Small message difficulty:</source> <source>Small message difficulty:</source>
<translation>Сложность для маленьких сообщений:</translation> <translation>Сложность для маленьких сообщений:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="362"/> <location filename="../bitmessageqt/settings.py" line="375"/>
<source>The &apos;Small message difficulty&apos; mostly only affects the difficulty of sending small messages. Doubling this value makes it almost twice as difficult to send a small message but doesn&apos;t really affect large messages.</source> <source>The &apos;Small message difficulty&apos; mostly only affects the difficulty of sending small messages. Doubling this value makes it almost twice as difficult to send a small message but doesn&apos;t really affect large messages.</source>
<translation>&quot;Сложность для маленьких сообщений&quot; влияет исключительно на небольшие сообщения. Увеличив это число в два раза, вы сделаете отправку маленьких сообщений в два раза сложнее, в то время как сложность отправки больших сообщений не изменится.</translation> <translation>&quot;Сложность для маленьких сообщений&quot; влияет исключительно на небольшие сообщения. Увеличив это число в два раза, вы сделаете отправку маленьких сообщений в два раза сложнее, в то время как сложность отправки больших сообщений не изменится.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="363"/> <location filename="../bitmessageqt/settings.py" line="376"/>
<source>The &apos;Total difficulty&apos; affects the absolute amount of work the sender must complete. Doubling this value doubles the amount of work.</source> <source>The &apos;Total difficulty&apos; affects the absolute amount of work the sender must complete. Doubling this value doubles the amount of work.</source>
<translation>&quot;Общая сложность&quot; влияет на абсолютное количество вычислений, которые отправитель должен провести, чтобы отправить сообщение. Увеличив это число в два раза, вы увеличите в два раза объем требуемых вычислений.</translation> <translation>&quot;Общая сложность&quot; влияет на абсолютное количество вычислений, которые отправитель должен провести, чтобы отправить сообщение. Увеличив это число в два раза, вы увеличите в два раза объем требуемых вычислений.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="364"/> <location filename="../bitmessageqt/settings.py" line="377"/>
<source>Demanded difficulty</source> <source>Demanded difficulty</source>
<translation>Требуемая сложность</translation> <translation>Требуемая сложность</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="365"/> <location filename="../bitmessageqt/settings.py" line="378"/>
<source>Here you may set the maximum amount of work you are willing to do to send a message to another person. Setting these values to 0 means that any value is acceptable.</source> <source>Here you may set the maximum amount of work you are willing to do to send a message to another person. Setting these values to 0 means that any value is acceptable.</source>
<translation>Здесь Вы можете установить максимальную вычислительную работу, которую Вы согласны проделать, чтобы отправить сообщение другому пользователю. Ноль означает, чтобы любое значение допустимо.</translation> <translation>Здесь Вы можете установить максимальную вычислительную работу, которую Вы согласны проделать, чтобы отправить сообщение другому пользователю. Ноль означает, чтобы любое значение допустимо.</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="366"/> <location filename="../bitmessageqt/settings.py" line="379"/>
<source>Maximum acceptable total difficulty:</source> <source>Maximum acceptable total difficulty:</source>
<translation>Макс допустимая общая сложность:</translation> <translation>Макс допустимая общая сложность:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="367"/> <location filename="../bitmessageqt/settings.py" line="380"/>
<source>Maximum acceptable small message difficulty:</source> <source>Maximum acceptable small message difficulty:</source>
<translation>Макс допустимая сложность для маленький сообщений:</translation> <translation>Макс допустимая сложность для маленький сообщений:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="368"/> <location filename="../bitmessageqt/settings.py" line="381"/>
<source>Max acceptable difficulty</source> <source>Max acceptable difficulty</source>
<translation>Макс допустимая сложность</translation> <translation>Макс допустимая сложность</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="357"/> <location filename="../bitmessageqt/settings.py" line="370"/>
<source>Listen for incoming connections when using proxy</source> <source>Listen for incoming connections when using proxy</source>
<translation>Прослушивать входящие соединения если используется прокси</translation> <translation>Прослушивать входящие соединения если используется прокси</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="342"/> <location filename="../bitmessageqt/settings.py" line="346"/>
<source>Willingly include unencrypted destination address when sending to a mobile device</source> <source>Willingly include unencrypted destination address when sending to a mobile device</source>
<translation type="unfinished"></translation> <translation>Специально прикреплять незашифрованный адрес получателя, когда посылаем на мобильное устройство</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="343"/> <location filename="../bitmessageqt/settings.py" line="382"/>
<source>Override automatic language localization (use countycode or language code, e.g. &apos;en_US&apos; or &apos;en&apos;):</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="369"/>
<source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Bitmessage can utilize a different Bitcoin-based program called Namecoin to make addresses human-friendly. For example, instead of having to tell your friend your long Bitmessage address, you can simply tell him to send a message to &lt;span style=&quot; font-style:italic;&quot;&gt;test. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;(Getting your own Bitmessage address into Namecoin is still rather difficult).&lt;/p&gt;&lt;p&gt;Bitmessage can use either namecoind directly or a running nmcontrol instance.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source> <source>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Bitmessage can utilize a different Bitcoin-based program called Namecoin to make addresses human-friendly. For example, instead of having to tell your friend your long Bitmessage address, you can simply tell him to send a message to &lt;span style=&quot; font-style:italic;&quot;&gt;test. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;(Getting your own Bitmessage address into Namecoin is still rather difficult).&lt;/p&gt;&lt;p&gt;Bitmessage can use either namecoind directly or a running nmcontrol instance.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
<translation type="unfinished"></translation> <translation>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Bitmessage умеет пользоваться программой Namecoin для того, чтобы сделать адреса более дружественными для пользователей. Например, вместо того, чтобы диктовать Вашему другу длинный и нудный адрес Bitmessage, Вы можете попросить его отправить сообщение на адрес вида &lt;span style=&quot; font-style:italic;&quot;&gt;test. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;(Перенести Ваш Bitmessage адрес в Namecoin по-прежнему пока довольно сложно).&lt;/p&gt;&lt;p&gt;Bitmessage может использовать либо прямо namecoind, либо уже запущенную программу nmcontrol.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="370"/> <location filename="../bitmessageqt/settings.py" line="383"/>
<source>Host:</source> <source>Host:</source>
<translation type="unfinished"></translation> <translation>Адрес:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="373"/> <location filename="../bitmessageqt/settings.py" line="386"/>
<source>Password:</source> <source>Password:</source>
<translation type="unfinished"></translation> <translation>Пароль:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="374"/> <location filename="../bitmessageqt/settings.py" line="387"/>
<source>Test</source> <source>Test</source>
<translation type="unfinished"></translation> <translation>Проверить</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="375"/> <location filename="../bitmessageqt/settings.py" line="388"/>
<source>Connect to:</source> <source>Connect to:</source>
<translation type="unfinished"></translation> <translation>Подсоединиться к:</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="376"/> <location filename="../bitmessageqt/settings.py" line="389"/>
<source>Namecoind</source> <source>Namecoind</source>
<translation type="unfinished"></translation> <translation>Namecoind</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="377"/> <location filename="../bitmessageqt/settings.py" line="390"/>
<source>NMControl</source> <source>NMControl</source>
<translation type="unfinished"></translation> <translation>NMControl</translation>
</message> </message>
<message> <message>
<location filename="../bitmessageqt/settings.py" line="378"/> <location filename="../bitmessageqt/settings.py" line="391"/>
<source>Namecoin integration</source> <source>Namecoin integration</source>
<translation type="unfinished"></translation> <translation>Интеграция с Namecoin</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="347"/>
<source>Interface Language</source>
<translation>Язык интерфейса</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="348"/>
<source>System Settings</source>
<comment>system</comment>
<translation>Язык по умолчанию</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="349"/>
<source>English</source>
<comment>en</comment>
<translation>English</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="350"/>
<source>Esperanto</source>
<comment>eo</comment>
<translation>Esperanto</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="351"/>
<source>Fran&#xc3;&#xa7;ais</source>
<comment>fr</comment>
<translation>Francais</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="352"/>
<source>Deutsch</source>
<comment>de</comment>
<translation>Deutsch</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="353"/>
<source>Espa&#xc3;&#xb1;ol</source>
<comment>es</comment>
<translation>Espanol</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="354"/>
<source>&#xd0;&#xa0;&#xd1;&#x83;&#xd1;&#x81;&#xd1;&#x81;&#xd0;&#xba;&#xd0;&#xb8;&#xd0;&#xb9;</source>
<comment>ru</comment>
<translation>Русский</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="355"/>
<source>Pirate English</source>
<comment>en_pirate</comment>
<translation>Pirate English</translation>
</message>
<message>
<location filename="../bitmessageqt/settings.py" line="356"/>
<source>Other (set in keys.dat)</source>
<comment>other</comment>
<translation>Другие (настроено в keys.dat)</translation>
</message> </message>
</context> </context>
</TS> </TS>