Layout adjustments

This commit is contained in:
SebastianObi 2023-07-29 19:35:54 +02:00
parent 7f167666ed
commit 56b3c50ab9
12 changed files with 43 additions and 367 deletions

View File

@ -82,7 +82,8 @@ COPYRIGHT = "(c) 2023 Sebastian Obele / obele.eu"
PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file__))[0] PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file__))[0]
PATH_RNS = None PATH_RNS = None
# Number of message ids which will be saved (older will be deleted).
DATA_COUNT_SAVE = 10000 #0=No limit
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
@ -450,7 +451,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -590,8 +591,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -820,8 +819,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if not CONFIG["router"].getboolean("lxmf_to_matrix"): if not CONFIG["router"].getboolean("lxmf_to_matrix"):
@ -914,7 +911,7 @@ def lxmf_message_received_callback(message):
if message.fields and "edit" in message.fields and "hash" in message.fields and message.fields["hash"] in DATA: if message.fields and "edit" in message.fields and "hash" in message.fields and message.fields["hash"] in DATA:
content = {"msgtype": "m.text", "body": "", "m.new_content": {"body": content, "msgtype": "m.text"}, "m.relates_to": {"event_id": DATA[message.fields["hash"]][0], "rel_type": "m.replace"}} content = {"msgtype": "m.text", "body": "", "m.new_content": {"body": content, "msgtype": "m.text"}, "m.relates_to": {"event_id": DATA[message.fields["hash"]][0], "rel_type": "m.replace"}}
elif message.fields and "delete" in message.fields and "hash" in message.fields and message.fields["hash"] in DATA: elif message.fields and "delete" in message.fields and "hash" in message.fields and message.fields["hash"] in DATA:
content = {"msgtype": "m.text", "body": "", "m.new_content": {"body": "-", "msgtype": "m.text"}, "m.relates_to": {"event_id": DATA[message.fields["hash"]][0], "rel_type": "m.replace"}} content = {"msgtype": "m.text", "body": "", "m.new_content": {"body": config_get(CONFIG, "message", "lxmf_to_matrix_deleted", "-"), "msgtype": "m.text"}, "m.relates_to": {"event_id": DATA[message.fields["hash"]][0], "rel_type": "m.replace"}}
elif message.fields and "answer" in message.fields and message.fields["answer"] in DATA: elif message.fields and "answer" in message.fields and message.fields["answer"] in DATA:
content = {"msgtype": "m.text", "body": content, "m.relates_to": {"m.in_reply_to": {"event_id": DATA[message.fields["answer"]][0]}}} content = {"msgtype": "m.text", "body": content, "m.relates_to": {"m.in_reply_to": {"event_id": DATA[message.fields["answer"]][0]}}}
else: else:
@ -1114,8 +1111,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -1144,8 +1139,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -1171,8 +1164,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -1191,8 +1182,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -1260,8 +1249,6 @@ def data_read(file=None):
return True return True
#### Data - Save ##### #### Data - Save #####
def data_save(file=None): def data_save(file=None):
global DATA global DATA
@ -1270,6 +1257,10 @@ def data_save(file=None):
return False return False
else: else:
try: try:
if DATA_COUNT_SAVE > 0 and len(DATA) > DATA_COUNT_SAVE:
keys = list(DATA.keys())[:DATA_COUNT_SAVE]
for key in keys:
del DATA[key]
fh = open(file, "wb") fh = open(file, "wb")
fh.write(umsgpack.packb(DATA)) fh.write(umsgpack.packb(DATA))
fh.close() fh.close()
@ -1278,8 +1269,6 @@ def data_save(file=None):
return True return True
#### Data - Save ##### #### Data - Save #####
def data_save_periodic(initial=False): def data_save_periodic(initial=False):
data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval"), data_save_periodic) data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval"), data_save_periodic)
@ -1347,8 +1336,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1561,8 +1548,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1615,8 +1600,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1637,8 +1620,6 @@ periodic_save_data = True
periodic_save_data_interval = 1 #Minutes periodic_save_data_interval = 1 #Minutes
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1705,8 +1686,6 @@ sync_limit = 0
signature_validated = Yes signature_validated = Yes
#### Matrix connection settings #### #### Matrix connection settings ####
[matrix] [matrix]
@ -1717,8 +1696,6 @@ username = <username>
password = <password> password = <password>
#### Message router settings #### #### Message router settings ####
[router] [router]
@ -1729,8 +1706,6 @@ lxmf_to_matrix = True
matrix_to_lxmf = True matrix_to_lxmf = True
#### Message routing table #### #### Message routing table ####
# Definition of the assignment of lxmf addresses to matrix room ids (bidirectional routing). # Definition of the assignment of lxmf addresses to matrix room ids (bidirectional routing).
# Format: <LXMF address> = <Matrix room id> = <Name (for display)> # Format: <LXMF address> = <Matrix room id> = <Name (for display)>
@ -1738,8 +1713,6 @@ matrix_to_lxmf = True
[routing_table] [routing_table]
#### Message settings #### #### Message settings ####
[message] [message]
@ -1769,6 +1742,9 @@ lxmf_to_matrix_regex_replace =
lxmf_to_matrix_length_min = 0 #0=any length lxmf_to_matrix_length_min = 0 #0=any length
lxmf_to_matrix_length_max = 0 #0=any length lxmf_to_matrix_length_max = 0 #0=any length
# Text is used.
lxmf_to_matrix_deleted = Message deleted
# Deny message if the title/content/fields contains the following content. # Deny message if the title/content/fields contains the following content.
# Comma-separated list with text or field keys. # Comma-separated list with text or field keys.
@ -1796,7 +1772,8 @@ matrix_to_lxmf_regex_replace =
matrix_to_lxmf_length_min = 0 #0=any length matrix_to_lxmf_length_min = 0 #0=any length
matrix_to_lxmf_length_max = 0 #0=any length matrix_to_lxmf_length_max = 0 #0=any length
# Text is used.
matrix_to_lxmf_deleted =
#### Right settings #### #### Right settings ####

