Restart streaming in certain changes to followed/muted people

This commit is contained in:
Manuel Cortez 2022-08-24 11:32:06 -05:00
parent ac80e039b2
commit c6cbe3360b
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
4 changed files with 270 additions and 250 deletions

View File

@ -8,6 +8,7 @@ TWBlue Changelog
* Implemented a new setting, available in the account settings dialog, that allows to hide emojis in twitter usernames.
* TWBlue should be able to sort conversations in a more logical way. This should make it easier to follow a long thread in Twitter.
* When opening a thread, TWBlue should be able to load the right conversation if the original tweet from where the thread was loaded was a retweet.
* TWBlue will restart the Streaming subsystem every time there are changes to followed, muted or blocked users within the application.
* Fixed error when attempting to mention an user by using the "mention" button in any people buffer. Now tweets should be posted normally.
* Fixed error when loading other user lists. ([#465](https://github.com/MCV-Software/TWBlue/issues/465))
* Fixed an issue that was making TWBlue to display incorrectly some retweets of quoted tweets.

View File

@ -135,6 +135,7 @@ class Controller(object):
pub.subscribe(self.manage_unblocked_user, "unblocked-user")
pub.subscribe(self.create_buffer, "createBuffer")
pub.subscribe(self.toggle_share_settings, "toggleShare")
pub.subscribe(self.restart_streaming, "restartStreaming")
if system == "Windows":
pub.subscribe(self.invisible_shorcuts_changed, "invisible-shorcuts-changed")
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.show_hide, menuitem=self.view.show_hide)
@ -1656,7 +1657,6 @@ class Controller(object):
def toggle_share_settings(self, shareable=True):
self.view.retweet.Enable(shareable)
def check_streams(self):
if self.started == False:
return
@ -1666,3 +1666,10 @@ class Controller(object):
sessions.sessions[i].check_streams()
except TweepyException: # We shouldn't allow this function to die.
pass
def restart_streaming(self, session):
for s in sessions.sessions:
if sessions.sessions[s].session_id == session:
log.debug("Restarting stream in session %s" % (session))
sessions.sessions[s].stop_streaming()
sessions.sessions[s].start_streaming()

View File

@ -29,36 +29,42 @@ class userActionsController(object):
def follow(self, user):
try:
self.session.twitter.create_friendship(screen_name=user )
pub.sendMessage("restartStreaming", session=self.session.session_id)
except TweepyException as err:
output.speak("Error %s" % (str(err)), True)
def unfollow(self, user):
try:
id = self.session.twitter.destroy_friendship(screen_name=user )
pub.sendMessage("restartStreaming", session=self.session.session_id)
except TweepyException as err:
output.speak("Error %s" % (str(err)), True)
def mute(self, user):
try:
id = self.session.twitter.create_mute(screen_name=user )
pub.sendMessage("restartStreaming", session=self.session.session_id)
except TweepyException as err:
output.speak("Error %s" % (str(err)), True)
def unmute(self, user):
try:
id = self.session.twitter.destroy_mute(screen_name=user )
pub.sendMessage("restartStreaming", session=self.session.session_id)
except TweepyException as err:
output.speak("Error %s" % (str(err)), True)
def report(self, user):
try:
id = self.session.twitter.report_spam(screen_name=user )
pub.sendMessage("restartStreaming", session=self.session.session_id)
except TweepyException as err:
output.speak("Error %s" % (str(err)), True)
def block(self, user):
try:
id = self.session.twitter.create_block(screen_name=user )
pub.sendMessage("restartStreaming", session=self.session.session_id)
except TweepyException as err:
output.speak("Error %s" % (str(err)), True)

File diff suppressed because it is too large Load Diff