summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_feed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/vk_feed.cpp')
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp21
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