diff options
author | George Hazan <george.hazan@gmail.com> | 2023-07-26 21:33:09 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-07-26 21:33:09 +0300 |
commit | 73c31a3f9ac9f323d6a17a910fb6a8a32416c7bb (patch) | |
tree | 2a6228d112e0c1dee7490050da6382006bcf57a4 /protocols | |
parent | fbb56ea0b2e5cdab7b82e46752d9451701e3eb5a (diff) |
fixes #3585 (Оффлайновые файлы: исходящие файлы должны выглядеть как и входящие)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 12 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 32 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/stdafx.h | 1 |
6 files changed, 28 insertions, 21 deletions
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 18ca3c59b3..01f04bb01f 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -25,12 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "jabber_caps.h"
-INT_PTR __cdecl CJabberProto::OnOfflineFile(WPARAM param, LPARAM)
-{
- ForkThread((MyThreadFunc)&CJabberProto::OfflineFileThread, (void*)param);
- return 0;
-}
-
void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *ofd)
{
DB::EventInfo dbei(ofd->hDbEvent);
@@ -108,6 +102,12 @@ void __cdecl CJabberProto::OfflineFileThread(OFDTHREAD *ofd) delete ofd;
}
+INT_PTR __cdecl CJabberProto::OnOfflineFile(WPARAM param, LPARAM)
+{
+ ForkThread((MyThreadFunc)&CJabberProto::OfflineFileThread, (void *)param);
+ return 0;
+}
+
void CJabberProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *pHandle)
{
if (auto *ft = (filetransfer *)pHandle)
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 1912a5b224..7f00b81449 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -783,23 +783,31 @@ LBL_Fail: }
else m << XCHILDNS("x", JABBER_FEAT_OOB2) << XCHILD("url", szMessage.c_str());
- if (m_bEmbraceUrls && ProtoGetAvatarFormat(_A2T(szMessage)) != PA_FORMAT_UNKNOWN) {
- szMessage.Insert(0, "[img]");
- szMessage.Append("[/img]");
- }
-
int ret = SendMsgEx(ft->std.hContact, szMessage.c_str(), m);
- if (ret != -1 && !isChatRoom(ft->std.hContact)) {
- PROTORECVEVENT recv = {};
- recv.flags = PREF_CREATEREAD | PREF_SENT;
- recv.szMessage = szMessage.GetBuffer();
- recv.timestamp = time(0);
- ProtoChainRecvMsg(ft->std.hContact, &recv);
- }
+ if (ret != -1 && !isChatRoom(ft->std.hContact))
+ ft->szUrl = mir_strdup(szMessage);
FtSendFinal(true, ft);
}
+void CJabberProto::OnSendOfflineFile(DB::EventInfo &/*dbei*/, DB::FILE_BLOB &blob, void *hTransfer)
+{
+ auto *ft = (filetransfer *)hTransfer;
+ if (!ft->szUrl)
+ return;
+
+ auto *p = wcsrchr(ft->std.szCurrentFile.w, '\\');
+ if (p == nullptr)
+ p = ft->std.szCurrentFile.w;
+ else
+ p++;
+ blob.setName(p);
+
+ blob.setUrl(ft->szUrl);
+ blob.complete(ft->std.totalBytes);
+ blob.setLocalName(ft->std.szCurrentFile.w);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
bool CJabberProto::FtTryInlineFile(filetransfer *ft)
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 27cee4ca46..c414d857f7 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -726,7 +726,6 @@ public: m_options.AddOption(LPGENW("Other"), LPGENW("Automatically accept authorization requests"), m_proto->m_bAutoAcceptAuthorization);
m_options.AddOption(LPGENW("Other"), LPGENW("Fix incorrect timestamps in incoming messages"), m_proto->m_bFixIncorrectTimestamps);
m_options.AddOption(LPGENW("Other"), LPGENW("Enable XMPP link processing (requires AssocMgr)"), m_proto->m_bProcessXMPPLinks);
- m_options.AddOption(LPGENW("Other"), LPGENW("Embrace picture URLs with [img]"), m_proto->m_bEmbraceUrls);
m_options.AddOption(LPGENW("Other"), LPGENW("Ignore server roster (groups and nick names)"), m_proto->m_bIgnoreRoster);
m_options.AddOption(LPGENW("Security"), LPGENW("Allow local time and timezone requests (XEP-0202)"), m_proto->m_bAllowTimeReplies);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 61f27ddab6..d3695437fa 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -121,7 +121,6 @@ CJabberProto::CJabberProto(const char *aProtoName, const wchar_t *aUserName) : m_bManualConnect(this, "ManualConnect", false),
m_bMsgAck(this, "MsgAck", true),
m_bProcessXMPPLinks(this, "ProcessXMPPLinks", false),
- m_bEmbraceUrls(this, "EmbraceUrls", false),
m_bRcMarkMessagesAsRead(this, "RcMarkMessagesAsRead", true),
m_bRosterSync(this, "RosterSync", false),
m_bSavePassword(this, "SavePassword", true),
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 4a645a894b..d08408df93 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -154,6 +154,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
void OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *ft) override;
+ void OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *ft) override;
void OnShutdown() override;
//====| Services |====================================================================
@@ -225,7 +226,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface CMOption<bool> m_bManualConnect;
CMOption<bool> m_bMsgAck;
CMOption<bool> m_bProcessXMPPLinks;
- CMOption<bool> m_bEmbraceUrls;
CMOption<bool> m_bRcMarkMessagesAsRead;
CMOption<bool> m_bRosterSync;
CMOption<bool> m_bSavePassword;
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index bc16368761..7123b8443e 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -445,6 +445,7 @@ struct filetransfer : public MZeroedObject HANDLE hFileEvent;
unsigned __int64 *fileSize;
wchar_t *szDescription;
+ ptrA szUrl;
CJabberProto *ppro;
};
|