From 8d879ad4a5cfec1507d7c7f2c773f6e23c47e411 Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Wed, 26 Feb 2025 14:42:57 -0700 Subject: [PATCH] added received indicator a * will appear by the name that received the message if the name is unknown then the * will appear by 'other' this currently only works for XMMP/Jabber acounts the sender has the part before the / extracted thus user@example.com/testing becomes user@example.com then this sender is checked againt the list of all accounts for the user --- pywmreceived.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/pywmreceived.py b/pywmreceived.py index c4234af..7cac304 100755 --- a/pywmreceived.py +++ b/pywmreceived.py @@ -36,13 +36,12 @@ class Application(wmoo.Application): self._count = 0 self._flasher = 0 self.backlit = 0 - self.lines = [ # name, messages received - [" CATHY", 0], - [" FRANK", 0], - [" TIM", 0], - [" LEE", 0], - [" TANDA", 0], - [" OTHER", 0], + self.lines = [ # name, messages received, accounts + [" CATHY", 0, ['cathy@example.com']], + [" FRANK", 0, ['frank@example.com']], + [" TIM", 0, ['tim@example.com']], + [" LEE", 0, ['lee@example.com']], + [" OTHER", 0, ['']], ] # Initialize D-Bus and connect to Pidgin's ReceivedIMMsg signal self.register_dbus() @@ -98,6 +97,13 @@ class Application(wmoo.Application): conversation (str): The conversation identifier. flags (int): Message flags. """ + # find who the message is for or return OTHER + self.lines[-1][0] = '* OTHER' + for line in self.lines[:-1]: + if sender.split('/')[0] in line[2]: + line[0] = '*' + line[0][1:] + self.lines[-1][0] = ' OTHER' + ic("") ic(f"sender: {sender}") ic(f"message: {message}") @@ -211,7 +217,12 @@ class Application(wmoo.Application): """ Turn of backlite and zero out messages """ + # clear out text + for line in self.lines: + line[0] = ' ' + line[0][1:] + self.backlite_off() + self.update() def handle_buttonrelease(self, event): """