Create chat for unread messages. Set online and offline

This commit is contained in:
Manuel Cortez 2016-06-03 10:24:35 -05:00
parent 5ac17087f4
commit 06c3fb58a7
2 changed files with 20 additions and 1 deletions

View File

@ -5,6 +5,10 @@
* Removed platform from "last seen" column in the friends list as it could cause some problems and it was being not so exact.
* Now deleted audios are not parsed and displayed as "audio removed from library". They are silently ignored.
* It's possible to open a friends timeline for others.
* Fixed some strange bugs in the built version.
* Deactivated accounts will not cause problems in friends lists. They will be displayed as deactivated, wich means that it'll be impossible to interact with those accounts.
* When opened, the client will set online for the user account, it'll inform VK that this user is currently online. This parameter will be updated every 15 minutes, as stated in the API documentation. When exiting, Socializer will try to set the account as offline.
* When opened, socializer will try to create chat buffers for all unread messages.
## Changes on build 2016.05.25

View File

@ -130,6 +130,10 @@ class Controller(object):
self.window.change_status(_(u"Ready"))
self.longpool = longpoolthread.worker(self.session)
self.longpool.start()
self.status_setter = RepeatingTimer(900, self.set_online)
self.status_setter.start()
self.set_online()
self.create_unread_messages()
def in_post(self, buffer):
buffer = self.search(buffer)
@ -161,6 +165,7 @@ class Controller(object):
def exit(self, *args, **kwargs):
log.debug("Receibed an exit signal. closing...")
self.session.vk.client.account.setOffline()
self.disconnect_events()
self.window.Destroy()
wx.GetApp().ExitMainLoop()
@ -300,4 +305,14 @@ class Controller(object):
# ToDo: Clean this code and test how is the database working with this set to True.
num = self.session.order_buffer(buffer.name, data, True)
buffer.insert(self.session.db[buffer.name]["items"][-1], False)
self.session.soundplayer.play("chat.ogg")
self.session.soundplayer.play("chat.ogg")
def set_online(self):
r = self.session.vk.client.account.setOnline()
print "online: %d" % (r,)
def create_unread_messages(self):
msgs = self.session.vk.client.messages.getDialogs(count=200, unread=1)
print msgs
for i in msgs["items"]:
self.chat_from_id(i["from_id"])