diff options
Diffstat (limited to 'protocols/SkypeWeb/src/skype_history_sync.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 0baf127e7b..c7d10ef54b 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -39,8 +39,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) if (totalCount >= 99 || conversations.size() >= 99)
PushRequest(new GetHistoryOnUrlRequest(syncState.c_str(), li), &CSkypeProto::OnGetServerHistory);
- for (int i = (int)conversations.size(); i >= 0; i--)
- {
+ for (int i = (int)conversations.size(); i >= 0; i--) {
const JSONNode &message = conversations.at(i);
CMStringA szMessageId = message["clientmessageid"] ? message["clientmessageid"].as_string().c_str() : message["skypeeditedid"].as_string().c_str();
@@ -56,7 +55,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) bool isEdited = message["skypeeditedid"];
MCONTACT hContact = FindContact(UrlToSkypename(conversationLink.c_str()));
-
+
if (timestamp > db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0))
db_set_dw(hContact, m_szModuleName, "LastMsgTime", (DWORD)timestamp);
@@ -68,46 +67,36 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) if (IsMe(skypename))
iFlags |= DBEF_SENT;
- if (strstr(conversationLink.c_str(), "/8:"))
- {
- if (messageType == "Text" || messageType == "RichText")
- {
+ if (strstr(conversationLink.c_str(), "/8:")) {
+ if (messageType == "Text" || messageType == "RichText") {
ptrA szMessage(messageType == "RichText" ? RemoveHtml(content.c_str()) : mir_strdup(content.c_str()));
MEVENT dbevent = GetMessageFromDb(hContact, szMessageId);
- if (isEdited && dbevent != NULL)
- {
+ if (isEdited && dbevent != NULL) {
AppendDBEvent(hContact, dbevent, szMessage, szMessageId, timestamp);
}
else AddDbEvent(emoteOffset == 0 ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION, hContact, timestamp, iFlags, &szMessage[emoteOffset], szMessageId);
}
- else if (messageType == "Event/Call")
- {
+ else if (messageType == "Event/Call") {
AddDbEvent(SKYPE_DB_EVENT_TYPE_CALL_INFO, hContact, timestamp, iFlags, content.c_str(), szMessageId);
}
- else if (messageType == "RichText/Files")
- {
+ else if (messageType == "RichText/Files") {
AddDbEvent(SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, hContact, timestamp, iFlags, content.c_str(), szMessageId);
}
- else if (messageType == "RichText/UriObject")
- {
+ else if (messageType == "RichText/UriObject") {
AddDbEvent(SKYPE_DB_EVENT_TYPE_URIOBJ, hContact, timestamp, iFlags, content.c_str(), szMessageId);
}
- else if (messageType == "RichText/Contacts")
- {
+ else if (messageType == "RichText/Contacts") {
ProcessContactRecv(hContact, timestamp, content.c_str(), szMessageId);
}
- else
- {
+ else {
AddDbEvent(SKYPE_DB_EVENT_TYPE_UNKNOWN, hContact, timestamp, iFlags, content.c_str(), szMessageId);
}
}
- else if (conversationLink.find("/19:") != -1)
- {
+ else if (conversationLink.find("/19:") != -1) {
CMStringA chatname(UrlToSkypename(conversationLink.c_str()));
ptrA szMessage(messageType == "RichText" ? RemoveHtml(content.c_str()) : mir_strdup(content.c_str()));
- if (messageType == "Text" || messageType == "RichText")
- {
+ if (messageType == "Text" || messageType == "RichText") {
AddMessageToChat(_A2T(chatname), _A2T(skypename), szMessage, emoteOffset != NULL, emoteOffset, timestamp, true);
}
}
@@ -138,24 +127,19 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) if (totalCount >= 99 || conversations.size() >= 99)
PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), li), &CSkypeProto::OnSyncHistory);
- for (size_t i = 0; i < conversations.size(); i++)
- {
+ for (size_t i = 0; i < conversations.size(); i++) {
const JSONNode &conversation = conversations.at(i);
const JSONNode &lastMessage = conversation["lastMessage"];
- if (lastMessage)
- {
+ if (lastMessage) {
std::string strConversationLink = lastMessage["conversationLink"].as_string();
- if (strConversationLink.find("/8:") != -1)
- {
+ if (strConversationLink.find("/8:") != -1) {
CMStringA szSkypename = UrlToSkypename(strConversationLink.c_str());
time_t composeTime(IsoToUnixTime(lastMessage["composetime"].as_string().c_str()));
MCONTACT hContact = FindContact(szSkypename);
- if (hContact != NULL)
- {
- if (getDword(hContact, "LastMsgTime", 0) < composeTime)
- {
+ if (hContact != NULL) {
+ if (getDword(hContact, "LastMsgTime", 0) < composeTime) {
PushRequest(new GetHistoryRequest(szSkypename, 100, false, 0, li), &CSkypeProto::OnGetServerHistory);
}
}
@@ -164,4 +148,4 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) }
m_bHistorySynced = true;
-}
\ No newline at end of file +}
|