View File

@ -82,8 +82,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
CONFIG = None CONFIG = None
RNS_CONNECTION = None RNS_CONNECTION = None
@ -447,7 +445,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -587,8 +585,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -672,8 +668,6 @@ class lxmf_announce_callback:
return return
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if not CONFIG["main"].getboolean("power") or not CONFIG["router"].getboolean("lxmf_to_mqtt"): if not CONFIG["main"].getboolean("power") or not CONFIG["router"].getboolean("lxmf_to_mqtt"):
@ -781,8 +775,6 @@ def mqtt_log_message(message, message_tag="MQTT - Message log"):
log("- QOS: " + str(message.qos), LOG_DEBUG) log("- QOS: " + str(message.qos), LOG_DEBUG)
#### MQTT - State #### #### MQTT - State ####
def mqtt_state(): def mqtt_state():
t = threading.Timer(int(CONFIG["mqtt"]["state_interval"])*60, mqtt_state_now) t = threading.Timer(int(CONFIG["mqtt"]["state_interval"])*60, mqtt_state_now)
@ -790,8 +782,6 @@ def mqtt_state():
t.start() t.start()
#### MQTT - State #### #### MQTT - State ####
def mqtt_state_now(): def mqtt_state_now():
if not CONFIG["router"].getboolean("state_to_mqtt"): if not CONFIG["router"].getboolean("state_to_mqtt"):
@ -826,8 +816,6 @@ def mqtt_state_now():
MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_rm_state"], message_out) MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_rm_state"], message_out)
#### MQTT - Connected #### #### MQTT - Connected ####
def mqtt_connected_callback(client, userdata, flags, rc): def mqtt_connected_callback(client, userdata, flags, rc):
MQTT_CONNECTION.subscribe(CONFIG["mqtt"]["topic_power"]) MQTT_CONNECTION.subscribe(CONFIG["mqtt"]["topic_power"])
@ -843,8 +831,6 @@ def mqtt_connected_callback(client, userdata, flags, rc):
log("MQTT - Connected", LOG_DEBUG) log("MQTT - Connected", LOG_DEBUG)
#### MQTT - Message #### #### MQTT - Message ####
def mqtt_message_received_callback_power(client, userdata, message): def mqtt_message_received_callback_power(client, userdata, message):
global CONFIG global CONFIG
@ -859,8 +845,6 @@ def mqtt_message_received_callback_power(client, userdata, message):
MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_rm_power"], "off") MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_rm_power"], "off")
#### MQTT - Message #### #### MQTT - Message ####
def mqtt_message_received_callback_state(client, userdata, message): def mqtt_message_received_callback_state(client, userdata, message):
global CONFIG global CONFIG
@ -870,8 +854,6 @@ def mqtt_message_received_callback_state(client, userdata, message):
mqtt_state_now() mqtt_state_now()
#### MQTT - Message #### #### MQTT - Message ####
def mqtt_message_received_callback_send(client, userdata, message): def mqtt_message_received_callback_send(client, userdata, message):
mqtt_log_message(message) mqtt_log_message(message)
@ -985,8 +967,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -1015,8 +995,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -1042,8 +1020,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -1062,8 +1038,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -1157,8 +1131,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1353,8 +1325,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1407,8 +1377,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1422,8 +1390,6 @@ name =
power = Yes power = Yes
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1490,8 +1456,6 @@ sync_limit = 8
signature_validated = Yes signature_validated = Yes
#### MQTT connection settings #### #### MQTT connection settings ####
[mqtt] [mqtt]
@ -1551,8 +1515,6 @@ state_periodic = Yes
state_interval = 30 #Minutes state_interval = 30 #Minutes
#### Message router settings #### #### Message router settings ####
[router] [router]
@ -1569,8 +1531,6 @@ lxmf_announce_to_mqtt = False
state_to_mqtt = True state_to_mqtt = True
#### Message settings #### #### Message settings ####
[message] [message]
@ -1622,8 +1582,6 @@ mqtt_to_lxmf_length_min = 0 #0=any length
mqtt_to_lxmf_length_max = 0 #0=any length mqtt_to_lxmf_length_max = 0 #0=any length
#### Right settings #### #### Right settings ####
# Allow only specific source addresses/hashs or any. # Allow only specific source addresses/hashs or any.
[allowed] [allowed]

