Make several changes that are related to presence of type unavailable.

This commit is contained in:
Schimon Jehudah, Adv. 2024-11-27 11:41:35 +02:00
parent f7a1196e64
commit 7e2724b663
2 changed files with 34 additions and 40 deletions

View file

@ -66,7 +66,7 @@ tags = ["event", "germany", "xmpp"]
[[feeds]] [[feeds]]
lang = "de-de" lang = "de-de"
name = "blog | hasecke" name = "journal | hasecke"
link = "https://www.hasecke.eu/index.xml" link = "https://www.hasecke.eu/index.xml"
tags = ["linux", "p2p", "software", "technology"] tags = ["linux", "p2p", "software", "technology"]
@ -78,7 +78,7 @@ tags = ["computer", "industry", "electronics", "technology"]
[[feeds]] [[feeds]]
lang = "de-de" lang = "de-de"
name = "CCC Event Blog" name = "CCC Event Journal"
link = "https://events.ccc.de/feed" link = "https://events.ccc.de/feed"
tags = ["ccc", "club", "event"] tags = ["ccc", "club", "event"]
@ -222,13 +222,19 @@ tags = ["gemini", "gopher", "browser", "telecommunication", "internet"]
[[feeds]] [[feeds]]
lang = "en" lang = "en"
name = "[ngn.tf] | blog" name = "[ngn.tf] | journal"
link = "https://api.ngn.tf/blog/feed.atom" link = "https://api.ngn.tf/blog/feed.atom"
tags = ["computer", "service", "technology", "telecommunication", "xmpp"] tags = ["computer", "service", "technology", "telecommunication", "xmpp"]
[[feeds]] [[feeds]]
lang = "en" 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/" link = "http://righttoprivacy.i2p/rss/"
tags = ["computer", "service", "technology", "telecommunication", "i2p", "privacy"] tags = ["computer", "service", "technology", "telecommunication", "i2p", "privacy"]
@ -276,7 +282,7 @@ tags = ["christianity", "copy", "freedom", "religion", "software", "technology"]
[[feeds]] [[feeds]]
lang = "en-ca" lang = "en-ca"
name = "blog.jmp.chat's blog" name = "JMP's Journal"
link = "https://blog.jmp.chat/atom.xml" link = "https://blog.jmp.chat/atom.xml"
tags = ["jmp", "service", "sms", "telecommunication", "xmpp"] tags = ["jmp", "service", "sms", "telecommunication", "xmpp"]
@ -324,7 +330,7 @@ tags = ["news", "politics", "privacy", "surveillance"]
[[feeds]] [[feeds]]
lang = "en-gb" lang = "en-gb"
name = "op-co.de blog" name = "op-co.de journal"
link = "https://op-co.de/blog/index.rss" link = "https://op-co.de/blog/index.rss"
tags = ["code", "germany", "jabber", "mastodon", "telecommunication", "xmpp"] tags = ["code", "germany", "jabber", "mastodon", "telecommunication", "xmpp"]
@ -354,7 +360,7 @@ tags = ["art", "economics", "education", "hardware", "research", "technology"]
[[feeds]] [[feeds]]
lang = "en-gb" lang = "en-gb"
name = "Snikket Blog on Snikket Chat" name = "Snikket Journal on Snikket Chat"
link = "https://snikket.org/blog/index.xml" link = "https://snikket.org/blog/index.xml"
tags = ["chat", "jabber", "telecommunication", "xmpp"] tags = ["chat", "jabber", "telecommunication", "xmpp"]
@ -412,12 +418,6 @@ name = "CODEPINK - Women for Peace"
link = "https://www.codepink.org/news.rss" link = "https://www.codepink.org/news.rss"
tags = ["activism", "peace", "war", "women"] tags = ["activism", "peace", "war", "women"]
[[feeds]]
lang = "en-us"
name = "Ctrl blog"
link = "https://feed.ctrl.blog/latest.atom"
tags = ["computer", "technology"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "Delta Chat - Messenger based on e-mail" name = "Delta Chat - Messenger based on e-mail"
@ -426,7 +426,7 @@ tags = ["email", "telecommunication"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "Disroot Blog" name = "Disroot Journal"
link = "https://disroot.org/en/blog.atom" link = "https://disroot.org/en/blog.atom"
tags = ["decentralization", "privacy"] tags = ["decentralization", "privacy"]
@ -492,7 +492,7 @@ tags = ["news", "politics", "usa", "world"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "Jacob's Unnamed Blog" name = "Jacob's Unnamed Journal"
link = "https://jacobwsmith.xyz/feed.xml" link = "https://jacobwsmith.xyz/feed.xml"
tags = ["book", "community", "culture", "family", "finance", "lifestyle", "market", "usa"] tags = ["book", "community", "culture", "family", "finance", "lifestyle", "market", "usa"]
@ -630,7 +630,7 @@ tags = ["gemini", "internet"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "Public Intelligence Blog" name = "Public Intelligence Journal"
link = "https://phibetaiota.net/feed/" link = "https://phibetaiota.net/feed/"
tags = ["cia", "conspiracy", "health", "government", "war", "world"] tags = ["cia", "conspiracy", "health", "government", "war", "world"]
@ -678,7 +678,7 @@ tags = ["culture", "podcast", "politics", "usa", "vodcast"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "Redecentralize Blog" name = "Redecentralize Journal"
link = "https://redecentralize.org/blog/feed.rss" link = "https://redecentralize.org/blog/feed.rss"
tags = ["podcast", "privacy", "surveillance", "vodcast"] tags = ["podcast", "privacy", "surveillance", "vodcast"]
@ -726,7 +726,7 @@ tags = ["activism", "geoengineering"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "Sweet Home 3D Blog" name = "Sweet Home 3D Journal"
link = "http://www.sweethome3d.com/blog/rss.xml" link = "http://www.sweethome3d.com/blog/rss.xml"
tags = ["3d", "architecture", "design", "game"] tags = ["3d", "architecture", "design", "game"]
@ -774,7 +774,7 @@ tags = ["farming", "food", "gardening", "survival"]
[[feeds]] [[feeds]]
lang = "en-us" lang = "en-us"
name = "The XMPP Blog on XMPP" name = "The XMPP Journal on XMPP"
link = "https://xmpp.org/feeds/all.atom.xml" link = "https://xmpp.org/feeds/all.atom.xml"
tags = ["jabber", "telecommunication", "xmpp"] tags = ["jabber", "telecommunication", "xmpp"]
@ -822,7 +822,7 @@ tags = ["decentralization", "development", "electronics", "networking", "privacy
[[feeds]] [[feeds]]
lang = "es-es" lang = "es-es"
name = "Disroot Blog" name = "Disroot Journal"
link = "https://disroot.org/es/blog.atom" link = "https://disroot.org/es/blog.atom"
tags = ["decentralization", "privacy"] tags = ["decentralization", "privacy"]
@ -852,13 +852,13 @@ tags = ["technology"]
[[feeds]] [[feeds]]
lang = "fr-fr" lang = "fr-fr"
name = "Disroot Blog" name = "Disroot Journal"
link = "https://disroot.org/fr/blog.atom" link = "https://disroot.org/fr/blog.atom"
tags = ["decentralization", "privacy"] tags = ["decentralization", "privacy"]
[[feeds]] [[feeds]]
lang = "fr-fr" lang = "fr-fr"
name = "Framablog" name = "Frama Journal"
link = "https://framablog.org/feed/" link = "https://framablog.org/feed/"
tags = ["fediverse", "framasoft", "open source", "peertube", "privacy", "software", "xmpp"] tags = ["fediverse", "framasoft", "open source", "peertube", "privacy", "software", "xmpp"]
@ -954,7 +954,7 @@ tags = ["computer", "culture", "food", "technology"]
[[feeds]] [[feeds]]
lang = "it-it" lang = "it-it"
name = "Disroot Blog" name = "Disroot Journal"
link = "https://disroot.org/it/blog.atom" link = "https://disroot.org/it/blog.atom"
tags = ["decentralization", "privacy"] tags = ["decentralization", "privacy"]
@ -1008,7 +1008,7 @@ tags = ["computer", "technology", "design"]
[[feeds]] [[feeds]]
lang = "ru-ru" lang = "ru-ru"
name = "Disroot Blog" name = "Disroot Journal"
link = "https://disroot.org/ru/blog.atom" link = "https://disroot.org/ru/blog.atom"
tags = ["decentralization", "privacy"] tags = ["decentralization", "privacy"]

View file

@ -259,16 +259,16 @@ class XmppClient(slixmpp.ClientXMPP):
self.on_session_start) self.on_session_start)
self.add_event_handler("session_resumed", self.add_event_handler("session_resumed",
self.on_session_resumed) self.on_session_resumed)
self.add_event_handler("got_offline", print("got_offline")) self.add_event_handler("got_offline",
# self.add_event_handler("got_online", self.check_readiness) self.on_got_offline)
self.add_event_handler("changed_status", self.add_event_handler("changed_status",
self.on_changed_status) self.on_changed_status)
self.add_event_handler("disco_info", self.add_event_handler("disco_info",
self.on_disco_info) self.on_disco_info)
self.add_event_handler("presence_available", self.add_event_handler("presence_available",
self.on_presence_available) self.on_presence_available)
# self.add_event_handler("presence_unavailable", self.add_event_handler("presence_unavailable",
# self.on_presence_unavailable) self.on_presence_unavailable)
self.add_event_handler("chatstate_active", self.add_event_handler("chatstate_active",
self.on_chatstate_active) self.on_chatstate_active)
self.add_event_handler("chatstate_composing", self.add_event_handler("chatstate_composing",
@ -530,6 +530,11 @@ class XmppClient(slixmpp.ClientXMPP):
difference)) difference))
async def on_got_offline(self, presence):
breakpoint()
# await task.check_readiness(self, presence)
async def on_changed_status(self, presence): async def on_changed_status(self, presence):
time_begin = time.time() time_begin = time.time()
jid_full = presence['from'].full jid_full = presence['from'].full
@ -617,16 +622,13 @@ class XmppClient(slixmpp.ClientXMPP):
message_log = '{}: jid_full: {}' message_log = '{}: jid_full: {}'
logger.debug(message_log.format(function_name, jid_full)) logger.debug(message_log.format(function_name, jid_full))
jid_bare = presence['from'].bare jid_bare = presence['from'].bare
if jid_bare == self.boundjid.bare: if jid_bare == self.boundjid.bare: return
return
# FIXME TODO Find out what is the source responsible for a couple presences with empty message # FIXME TODO Find out what is the source responsible for a couple presences with empty message
# NOTE This is a temporary solution # NOTE This is a temporary solution
await asyncio.sleep(10) await asyncio.sleep(10)
FeedTask.restart_task(self, jid_bare) FeedTask.restart_task(self, jid_bare)
XmppChatTask.restart_task(self, jid_bare) XmppChatTask.restart_task(self, jid_bare)
XmppStatusTask.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() time_end = time.time()
difference = time_end - time_begin difference = time_end - time_begin
if difference > 15: logger.warning('{}: jid_full: {} (time: {})' if difference > 15: logger.warning('{}: jid_full: {} (time: {})'
@ -664,14 +666,6 @@ class XmppClient(slixmpp.ClientXMPP):
jid_bare = presence['from'].bare jid_bare = presence['from'].bare
for task in ('check', 'interval', 'status'): for task in ('check', 'interval', 'status'):
Task.stop(self, jid_bare, '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() time_end = time.time()
difference = time_end - time_begin difference = time_end - time_begin
if difference > 1: logger.warning('{} (time: {})'.format(function_name, if difference > 1: logger.warning('{} (time: {})'.format(function_name,