From d636c2b1f2b21ae70d1a12141c7c137525b47e81 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Wed, 23 Oct 2019 19:53:23 +0200 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- pwnagotchi/plugins/default/grid.py | 3 ++- pwnagotchi/voice.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/plugins/default/grid.py b/pwnagotchi/plugins/default/grid.py index d111f9ab..4c411b44 100644 --- a/pwnagotchi/plugins/default/grid.py +++ b/pwnagotchi/plugins/default/grid.py @@ -67,6 +67,7 @@ def is_excluded(what): def on_ui_update(ui): if UNREAD_MESSAGES > 0: + logging.debug("[grid] unread:%d total:%d" % (UNREAD_MESSAGES, TOTAL_MESSAGES)) ui.on_unread_messages(UNREAD_MESSAGES, TOTAL_MESSAGES) @@ -135,4 +136,4 @@ def on_internet_available(agent): logging.debug("grid: reporting disabled") except Exception as e: - logging.error("grid api: %s" % e) \ No newline at end of file + logging.error("grid api: %s" % e) diff --git a/pwnagotchi/voice.py b/pwnagotchi/voice.py index b718e4e2..249ac21b 100644 --- a/pwnagotchi/voice.py +++ b/pwnagotchi/voice.py @@ -70,9 +70,12 @@ class Voice: self._('My crime is that of curiosity ...')]) def on_new_peer(self, peer): - return random.choice([ - self._('Hello {name}! Nice to meet you.').format(name=peer.name()), - self._('Unit {name} is nearby!').format(name=peer.name())]) + if peer.first_encounter(): + return random.choice([ + self._('Hello {name}! Nice to meet you.').format(name=peer.name())]) + else: + return random.choice([ + self._('Unit {name} is nearby!').format(name=peer.name())]) def on_lost_peer(self, peer): return random.choice([