View File

@ -80,8 +80,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
CONFIG = None CONFIG = None
RNS_CONNECTION = None RNS_CONNECTION = None
@ -445,7 +443,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -585,8 +583,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -648,8 +644,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated: if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -797,8 +791,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -854,8 +846,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -874,8 +864,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -969,8 +957,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1163,8 +1149,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1217,8 +1201,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1228,8 +1210,6 @@ enabled = True
name = Echo Test name = Echo Test
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1296,8 +1276,6 @@ sync_limit = 8
signature_validated = Yes signature_validated = Yes
#### Message settings #### #### Message settings ####
[message] [message]
@ -1342,8 +1320,6 @@ send_length_min = 0 #0=any length
send_length_max = 0 #0=any length send_length_max = 0 #0=any length
#### Right settings #### #### Right settings ####
# Allow only specific source addresses/hashs or any. # Allow only specific source addresses/hashs or any.
[allowed] [allowed]

View File

@ -79,8 +79,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
CONFIG = None CONFIG = None
RNS_CONNECTION = None RNS_CONNECTION = None
@ -443,7 +441,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -583,8 +581,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -646,8 +642,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated: if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -753,8 +747,6 @@ def replace(text):
return text return text
def cmd(cmd): def cmd(cmd):
content = "" content = ""
@ -833,8 +825,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -863,8 +853,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -890,8 +878,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -910,8 +896,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -1005,8 +989,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1188,8 +1170,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1242,8 +1222,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1253,8 +1231,6 @@ enabled = True
name = CMD name = CMD
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1321,8 +1297,6 @@ sync_limit = 8
signature_validated = Yes signature_validated = Yes
#### Message settings #### #### Message settings ####
[message] [message]
@ -1367,8 +1341,6 @@ send_length_min = 0 #0=any length
send_length_max = 0 #0=any length send_length_max = 0 #0=any length
#### Right settings #### #### Right settings ####
# Allow only specific source addresses/hashs or any. # Allow only specific source addresses/hashs or any.
[allowed] [allowed]

View File

@ -20,6 +20,8 @@ description-de =
rules = rules =
rules-de = rules-de =
[topics]
[admin] [admin]
[mod] [mod]

View File

@ -20,6 +20,8 @@ description-de = Diese Gruppe dient einem ersten Test der Funktionalität.
rules = Please follow the general rules of etiquette which should be taken for granted!!n!Prohibited are:!n!Spam, insults, violence, sex, illegal topics rules = Please follow the general rules of etiquette which should be taken for granted!!n!Prohibited are:!n!Spam, insults, violence, sex, illegal topics
rules-de = Bitte befolgen Sie die allgemeinen benimm-dich-Regeln welche als selbstverständlich gelten sollten!!n!Verboten sind:!n!Spam, Beleidigungen, Gewalt, Sex, illegale Themen rules-de = Bitte befolgen Sie die allgemeinen benimm-dich-Regeln welche als selbstverständlich gelten sollten!!n!Verboten sind:!n!Spam, Beleidigungen, Gewalt, Sex, illegale Themen
[topics]
[admin] [admin]
[mod] [mod]

View File

