View friends and send chats to them with a button in the buffer

This commit is contained in:
2016-05-25 11:33:57 -05:00
parent 2b44c72999
commit 1252b7feac
6 changed files with 68 additions and 33 deletions

View File

@@ -288,4 +288,17 @@ class chatBuffer(baseBuffer):
def send_chat_to_user(self, *args, **kwargs):
text = self.tab.text.GetValue()
if text == "": return
response = self.session.vk.client.messages.send(user_id=self.kwargs["user_id"], message=text)
response = self.session.vk.client.messages.send(user_id=self.kwargs["user_id"], message=text)
class peopleBuffer(feedBuffer):
def create_tab(self, parent):
self.tab = home.peopleTab(parent)
def connect_events(self):
super(peopleBuffer, self).connect_events()
widgetUtils.connect_event(self.tab.new_chat, widgetUtils.BUTTON_PRESSED, self.new_chat)
def new_chat(self, *args, **kwargs):
user_id = self.session.db[self.name]["items"][self.tab.list.get_selected()]["id"]
pub.sendMessage("new-chat", user_id=user_id)