From 3b180cda83183c41ffe0dc31dd3969616a1a78f3 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 21 Jan 2019 04:42:52 -0600 Subject: [PATCH] Added support to subscribers buffer --- changelog.md | 4 ++++ src/controller/buffers.py | 12 ++++++++---- src/wxUI/menus.py | 12 +++++++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index f361959..950d4b1 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ ## 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. * 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. diff --git a/src/controller/buffers.py b/src/controller/buffers.py index a73d1f9..35a4efd 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -855,7 +855,7 @@ class chatBuffer(baseBuffer): call_threaded(self.session.vk.client.messages.setActivity, peer_id=self.kwargs["peer_id"], type="typing") 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 retrieved = True # Control variable for handling unauthorised/connection errors. try: @@ -882,7 +882,7 @@ class chatBuffer(baseBuffer): else: if num > 0: [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) return retrieved @@ -951,8 +951,9 @@ class chatBuffer(baseBuffer): 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.")) - def __init__(self, *args, **kwargs): + def __init__(self, unread=False, *args, **kwargs): super(chatBuffer, self).__init__(*args, **kwargs) + self.unread = unread self.reads = [] self.chats = dict() 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.decline_friendship, menuitem=m.decline) 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: 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: m.message.Enable(False) widgetUtils.connect_event(m, widgetUtils.MENU, self.new_chat, menuitem=m.message) diff --git a/src/wxUI/menus.py b/src/wxUI/menus.py index 7f825c6..1777fb2 100644 --- a/src/wxUI/menus.py +++ b/src/wxUI/menus.py @@ -44,10 +44,12 @@ class audioMenu(wx.Menu): self.Append(self.move) 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) 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.Append(self.view_profile) 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.Append(self.common_friends) - def create_extra_items(self): + def create_request_items(self): self.accept = wx.MenuItem(self, wx.NewId(), _("Accept")) self.Append(self.accept) 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.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): def __init__(self, *args, **kwargs): super(commentMenu, self).__init__(*args, **kwargs)