@ -82,8 +82,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
DATA = None DATA = None
CONFIG = None CONFIG = None
@ -454,7 +452,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -594,8 +592,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -867,8 +863,6 @@ class lxmf_announce_callback:
DATA["main"]["unsaved"] = "True" DATA["main"]["unsaved"] = "True"
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated: if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -1439,8 +1433,6 @@ def lxmf_message_received_callback(message):
return return
#### LXMF - Notification #### #### LXMF - Notification ####
def lxmf_message_notification_success_callback(message): def lxmf_message_notification_success_callback(message):
if CONFIG["statistic"].getboolean("enabled"): if CONFIG["statistic"].getboolean("enabled"):
@ -1461,8 +1453,6 @@ def lxmf_message_notification_success_callback(message):
return return
#### LXMF - Notification #### #### LXMF - Notification ####
def lxmf_message_notification_failed_callback(message): def lxmf_message_notification_failed_callback(message):
if CONFIG["statistic"].getboolean("enabled"): if CONFIG["statistic"].getboolean("enabled"):
@ -2913,8 +2903,6 @@ def interface(cmd, source_hash, source_name, source_right, source_rights, lng_ke
return content return content
#### Fields ##### #### Fields #####
def fields_remove(fields=None, key="fields_remove"): def fields_remove(fields=None, key="fields_remove"):
search = config_get(CONFIG, "message", key).split(",") search = config_get(CONFIG, "message", key).split(",")
@ -2930,8 +2918,6 @@ def fields_remove(fields=None, key="fields_remove"):
return fields return fields
#### Fields ##### #### Fields #####
def fields_generate(lng_key, fields=None, h=None, n=None, m=False, d=False, r=False, cmd=None, config=None, tpl=None): def fields_generate(lng_key, fields=None, h=None, n=None, m=False, d=False, r=False, cmd=None, config=None, tpl=None):
if not CONFIG["main"].getboolean("fields_message"): if not CONFIG["main"].getboolean("fields_message"):
@ -2988,14 +2974,21 @@ def fields_generate(lng_key, fields=None, h=None, n=None, m=False, d=False, r=Fa
key, value = config.split("=", 1) key, value = config.split("=", 1)
fields["data"]["config"][key] = val_to_val(value) fields["data"]["config"][key] = val_to_val(value)
if cmd or config:
if DATA.has_section("topics"):
fields["data"]["topics"] = {}
for (key, val) in DATA.items("topics"):
try:
fields["data"]["topics"][int(key)] = val
except:
pass
if tpl: if tpl:
fields["tpl"] = tpl fields["tpl"] = tpl
return fields return fields
#### Replace ##### #### Replace #####
def replace(text, source_hash, source_name, source_right, lng_key): def replace(text, source_hash, source_name, source_right, lng_key):
delimiter = CONFIG["interface"]["delimiter_output"] delimiter = CONFIG["interface"]["delimiter_output"]
@ -3087,8 +3080,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -3117,8 +3108,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -3144,8 +3133,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -3164,8 +3151,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -3232,8 +3217,6 @@ def data_read(file=None):
return True return True
#### Data - Save ##### #### Data - Save #####
def data_save(file=None): def data_save(file=None):
global DATA global DATA
@ -3252,8 +3235,6 @@ def data_save(file=None):
return True return True
#### Data - Save ##### #### Data - Save #####
def data_save_periodic(initial=False): def data_save_periodic(initial=False):
data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval")*60, data_save_periodic) data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval")*60, data_save_periodic)
@ -3271,8 +3252,6 @@ def data_save_periodic(initial=False):
DATA["main"]["unsaved"] = "True" DATA["main"]["unsaved"] = "True"
#### Data - Default ##### #### Data - Default #####
def data_default(file=None): def data_default(file=None):
global DATA global DATA
@ -3338,8 +3317,6 @@ def statistic(cmd="add", section="global", key="", value=1):
STATISTIC["main"]["unsaved"] = "True" STATISTIC["main"]["unsaved"] = "True"
#### Statistic - Add ##### #### Statistic - Add #####
def statistic_add(section="global", value=1): def statistic_add(section="global", value=1):
global STATISTIC global STATISTIC
@ -3381,8 +3358,6 @@ def statistic_add(section="global", value=1):
return return
#### Statistic - Recalculate ##### #### Statistic - Recalculate #####
def statistic_recalculate(section="global"): def statistic_recalculate(section="global"):
global STATISTIC global STATISTIC
@ -3443,8 +3418,6 @@ def statistic_recalculate(section="global"):
return return
#### Statistic - Del ##### #### Statistic - Del #####
def statistic_del(section="global"): def statistic_del(section="global"):
global STATISTIC global STATISTIC
@ -3453,16 +3426,12 @@ def statistic_del(section="global"):
STATISTIC.remove_section(section) STATISTIC.remove_section(section)
#### Statistic - Reset ##### #### Statistic - Reset #####
def statistic_reset(section="global"): def statistic_reset(section="global"):
statistic_del(section) statistic_del(section)
statistic_add(section, 0) statistic_add(section, 0)
#### Statistic - Get ##### #### Statistic - Get #####
def statistic_get(section="global"): def statistic_get(section="global"):
global STATISTIC global STATISTIC
@ -3480,8 +3449,6 @@ def statistic_get(section="global"):
return text return text
#### Statistic - Value set ##### #### Statistic - Value set #####
def statistic_value_set(section, key, value): def statistic_value_set(section, key, value):
global STATISTIC global STATISTIC
@ -3492,8 +3459,6 @@ def statistic_value_set(section, key, value):
STATISTIC[section][key] = value STATISTIC[section][key] = value
#### Statistic - Value get ##### #### Statistic - Value get #####
def statistic_value_get(section, key, default=""): def statistic_value_get(section, key, default=""):
global STATISTIC global STATISTIC
@ -3504,8 +3469,6 @@ def statistic_value_get(section, key, default=""):
return default return default
#### Statistic - Read ##### #### Statistic - Read #####
def statistic_read(file=None): def statistic_read(file=None):
global STATISTIC global STATISTIC
@ -3523,8 +3486,6 @@ def statistic_read(file=None):
return True return True
#### Statistic - Save ##### #### Statistic - Save #####
def statistic_save(file=None): def statistic_save(file=None):
global STATISTIC global STATISTIC
@ -3542,8 +3503,6 @@ def statistic_save(file=None):
return True return True
#### Statistic - Save ##### #### Statistic - Save #####
def statistic_save_periodic(initial=False): def statistic_save_periodic(initial=False):
statistic_timer = threading.Timer(CONFIG.getint("main", "periodic_save_statistic_interval")*60, statistic_save_periodic) statistic_timer = threading.Timer(CONFIG.getint("main", "periodic_save_statistic_interval")*60, statistic_save_periodic)
@ -3563,8 +3522,6 @@ def statistic_save_periodic(initial=False):
STATISTIC["main"]["unsaved"] = "True" STATISTIC["main"]["unsaved"] = "True"
#### Statistic - Default ##### #### Statistic - Default #####
def statistic_default(section="global"): def statistic_default(section="global"):
global STATISTIC global STATISTIC
@ -3648,8 +3605,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -3776,7 +3731,9 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
exit() exit()
if CONFIG["statistic"].getboolean("enabled"): if CONFIG["statistic"].getboolean("enabled"):
statistic_read(PATH + "/statistic.cfg") if not statistic_read(PATH + "/statistic.cfg"):
print("Statistic - Error reading statistic file " + PATH + "/statistic.cfg")
panic()
if CONFIG.has_section("cmds") and CONFIG.has_section("rights"): if CONFIG.has_section("cmds") and CONFIG.has_section("rights"):
for (key, val) in CONFIG.items("cmds"): for (key, val) in CONFIG.items("cmds"):
@ -3909,8 +3866,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -4044,8 +3999,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -4086,8 +4039,6 @@ fields_announce = False
fields_message = False fields_message = False
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -4158,8 +4109,6 @@ signature_validated_new = No
signature_validated_known = No signature_validated_known = No
#### RNS connection settings #### #### RNS connection settings ####
[rns] [rns]
@ -4183,8 +4132,6 @@ announce_periodic_interval = 120 #Minutes
announce_hidden = No announce_hidden = No
#### Cluster settings #### #### Cluster settings ####
[cluster] [cluster]
@ -4207,8 +4154,6 @@ display_name = County/Region/City
delimiter_input = @ delimiter_input = @
#### Router settings #### #### Router settings ####
[router] [router]
@ -4221,8 +4166,6 @@ enabled = False
display_name = Country,Country/Region display_name = Country,Country/Region
#### High availability settings #### #### High availability settings ####
[high_availability] [high_availability]
@ -4247,8 +4190,6 @@ heartbeat_interval = 1 #Minutes
heartbeat_timeout = 15 #Minutes heartbeat_timeout = 15 #Minutes
#### Message settings #### #### Message settings ####
[message] [message]
@ -4356,8 +4297,6 @@ fields_remove =
fields_remove_anonymous = fields_remove_anonymous =
#### Statistic/Counter settings #### #### Statistic/Counter settings ####
[statistic] [statistic]
@ -4380,8 +4319,6 @@ interface = True
user = True user = True
#### User rights assignment #### #### User rights assignment ####
# Define the individual rights for the different user types. # Define the individual rights for the different user types.
@ -4395,8 +4332,6 @@ guest = interface,receive_local,receive_cluster,receive_cluster_loop,update,join
wait = interface,update,join,leave wait = interface,update,join,leave
#### User cmd assignment #### #### User cmd assignment ####
# Define the individual cmds for the different user types. # Define the individual cmds for the different user types.
@ -4410,8 +4345,6 @@ guest = leave
wait = leave wait = leave
#### User config assignment #### #### User config assignment ####
# Define the individual configs for the different user types. # Define the individual configs for the different user types.
# Delimiter for different configs: , # Delimiter for different configs: ,
@ -4423,8 +4356,6 @@ guest =
wait = wait =
#### User rights/cmds options #### #### User rights/cmds options ####
# The following rights/cmds can be assigned: # The following rights/cmds can be assigned:
@ -4534,8 +4465,6 @@ wait =
# unsaved = Displays the status of the data file when using any action/command. # unsaved = Displays the status of the data file when using any action/command.
#### Interface settings - General #### #### Interface settings - General ####
[interface] [interface]
@ -4547,8 +4476,6 @@ delimiter_input = /
delimiter_output = ! delimiter_output = !
#### Interface settings - Messages #### #### Interface settings - Messages ####
# Define messages for user or automatic actions. # Define messages for user or automatic actions.
@ -4712,8 +4639,6 @@ reply_length_max = Info: Maximum message length exceeded!
reply_length_max-de = Info: Maximale Nachrichtenlänge überschritten! reply_length_max-de = Info: Maximale Nachrichtenlänge überschritten!
#### Interface settings - Menu/command #### #### Interface settings - Menu/command ####
# Define menu/command texts. # Define menu/command texts.
@ -5118,8 +5043,6 @@ cmd_unknown = ERROR: Unknown command. Type /? for help.
cmd_unknown-de = FEHLER: Unbekannter Befehl. Geben Sie /? für Hilfe ein. cmd_unknown-de = FEHLER: Unbekannter Befehl. Geben Sie /? für Hilfe ein.
#### Interface settings - Help #### #### Interface settings - Help ####
# Define help texts. # Define help texts.
@ -5343,6 +5266,10 @@ rules = Please follow the general rules of etiquette which should be taken for g
rules-de = Bitte befolgen Sie die allgemeinen benimm-dich-Regeln welche als selbstverständlich gelten sollten!!n!Verboten sind:!n!Spam, Beleidigungen, Gewalt, Sex, illegale Themen rules-de = Bitte befolgen Sie die allgemeinen benimm-dich-Regeln welche als selbstverständlich gelten sollten!!n!Verboten sind:!n!Spam, Beleidigungen, Gewalt, Sex, illegale Themen
#### Topics ####
[topics]
#### Admin user #### #### Admin user ####
[admin] [admin]

