Fixed error with LXMF send

This commit is contained in:
SebastianObi 2022-10-22 09:04:32 +02:00
parent b4bc35ee31
commit f2db594c29
5 changed files with 6 additions and 8 deletions

View File

@ -769,7 +769,7 @@ def mqtt_message_received_callback_send(client, userdata, message):
if message_data["date_time"] != "": if message_data["date_time"] != "":
timestamp = time.mktime(datetime.datetime.strptime(message_data["date_time"], '%Y-%m-%d %H:%M:%S').timetuple()) timestamp = time.mktime(datetime.datetime.strptime(message_data["date_time"], '%Y-%m-%d %H:%M:%S').timetuple())
LXMF_CONNECTION.send(message_data["destination"].strip(), content, message_data["title"].strip(), timestamp) LXMF_CONNECTION.send(message_data["destination"].strip(), content, message_data["title"].strip(), None, timestamp)
############################################################################################################## ##############################################################################################################

View File

@ -587,7 +587,7 @@ def lxmf_message_received_callback(message):
if search != "": if search != "":
content = re.sub(search, config_get(CONFIG, "message", "send_regex_replace"), content) content = re.sub(search, config_get(CONFIG, "message", "send_regex_replace"), content)
LXMF_CONNECTION.send(message.source_hash, content_prefix + content + content_suffix, "") LXMF_CONNECTION.send(message.source_hash, content_prefix + content + content_suffix)
else: else:
log("LXMF - Source " + RNS.prettyhexrep(message.source_hash) + " not allowed", LOG_DEBUG) log("LXMF - Source " + RNS.prettyhexrep(message.source_hash) + " not allowed", LOG_DEBUG)
return return

View File

@ -608,8 +608,6 @@ def lxmf_message_received_callback(message):
content = content_prefix + content + content_suffix content = content_prefix + content + content_suffix
title = message.title.decode('utf-8')
if config_get(CONFIG, "message", "timestamp") == "client": if config_get(CONFIG, "message", "timestamp") == "client":
timestamp = message.timestamp timestamp = message.timestamp
else: else:
@ -619,7 +617,7 @@ def lxmf_message_received_callback(message):
if "receive" in section: if "receive" in section:
for (key, val) in DATA.items(section): for (key, val) in DATA.items(section):
if key != source_hash: if key != source_hash:
LXMF_CONNECTION.send(key, content, title, timestamp) LXMF_CONNECTION.send(key, content, title, None, timestamp)
return return
else: else:
log("LXMF - Source " + RNS.prettyhexrep(message.source_hash) + " 'send' not allowed", LOG_DEBUG) log("LXMF - Source " + RNS.prettyhexrep(message.source_hash) + " 'send' not allowed", LOG_DEBUG)

View File

@ -739,9 +739,9 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, dest="", inter
content = "#"+ str(DATA[key]["count"]) + " " + content content = "#"+ str(DATA[key]["count"]) + " " + content
content = content[:size] content = content[:size]
if key == ".": if key == ".":
LXMF_CONNECTION.send(secrets.token_hex(nbytes=10), content, "") LXMF_CONNECTION.send(secrets.token_hex(nbytes=10), content)
else: else:
LXMF_CONNECTION.send(key, content, "") LXMF_CONNECTION.send(key, content)
print("Destination: " + str (key) + " | #: " + str(DATA[key]["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: Sending/Queued") print("Destination: " + str (key) + " | #: " + str(DATA[key]["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: Sending/Queued")
time.sleep(interval) time.sleep(interval)

View File

@ -763,7 +763,7 @@ def output_now():
if search != "": if search != "":
output = re.sub(search, config_get(CONFIG, "message", "send_regex_replace"), output) output = re.sub(search, config_get(CONFIG, "message", "send_regex_replace"), output)
LXMF_CONNECTION.send(SESSION["source"], content_prefix + output + content_suffix, "") LXMF_CONNECTION.send(SESSION["source"], content_prefix + output + content_suffix)
return True return True