diff options
author | George Hazan <ghazan@miranda.im> | 2023-04-12 18:13:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-04-12 18:13:51 +0300 |
commit | d0516970abbb1c4ae87ae31e360214b5e7e7763f (patch) | |
tree | ddada09e37e9784e5bd6c4df5ea9c12b4b926794 /src/core/stdfile | |
parent | cd83b1c10bbe50f5aa43a8e8f7dffc5fee1d769a (diff) |
StdFile: fix for file receive dialog
Diffstat (limited to 'src/core/stdfile')
-rw-r--r-- | src/core/stdfile/src/file.cpp | 12 | ||||
-rw-r--r-- | src/core/stdfile/src/filerecvdlg.cpp | 15 |
2 files changed, 7 insertions, 20 deletions
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 4bd5eee393..e9720c9acd 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -118,16 +118,10 @@ static void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) static int FileEventAdded(WPARAM wParam, LPARAM lParam)
{
- uint32_t dwSignature;
-
DBEVENTINFO dbei = {};
- dbei.cbBlob = sizeof(uint32_t);
- dbei.pBlob = (uint8_t*)&dwSignature;
db_event_get(lParam, &dbei);
- if (dbei.flags & (DBEF_SENT | DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0)
- return 0;
-
- PushFileEvent(wParam, lParam, 0);
+ if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_FILE)
+ PushFileEvent(wParam, lParam, 0);
return 0;
}
@@ -274,7 +268,7 @@ static void RemoveUnreadFileEvents(void) while (hDbEvent) {
DBEVENTINFO dbei = {};
db_event_get(hDbEvent, &dbei);
- if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && dbei.eventType == EVENTTYPE_FILE)
+ if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_FILE)
db_event_markRead(hContact, hDbEvent);
hDbEvent = db_event_next(hContact, hDbEvent);
}
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 29e0a7f53c..099f419fcb 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -247,18 +247,11 @@ public: if (!dbei)
return false;
- dat->fs = m_lParam ? (HANDLE)m_lParam : (HANDLE)*(PDWORD)dbei.pBlob;
+ dat->fs = (HANDLE)m_lParam;
- char *str = (char *)dbei.pBlob + 4;
- ptrW ptszFileName(DbEvent_GetString(&dbei, str));
- SetDlgItemText(m_hwnd, IDC_FILENAMES, ptszFileName);
-
- int len = (int)mir_strlen(str) + 1;
- if (len + 4 < dbei.cbBlob) {
- str += len;
- ptrW pwszDescription(DbEvent_GetString(&dbei, str));
- SetDlgItemText(m_hwnd, IDC_MSG, pwszDescription);
- }
+ DB::FILE_BLOB blob(dbei);
+ SetDlgItemText(m_hwnd, IDC_FILENAMES, blob.getName());
+ SetDlgItemText(m_hwnd, IDC_MSG, blob.getDescr());
wchar_t datetimestr[64];
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0);
|