View File

@ -76,8 +76,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
DATA = None DATA = None
CONFIG = None CONFIG = None
@ -441,7 +439,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -581,8 +579,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -651,8 +647,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated: if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -838,8 +832,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -868,8 +860,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -895,8 +885,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -915,8 +903,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -983,8 +969,6 @@ def data_read(file=None):
return True return True
#### Data - Save ##### #### Data - Save #####
def data_save(file=None): def data_save(file=None):
global DATA global DATA
@ -1003,8 +987,6 @@ def data_save(file=None):
return True return True
#### Data - Save ##### #### Data - Save #####
def data_save_periodic(initial=False): def data_save_periodic(initial=False):
data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval")*60, data_save_periodic) data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval")*60, data_save_periodic)
@ -1022,8 +1004,6 @@ def data_save_periodic(initial=False):
DATA["main"]["unsaved"] = "True" DATA["main"]["unsaved"] = "True"
#### Data - Default ##### #### Data - Default #####
def data_default(file=None): def data_default(file=None):
global DATA global DATA
@ -1100,8 +1080,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1288,8 +1266,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1364,8 +1340,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1375,8 +1349,6 @@ enabled = True
name = Distribution Group name = Distribution Group
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1443,8 +1415,6 @@ sync_limit = 0
signature_validated = No signature_validated = No
#### Message settings #### #### Message settings ####
[message] [message]
## Each message received (message and command) ## ## Each message received (message and command) ##

