2019-09-20 16:49:04 +05:30
|
|
|
"""
|
2019-12-26 21:26:04 +05:30
|
|
|
src/state.py
|
|
|
|
=================================
|
2019-09-20 16:49:04 +05:30
|
|
|
"""
|
2017-01-12 06:58:35 +01:00
|
|
|
import collections
|
|
|
|
|
2017-01-11 14:27:19 +01:00
|
|
|
neededPubkeys = {}
|
2017-02-06 17:47:05 +01:00
|
|
|
streamsInWhichIAmParticipating = []
|
2019-12-26 21:26:04 +05:30
|
|
|
# For UPnP
|
2017-01-11 14:27:19 +01:00
|
|
|
extPort = None
|
2019-12-26 21:26:04 +05:30
|
|
|
# for Tor hidden service
|
2017-01-11 14:27:19 +01:00
|
|
|
socksIP = None
|
2019-12-26 21:26:04 +05:30
|
|
|
# Network protocols availability, initialised below
|
|
|
|
networkProtocolAvailability = None
|
|
|
|
appdata = '' # holds the location of the application data storage directory
|
|
|
|
# Set to 1 by the doCleanShutdown function.
|
|
|
|
# Used to tell the proof of work worker threads to exit.
|
2018-04-18 13:34:12 +03:00
|
|
|
shutdown = 0
|
2018-04-09 14:38:48 +10:00
|
|
|
# Component control flags - set on startup, do not change during runtime
|
|
|
|
# The defaults are for standalone GUI (default operating mode)
|
2019-12-26 21:26:04 +05:30
|
|
|
enableNetwork = True # enable network threads
|
|
|
|
enableObjProc = True # enable object processing threads
|
|
|
|
enableAPI = True # enable API (if configured)
|
|
|
|
enableGUI = True # enable GUI (QT or ncurses)
|
|
|
|
enableSTDIO = False # enable STDIO threads
|
2017-02-02 15:48:56 +01:00
|
|
|
curses = False
|
2019-12-26 21:26:04 +05:30
|
|
|
sqlReady = False # set to true by sqlTread when ready for processing
|
2017-05-25 23:04:33 +02:00
|
|
|
maximumNumberOfHalfOpenConnections = 0
|
|
|
|
|
2019-11-05 18:54:04 +02:00
|
|
|
maximumLengthOfTimeToBotherResendingMessages = 0
|
|
|
|
|
2017-05-29 00:24:07 +02:00
|
|
|
invThread = None
|
2017-07-05 08:57:44 +02:00
|
|
|
addrThread = None
|
2017-07-05 09:25:49 +02:00
|
|
|
downloadThread = None
|
2018-12-18 22:47:34 +01:00
|
|
|
uploadThread = None
|
2017-05-31 00:04:21 +02:00
|
|
|
ownAddresses = {}
|
2017-01-12 06:58:35 +01:00
|
|
|
# If the trustedpeer option is specified in keys.dat then this will
|
|
|
|
# contain a Peer which will be connected to instead of using the
|
|
|
|
# addresses advertised by other peers. The client will only connect to
|
|
|
|
# this peer and the timing attack mitigation will be disabled in order
|
|
|
|
# to download data faster. The expected use case is where the user has
|
|
|
|
# a fast connection to a trusted server where they run a BitMessage
|
|
|
|
# daemon permanently. If they then run a second instance of the client
|
|
|
|
# on a local machine periodically when they want to check for messages
|
|
|
|
# it will sync with the network a lot faster without compromising
|
|
|
|
# security.
|
|
|
|
trustedPeer = None
|
2017-08-06 21:29:54 +02:00
|
|
|
discoveredPeers = {}
|
2017-01-12 06:58:35 +01:00
|
|
|
Peer = collections.namedtuple('Peer', ['host', 'port'])
|
2017-01-12 19:18:56 +01:00
|
|
|
|
2019-09-20 16:49:04 +05:30
|
|
|
|
|
|
|
def resetNetworkProtocolAvailability():
|
|
|
|
"""This method helps to reset the availability of network protocol"""
|
|
|
|
# pylint: disable=global-statement
|
|
|
|
global networkProtocolAvailability
|
|
|
|
networkProtocolAvailability = {'IPv4': None, 'IPv6': None, 'onion': None}
|
|
|
|
|
|
|
|
|
|
|
|
resetNetworkProtocolAvailability()
|
|
|
|
|
2018-02-03 11:46:39 +01:00
|
|
|
dandelion = 0
|
2018-04-05 12:50:34 +03:00
|
|
|
|
|
|
|
testmode = False
|
2018-07-05 19:07:16 +05:30
|
|
|
|
|
|
|
kivy = False
|
2018-09-04 18:14:28 +05:30
|
|
|
|
|
|
|
association = ''
|
2019-05-09 18:18:29 +05:30
|
|
|
|
|
|
|
kivyapp = None
|
|
|
|
|
2019-05-28 16:42:51 +05:30
|
|
|
navinstance = None
|
|
|
|
|
2019-10-03 21:57:54 +05:30
|
|
|
mail_id = 0
|
2019-05-28 16:42:51 +05:30
|
|
|
|
2019-06-06 19:18:20 +05:30
|
|
|
myAddressObj = None
|
2019-05-28 16:42:51 +05:30
|
|
|
|
2019-06-06 19:18:20 +05:30
|
|
|
detailPageType = None
|
|
|
|
|
|
|
|
ackdata = None
|
|
|
|
|
2019-06-28 20:24:47 +05:30
|
|
|
status = None
|
|
|
|
|
|
|
|
screen_density = None
|
|
|
|
|
|
|
|
msg_counter_objs = None
|
|
|
|
|
|
|
|
check_sent_acc = None
|
|
|
|
|
|
|
|
sent_count = 0
|
|
|
|
|
|
|
|
inbox_count = 0
|
|
|
|
|
2019-07-17 14:20:27 +05:30
|
|
|
trash_count = 0
|
|
|
|
|
2019-08-02 14:41:33 +05:30
|
|
|
draft_count = 0
|
|
|
|
|
2019-08-14 20:25:34 +05:30
|
|
|
all_count = 0
|
|
|
|
|
2019-08-02 14:41:33 +05:30
|
|
|
searcing_text = ''
|
|
|
|
|
2019-08-19 16:36:24 +05:30
|
|
|
search_screen = ''
|
|
|
|
|
2019-08-26 20:58:12 +05:30
|
|
|
send_draft_mail = None
|
|
|
|
|
2019-09-11 20:33:51 +05:30
|
|
|
is_allmail = False
|
|
|
|
|
|
|
|
in_composer = False
|
|
|
|
|
2019-09-17 19:08:05 +05:30
|
|
|
availabe_credit = 0
|
2019-12-12 20:08:07 +05:30
|
|
|
|
|
|
|
in_sent_method = False
|
|
|
|
|
2019-12-30 17:40:02 +05:30
|
|
|
in_search_mode = False
|
2020-06-10 15:46:16 +05:30
|
|
|
|
2019-11-05 18:54:04 +02:00
|
|
|
clientHasReceivedIncomingConnections = False
|
|
|
|
"""used by API command clientStatus"""
|
|
|
|
|
|
|
|
numberOfMessagesProcessed = 0
|
|
|
|
numberOfBroadcastsProcessed = 0
|
|
|
|
numberOfPubkeysProcessed = 0
|
|
|
|
|
|
|
|
statusIconColor = 'red'
|
|
|
|
"""
|
|
|
|
GUI status icon color
|
|
|
|
.. note:: bad style, refactor it
|
|
|
|
"""
|
|
|
|
|
|
|
|
ackdataForWhichImWatching = {}
|
|
|
|
|
|
|
|
thisapp = None
|
|
|
|
"""Singleton instance"""
|
2020-06-11 15:45:32 +05:30
|
|
|
|
|
|
|
imageDir = None
|