diff options
author | George Hazan <ghazan@miranda.im> | 2018-08-28 13:00:26 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-08-28 13:00:26 +0300 |
commit | 5a79be6d2b588c87fd733a5080d5a5b1d9268fcb (patch) | |
tree | 610fd1a3a8d3568eec9e024d7b8fa315b80d8636 /plugins/Import/src | |
parent | 5ad0b6021dcbf76ee2846c38b39e767172ac0e1d (diff) |
fix for importing various kinds of events
Diffstat (limited to 'plugins/Import/src')
-rw-r--r-- | plugins/Import/src/textjson.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/plugins/Import/src/textjson.cpp b/plugins/Import/src/textjson.cpp index 0102e433b6..dcbb6449bd 100644 --- a/plugins/Import/src/textjson.cpp +++ b/plugins/Import/src/textjson.cpp @@ -157,10 +157,25 @@ public: std::string szBody = (*node)["body"].as_string(); if (!szBody.empty()) { + int offset; + switch (dbei->eventType) { + case EVENTTYPE_ADDED: + case EVENTTYPE_FILE: + offset = sizeof(DWORD); + break; + + case EVENTTYPE_AUTHREQUEST: + offset = sizeof(DWORD)*2; + break; + + default: + offset = 0; + } + dbei->flags |= DBEF_UTF; - dbei->cbBlob = (DWORD)szBody.size()+1; - dbei->pBlob = (PBYTE)mir_alloc(dbei->cbBlob); - strcpy((char*)dbei->pBlob, szBody.c_str()); + dbei->cbBlob = (DWORD)szBody.size() + offset + 2; + dbei->pBlob = (PBYTE)mir_calloc(dbei->cbBlob); + strcpy((char*)dbei->pBlob + offset, szBody.c_str()); } return 0; @@ -173,7 +188,7 @@ public: STDMETHODIMP_(MEVENT) FindNextEvent(MCONTACT, MEVENT iEvent) override { - if (iEvent >= m_events.getCount()) + if ((int)iEvent >= m_events.getCount()) return 0; return iEvent+1; |