Added support to subscribers buffer

This commit is contained in:
Manuel Cortez 2019-01-21 04:42:52 -06:00
parent 1a877bbfa1
commit 3b180cda83
3 changed files with 21 additions and 7 deletions

View File

@ -2,6 +2,10 @@
## changes in this version ## changes in this version
* Added experimental support to "subscribers" buffer, inside frienship requests. This shows friend requests that have been declined by the current user.
## Changes in version 0.18 (21.01.2019)
* Changed authentication tokens in Socializer. It is mandatory to download a fresh copy of socializer and start a new configuration for your account. * Changed authentication tokens in Socializer. It is mandatory to download a fresh copy of socializer and start a new configuration for your account.
* Stable versions of Socializer are built with Python 3. Previous versions are built with Python 2, however support for Python 2 will be dropped very soon. * Stable versions of Socializer are built with Python 3. Previous versions are built with Python 2, however support for Python 2 will be dropped very soon.
* There is an installer file for Socializer, available in our downloads page. Installed version of Socializer will be more confortable for some people. * There is an installer file for Socializer, available in our downloads page. Installed version of Socializer will be more confortable for some people.

View File

@ -855,7 +855,7 @@ class chatBuffer(baseBuffer):
call_threaded(self.session.vk.client.messages.setActivity, peer_id=self.kwargs["peer_id"], type="typing") call_threaded(self.session.vk.client.messages.setActivity, peer_id=self.kwargs["peer_id"], type="typing")
event.Skip() event.Skip()
def get_items(self, show_nextpage=False, unread=False): def get_items(self, show_nextpage=False):
if self.can_get_items == False: return if self.can_get_items == False: return
retrieved = True # Control variable for handling unauthorised/connection errors. retrieved = True # Control variable for handling unauthorised/connection errors.
try: try:
@ -882,7 +882,7 @@ class chatBuffer(baseBuffer):
else: else:
if num > 0: if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]] [self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
if unread == True and num > 0: if self.unread == True and num > 0:
self.session.db[self.name]["items"][-1].update(read_state=0) self.session.db[self.name]["items"][-1].update(read_state=0)
return retrieved return retrieved
@ -951,8 +951,9 @@ class chatBuffer(baseBuffer):
if ex.code == 9: if ex.code == 9:
output.speak(_("You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history.")) output.speak(_("You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history."))
def __init__(self, *args, **kwargs): def __init__(self, unread=False, *args, **kwargs):
super(chatBuffer, self).__init__(*args, **kwargs) super(chatBuffer, self).__init__(*args, **kwargs)
self.unread = unread
self.reads = [] self.reads = []
self.chats = dict() self.chats = dict()
self.peer_typing = 0 self.peer_typing = 0
@ -1071,9 +1072,12 @@ class peopleBuffer(feedBuffer):
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.accept) widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.accept)
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline) widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
widgetUtils.connect_event(m, widgetUtils.MENU, self.keep_as_follower, menuitem=m.keep_as_follower) widgetUtils.connect_event(m, widgetUtils.MENU, self.keep_as_follower, menuitem=m.keep_as_follower)
elif self.name == "subscribers":
m = menus.peopleMenu(is_subscriber=True)
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.add)
else: else:
m = menus.peopleMenu(is_request=False) m = menus.peopleMenu(is_request=False)
# It is not allowed to send messages to people who is not your friends, so let's disble it if we're in a pending or outgoing requests folder. # It is not allowed to send messages to people who is not your friends, so let's disable it if we're in a pending or outgoing requests folder.
if "friend_requests" in self.name: if "friend_requests" in self.name:
m.message.Enable(False) m.message.Enable(False)
widgetUtils.connect_event(m, widgetUtils.MENU, self.new_chat, menuitem=m.message) widgetUtils.connect_event(m, widgetUtils.MENU, self.new_chat, menuitem=m.message)

View File

@ -44,10 +44,12 @@ class audioMenu(wx.Menu):
self.Append(self.move) self.Append(self.move)
class peopleMenu(wx.Menu): class peopleMenu(wx.Menu):
def __init__(self, is_request=False, *args, **kwargs): def __init__(self, is_request=False, is_subscriber=False, *args, **kwargs):
super(peopleMenu, self).__init__(*args, **kwargs) super(peopleMenu, self).__init__(*args, **kwargs)
if is_request: if is_request:
self.create_extra_items() self.create_request_items()
elif is_subscriber:
self.create_subscriber_items()
self.view_profile = wx.MenuItem(self, wx.NewId(), _("View profile")) self.view_profile = wx.MenuItem(self, wx.NewId(), _("View profile"))
self.Append(self.view_profile) self.Append(self.view_profile)
self.message = wx.MenuItem(self, wx.NewId(), _("Send a message")) self.message = wx.MenuItem(self, wx.NewId(), _("Send a message"))
@ -57,7 +59,7 @@ class peopleMenu(wx.Menu):
self.common_friends = wx.MenuItem(self, wx.NewId(), _("View friends in common")) self.common_friends = wx.MenuItem(self, wx.NewId(), _("View friends in common"))
self.Append(self.common_friends) self.Append(self.common_friends)
def create_extra_items(self): def create_request_items(self):
self.accept = wx.MenuItem(self, wx.NewId(), _("Accept")) self.accept = wx.MenuItem(self, wx.NewId(), _("Accept"))
self.Append(self.accept) self.Append(self.accept)
self.decline = wx.MenuItem(self, wx.NewId(), _("Decline")) self.decline = wx.MenuItem(self, wx.NewId(), _("Decline"))
@ -65,6 +67,10 @@ class peopleMenu(wx.Menu):
self.keep_as_follower = wx.MenuItem(self, wx.NewId(), _("Keep as follower")) self.keep_as_follower = wx.MenuItem(self, wx.NewId(), _("Keep as follower"))
self.Append(self.keep_as_follower) self.Append(self.keep_as_follower)
def create_subscriber_items(self):
self.add = wx.MenuItem(self, wx.NewId(), _("Add to friends"))
self.Append(self.add)
class commentMenu(wx.Menu): class commentMenu(wx.Menu):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(commentMenu, self).__init__(*args, **kwargs) super(commentMenu, self).__init__(*args, **kwargs)