summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-12 18:18:57 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-12 18:18:57 +0300
commit08840edfd4acce464d32244b5ccc3648588ce33d (patch)
tree61c799d10e287bf8ae1e293edee75ea5615328b2 /src/core
parentd0516970abbb1c4ae87ae31e360214b5e7e7763f (diff)
first attempt to make offline transfers visible
Diffstat (limited to 'src/core')
-rw-r--r--src/core/stdmsg/src/msglog.cpp44
1 files changed, 33 insertions, 11 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;