diff options
-rw-r--r-- | include/m_protoint.h | 2 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 299050 -> 299124 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 299072 -> 299152 bytes | |||
-rw-r--r-- | protocols/Discord/src/files.cpp | 2 | ||||
-rw-r--r-- | protocols/Discord/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Discord/src/utils.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 40 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 6 | ||||
-rw-r--r-- | protocols/Telegram/src/avatars.cpp | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/file.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_interface.cpp | 2 |
17 files changed, 32 insertions, 40 deletions
diff --git a/include/m_protoint.h b/include/m_protoint.h index 8dc0955a63..28343fe201 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -287,7 +287,7 @@ public: virtual void OnModulesLoaded(void);
// called when an cloud file is being received
- virtual void OnReceiveOfflineFile(DB::FILE_BLOB &blob);
+ virtual void OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob);
// prepares an event of the file being sent
virtual void OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *ft);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 79cb0fda50..a800d0dd2b 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 4523f6bdf1..5beaf47e15 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/protocols/Discord/src/files.cpp b/protocols/Discord/src/files.cpp index 163f1c7c72..b8cfa87935 100644 --- a/protocols/Discord/src/files.cpp +++ b/protocols/Discord/src/files.cpp @@ -78,7 +78,7 @@ INT_PTR CDiscordProto::SvcOfflineFile(WPARAM param, LPARAM) return 0; } -void CDiscordProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob) +void CDiscordProto::OnReceiveOfflineFile(DB::EventInfo&, DB::FILE_BLOB &blob) { if (auto *ft = (CDiscordAttachment *)blob.getUserInfo()) { blob.setUrl(ft->szUrl.GetBuffer()); diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index efee984afa..fac698111d 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -560,7 +560,7 @@ public: MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
- void OnReceiveOfflineFile(DB::FILE_BLOB &blob);
+ void OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob);
void OnShutdown() override;
//////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp index 3132407b03..ce5a88ae58 100644 --- a/protocols/Discord/src/utils.cpp +++ b/protocols/Discord/src/utils.cpp @@ -388,7 +388,7 @@ CMStringW CDiscordProto::PrepareMessageText(const JSONNode &pRoot, CDiscordUser if (dbei) {
DB::FILE_BLOB blob(dbei);
- OnReceiveOfflineFile(blob);
+ OnReceiveOfflineFile(dbei, blob);
blob.write(dbei);
db_event_edit(dbei.getEvent(), &dbei, true);
delete pFile;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index c115e63de0..ddd2a5bdf2 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -113,7 +113,7 @@ INT_PTR __cdecl CJabberProto::OnOfflineFile(WPARAM param, LPARAM) return 0;
}
-void CJabberProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob)
+void CJabberProto::OnReceiveOfflineFile(DB::EventInfo&, DB::FILE_BLOB &blob)
{
if (auto *ft = (filetransfer *)blob.getUserInfo()) {
if (ft->type == FT_HTTP) {
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index f82cdcb850..615ab8e70b 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -154,7 +154,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface MWindow OnCreateAccMgrUI(MWindow) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
- void OnReceiveOfflineFile(DB::FILE_BLOB &blob) override;
+ void OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob) override;
void OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *ft) override;
void OnShutdown() override;
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 4fc18a5c97..e99d5fcdb1 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -210,11 +210,18 @@ void CSkypeProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent) }
}
-void CSkypeProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob)
+void CSkypeProto::OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob)
{
if (auto *ft = (CSkypeTransfer *)blob.getUserInfo()) {
blob.setUrl(ft->url);
blob.setSize(ft->iFileSize);
+
+ auto &json = dbei.setJson();
+ json << CHAR_PARAM("skft", ft->fileType);
+ if (ft->iHeight != -1)
+ json << INT_PARAM("h", ft->iHeight);
+ if (ft->iWidth != -1)
+ json << INT_PARAM("w", ft->iWidth);
delete ft;
}
}
@@ -229,16 +236,15 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: if (xmlRoot == nullptr)
return;
- CMStringA szFileType;
CSkypeTransfer *ft = new CSkypeTransfer;
if (auto *str = xmlRoot->Attribute("doc_id"))
ft->docId = str;
if (auto *str = xmlRoot->Attribute("uri"))
ft->url = str;
- int iWidth = xmlRoot->IntAttribute("width", -1);
- int iHeight = xmlRoot->IntAttribute("heighr", -1);
+ ft->iWidth = xmlRoot->IntAttribute("width", -1);
+ ft->iHeight = xmlRoot->IntAttribute("heighr", -1);
if (auto *str = xmlRoot->Attribute("type"))
- szFileType = str;
+ ft->fileType = str;
if (auto *xml = xmlRoot->FirstChildElement("FileSize"))
if (auto *str = xml->Attribute("v"))
ft->iFileSize = atoi(str);
@@ -252,39 +258,25 @@ void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB:: return;
}
- int idx = szFileType.Find('/');
+ int idx = ft->fileType.Find('/');
if (idx != -1)
- szFileType = szFileType.Left(idx);
+ ft->fileType = ft->fileType.Left(idx);
// ordinary file
- if (szFileType == "File.1" || szFileType == "Picture.1" || szFileType == "Video.1") {
+ if (ft->fileType == "File.1" || ft->fileType == "Picture.1" || ft->fileType == "Video.1") {
MEVENT hEvent;
dbei.flags |= DBEF_TEMPORARY | DBEF_JSON;
if (dbei) {
DB::FILE_BLOB blob(dbei);
- OnReceiveOfflineFile(blob);
+ OnReceiveOfflineFile(dbei, blob);
blob.write(dbei);
db_event_edit(dbei.getEvent(), &dbei, true);
delete ft;
hEvent = dbei.getEvent();
}
else hEvent = ProtoChainRecvFile(hContact, DB::FILE_BLOB(ft, ft->fileName), dbei);
-
- DBVARIANT dbv = { DBVT_UTF8 };
- dbv.pszVal = szFileType.GetBuffer();
- db_event_setJson(hEvent, "skft", &dbv);
-
- dbv.type = DBVT_DWORD;
- if (iWidth != -1) {
- dbv.dVal = iWidth;
- db_event_setJson(hEvent, "w", &dbv);
- }
- if (iHeight != -1) {
- dbv.dVal = iHeight;
- db_event_setJson(hEvent, "h", &dbv);
- }
}
- else debugLogA("Invalid or unsupported file type <%s> ignored", szFileType.c_str());
+ else debugLogA("Invalid or unsupported file type <%s> ignored", ft->fileType.c_str());
}
void CSkypeProto::ProcessContactRecv(MCONTACT hContact, const char *szContent, DB::EventInfo &dbei)
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index de73e6be3d..2b8b7e5e8c 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CSkypeTransfer
{
- CMStringA docId, fileName, url;
- int iFileSize = 0;
+ CMStringA docId, fileName, fileType, url;
+ int iFileSize = 0, iWidth = -1, iHeight = -1;
};
struct CSkypeProto : public PROTO <CSkypeProto>
@@ -78,7 +78,7 @@ public: void OnEventDeleted(MCONTACT hContact, MEVENT hDbEvent, int flags) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
- void OnReceiveOfflineFile(DB::FILE_BLOB &blob) override;
+ void OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob) override;
void OnShutdown() override;
// icons
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 32d2255cee..873db7663f 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -149,7 +149,7 @@ INT_PTR __cdecl CTelegramProto::SvcOfflineFile(WPARAM param, LPARAM) /////////////////////////////////////////////////////////////////////////////////////////
// Cloud file pre-creator
-void CTelegramProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob)
+void CTelegramProto::OnReceiveOfflineFile(DB::EventInfo&, DB::FILE_BLOB &blob)
{
if (auto *ft = (TG_FILE_REQUEST *)blob.getUserInfo()) {
blob.setUrl(ft->m_uniqueId.GetBuffer());
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index d19ecdfb33..f3c66d3f50 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -409,7 +409,7 @@ public: void OnEventEdited(MCONTACT, MEVENT, const DBEVENTINFO &dbei) override; void OnMarkRead(MCONTACT, MEVENT) override; void OnModulesLoaded() override; - void OnReceiveOfflineFile(DB::FILE_BLOB &blob) override; + void OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob) override; void OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *hTransfer) override; void OnShutdown() override; diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index fa38d6cdc9..829677e8b3 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -454,7 +454,7 @@ bool CTelegramProto::GetMessageFile(const EmbeddedFile &F, TG_FILE_REQUEST::Type if (dbei) {
DB::FILE_BLOB blob(dbei);
- OnReceiveOfflineFile(blob);
+ OnReceiveOfflineFile(dbei, blob);
blob.write(dbei);
db_event_edit(dbei.getEvent(), &dbei, true);
delete pRequest;
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp index b57983de1b..5f1b5641c2 100644 --- a/src/mir_app/src/file.cpp +++ b/src/mir_app/src/file.cpp @@ -227,7 +227,7 @@ MEVENT Proto_RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbe CMStringW wszFiles, wszDescr; if (auto *ppro = Proto_GetContactInstance(hContact)) - ppro->OnReceiveOfflineFile(blob); + ppro->OnReceiveOfflineFile(dbei, blob); blob.write(dbei); MEVENT hdbe = db_event_add(hContact, &dbei); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 893a2882d6..975784af91 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -849,7 +849,7 @@ Chat_IsMuted @941 NONAME ?getIcon@LOGINFO@@QBEHXZ @981 NONAME
?getIndex@LOGINFO@@QBEHXZ @982 NONAME
?write@LOGINFO@@QBEXPAURtfChatLogStreamData@@_NAAV?$CMStringT@DV?$ChTraitsCRT@D@@@@PB_W@Z @983 NONAME
-?OnReceiveOfflineFile@PROTO_INTERFACE@@UAEXAAVFILE_BLOB@DB@@@Z @984 NONAME
+?OnReceiveOfflineFile@PROTO_INTERFACE@@UAEXAAVEventInfo@DB@@AAVFILE_BLOB@3@@Z @984 NONAME
?setSize@FILE_BLOB@DB@@QAEX_J@Z @985 NONAME
?setUrl@FILE_BLOB@DB@@QAEXPBD@Z @986 NONAME
?Clist_GetEvent@@YGPAUCListEvent@@IH@Z @987 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index cdb622cf2a..26d32d197a 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -849,7 +849,7 @@ Chat_IsMuted @941 NONAME ?getIcon@LOGINFO@@QEBAHXZ @981 NONAME
?getIndex@LOGINFO@@QEBAHXZ @982 NONAME
?write@LOGINFO@@QEBAXPEAURtfChatLogStreamData@@_NAEAV?$CMStringT@DV?$ChTraitsCRT@D@@@@PEB_W@Z @983 NONAME
-?OnReceiveOfflineFile@PROTO_INTERFACE@@UEAAXAEAVFILE_BLOB@DB@@@Z @984 NONAME
+?OnReceiveOfflineFile@PROTO_INTERFACE@@UEAAXAEAVEventInfo@DB@@AEAVFILE_BLOB@3@@Z @984 NONAME
?setSize@FILE_BLOB@DB@@QEAAX_J@Z @985 NONAME
?setUrl@FILE_BLOB@DB@@QEAAXPEBD@Z @986 NONAME
?Clist_GetEvent@@YAPEAUCListEvent@@IH@Z @987 NONAME
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp index dd8219703d..77413693dd 100644 --- a/src/mir_app/src/proto_interface.cpp +++ b/src/mir_app/src/proto_interface.cpp @@ -114,7 +114,7 @@ bool PROTO_INTERFACE::IsReadyToExit() return true;
}
-void PROTO_INTERFACE::OnReceiveOfflineFile(DB::FILE_BLOB &)
+void PROTO_INTERFACE::OnReceiveOfflineFile(DB::EventInfo&, DB::FILE_BLOB &)
{}
void PROTO_INTERFACE::OnSendOfflineFile(DB::EventInfo &, DB::FILE_BLOB &, void *)
|