summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_messages.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2013-07-01 19:00:11 +0000
committerAlexander Lantsev <aunsane@gmail.com>2013-07-01 19:00:11 +0000
commit3acc3adbcba5afbb0527a4385e6b2f0c63e960da (patch)
tree89cab2a7cf8fe3ae42a984eb0a8a02c4209998c0 /protocols/Skype/src/skype_messages.cpp
parentb365a9ca74456f3a3962161ec6564244c35b1fb9 (diff)
Skype:
- removed ignore command - block command behavior like in official client now - added blocked list in account options - added history sync Note: this commit may contain non-working code git-svn-id: http://svn.miranda-ng.org/main/trunk@5203 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_messages.cpp')
-rw-r--r--protocols/Skype/src/skype_messages.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp
index 2c398de2b0..16570e8081 100644
--- a/protocols/Skype/src/skype_messages.cpp
+++ b/protocols/Skype/src/skype_messages.cpp
@@ -207,4 +207,131 @@ void CSkypeProto::OnMessageEvent(const ConversationRef &conversation, const Mess
}
break;
}
+}
+
+void CSkypeProto::SyncMessageHystory(const ConversationRef &conversation, const time_t timestamp)
+{
+ if (conversation)
+ {
+ conversation->SetConsumedHorizon(timestamp);
+ MessageRefs oldMessages, newMessages;
+ conversation->GetLastMessages(oldMessages, newMessages, timestamp);
+ for (size_t i = 0; i < oldMessages.size(); i++)
+ this->OnMessageEvent(conversation, oldMessages[i]);
+ for (size_t i = 0; i < newMessages.size(); i++)
+ this->OnMessageEvent(conversation, newMessages[i]);
+ conversation->SetConsumedHorizon(time(NULL));
+ }
+}
+
+int CSkypeProto::SyncLastDayHistoryCommand(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact)
+ {
+ ptrW sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
+
+ ConversationRef conversation;
+ if ( !this->IsChatRoom(hContact))
+ {
+ SEStringList target;
+ target.append((char *)ptrA(::mir_utf8encodeW(sid)));
+ this->GetConversationByParticipants(target, conversation);
+ }
+ else
+ this->GetConversationByIdentity((char *)ptrA(::mir_utf8encodeW(sid)), conversation);
+
+ if (conversation)
+ {
+ time_t timestamp = time(NULL);
+ timestamp -= 60*60*24;
+
+ this->SyncMessageHystory(conversation, timestamp);
+ }
+ }
+ return 0;
+}
+
+int CSkypeProto::SyncLastWeekHistoryCommand(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact)
+ {
+ ptrW sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
+
+ ConversationRef conversation;
+ if ( !this->IsChatRoom(hContact))
+ {
+ SEStringList target;
+ target.append((char *)ptrA(::mir_utf8encodeW(sid)));
+ this->GetConversationByParticipants(target, conversation);
+ }
+ else
+ this->GetConversationByIdentity((char *)ptrA(::mir_utf8encodeW(sid)), conversation);
+
+ if (conversation)
+ {
+ time_t timestamp = time(NULL);
+ timestamp -= 60*60*24*7;
+
+ this->SyncMessageHystory(conversation, timestamp);
+ }
+ }
+ return 0;
+}
+
+int CSkypeProto::SyncLastMonthHistoryCommand(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact)
+ {
+ ptrW sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
+
+ ConversationRef conversation;
+ if ( !this->IsChatRoom(hContact))
+ {
+ SEStringList target;
+ target.append((char *)ptrA(::mir_utf8encodeW(sid)));
+ this->GetConversationByParticipants(target, conversation);
+ }
+ else
+ this->GetConversationByIdentity((char *)ptrA(::mir_utf8encodeW(sid)), conversation);
+
+ if (conversation)
+ {
+ time_t timestamp = time(NULL);
+ timestamp -= 60*60*24*30;
+
+ this->SyncMessageHystory(conversation, timestamp);
+ }
+ }
+ return 0;
+}
+
+int CSkypeProto::SyncLast3MonthHistoryCommand(WPARAM wParam, LPARAM lParam)
+{
+ HANDLE hContact = (HANDLE)wParam;
+ if (hContact)
+ {
+ ptrW sid = ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID);
+
+ ConversationRef conversation;
+ if ( !this->IsChatRoom(hContact))
+ {
+ SEStringList target;
+ target.append((char *)ptrA(::mir_utf8encodeW(sid)));
+ this->GetConversationByParticipants(target, conversation);
+ }
+ else
+ this->GetConversationByIdentity((char *)ptrA(::mir_utf8encodeW(sid)), conversation);
+
+ if (conversation)
+ {
+ time_t timestamp = time(NULL);
+ timestamp -= 60*60*24*90;
+
+ this->SyncMessageHystory(conversation, timestamp);
+ }
+ }
+ return 0;
} \ No newline at end of file