mirror of
https://github.com/markqvist/LXMF-Tools.git
synced 2025-01-09 06:28:01 -05:00
Fixed error with LXMF send
This commit is contained in:
parent
b4bc35ee31
commit
f2db594c29
@ -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)
|
||||||
|
|
||||||
|
|
||||||
##############################################################################################################
|
##############################################################################################################
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user