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_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) ####
@ -450,7 +451,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -590,8 +591,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
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:
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:
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:
content = {"msgtype": "m.text", "body": content, "m.relates_to": {"m.in_reply_to": {"event_id": DATA[message.fields["answer"]][0]}}}
else:
@ -1114,8 +1111,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -1144,8 +1139,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -1171,8 +1164,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -1191,8 +1182,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -1260,8 +1249,6 @@ def data_read(file=None):
return True
#### Data - Save #####
def data_save(file=None):
global DATA
@ -1270,6 +1257,10 @@ def data_save(file=None):
return False
else:
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.write(umsgpack.packb(DATA))
fh.close()
@ -1278,8 +1269,6 @@ def data_save(file=None):
return True
#### Data - Save #####
def data_save_periodic(initial=False):
data_timer = threading.Timer(CONFIG.getint("main", "periodic_save_data_interval"), data_save_periodic)
@ -1347,8 +1336,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1561,8 +1548,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1637,8 +1620,6 @@ periodic_save_data = True
periodic_save_data_interval = 1 #Minutes
#### LXMF connection settings ####
[lxmf]
@ -1705,8 +1686,6 @@ sync_limit = 0
signature_validated = Yes
#### Matrix connection settings ####
[matrix]
@ -1717,8 +1696,6 @@ username = <username>
password = <password>
#### Message router settings ####
[router]
@ -1729,8 +1706,6 @@ lxmf_to_matrix = True
matrix_to_lxmf = True
#### Message routing table ####
# Definition of the assignment of lxmf addresses to matrix room ids (bidirectional routing).
# Format: <LXMF address> = <Matrix room id> = <Name (for display)>
@ -1738,8 +1713,6 @@ matrix_to_lxmf = True
[routing_table]
#### Message settings ####
[message]
@ -1769,6 +1742,9 @@ lxmf_to_matrix_regex_replace =
lxmf_to_matrix_length_min = 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.
# 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_max = 0 #0=any length
# Text is used.
matrix_to_lxmf_deleted =
#### Right settings ####

View File

@ -82,8 +82,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
CONFIG = None
RNS_CONNECTION = None
@ -447,7 +445,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -587,8 +585,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
self.owner = owner
@ -672,8 +668,6 @@ class lxmf_announce_callback:
return
#### LXMF - Message ####
def lxmf_message_received_callback(message):
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)
#### MQTT - State ####
def mqtt_state():
t = threading.Timer(int(CONFIG["mqtt"]["state_interval"])*60, mqtt_state_now)
@ -790,8 +782,6 @@ def mqtt_state():
t.start()
#### MQTT - State ####
def mqtt_state_now():
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 - Connected ####
def mqtt_connected_callback(client, userdata, flags, rc):
MQTT_CONNECTION.subscribe(CONFIG["mqtt"]["topic_power"])
@ -843,8 +831,6 @@ def mqtt_connected_callback(client, userdata, flags, rc):
log("MQTT - Connected", LOG_DEBUG)
#### MQTT - Message ####
def mqtt_message_received_callback_power(client, userdata, message):
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 - Message ####
def mqtt_message_received_callback_state(client, userdata, message):
global CONFIG
@ -870,8 +854,6 @@ def mqtt_message_received_callback_state(client, userdata, message):
mqtt_state_now()
#### MQTT - Message ####
def mqtt_message_received_callback_send(client, userdata, message):
mqtt_log_message(message)
@ -985,8 +967,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -1015,8 +995,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -1042,8 +1020,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -1062,8 +1038,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -1157,8 +1131,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1353,8 +1325,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1422,8 +1390,6 @@ name =
power = Yes
#### LXMF connection settings ####
[lxmf]
@ -1490,8 +1456,6 @@ sync_limit = 8
signature_validated = Yes
#### MQTT connection settings ####
[mqtt]
@ -1551,8 +1515,6 @@ state_periodic = Yes
state_interval = 30 #Minutes
#### Message router settings ####
[router]
@ -1569,8 +1531,6 @@ lxmf_announce_to_mqtt = False
state_to_mqtt = True
#### Message settings ####
[message]
@ -1622,8 +1582,6 @@ mqtt_to_lxmf_length_min = 0 #0=any length
mqtt_to_lxmf_length_max = 0 #0=any length
#### Right settings ####
# Allow only specific source addresses/hashs or any.
[allowed]

View File

