mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-01-22 20:41:08 -05:00
Persist directory to disk for every user modification
This commit is contained in:
parent
6df7feffe6
commit
ebfa6484a2
@ -142,6 +142,9 @@ class Conversation:
|
||||
|
||||
self.__changed_callback = None
|
||||
|
||||
if not RNS.Transport.has_path(bytes.fromhex(source_hash)):
|
||||
RNS.Transport.request_path(bytes.fromhex(source_hash))
|
||||
|
||||
self.source_identity = RNS.Identity.recall(bytes.fromhex(self.source_hash))
|
||||
|
||||
if self.source_identity:
|
||||
|
@ -47,6 +47,7 @@ class Directory:
|
||||
file = open(self.app.directorypath, "wb")
|
||||
file.write(msgpack.packb(directory))
|
||||
file.close()
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("Could not write directory to disk. Then contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
|
||||
@ -179,6 +180,8 @@ class Directory:
|
||||
node_entry = self.directory_entries[associated_node]
|
||||
node_entry.trust_level = entry.trust_level
|
||||
|
||||
self.save_to_disk()
|
||||
|
||||
def forget(self, source_hash):
|
||||
if source_hash in self.directory_entries:
|
||||
self.directory_entries.pop(source_hash)
|
||||
|
@ -30,7 +30,6 @@ class NomadNetworkApp:
|
||||
START_ANNOUNCE_DELAY = 3
|
||||
|
||||
def exit_handler(self):
|
||||
RNS.log("Nomad Network Client exit handler executing...", RNS.LOG_VERBOSE)
|
||||
self.should_run_jobs = False
|
||||
|
||||
RNS.log("Saving directory...", RNS.LOG_VERBOSE)
|
||||
|
@ -294,9 +294,6 @@ class ConversationsDisplay():
|
||||
self.app.directory.remember(entry)
|
||||
|
||||
new_conversation = nomadnet.Conversation(source_hash_text, nomadnet.NomadNetworkApp.get_shared_instance(), initiator=True)
|
||||
|
||||
if not RNS.Transport.has_path(source_hash):
|
||||
RNS.Transport.request_path(source_hash)
|
||||
|
||||
self.update_conversation_list()
|
||||
|
||||
|
@ -127,6 +127,9 @@ class AnnounceInfo(urwid.WidgetWrap):
|
||||
|
||||
if is_node:
|
||||
node_ident = RNS.Identity.recall(source_hash)
|
||||
if not node_ident:
|
||||
raise KeyError("Could not recall identity for selected node")
|
||||
|
||||
op_hash = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", node_ident)
|
||||
op_str = self.app.directory.simplest_display_str(op_hash)
|
||||
|
||||
@ -607,6 +610,8 @@ class ExceptionHandlingListBox(IndicativeListBox):
|
||||
nomadnet.NomadNetworkApp.get_shared_instance().ui.main_display.frame.set_focus("header")
|
||||
elif key == "down":
|
||||
nomadnet.NomadNetworkApp.get_shared_instance().ui.main_display.sub_displays.network_display.left_pile.set_focus(1)
|
||||
else:
|
||||
RNS.log("An error occurred while processing an interface event. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
|
||||
|
||||
class KnownNodes(urwid.WidgetWrap):
|
||||
|
Loading…
Reference in New Issue
Block a user