summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/ICQ-WIM/src/menus.cpp6
-rw-r--r--protocols/ICQ-WIM/src/server.cpp26
2 files changed, 23 insertions, 9 deletions
diff --git a/protocols/ICQ-WIM/src/menus.cpp b/protocols/ICQ-WIM/src/menus.cpp
index ddfa5f0745..4cb75fe7b0 100644
--- a/protocols/ICQ-WIM/src/menus.cpp
+++ b/protocols/ICQ-WIM/src/menus.cpp
@@ -48,18 +48,18 @@ INT_PTR CIcqProto::SvcExecMenu(WPARAM iCommand, LPARAM pHandle)
IcqFileInfo *pFileInfo = nullptr;
CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
if (CheckFile(db_event_getContact(hEvent), wszText, pFileInfo)) {
- if (pFileInfo->bIsSticker) {
+ if (!pFileInfo || pFileInfo->bIsSticker) {
// sticker is a simple text message prcoessed by SmileyAdd
T2Utf szBody(wszText);
mir_free(dbei.pBlob);
- dbei.pBlob = (uint8_t*)szBody.get();
dbei.cbBlob = (int)mir_strlen(szBody.get());
+ dbei.pBlob = (uint8_t*)szBody.detach();
}
else {
// create the offline file event
dbei.eventType = EVENTTYPE_FILE;
- DB::FILE_BLOB blob(pFileInfo->wszDescr, L"");
+ DB::FILE_BLOB blob(pFileInfo->wszDescr, wszText);
blob.setUrl(pFileInfo->szOrigUrl);
blob.setSize(pFileInfo->dwFileSize);
blob.write(dbei);
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index a84efd0a16..a44c753bec 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -183,16 +183,18 @@ IcqFileInfo *CIcqProto::RetrieveFileInfo(MCONTACT hContact, const CMStringW &wsz
bool CIcqProto::CheckFile(MCONTACT hContact, CMStringW &wszText, IcqFileInfo *&pFileInfo)
{
+ bool bRet;
CMStringW wszUrl;
- if (!fileText2url(wszText, &wszUrl))
+ int idx = wszText.Find(' ');
+ if (idx == -1)
+ bRet = fileText2url(wszText, &wszUrl);
+ else
+ bRet = fileText2url(wszText.Mid(0, idx), &wszUrl);
+ if (!bRet)
return false;
pFileInfo = nullptr;
- int idx = wszText.Find(' ');
- if (idx != -1)
- wszText.Truncate(idx);
-
// is it already downloaded sticker?
CMStringW wszLoadedPath(FORMAT, L"%s\\%S\\Stickers\\STK{%s}.png", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName, wszUrl.c_str());
if (!_waccess(wszLoadedPath, 0)) {
@@ -221,7 +223,16 @@ bool CIcqProto::CheckFile(MCONTACT hContact, CMStringW &wszText, IcqFileInfo *&p
}
else wszText = TranslateT("SmileyAdd plugin required to support stickers");
}
- else pFileInfo->szOrigUrl = wszText;
+ else {
+ if (idx != -1) {
+ pFileInfo->szOrigUrl = wszText.Mid(0, idx);
+ wszText.Delete(0, idx + 1);
+ }
+ else {
+ pFileInfo->szOrigUrl = wszText;
+ wszText.Empty();
+ }
+ }
return true;
}
@@ -578,7 +589,10 @@ void CIcqProto::ParseMessage(MCONTACT hContact, __int64 &lastMsgId, const JSONNo
if (pFileInfo == nullptr && fileText2url(wszText)) {
if (hOldEvent)
return;
+
CheckFile(hContact, wszText, pFileInfo);
+ if (pFileInfo)
+ pFileInfo->wszDescr = wszText;
}
// process our own messages