summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-25 20:00:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-25 20:00:55 +0300
commit9ea18ddc413a8c1eae6c32fe16e162a1998079c1 (patch)
tree0fcf08adc603e6420fae94bf79d7ede357b96edb /src
parentc104e058686d3d36bc9b15d84bfd9b84740cd3fa (diff)
Telegram: offline files to be links from the very beginning
Diffstat (limited to 'src')
-rw-r--r--src/core/stdfile/src/file.cpp1
-rw-r--r--src/mir_app/src/mir_app.def3
-rw-r--r--src/mir_app/src/mir_app64.def3
-rw-r--r--src/mir_app/src/proto_interface.cpp3
-rw-r--r--src/mir_app/src/protocols.cpp66
5 files changed, 44 insertions, 32 deletions
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index b1f8f3670f..652da6a36c 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -355,6 +355,7 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
}
DB::FILE_BLOB blob(wszFiles, bUtf ? Utf2T(pre->descr.a).get() : _A2T(pre->descr.a));
+ CallProtoService(dbei.szModule, PS_PRECREATE_OFFLINEFILE, WPARAM(&blob), pre->lParam);
blob.write(dbei);
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 319027ada5..2af6fdb061 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -864,3 +864,6 @@ 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
+?OnCreateOfflineFile@PROTO_INTERFACE@@UAEXAAVFILE_BLOB@DB@@PAX@Z @984 NONAME
+?setSize@FILE_BLOB@DB@@QAEX_J@Z @985 NONAME
+?setUrl@FILE_BLOB@DB@@QAEXPBD@Z @986 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 94c6600242..33cd79d291 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -864,3 +864,6 @@ 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
+?OnCreateOfflineFile@PROTO_INTERFACE@@UEAAXAEAVFILE_BLOB@DB@@PEAX@Z @984 NONAME
+?setSize@FILE_BLOB@DB@@QEAAX_J@Z @985 NONAME
+?setUrl@FILE_BLOB@DB@@QEAAXPEBD@Z @986 NONAME
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp
index b49e9a74ca..9e3d719126 100644
--- a/src/mir_app/src/proto_interface.cpp
+++ b/src/mir_app/src/proto_interface.cpp
@@ -79,6 +79,9 @@ MWindow PROTO_INTERFACE::OnCreateAccMgrUI(MWindow)
return nullptr; // error
}
+void PROTO_INTERFACE::OnCreateOfflineFile(DB::FILE_BLOB&, void *)
+{}
+
void PROTO_INTERFACE::OnEventDeleted(MCONTACT, MEVENT)
{}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index f3a1d60f5c..d369bdf4da 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -43,38 +43,39 @@ static int __cdecl CompareServiceItems(const void *p1, const void *p2)
static TServiceListItem serviceItems[] =
{
- { PS_ADDTOLIST, 1 },
- { PS_ADDTOLISTBYEVENT, 2 },
- { PS_AUTHALLOW, 3 },
- { PS_AUTHDENY, 4 },
- { PSR_AUTH, 5 },
- { PSS_AUTHREQUEST, 6 },
- { PSS_FILEALLOW, 8 },
- { PSS_FILECANCEL, 9 },
- { PSS_FILEDENY, 10 },
- { PS_FILERESUME, 11 },
- { PS_GETCAPS, 12 },
- { PS_LOADICON, 13 },
- { PSS_GETINFO, 14 },
- { PS_BASICSEARCH, 15 },
- { PS_SEARCHBYEMAIL, 16 },
- { PS_SEARCHBYNAME, 17 },
- { PS_SEARCHBYADVANCED, 18 },
- { PS_CREATEADVSEARCHUI, 19 },
- { PSR_CONTACTS, 20 },
- { PSR_FILE, 21 },
- { PSR_MESSAGE, 22 },
- { PSS_CONTACTS, 23 },
- { PSS_FILE, 24 },
- { PSS_MESSAGE, 25 },
- { PSS_SETAPPARENTMODE, 26 },
- { PS_SETSTATUS, 27 },
- { PSS_GETAWAYMSG, 28 },
- { PSR_AWAYMSG, 29 },
- { PS_SETAWAYMSG, 30 },
- { PSS_USERISTYPING, 31 },
- { PS_GETNAME, 32 },
- { PS_GETSTATUS, 33 }
+ { PS_ADDTOLIST, 1 },
+ { PS_ADDTOLISTBYEVENT, 2 },
+ { PS_AUTHALLOW, 3 },
+ { PS_AUTHDENY, 4 },
+ { PSR_AUTH, 5 },
+ { PSS_AUTHREQUEST, 6 },
+ { PS_PRECREATE_OFFLINEFILE, 7 },
+ { PSS_FILEALLOW, 8 },
+ { PSS_FILECANCEL, 9 },
+ { PSS_FILEDENY, 10 },
+ { PS_FILERESUME, 11 },
+ { PS_GETCAPS, 12 },
+ { PS_LOADICON, 13 },
+ { PSS_GETINFO, 14 },
+ { PS_BASICSEARCH, 15 },
+ { PS_SEARCHBYEMAIL, 16 },
+ { PS_SEARCHBYNAME, 17 },
+ { PS_SEARCHBYADVANCED, 18 },
+ { PS_CREATEADVSEARCHUI, 19 },
+ { PSR_CONTACTS, 20 },
+ { PSR_FILE, 21 },
+ { PSR_MESSAGE, 22 },
+ { PSS_CONTACTS, 23 },
+ { PSS_FILE, 24 },
+ { PSS_MESSAGE, 25 },
+ { PSS_SETAPPARENTMODE, 26 },
+ { PS_SETSTATUS, 27 },
+ { PSS_GETAWAYMSG, 28 },
+ { PSR_AWAYMSG, 29 },
+ { PS_SETAWAYMSG, 30 },
+ { PSS_USERISTYPING, 31 },
+ { PS_GETNAME, 32 },
+ { PS_GETSTATUS, 33 },
};
//------------------------------------------------------------------------------------
@@ -400,6 +401,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
case 4: return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (wchar_t *)lParam);
case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT *)lParam);
case 6: return (INT_PTR)ppi->AuthRequest(hContact, (wchar_t *)lParam);
+ case 7: ppi->OnCreateOfflineFile(*(DB::FILE_BLOB *)wParam, (void *)lParam); return 0;
case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (wchar_t *)lParam);
case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (wchar_t *)lParam);