diff options
author | George Hazan <ghazan@miranda.im> | 2022-06-20 14:11:47 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-06-20 14:11:47 +0300 |
commit | 5fb505e97bca59badf137b524c54629fa51a8d65 (patch) | |
tree | f28dc534a9ba2cede9402d7db840749865fc5413 | |
parent | f5edf42fe7c00d966905d5d63441ad4bc3bc7b5a (diff) |
Jabber: added code to handle file size error, if HTTP Upload service sets the limit
-rw-r--r-- | protocols/JabberG/src/jabber_ft.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index e0f17beb94..b3e3845692 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -127,6 +127,12 @@ void CJabberProto::FtInitiate(filetransfer *ft) struct _stat64 st;
_wstat64(ft->std.szCurrentFile.w, &st);
+ uint32_t maxsize = getDword("HttpUploadMaxSize");
+ if (maxsize && st.st_size > maxsize) {
+ MsgPopup(ft->std.hContact, CMStringW(FORMAT, TranslateT("%s is too large. Maximum size supported by the service is %d KB"), ft->std.szCurrentFile.w, maxsize), L"HTTP Upload");
+ goto LBL_Error;
+ }
+
auto *pwszContentType = ProtoGetAvatarMimeType(ProtoGetAvatarFileFormat(ft->std.szCurrentFile.w));
if (pwszContentType == nullptr)
pwszContentType = "application/octet-stream";
|