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

@ -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]