diff options
-rw-r--r-- | gateway.py | 4 | ||||
-rw-r--r-- | library/longpoll.py | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -466,7 +466,7 @@ class VK(object): peers = [] if not conversations: logger.warning("no conversations for (jid: %s)", source) - return [] + return peers for conversation in conversations: if isinstance(conversation, dict): innerConversation = conversation.get("conversation") @@ -525,7 +525,7 @@ class VK(object): conversations = self.method("messages.getConversations", {"count": count, "filter": filter_}) conversations = conversations.get("items") else: - conversations = {"unread_count": 1, "1": {"conversation": {"peer": {"id": uid}}}} + conversations = [{"conversation": {"peer": {"id": uid}}}] peers = VK.getPeerIds(conversations, self.source) return self.getMessagesBulk(peers, count=count, mid=mid) diff --git a/library/longpoll.py b/library/longpoll.py index 51d5de8..c8db9f0 100644 --- a/library/longpoll.py +++ b/library/longpoll.py @@ -110,6 +110,10 @@ def processPollResult(user, data): mid, flags, uid, date, subject, body, attachments = evt out = flags & FLAG_OUT chat = (uid > MIN_CHAT_UID) # a groupchat always has uid > 2000000000 + # there is no point to request messages if there's only a single emoji attachment + # we actually only need to request for new messages if there are complex attachments in it (e.g. photos) + if len(attachments) == 1 and "emoji" in attachments: + attachments = None if not out: if not attachments and not chat: message = [{"out": 0, "user_id": uid, "id": mid, "date": date, "body": body}] |