Mastodon: Added notifications in real time from streaming API

This commit is contained in:
Manuel Cortez 2022-12-19 16:07:45 -06:00
parent d4ebfac317
commit 1eb9aefbf1
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
2 changed files with 6 additions and 1 deletions

View File

@ -1238,6 +1238,7 @@ class Controller(object):
elif buff == "direct_messages": sound_to_play = "dm_received.ogg"
elif buff == "sent": sound_to_play = "tweet_send.ogg"
elif buff == "followers" or buff == "following": sound_to_play = "update_followers.ogg"
elif buff == "notifications": sound_to_play = "new_event.ogg"
elif "timeline" in buff: sound_to_play = "tweet_timeline.ogg"
else: sound_to_play = None
if sound_to_play != None and buff not in buffer.session.settings["other_buffers"]["muted_buffers"]:

View File

@ -288,3 +288,7 @@ class Session(base.baseSession):
if num == 0:
buffers.remove(b)
pub.sendMessage("mastodon.new_item", session_name=self.get_name(), item=obj, _buffers=buffers)
# Now, add notification to its buffer.
num = self.order_buffer("notifications", [notification])
if num > 0:
pub.sendMessage("mastodon.new_item", session_name=self.get_name(), item=notification, _buffers=["notifications"])