diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-26 04:23:50 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-26 04:23:50 +0000 |
commit | efee96cfd3e6318ed376363ab9781bd944940107 (patch) | |
tree | 65b7c778fb973910bd0dc8bc82b56e4e3c70b7e0 /protocols/VKontakte/src/vk_feed.cpp | |
parent | f323ef4e6b1fe263e5564c66da33bdef7eb5fdde (diff) |
VKontakte:
add news¬ification autoclear option
code cleanup
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@11641 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_feed.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index e4152d5ae5..9f13a44dea 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -493,10 +493,12 @@ void CVkProto::RetrieveUnreadEvents() if (time(NULL) - tLastNewsTime >= m_iNewsInterval * 60 && m_bNewsEnabled)
RetrieveUnreadNews(tLastNewsTime);
+ NewsClearHistory();
}
INT_PTR CVkProto::SvcLoadVKNews(WPARAM, LPARAM)
{
+ debugLogA("CVkProto::SvcLoadVKNews");
if (!IsOnline())
return 1;
@@ -509,4 +511,23 @@ INT_PTR CVkProto::SvcLoadVKNews(WPARAM, LPARAM) RetrieveUnreadNews(tLastNewsTime);
return 0;
+}
+
+void CVkProto::NewsClearHistory()
+{
+ debugLogA("CVkProto::NewsClearHistory");
+ MCONTACT hContact = FindUser(VK_FEED_USER);
+ if (hContact == NULL || !m_bNewsAutoClearHistory)
+ return;
+
+ time_t tTime = time(NULL) - m_iNewsAutoClearHistoryInterval;
+ HANDLE hDBEvent = db_event_first(hContact);
+ while (hDBEvent) {
+ HANDLE hDBEventNext = db_event_next(hContact, hDBEvent);
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ db_event_get(hDBEvent, &dbei);
+ if (dbei.timestamp < tTime)
+ db_event_delete(hContact, hDBEvent);
+ hDBEvent = hDBEventNext;
+ }
}
\ No newline at end of file |