mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-05-18 05:40:26 -04:00
Ratchet, stamp and ticket compatibility
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
Some checks failed
Create and publish a Docker image / build-and-push-image (push) Has been cancelled
This commit is contained in:
parent
77c9e6c9eb
commit
76cb1f73f5
2 changed files with 25 additions and 9 deletions
|
@ -27,6 +27,13 @@ class Conversation:
|
||||||
if Conversation.created_callback != None:
|
if Conversation.created_callback != None:
|
||||||
Conversation.created_callback()
|
Conversation.created_callback()
|
||||||
|
|
||||||
|
# This reformats the new v0.5.0 announce data back to the expected format
|
||||||
|
# for nomadnets storage and other handling functions.
|
||||||
|
dn = LXMF.display_name_from_app_data(app_data)
|
||||||
|
app_data = b""
|
||||||
|
if dn != None:
|
||||||
|
app_data = dn.encode("utf-8")
|
||||||
|
|
||||||
# Add the announce to the directory announce
|
# Add the announce to the directory announce
|
||||||
# stream logger
|
# stream logger
|
||||||
app.directory.lxmf_announce_received(destination_hash, app_data)
|
app.directory.lxmf_announce_received(destination_hash, app_data)
|
||||||
|
@ -281,9 +288,13 @@ class Conversation:
|
||||||
|
|
||||||
def message_notification(self, message):
|
def message_notification(self, message):
|
||||||
if message.state == LXMF.LXMessage.FAILED and hasattr(message, "try_propagation_on_fail") and message.try_propagation_on_fail:
|
if message.state == LXMF.LXMessage.FAILED and hasattr(message, "try_propagation_on_fail") and message.try_propagation_on_fail:
|
||||||
|
if hasattr(message, "stamp_generation_failed") and message.stamp_generation_failed == True:
|
||||||
|
RNS.log(f"Could not send {message} due to a stamp generation failure", RNS.LOG_ERROR)
|
||||||
|
else:
|
||||||
RNS.log("Direct delivery of "+str(message)+" failed. Retrying as propagated message.", RNS.LOG_VERBOSE)
|
RNS.log("Direct delivery of "+str(message)+" failed. Retrying as propagated message.", RNS.LOG_VERBOSE)
|
||||||
message.try_propagation_on_fail = None
|
message.try_propagation_on_fail = None
|
||||||
message.delivery_attempts = 0
|
message.delivery_attempts = 0
|
||||||
|
if hasattr(message, "next_delivery_attempt"):
|
||||||
del message.next_delivery_attempt
|
del message.next_delivery_attempt
|
||||||
message.packed = None
|
message.packed = None
|
||||||
message.desired_method = LXMF.LXMessage.PROPAGATED
|
message.desired_method = LXMF.LXMessage.PROPAGATED
|
||||||
|
@ -318,12 +329,17 @@ class ConversationMessage:
|
||||||
self.timestamp = self.lxm.timestamp
|
self.timestamp = self.lxm.timestamp
|
||||||
self.sort_timestamp = os.path.getmtime(self.file_path)
|
self.sort_timestamp = os.path.getmtime(self.file_path)
|
||||||
|
|
||||||
if self.lxm.state > LXMF.LXMessage.DRAFT and self.lxm.state < LXMF.LXMessage.SENT:
|
if self.lxm.state > LXMF.LXMessage.GENERATING and self.lxm.state < LXMF.LXMessage.SENT:
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
for pending in nomadnet.NomadNetworkApp.get_shared_instance().message_router.pending_outbound:
|
for pending in nomadnet.NomadNetworkApp.get_shared_instance().message_router.pending_outbound:
|
||||||
if pending.hash == self.lxm.hash:
|
if pending.hash == self.lxm.hash:
|
||||||
found = True
|
found = True
|
||||||
|
|
||||||
|
for pending_id in nomadnet.NomadNetworkApp.get_shared_instance().message_router.pending_deferred_stamps:
|
||||||
|
if pending_id == self.lxm.hash:
|
||||||
|
found = True
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
self.lxm.state = LXMF.LXMessage.FAILED
|
self.lxm.state = LXMF.LXMessage.FAILED
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -30,6 +30,6 @@ setuptools.setup(
|
||||||
entry_points= {
|
entry_points= {
|
||||||
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
||||||
},
|
},
|
||||||
install_requires=["rns>=0.7.6", "lxmf>=0.4.5", "urwid>=2.4.4", "qrcode"],
|
install_requires=["rns>=0.7.7", "lxmf>=0.5.0", "urwid>=2.4.4", "qrcode"],
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue