From 7e2724b663550aa303f31d05eed690c281fae762 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Wed, 27 Nov 2024 11:41:35 +0200 Subject: [PATCH] Make several changes that are related to presence of type unavailable. --- slixfeed/configs/feeds.toml | 48 ++++++++++++++++++------------------- slixfeed/xmpp/client.py | 26 ++++++++------------ 2 files changed, 34 insertions(+), 40 deletions(-) diff --git a/slixfeed/configs/feeds.toml b/slixfeed/configs/feeds.toml index 347e7a9..656c492 100644 --- a/slixfeed/configs/feeds.toml +++ b/slixfeed/configs/feeds.toml @@ -66,7 +66,7 @@ tags = ["event", "germany", "xmpp"] [[feeds]] lang = "de-de" -name = "blog | hasecke" +name = "journal | hasecke" link = "https://www.hasecke.eu/index.xml" tags = ["linux", "p2p", "software", "technology"] @@ -78,7 +78,7 @@ tags = ["computer", "industry", "electronics", "technology"] [[feeds]] lang = "de-de" -name = "CCC Event Blog" +name = "CCC Event Journal" link = "https://events.ccc.de/feed" tags = ["ccc", "club", "event"] @@ -222,13 +222,19 @@ tags = ["gemini", "gopher", "browser", "telecommunication", "internet"] [[feeds]] lang = "en" -name = "[ngn.tf] | blog" +name = "[ngn.tf] | journal" link = "https://api.ngn.tf/blog/feed.atom" tags = ["computer", "service", "technology", "telecommunication", "xmpp"] [[feeds]] lang = "en" -name = "RTP Blog" +name = "Proycon's Journal" +link = "https://proycon.anaproy.nl/rss.xml" +tags = ["computer", "technology", "telecommunication", "postmarketos", "music", "piano", "privacy"] + +[[feeds]] +lang = "en" +name = "RTP - Right To Privacy Journal" link = "http://righttoprivacy.i2p/rss/" tags = ["computer", "service", "technology", "telecommunication", "i2p", "privacy"] @@ -276,7 +282,7 @@ tags = ["christianity", "copy", "freedom", "religion", "software", "technology"] [[feeds]] lang = "en-ca" -name = "blog.jmp.chat's blog" +name = "JMP's Journal" link = "https://blog.jmp.chat/atom.xml" tags = ["jmp", "service", "sms", "telecommunication", "xmpp"] @@ -324,7 +330,7 @@ tags = ["news", "politics", "privacy", "surveillance"] [[feeds]] lang = "en-gb" -name = "op-co.de blog" +name = "op-co.de journal" link = "https://op-co.de/blog/index.rss" tags = ["code", "germany", "jabber", "mastodon", "telecommunication", "xmpp"] @@ -354,7 +360,7 @@ tags = ["art", "economics", "education", "hardware", "research", "technology"] [[feeds]] lang = "en-gb" -name = "Snikket Blog on Snikket Chat" +name = "Snikket Journal on Snikket Chat" link = "https://snikket.org/blog/index.xml" tags = ["chat", "jabber", "telecommunication", "xmpp"] @@ -412,12 +418,6 @@ name = "CODEPINK - Women for Peace" link = "https://www.codepink.org/news.rss" tags = ["activism", "peace", "war", "women"] -[[feeds]] -lang = "en-us" -name = "Ctrl blog" -link = "https://feed.ctrl.blog/latest.atom" -tags = ["computer", "technology"] - [[feeds]] lang = "en-us" name = "Delta Chat - Messenger based on e-mail" @@ -426,7 +426,7 @@ tags = ["email", "telecommunication"] [[feeds]] lang = "en-us" -name = "Disroot Blog" +name = "Disroot Journal" link = "https://disroot.org/en/blog.atom" tags = ["decentralization", "privacy"] @@ -492,7 +492,7 @@ tags = ["news", "politics", "usa", "world"] [[feeds]] lang = "en-us" -name = "Jacob's Unnamed Blog" +name = "Jacob's Unnamed Journal" link = "https://jacobwsmith.xyz/feed.xml" tags = ["book", "community", "culture", "family", "finance", "lifestyle", "market", "usa"] @@ -630,7 +630,7 @@ tags = ["gemini", "internet"] [[feeds]] lang = "en-us" -name = "Public Intelligence Blog" +name = "Public Intelligence Journal" link = "https://phibetaiota.net/feed/" tags = ["cia", "conspiracy", "health", "government", "war", "world"] @@ -678,7 +678,7 @@ tags = ["culture", "podcast", "politics", "usa", "vodcast"] [[feeds]] lang = "en-us" -name = "Redecentralize Blog" +name = "Redecentralize Journal" link = "https://redecentralize.org/blog/feed.rss" tags = ["podcast", "privacy", "surveillance", "vodcast"] @@ -726,7 +726,7 @@ tags = ["activism", "geoengineering"] [[feeds]] lang = "en-us" -name = "Sweet Home 3D Blog" +name = "Sweet Home 3D Journal" link = "http://www.sweethome3d.com/blog/rss.xml" tags = ["3d", "architecture", "design", "game"] @@ -774,7 +774,7 @@ tags = ["farming", "food", "gardening", "survival"] [[feeds]] lang = "en-us" -name = "The XMPP Blog on XMPP" +name = "The XMPP Journal on XMPP" link = "https://xmpp.org/feeds/all.atom.xml" tags = ["jabber", "telecommunication", "xmpp"] @@ -822,7 +822,7 @@ tags = ["decentralization", "development", "electronics", "networking", "privacy [[feeds]] lang = "es-es" -name = "Disroot Blog" +name = "Disroot Journal" link = "https://disroot.org/es/blog.atom" tags = ["decentralization", "privacy"] @@ -852,13 +852,13 @@ tags = ["technology"] [[feeds]] lang = "fr-fr" -name = "Disroot Blog" +name = "Disroot Journal" link = "https://disroot.org/fr/blog.atom" tags = ["decentralization", "privacy"] [[feeds]] lang = "fr-fr" -name = "Framablog" +name = "Frama Journal" link = "https://framablog.org/feed/" tags = ["fediverse", "framasoft", "open source", "peertube", "privacy", "software", "xmpp"] @@ -954,7 +954,7 @@ tags = ["computer", "culture", "food", "technology"] [[feeds]] lang = "it-it" -name = "Disroot Blog" +name = "Disroot Journal" link = "https://disroot.org/it/blog.atom" tags = ["decentralization", "privacy"] @@ -1008,7 +1008,7 @@ tags = ["computer", "technology", "design"] [[feeds]] lang = "ru-ru" -name = "Disroot Blog" +name = "Disroot Journal" link = "https://disroot.org/ru/blog.atom" tags = ["decentralization", "privacy"] diff --git a/slixfeed/xmpp/client.py b/slixfeed/xmpp/client.py index c42831a..c3055b3 100644 --- a/slixfeed/xmpp/client.py +++ b/slixfeed/xmpp/client.py @@ -259,16 +259,16 @@ class XmppClient(slixmpp.ClientXMPP): self.on_session_start) self.add_event_handler("session_resumed", self.on_session_resumed) - self.add_event_handler("got_offline", print("got_offline")) - # self.add_event_handler("got_online", self.check_readiness) + self.add_event_handler("got_offline", + self.on_got_offline) self.add_event_handler("changed_status", self.on_changed_status) self.add_event_handler("disco_info", self.on_disco_info) self.add_event_handler("presence_available", self.on_presence_available) - # self.add_event_handler("presence_unavailable", - # self.on_presence_unavailable) + self.add_event_handler("presence_unavailable", + self.on_presence_unavailable) self.add_event_handler("chatstate_active", self.on_chatstate_active) self.add_event_handler("chatstate_composing", @@ -530,6 +530,11 @@ class XmppClient(slixmpp.ClientXMPP): difference)) + async def on_got_offline(self, presence): + breakpoint() + # await task.check_readiness(self, presence) + + async def on_changed_status(self, presence): time_begin = time.time() jid_full = presence['from'].full @@ -617,16 +622,13 @@ class XmppClient(slixmpp.ClientXMPP): message_log = '{}: jid_full: {}' logger.debug(message_log.format(function_name, jid_full)) jid_bare = presence['from'].bare - if jid_bare == self.boundjid.bare: - return + if jid_bare == self.boundjid.bare: return # FIXME TODO Find out what is the source responsible for a couple presences with empty message # NOTE This is a temporary solution await asyncio.sleep(10) FeedTask.restart_task(self, jid_bare) XmppChatTask.restart_task(self, jid_bare) XmppStatusTask.restart_task(self, jid_bare) - self.add_event_handler("presence_unavailable", - self.on_presence_unavailable) time_end = time.time() difference = time_end - time_begin if difference > 15: logger.warning('{}: jid_full: {} (time: {})' @@ -664,14 +666,6 @@ class XmppClient(slixmpp.ClientXMPP): jid_bare = presence['from'].bare for task in ('check', 'interval', 'status'): Task.stop(self, jid_bare, 'status') - - # NOTE Albeit nice to ~have~ see, this would constantly - # send presence messages to server to no end. - status_message = 'Farewell' - XmppPresence.send(self, jid_bare, status_message, - presence_type='unavailable') - self.del_event_handler("presence_unavailable", - self.on_presence_unavailable) time_end = time.time() difference = time_end - time_begin if difference > 1: logger.warning('{} (time: {})'.format(function_name,