diff options
author | George Hazan <ghazan@miranda.im> | 2023-04-12 18:18:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-04-12 18:18:57 +0300 |
commit | 08840edfd4acce464d32244b5ccc3648588ce33d (patch) | |
tree | 61c799d10e287bf8ae1e293edee75ea5615328b2 /src | |
parent | d0516970abbb1c4ae87ae31e360214b5e7e7763f (diff) |
first attempt to make offline transfers visible
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 44 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 4 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 5 |
3 files changed, 39 insertions, 14 deletions
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index a105a2fe53..778ae5f991 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -195,7 +195,7 @@ bool DbEventIsForMsgWindow(const DBEVENTINFO *dbei) bool DbEventIsShown(const DBEVENTINFO *dbei)
{
- return (dbei->eventType == EVENTTYPE_MESSAGE) || DbEventIsForMsgWindow(dbei);
+ return dbei->eventType == EVENTTYPE_MESSAGE || dbei->eventType == EVENTTYPE_FILE || DbEventIsForMsgWindow(dbei);
}
static bool CreateRTFFromDbEvent(LogStreamData *dat)
@@ -303,18 +303,40 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) break;
case EVENTTYPE_FILE:
+ SetToStyle(MSGFONTID_NOTICE, buf);
{
DB::FILE_BLOB blob(dbei);
-
- SetToStyle(MSGFONTID_NOTICE, buf);
- AppendToBufferWithRTF(buf, (dbei.flags & DBEF_SENT) ? TranslateT("File sent") : TranslateT("File received"));
- buf.Append(": ");
- AppendToBufferWithRTF(buf, blob.getName());
-
- if (*blob.getDescr() != 0) {
- buf.Append(" (");
- AppendToBufferWithRTF(buf, blob.getDescr());
- buf.Append(")");
+ if (blob.isOffline()) {
+ AppendToBufferWithRTF(buf, TranslateT("Offline file"));
+ buf.Append(" {\\field{\\*\\fldinst HYPERLINK \"");
+ buf.AppendFormat("ofile:%ul", dat->hDbEvent);
+ buf.Append("\"}{\\fldrslt{\\ul ");
+ AppendToBufferWithRTF(buf, blob.getName());
+ buf.AppendFormat("}}} | %uKB", blob.getSize() / 1024);
+
+ CMStringA szHost;
+ if (const char *b = strstr(blob.getUrl(), "://"))
+ for (b = b + 3; *b != 0 && *b != '/' && *b != ':'; b++)
+ szHost.AppendChar(*b);
+
+ if (!szHost.IsEmpty())
+ buf.AppendFormat(" on %s", szHost.c_str());
+
+ if (blob.getSize() > 0 && blob.getSize() == blob.getTransferred()) {
+ buf.AppendChar(' ');
+ AppendToBufferWithRTF(buf, TranslateT("Completed"));
+ }
+ }
+ else {
+ AppendToBufferWithRTF(buf, (dbei.flags & DBEF_SENT) ? TranslateT("File sent") : TranslateT("File received"));
+ buf.Append(": ");
+ AppendToBufferWithRTF(buf, blob.getName());
+
+ if (*blob.getDescr() != 0) {
+ buf.Append(" (");
+ AppendToBufferWithRTF(buf, blob.getDescr());
+ buf.Append(")");
+ }
}
}
break;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index f4c74509a7..c1d9a5682b 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -846,4 +846,6 @@ Chat_IsMuted @941 NONAME ?getUrl@FILE_BLOB@DB@@QBEPBDXZ @961 NONAME
?isCompleted@FILE_BLOB@DB@@QBE_NXZ @962 NONAME
?isOffline@FILE_BLOB@DB@@QBE_NXZ @963 NONAME
-?setSize@FILE_BLOB@DB@@QAEXI@Z @964 NONAME
+?SetEventJson@MDatabaseCommon@@UAGHIPBDPAUDBVARIANT@@@Z @964 NONAME
+?getSize@FILE_BLOB@DB@@QBEIXZ @965 NONAME
+?getTransferred@FILE_BLOB@DB@@QBEIXZ @966 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a6e78bcdad..1ad0ea4d87 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -846,5 +846,6 @@ Chat_IsMuted @941 NONAME ?getUrl@FILE_BLOB@DB@@QEBAPEBDXZ @961 NONAME
?isCompleted@FILE_BLOB@DB@@QEBA_NXZ @962 NONAME
?isOffline@FILE_BLOB@DB@@QEBA_NXZ @963 NONAME
-?setSize@FILE_BLOB@DB@@QEAAXI@Z @964 NONAME
-?SetEventJson@MDatabaseCommon@@UEAAHIPEBDPEAUDBVARIANT@@@Z @965 NONAME
+?SetEventJson@MDatabaseCommon@@UEAAHIPEBDPEAUDBVARIANT@@@Z @964 NONAME
+?getSize@FILE_BLOB@DB@@QEBAIXZ @965 NONAME
+?getTransferred@FILE_BLOB@DB@@QEBAIXZ @966 NONAME
|