@ -80,8 +80,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
CONFIG = None
RNS_CONNECTION = None
@ -445,7 +443,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -585,8 +583,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
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
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -854,8 +846,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -874,8 +864,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -969,8 +957,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1163,8 +1149,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1228,8 +1210,6 @@ enabled = True
name = Echo Test
#### LXMF connection settings ####
[lxmf]
@ -1296,8 +1276,6 @@ sync_limit = 8
signature_validated = Yes
#### Message settings ####
[message]
@ -1342,8 +1320,6 @@ send_length_min = 0 #0=any length
send_length_max = 0 #0=any length
#### Right settings ####
# Allow only specific source addresses/hashs or any.
[allowed]

View File

@ -79,8 +79,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
CONFIG = None
RNS_CONNECTION = None
@ -443,7 +441,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -583,8 +581,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -753,8 +747,6 @@ def replace(text):
return text
def cmd(cmd):
content = ""
@ -833,8 +825,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -863,8 +853,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -890,8 +878,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -910,8 +896,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -1005,8 +989,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1188,8 +1170,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1253,8 +1231,6 @@ enabled = True
name = CMD
#### LXMF connection settings ####
[lxmf]
@ -1321,8 +1297,6 @@ sync_limit = 8
signature_validated = Yes
#### Message settings ####
[message]
@ -1367,8 +1341,6 @@ send_length_min = 0 #0=any length
send_length_max = 0 #0=any length
#### Right settings ####
# Allow only specific source addresses/hashs or any.
[allowed]

View File

@ -20,6 +20,8 @@ description-de =
rules =
rules-de =
[topics]
[admin]
[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-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]
[mod]

View File

@ -82,8 +82,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
DATA = None
CONFIG = None
@ -454,7 +452,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -594,8 +592,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
self.owner = owner
@ -867,8 +863,6 @@ class lxmf_announce_callback:
DATA["main"]["unsaved"] = "True"
#### LXMF - Message ####
def lxmf_message_received_callback(message):
if CONFIG["lxmf"].getboolean("signature_validated") and not message.signature_validated:
@ -1439,8 +1433,6 @@ def lxmf_message_received_callback(message):
return
#### LXMF - Notification ####
def lxmf_message_notification_success_callback(message):
if CONFIG["statistic"].getboolean("enabled"):
@ -1461,8 +1453,6 @@ def lxmf_message_notification_success_callback(message):
return
#### LXMF - Notification ####
def lxmf_message_notification_failed_callback(message):
if CONFIG["statistic"].getboolean("enabled"):
@ -2913,8 +2903,6 @@ def interface(cmd, source_hash, source_name, source_right, source_rights, lng_ke
return content
#### Fields #####
def fields_remove(fields=None, key="fields_remove"):
search = config_get(CONFIG, "message", key).split(",")
@ -2930,8 +2918,6 @@ def fields_remove(fields=None, key="fields_remove"):
return 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):
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)
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:
fields["tpl"] = tpl
return fields
#### Replace #####
def replace(text, source_hash, source_name, source_right, lng_key):
delimiter = CONFIG["interface"]["delimiter_output"]
@ -3087,8 +3080,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -3117,8 +3108,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -3144,8 +3133,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -3164,8 +3151,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -3232,8 +3217,6 @@ def data_read(file=None):
return True
#### Data - Save #####
def data_save(file=None):
global DATA
@ -3252,8 +3235,6 @@ def data_save(file=None):
return True
#### Data - Save #####
def data_save_periodic(initial=False):
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 - Default #####
def data_default(file=None):
global DATA
@ -3338,8 +3317,6 @@ def statistic(cmd="add", section="global", key="", value=1):
STATISTIC["main"]["unsaved"] = "True"
#### Statistic - Add #####
def statistic_add(section="global", value=1):
global STATISTIC
@ -3381,8 +3358,6 @@ def statistic_add(section="global", value=1):
return
#### Statistic - Recalculate #####
def statistic_recalculate(section="global"):
global STATISTIC
@ -3443,8 +3418,6 @@ def statistic_recalculate(section="global"):
return
#### Statistic - Del #####
def statistic_del(section="global"):
global STATISTIC
@ -3453,16 +3426,12 @@ def statistic_del(section="global"):
STATISTIC.remove_section(section)
#### Statistic - Reset #####
def statistic_reset(section="global"):
statistic_del(section)
statistic_add(section, 0)
#### Statistic - Get #####
def statistic_get(section="global"):
global STATISTIC
@ -3480,8 +3449,6 @@ def statistic_get(section="global"):
return text
#### Statistic - Value set #####
def statistic_value_set(section, key, value):
global STATISTIC
@ -3492,8 +3459,6 @@ def statistic_value_set(section, key, value):
STATISTIC[section][key] = value
#### Statistic - Value get #####
def statistic_value_get(section, key, default=""):
global STATISTIC
@ -3504,8 +3469,6 @@ def statistic_value_get(section, key, default=""):
return default
#### Statistic - Read #####
def statistic_read(file=None):
global STATISTIC
@ -3523,8 +3486,6 @@ def statistic_read(file=None):
return True
#### Statistic - Save #####
def statistic_save(file=None):
global STATISTIC
@ -3542,8 +3503,6 @@ def statistic_save(file=None):
return True
#### Statistic - Save #####
def statistic_save_periodic(initial=False):
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 - Default #####
def statistic_default(section="global"):
global STATISTIC
@ -3648,8 +3605,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -3776,7 +3731,9 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
exit()
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"):
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)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -4086,8 +4039,6 @@ fields_announce = False
fields_message = False
#### LXMF connection settings ####
[lxmf]
@ -4158,8 +4109,6 @@ signature_validated_new = No
signature_validated_known = No
#### RNS connection settings ####
[rns]
@ -4183,8 +4132,6 @@ announce_periodic_interval = 120 #Minutes
announce_hidden = No
#### Cluster settings ####
[cluster]
@ -4207,8 +4154,6 @@ display_name = County/Region/City
delimiter_input = @
#### Router settings ####
[router]
@ -4221,8 +4166,6 @@ enabled = False
display_name = Country,Country/Region
#### High availability settings ####
[high_availability]
@ -4247,8 +4190,6 @@ heartbeat_interval = 1 #Minutes
heartbeat_timeout = 15 #Minutes
#### Message settings ####
[message]
@ -4356,8 +4297,6 @@ fields_remove =
fields_remove_anonymous =
#### Statistic/Counter settings ####
[statistic]
@ -4380,8 +4319,6 @@ interface = True
user = True
#### User rights assignment ####
# 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
#### User cmd assignment ####
# Define the individual cmds for the different user types.
@ -4410,8 +4345,6 @@ guest = leave
wait = leave
#### User config assignment ####
# Define the individual configs for the different user types.
# Delimiter for different configs: ,
@ -4423,8 +4356,6 @@ guest =
wait =
#### User rights/cmds options ####
# 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.
#### Interface settings - General ####
[interface]
@ -4547,8 +4476,6 @@ delimiter_input = /
delimiter_output = !
#### Interface settings - Messages ####
# 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!
#### Interface settings - Menu/command ####
# 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.
#### Interface settings - Help ####
# 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
#### Topics ####
[topics]
#### Admin user ####
[admin]