View File

@ -75,8 +75,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
CONFIG = None CONFIG = None
RNS_CONNECTION = None RNS_CONNECTION = None
@ -439,7 +437,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -579,8 +577,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -642,8 +638,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated: if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -805,8 +799,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -835,8 +827,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -862,8 +852,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -882,8 +870,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -977,8 +963,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1160,8 +1144,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1214,8 +1196,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1225,8 +1205,6 @@ enabled = True
name = Echo Test name = Echo Test
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1293,8 +1271,6 @@ sync_limit = 8
signature_validated = Yes signature_validated = Yes
#### Message settings #### #### Message settings ####
[message] [message]
@ -1346,8 +1322,6 @@ fields = Yes
fields_remove = fields_remove =
#### Right settings #### #### Right settings ####
# Allow only specific source addresses/hashs or any. # Allow only specific source addresses/hashs or any.
[allowed] [allowed]

View File

@ -76,8 +76,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
DATA = None DATA = None
RNS_CONNECTION = None RNS_CONNECTION = None
@ -440,7 +438,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -580,8 +578,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -646,8 +642,6 @@ def lxmf_success(message):
print("Destination: " + str (key) + " | #: " + str(count) + " | Messages delivered: " + str(DATA[key]["count_success"]) + "/" + str(DATA[key]["count"]) + " (" + str(round(100/DATA[key]["count"]*DATA[key]["count_success"], 2)) + "%) | Time (min / max / avg): " + str(DATA[key]["time_min"]) + " / " + str(DATA[key]["time_max"]) + " / " + str(DATA[key]["time_avg"]) + " | Info: Success") print("Destination: " + str (key) + " | #: " + str(count) + " | Messages delivered: " + str(DATA[key]["count_success"]) + "/" + str(DATA[key]["count"]) + " (" + str(round(100/DATA[key]["count"]*DATA[key]["count_success"], 2)) + "%) | Time (min / max / avg): " + str(DATA[key]["time_min"]) + " / " + str(DATA[key]["time_max"]) + " / " + str(DATA[key]["time_avg"]) + " | Info: Success")
#### LXMF - Failed #### #### LXMF - Failed ####
def lxmf_failed(message): def lxmf_failed(message):
global DATA global DATA
@ -717,8 +711,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -868,8 +860,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, dest="", inter
time.sleep(interval) time.sleep(interval)
#### Start #### #### Start ####
def main(): def main():
try: try:

View File

@ -88,8 +88,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
CACHE = {} CACHE = {}
CACHE["in"] = {} CACHE["in"] = {}
@ -457,7 +455,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -597,8 +595,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -660,8 +656,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
global CACHE, CACHE_CHANGE global CACHE, CACHE_CHANGE
@ -705,8 +699,6 @@ def lxmf_message_received_callback(message):
pass pass
#### LXMF - Notification #### #### LXMF - Notification ####
def lxmf_message_notification_success_callback(message): def lxmf_message_notification_success_callback(message):
global CACHE, CACHE_CHANGE global CACHE, CACHE_CHANGE
@ -717,8 +709,6 @@ def lxmf_message_notification_success_callback(message):
CACHE_CHANGE = True CACHE_CHANGE = True
#### Jobs #### #### Jobs ####
def jobs_in(): def jobs_in():
global CACHE, CACHE_CHANGE global CACHE, CACHE_CHANGE
@ -933,8 +923,6 @@ def jobs_in():
CACHE_CHANGE = False CACHE_CHANGE = False
#### Jobs #### #### Jobs ####
def jobs_out(): def jobs_out():
global CACHE, CACHE_CHANGE global CACHE, CACHE_CHANGE
@ -967,8 +955,6 @@ def jobs_out():
CACHE_CHANGE = False CACHE_CHANGE = False
############################################################################################################## ##############################################################################################################
# Cache # Cache
@ -994,8 +980,6 @@ def cache_read(file=None):
return True return True
#### Cache - Save ##### #### Cache - Save #####
def cache_save(file=None): def cache_save(file=None):
log("Cache - Save", LOG_DEBUG) log("Cache - Save", LOG_DEBUG)
@ -1016,8 +1000,6 @@ def cache_save(file=None):
return True return True
#### Cache - Default ##### #### Cache - Default #####
def cache_default(file=None): def cache_default(file=None):
log("Cache - Default", LOG_DEBUG) log("Cache - Default", LOG_DEBUG)
@ -1095,8 +1077,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -1125,8 +1105,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -1152,8 +1130,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -1172,8 +1148,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -1267,8 +1241,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1481,8 +1453,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1546,7 +1516,6 @@ interval_out = 60 #Seconds
[data] [data]
v_s = 0.0.0 #Version software v_s = 0.0.0 #Version software
v_c = 0.0.0 #Version config
u_s = #URL Software u_s = #URL Software
i_s = #Info Software i_s = #Info Software
cmd = #CMD cmd = #CMD
@ -1559,8 +1528,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1570,8 +1537,6 @@ enabled = True
name = LXMF Provisioning Server name = LXMF Provisioning Server
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1639,8 +1604,6 @@ sync_limit = 8
signature_validated = No signature_validated = No
#### Database connection settings #### #### Database connection settings ####
[database] [database]
@ -1678,21 +1641,16 @@ account_prove_auth_role = 3
telemetry = False telemetry = False
#### Processing #### #### Processing ####
[processing] [processing]
interval_in = 5 #Seconds interval_in = 5 #Seconds
interval_out = 60 #Seconds interval_out = 60 #Seconds
#### Data settings #### #### Data settings ####
[data] [data]
v_s = 0.0.0 #Version software v_s = 0.0.0 #Version software
v_c = 0.0.0 #Version config
u_s = #URL Software u_s = #URL Software
i_s = #Info Software i_s = #Info Software
cmd = #CMD cmd = #CMD

