summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/src/misc.cpp16
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp7
2 files changed, 10 insertions, 13 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index 06e0bccac2..dcdfd848fe 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -666,18 +666,14 @@ void CVkProto::MarkDialogAsRead(MCONTACT hContact)
return;
MEVENT hDBEvent;
+ MCONTACT hMContact = db_mc_tryMeta(hContact);
while ((hDBEvent = db_event_firstUnread(hContact)) != NULL) {
db_event_markRead(hContact, hDBEvent);
- int res = CallService(MS_CLIST_REMOVEEVENT, hContact, hDBEvent);
- debugLogA("CVkProto::MarkDialogAsRead [1] result = %d, hDbEvent = %d", res, (int)hDBEvent);
- }
-
- hContact = db_mc_tryMeta(hContact);
- CLISTEVENT *cle = NULL;
- while ((cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, hContact, 0)) != NULL) {
- db_event_markRead(hContact, cle->hDbEvent);
- int res = CallService(MS_CLIST_REMOVEEVENT, hContact, cle->hDbEvent);
- debugLogA("CVkProto::MarkDialogAsRead [2] result = %d, hDbEvent = %d", res, (int)(cle->hDbEvent));
+ int res1 = CallService(MS_CLIST_REMOVEEVENT, hMContact, hDBEvent);
+ int res2 = 2;
+ if (hContact != hMContact)
+ res2 = CallService(MS_CLIST_REMOVEEVENT, hContact, hDBEvent);
+ debugLogA("CVkProto::MarkDialogAsRead [1] result = (%d, %d), hDbEvent = %d", res1, res2, (int)hDBEvent);
}
}
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index c48a330ef6..9aa1585f20 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -403,17 +403,18 @@ void CVkProto::RetrieveUsersInfo(bool flag)
userIDs.AppendFormat(_T("%i"), userID);
}
- CMString codeformat("var userIDs=\"%s\";");
+ CMString codeformat("var userIDs=\"%s\";var _fields=\"%s\";");
if (m_bNeedSendOnline)
codeformat += _T("API.account.setOnline();");
if (flag && !m_bLoadFullCList)
- codeformat += CMString("var US=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});"
+ codeformat += CMString("var US=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});"
+ "var _US=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});if(_US.length>US.length)US=_US;"
"var res=[];var index=US.length;while(index>0){index=index-1;if(US[index].online!=0){res.unshift(US[index]);};};"
"return{\"freeoffline\":1,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
else
- codeformat += CMString("var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});"
+ codeformat += CMString("var res=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});"
"return{\"freeoffline\":0,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
code.AppendFormat(codeformat, userIDs, CMString(flag ? "online,status" : fieldsName));