Skip to content

Commit

Permalink
Merge branch 'master' of github.com:markqvist/NomadNet
Browse files Browse the repository at this point in the history
  • Loading branch information
markqvist committed Feb 16, 2024
2 parents 641f326 + 014b9fa commit a4c3485
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-rc-alpine3.14 as build
FROM python:3.12-alpine as build

RUN apk add --no-cache build-base linux-headers libffi-dev cargo

Expand All @@ -8,10 +8,10 @@ ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install setuptools-rust pyopenssl cryptography

COPY . /app/
RUN cd /app/ && python3 setup.py install
RUN cd /app/ && pip3 install .

# Use multi-stage build, as we don't need rust compilation on the final image
FROM python:3.11-rc-alpine3.14
FROM python:3.12-alpine

LABEL org.opencontainers.image.documentation="https://github.com/markqvist/NomadNet#nomad-network-daemon-with-docker"

Expand Down
14 changes: 14 additions & 0 deletions nomadnet/NomadNetworkApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def __init__(self, configdir = None, rnsconfigdir = None, daemon = False, force_
self.peer_announce_at_start = True
self.try_propagation_on_fail = True
self.disable_propagation = False
self.notify_on_new_message = True

self.periodic_lxmf_sync = True
self.lxmf_sync_interval = 360*60
Expand Down Expand Up @@ -546,6 +547,9 @@ def lxmf_delivery(self, message):

nomadnet.Conversation.ingest(message, self)

if self.notify_on_new_message:
self.notify_message_recieved()

if self.should_print(message):
self.print_message(message)

Expand Down Expand Up @@ -649,6 +653,11 @@ def mark_conversation_read(self, source_hash):
if os.path.isfile(self.conversationpath + "/" + source_hash + "/unread"):
os.unlink(self.conversationpath + "/" + source_hash + "/unread")

def notify_message_recieved(self):
if self.uimode == nomadnet.ui.UI_TEXT:
sys.stdout.write("\a")
sys.stdout.flush()

def clear_tmp_dir(self):
if os.path.isdir(self.tmpfilespath):
for file in os.listdir(self.tmpfilespath):
Expand Down Expand Up @@ -726,6 +735,10 @@ def applyConfig(self):
value = self.config["client"].as_bool(option)
self.compact_stream = value

if option == "notify_on_new_message":
value = self.config["client"].as_bool(option)
self.notify_on_new_message = value

if option == "user_interface":
value = value.lower()
if value == "none":
Expand Down Expand Up @@ -953,6 +966,7 @@ def quit(self):
enable_client = yes
user_interface = text
downloads_path = ~/Downloads
notify_on_new_message = yes
# By default, the peer is announced at startup
# to let other peers reach it immediately.
Expand Down

0 comments on commit a4c3485

Please sign in to comment.