]> kaliko git repositories - sid.git/commitdiff
log: Add jid and nick dev
authorkaliko <kaliko@azylum.org>
Sat, 26 Oct 2024 16:32:24 +0000 (18:32 +0200)
committerkaliko <kaliko@azylum.org>
Sat, 26 Oct 2024 16:32:24 +0000 (18:32 +0200)
sid/__init__.py
sid/feeds.py
sid/log.py

index d3c5ad097a8a2fbf997ca52695a12f16dd9cfe4b..761b846f9a65188be6ad85860bf427463446b661 100644 (file)
@@ -7,6 +7,6 @@ __email__ = 'kaliko@azylum.org'
 __description__ = 'An xmpp bot based on slixmpp'
 # Use semantic versioning as much as possible
 # https://www.python.org/dev/peps/pep-0440/
-__version__ = '0.3.0'
+__version__ = '0.4.0'
 __url__ = 'http://git.kaliko.me/?p=sid.git'
 __doc__ = 'https://kaliko.gitlab.io/sid/'
index 3fe7ce9ecdd406dbe9d9ba43b977e01c5e6144ba..de789f51425c6887667dc9d985af4b69856b5a7b 100644 (file)
@@ -55,11 +55,11 @@ class FeedMonitor(threading.Thread):
         self.tempo = plugin.TEMPO
         self.plugin = plugin
         self.last_check = datetime.datetime.utcnow()
-        self.seen = dict()
+        self.seen = {}
         self.thread_killed = False
 
     def _update_cache(self, feed, parsed):
-        self.seen[feed].update({'ids': {p.id for p in parsed.entries} or {}})
+        self.seen[feed].update({'ids': {p.id for p in parsed.entries} or set()})
         # Common HTTP caching
         if parsed.get('etag', False):
             self.seen[feed].update({'cache': {'etag': parsed.etag}})
index 1872c1beedf486c074f0f563b7e62b57726be54c..7962415b4f040b1ed9968e83c3477fa5640fd917 100644 (file)
@@ -34,18 +34,18 @@ class Log(Plugin):
         if not jid:
             self.log.debug('jid not found, is bot account moderating room?')
             return nick
-        jid = jid.split('/')[0]  # strip ressource
+        #jid = jid.split('/')[0]  # strip ressource
         return jid
 
     def log_online(self, pres):
-        nick = self._get_jid(pres)
-        self.log.info('got online: %s', nick)
-        self.presence.append((datetime.now(), 'online', nick))
+        jid = self._get_jid(pres)
+        self.log.info('got online: %s as %s', jid, pres['muc']['nick'])
+        self.presence.append((datetime.now(), 'online', jid))
 
     def log_offline(self, pres):
-        nick = self._get_jid(pres)
-        self.log.info('got offline: %s', nick)
-        self.presence.append((datetime.now(), 'offline', nick))
+        jid = self._get_jid(pres)
+        self.log.info('got offline: %s was %s', jid, pres['muc']['nick'])
+        self.presence.append((datetime.now(), 'offline', jid))
 
     def log_presence(self, pres):
         nick = self._get_jid(pres)