View File

@ -84,8 +84,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None PATH_RNS = None
#### Global Variables - System (Not changeable) #### #### Global Variables - System (Not changeable) ####
CONFIG = None CONFIG = None
RNS_CONNECTION = None RNS_CONNECTION = None
@ -540,7 +538,7 @@ class lxmf_connection:
def sync_now(self, limit=None): def sync_now(self, limit=None):
if self.message_router.get_outbound_propagation_node() is not None: if self.message_router.get_outbound_propagation_node() is not None:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE: if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity)) log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit) self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
return True return True
else: else:
@ -680,8 +678,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG) log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation(): class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None): def __init__(self, owner, aspect_filter=None):
self.owner = owner self.owner = owner
@ -743,8 +739,6 @@ class lxmf_announce_callback:
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO) log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
#### LXMF - Message #### #### LXMF - Message ####
def lxmf_message_received_callback(message): def lxmf_message_received_callback(message):
global SESSION global SESSION
@ -830,8 +824,6 @@ def output(initial=False):
output_now() output_now()
def output_now(): def output_now():
global SESSION global SESSION
global TERMINAL global TERMINAL
@ -968,8 +960,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default return default
#### Config - Set ##### #### Config - Set #####
def config_set(key=None, value=""): def config_set(key=None, value=""):
global PATH global PATH
@ -998,8 +988,6 @@ def config_set(key=None, value=""):
pass pass
#### Config - Read ##### #### Config - Read #####
def config_read(file=None, file_override=None): def config_read(file=None, file_override=None):
global CONFIG global CONFIG
@ -1025,8 +1013,6 @@ def config_read(file=None, file_override=None):
return True return True
#### Config - Save ##### #### Config - Save #####
def config_save(file=None): def config_save(file=None):
global CONFIG global CONFIG
@ -1045,8 +1031,6 @@ def config_save(file=None):
return True return True
#### Config - Default ##### #### Config - Default #####
def config_default(file=None, file_override=None): def config_default(file=None, file_override=None):
global CONFIG global CONFIG
@ -1140,8 +1124,6 @@ LOG_SUFFIX = ""
LOG_FILE = "" LOG_FILE = ""
def log(text, level=3, file=None): def log(text, level=3, file=None):
if not LOG_LEVEL: if not LOG_LEVEL:
return return
@ -1328,8 +1310,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1) time.sleep(1)
#### Start #### #### Start ####
def main(): def main():
try: try:
@ -1382,8 +1362,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
# You should probably edit it to suit your needs and use-case. # You should probably edit it to suit your needs and use-case.
#### Main program settings #### #### Main program settings ####
[main] [main]
@ -1393,8 +1371,6 @@ enabled = True
name = Terminal name = Terminal
#### LXMF connection settings #### #### LXMF connection settings ####
[lxmf] [lxmf]
@ -1461,8 +1437,6 @@ sync_limit = 8
signature_validated = Yes signature_validated = Yes
#### Terminal settings #### #### Terminal settings ####
[terminal] [terminal]
@ -1477,8 +1451,6 @@ restart_session = True
interval = 5 #Seconds interval = 5 #Seconds
#### Message settings #### #### Message settings ####
[message] [message]
@ -1532,8 +1504,6 @@ replace_special_characters = True
replace_unnecessary_characters = True replace_unnecessary_characters = True
#### Right settings #### #### Right settings ####
# Allow only specific source addresses/hashs or any. # Allow only specific source addresses/hashs or any.
[allowed] [allowed]