View File

@ -76,8 +76,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
DATA = None
CONFIG = None
@ -441,7 +439,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -581,8 +579,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
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
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -868,8 +860,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -895,8 +885,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -915,8 +903,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -983,8 +969,6 @@ def data_read(file=None):
return True
#### Data - Save #####
def data_save(file=None):
global DATA
@ -1003,8 +987,6 @@ def data_save(file=None):
return True
#### Data - Save #####
def data_save_periodic(initial=False):
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 - Default #####
def data_default(file=None):
global DATA
@ -1100,8 +1080,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1288,8 +1266,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1375,8 +1349,6 @@ enabled = True
name = Distribution Group
#### LXMF connection settings ####
[lxmf]
@ -1443,8 +1415,6 @@ sync_limit = 0
signature_validated = No
#### Message settings ####
[message]
## 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
#### Global Variables - System (Not changeable) ####
CONFIG = None
RNS_CONNECTION = None
@ -439,7 +437,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -579,8 +577,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
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
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -835,8 +827,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -862,8 +852,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -882,8 +870,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -977,8 +963,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1160,8 +1144,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1225,8 +1205,6 @@ enabled = True
name = Echo Test
#### LXMF connection settings ####
[lxmf]
@ -1293,8 +1271,6 @@ sync_limit = 8
signature_validated = Yes
#### Message settings ####
[message]
@ -1346,8 +1322,6 @@ fields = Yes
fields_remove =
#### Right settings ####
# Allow only specific source addresses/hashs or any.
[allowed]

View File

@ -76,8 +76,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
DATA = None
RNS_CONNECTION = None
@ -440,7 +438,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -580,8 +578,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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")
#### LXMF - Failed ####
def lxmf_failed(message):
global DATA
@ -717,8 +711,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -840,7 +832,7 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, dest="", inter
DATA = {}
destinations = dest.split(",")
for key in destinations:
for key in destinations:
DATA[key] = {}
DATA[key]["count"] = 0
DATA[key]["count_success"] = 0
@ -868,8 +860,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, dest="", inter
time.sleep(interval)
#### Start ####
def main():
try:

View File

@ -88,8 +88,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
CACHE = {}
CACHE["in"] = {}
@ -457,7 +455,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -597,8 +595,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
global CACHE, CACHE_CHANGE
@ -705,8 +699,6 @@ def lxmf_message_received_callback(message):
pass
#### LXMF - Notification ####
def lxmf_message_notification_success_callback(message):
global CACHE, CACHE_CHANGE
@ -717,8 +709,6 @@ def lxmf_message_notification_success_callback(message):
CACHE_CHANGE = True
#### Jobs ####
def jobs_in():
global CACHE, CACHE_CHANGE
@ -933,8 +923,6 @@ def jobs_in():
CACHE_CHANGE = False
#### Jobs ####
def jobs_out():
global CACHE, CACHE_CHANGE
@ -967,8 +955,6 @@ def jobs_out():
CACHE_CHANGE = False
##############################################################################################################
# Cache
@ -994,8 +980,6 @@ def cache_read(file=None):
return True
#### Cache - Save #####
def cache_save(file=None):
log("Cache - Save", LOG_DEBUG)
@ -1016,8 +1000,6 @@ def cache_save(file=None):
return True
#### Cache - Default #####
def cache_default(file=None):
log("Cache - Default", LOG_DEBUG)
@ -1095,8 +1077,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -1125,8 +1105,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -1152,8 +1130,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -1172,8 +1148,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -1267,8 +1241,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1481,8 +1453,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
try:
@ -1546,7 +1516,6 @@ interval_out = 60 #Seconds
[data]
v_s = 0.0.0 #Version software
v_c = 0.0.0 #Version config
u_s = #URL Software
i_s = #Info Software
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.
#### Main program settings ####
[main]
@ -1570,8 +1537,6 @@ enabled = True
name = LXMF Provisioning Server
#### LXMF connection settings ####
[lxmf]
@ -1639,8 +1604,6 @@ sync_limit = 8
signature_validated = No
#### Database connection settings ####
[database]
@ -1678,21 +1641,16 @@ account_prove_auth_role = 3
telemetry = False
#### Processing ####
[processing]
interval_in = 5 #Seconds
interval_out = 60 #Seconds
#### Data settings ####
[data]
v_s = 0.0.0 #Version software
v_c = 0.0.0 #Version config
u_s = #URL Software
i_s = #Info Software
cmd = #CMD

View File

@ -84,8 +84,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
PATH_RNS = None
#### Global Variables - System (Not changeable) ####
CONFIG = None
RNS_CONNECTION = None
@ -540,7 +538,7 @@ class lxmf_connection:
def sync_now(self, limit=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:
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)
return True
else:
@ -680,8 +678,6 @@ class lxmf_connection:
log("- App Data: " + message.app_data, LOG_DEBUG)
class lxmf_connection_propagation():
def __init__(self, owner, aspect_filter=None):
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)
#### LXMF - Message ####
def lxmf_message_received_callback(message):
global SESSION
@ -830,8 +824,6 @@ def output(initial=False):
output_now()
def output_now():
global SESSION
global TERMINAL
@ -968,8 +960,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
return default
#### Config - Set #####
def config_set(key=None, value=""):
global PATH
@ -998,8 +988,6 @@ def config_set(key=None, value=""):
pass
#### Config - Read #####
def config_read(file=None, file_override=None):
global CONFIG
@ -1025,8 +1013,6 @@ def config_read(file=None, file_override=None):
return True
#### Config - Save #####
def config_save(file=None):
global CONFIG
@ -1045,8 +1031,6 @@ def config_save(file=None):
return True
#### Config - Default #####
def config_default(file=None, file_override=None):
global CONFIG
@ -1140,8 +1124,6 @@ LOG_SUFFIX = ""
LOG_FILE = ""
def log(text, level=3, file=None):
if not LOG_LEVEL:
return
@ -1328,8 +1310,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
time.sleep(1)
#### Start ####
def main():
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.
#### Main program settings ####
[main]
@ -1393,8 +1371,6 @@ enabled = True
name = Terminal
#### LXMF connection settings ####
[lxmf]
@ -1461,8 +1437,6 @@ sync_limit = 8
signature_validated = Yes
#### Terminal settings ####
[terminal]
@ -1477,8 +1451,6 @@ restart_session = True
interval = 5 #Seconds
#### Message settings ####
[message]
@ -1532,8 +1504,6 @@ replace_special_characters = True
replace_unnecessary_characters = True
#### Right settings ####
# Allow only specific source addresses/hashs or any.
[allowed]