diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 35a4efd..8082581 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -1095,7 +1095,20 @@ class peopleBuffer(feedBuffer): pass def decline_friendship(self, *args, **kwargs): - pass + person = self.get_post() + if person == None: + return + user = self.session.get_user(person["id"]) + question = commonMessages.remove_friend(user) + if question == widgetUtils.NO: + return + result = self.session.vk.client.friends.delete(user_id=person["id"]) + if "friend_deleted" in result: + msg = _("You've deleted {user1_nom} from your friends.").format(**user,) + print(msg) + pub.sendMessage("notify", message=msg) + self.session.db[self.name]["items"].pop(self.tab.list.get_selected()) + self.tab.list.remove_item(self.tab.list.get_selected()) def keep_as_follower(self, *args, **kwargs): pass diff --git a/src/wxUI/commonMessages.py b/src/wxUI/commonMessages.py index ea37780..f31e313 100644 --- a/src/wxUI/commonMessages.py +++ b/src/wxUI/commonMessages.py @@ -49,3 +49,6 @@ def group_joined(): def proxy_question(): return wx.MessageDialog(None, _("If you live in a country where VK is blocked, you can use a proxy to bypass such restrictions. Socializer includes a working proxy to ensure all users can connect to VK. Do you want to use Socializer through the proxy?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() + +def remove_friend(user): + return wx.MessageDialog(None, _("Are you sure you want to remove {user1_nom} from your friends?").format(**user), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() \ No newline at end of file