summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-25 14:58:56 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-25 14:58:56 +0300
commit0f9e1002ec21154bc476fbfeab0d21f796515823 (patch)
tree678f870457343d977afe06b154cfa5323b75e8da
parentee7a91629442ba40e876e19e4cdd7af173e8e840 (diff)
DbEvent_GetTextW: useless second parameter removed
-rw-r--r--include/delphi/m_database.inc2
-rw-r--r--include/m_database.h2
-rw-r--r--libs/win32/mir_app.libbin276564 -> 276564 bytes
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp2
-rw-r--r--plugins/BasicHistory/src/EventList.cpp2
-rw-r--r--plugins/Boltun/src/boltun.cpp2
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp2
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_fct.cpp6
-rw-r--r--plugins/HistoryPlusPlus/hpp_events.pas2
-rw-r--r--plugins/IEHistory/src/utils.cpp2
-rw-r--r--plugins/IEView/src/HTMLBuilder.cpp6
-rw-r--r--plugins/Msg_Export/src/utils.cpp4
-rw-r--r--plugins/NewEventNotify/src/popup.cpp4
-rw-r--r--plugins/NewStory/src/history_array.cpp6
-rw-r--r--plugins/NewStory/src/history_dlg.cpp4
-rw-r--r--plugins/Scriver/src/msgdialog.cpp2
-rw-r--r--plugins/Scriver/src/msglog.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp2
-rw-r--r--plugins/TabSRMM/src/msglog.cpp6
-rw-r--r--plugins/TipperYM/src/subst.cpp2
-rw-r--r--plugins/Variables/src/parse_miranda.cpp2
-rw-r--r--plugins/wbOSD/src/events.cpp4
-rw-r--r--protocols/Discord/src/dispatch.cpp2
-rw-r--r--protocols/ICQ-WIM/src/menus.cpp6
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp2
-rw-r--r--protocols/JabberG/src/jabber_rc.cpp4
-rw-r--r--src/core/stdmsg/src/msglog.cpp4
-rw-r--r--src/core/stduihist/src/history.cpp4
-rw-r--r--src/mir_app/src/chat_log.cpp2
-rw-r--r--src/mir_app/src/chat_tools.cpp2
-rw-r--r--src/mir_app/src/db_events.cpp12
-rw-r--r--src/mir_app/src/srmm_base.cpp4
32 files changed, 52 insertions, 56 deletions
diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc
index 93baaf542e..e7c1d5499a 100644
--- a/include/delphi/m_database.inc
+++ b/include/delphi/m_database.inc
@@ -298,7 +298,7 @@ function DbEvent_RegisterType(et:PDBEVENTTYPEDESCR) : int; stdcall; external App
function DbEvent_GetType(szModule:PAnsiChar; eventType:int) : PDBEVENTTYPEDESCR; stdcall; external AppDll;
function DbEvent_GetTextA(dbei:PDBEVENTINFO; codepage:int) : PAnsiChar; stdcall; external AppDll;
-function DbEvent_GetTextW(dbei:PDBEVENTINFO; codepage:int) : PWideChar; stdcall; external AppDll;
+function DbEvent_GetTextW(dbei:PDBEVENTINFO) : PWideChar; stdcall; external AppDll;
function DbEvent_GetIcon(dbei:PDBEVENTINFO; flags:int) : HICON; stdcall; external AppDll;
diff --git a/include/m_database.h b/include/m_database.h
index 5d2d4ccab8..975d3d865c 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -523,7 +523,7 @@ __forceinline MCONTACT DbGetAuthEventContact(DBEVENTINFO *dbei)
// This string should be freed by a call of mir_free
EXTERN_C MIR_APP_DLL(char*) DbEvent_GetTextA(const DBEVENTINFO *dbei, int codepage);
-EXTERN_C MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(const DBEVENTINFO *dbei, int codepage);
+EXTERN_C MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(const DBEVENTINFO *dbei);
/////////////////////////////////////////////////////////////////////////////////////////
// Retrieves the event's icon
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index f2af590140..a348e78163 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp
index 271e619180..d290a65c78 100644
--- a/plugins/AutoShutdown/src/watcher.cpp
+++ b/plugins/AutoShutdown/src/watcher.cpp
@@ -72,7 +72,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent)
DBVARIANT dbv;
if (!g_plugin.getWString("Message", &dbv)) {
ltrimw(rtrimw(dbv.pwszVal));
- ptrW wszMsg(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW wszMsg(DbEvent_GetTextW(&dbei));
if (wszMsg != nullptr && wcsstr(wszMsg, dbv.pwszVal) != nullptr)
ShutdownAndStopWatcher(); /* msg with specified text recvd */
mir_free(dbv.pwszVal); /* does NULL check */
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp
index 031552102e..2be9c30110 100644
--- a/plugins/BasicHistory/src/EventList.cpp
+++ b/plugins/BasicHistory/src/EventList.cpp
@@ -443,7 +443,7 @@ std::wstring HistoryEventList::GetContactId()
static void GetMessageDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf)
{
- wchar_t *msg = DbEvent_GetTextW(dbei, CP_ACP);
+ wchar_t *msg = DbEvent_GetTextW(dbei);
wcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid message"), _TRUNCATE);
buf[cbBuf - 1] = 0;
mir_free(msg);
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp
index beaee86406..7b691a29be 100644
--- a/plugins/Boltun/src/boltun.cpp
+++ b/plugins/Boltun/src/boltun.cpp
@@ -202,7 +202,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
if (Config.MarkAsRead)
db_event_markRead(hContact, hDbEvent);
- AnswerToContact(hContact, ptrW(DbEvent_GetTextW(&dbei, CP_ACP)));
+ AnswerToContact(hContact, ptrW(DbEvent_GetTextW(&dbei)));
return 0;
}
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index 1410c7c29a..e41ec820a4 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -1223,7 +1223,7 @@ void AddHistoryEvent(DBEVENTINFO *dbEvent, wchar_t *contact, PReply reply)
TimeZone_ToString(dbEvent->timestamp, "D, s", timestamp, _countof(timestamp));
wchar_t *sender = (dbEvent->flags & DBEF_SENT) ? TranslateT("[me]") : contact;
- wchar_t *message = DbEvent_GetTextW(dbEvent, CP_ACP);
+ wchar_t *message = DbEvent_GetTextW(dbEvent);
static wchar_t buffer[8192];
mir_snwprintf(buffer, L"[%S] %15s: %s", timestamp, sender, message);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
index 4b4736ea53..2977f5fedd 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
@@ -57,7 +57,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
date[0] = 0;
time[0] = 0;
- msg = DbEvent_GetTextW(dbei, CP_ACP);
+ msg = DbEvent_GetTextW(dbei);
if (msg == nullptr)
return 0;
@@ -382,7 +382,7 @@ void WriteLinkList(HWND hDlg, uint8_t params, LISTELEMENT *listStart, LPCTSTR se
{
DB::EventInfo dbe(actualElement->hEvent);
- ptrW msg(DbEvent_GetTextW(&dbe, CP_ACP));
+ ptrW msg(DbEvent_GetTextW(&dbe));
if (wcsstr(msg, searchString))
filter3 = 1;
}
@@ -611,7 +611,7 @@ void WriteMessage(HWND hDlg, LISTELEMENT *listStart, int actLinePos)
SetDlgItemTextW(hDlg, IDC_MESSAGE, L"");
DB::EventInfo dbe(hEvent);
- SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, ptrW(DbEvent_GetTextW(&dbe, CP_ACP)));
+ SendDlgItemMessage(hDlg, IDC_MESSAGE, EM_REPLACESEL, FALSE, ptrW(DbEvent_GetTextW(&dbe)));
}
break;
}
diff --git a/plugins/HistoryPlusPlus/hpp_events.pas b/plugins/HistoryPlusPlus/hpp_events.pas
index 004095c98f..6f70f39a35 100644
--- a/plugins/HistoryPlusPlus/hpp_events.pas
+++ b/plugins/HistoryPlusPlus/hpp_events.pas
@@ -525,7 +525,7 @@ begin
Result := False;
msg := nil;
try
- msg := DbEvent_GetTextW(@EventInfo, CP_ACP);
+ msg := DbEvent_GetTextW(@EventInfo);
Result := Assigned(msg);
except
if Assigned(msg) then mir_free(msg);
diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp
index c9e2e2a5a7..a16465d843 100644
--- a/plugins/IEHistory/src/utils.cpp
+++ b/plugins/IEHistory/src/utils.cpp
@@ -141,7 +141,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat
switch (type) {
case SEARCH_TEXT:
{
- ptrW data(DbEvent_GetTextW(&dbEvent, CP_UTF8));
+ ptrW data(DbEvent_GetTextW(&dbEvent));
wchar_t *tmp = wcsstr(data, (wchar_t *)searchData);
if (tmp)
found = true;
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp
index 3c251572c4..47525671a0 100644
--- a/plugins/IEView/src/HTMLBuilder.cpp
+++ b/plugins/IEView/src/HTMLBuilder.cpp
@@ -229,14 +229,14 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
eventData->bIsMe = FALSE;
}
if (dbei.eventType == EVENTTYPE_MESSAGE || dbei.isSrmm()) {
- eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
+ eventData->szText.w = DbEvent_GetTextW(&dbei);
if (dbei.eventType == EVENTTYPE_MESSAGE)
eventData->iType = IEED_EVENT_MESSAGE;
else
eventData->iType = IEED_EVENT_STATUSCHANGE;
}
else if (dbei.eventType == EVENTTYPE_FILE) {
- eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
+ eventData->szText.w = DbEvent_GetTextW(&dbei);
eventData->iType = IEED_EVENT_FILE;
}
else if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
@@ -252,7 +252,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event)
eventData->iType = IEED_EVENT_SYSTEM;
}
else { // custom event
- eventData->szText.w = DbEvent_GetTextW(&dbei, newEvent.codepage);
+ eventData->szText.w = DbEvent_GetTextW(&dbei);
eventData->iType = IEED_EVENT_MESSAGE;
}
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp
index 924d26fa58..b4a48cac06 100644
--- a/plugins/Msg_Export/src/utils.cpp
+++ b/plugins/Msg_Export/src/utils.cpp
@@ -789,7 +789,7 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF
}
}
else {
- ptrW msg(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW msg(DbEvent_GetTextW(&dbei));
if (msg)
pRoot.push_back(JSONNode("body", T2Utf(msg).get()));
}
@@ -820,7 +820,7 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF
switch (dbei.eventType) {
case EVENTTYPE_MESSAGE:
- bWriteIndentedToFile(hFile, nIndent, ptrW(DbEvent_GetTextW(&dbei, CP_ACP)), bWriteUTF8Format);
+ bWriteIndentedToFile(hFile, nIndent, ptrW(DbEvent_GetTextW(&dbei)), bWriteUTF8Format);
break;
case EVENTTYPE_FILE:
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp
index 0c3a43d50c..4fb80b8342 100644
--- a/plugins/NewEventNotify/src/popup.cpp
+++ b/plugins/NewEventNotify/src/popup.cpp
@@ -157,7 +157,7 @@ static wchar_t* ShortenPreview(DB::EventInfo &dbei)
if (iPreviewLimit > 500 || iPreviewLimit == 0)
iPreviewLimit = 500;
- wchar_t *buf = DbEvent_GetTextW(&dbei, CP_ACP);
+ wchar_t *buf = DbEvent_GetTextW(&dbei);
if (mir_wstrlen(buf) > iPreviewLimit) {
fAddEllipsis = true;
size_t iIndex = iPreviewLimit;
@@ -294,7 +294,7 @@ static wchar_t* GetEventPreview(DB::EventInfo &dbei)
// support for custom database event types
DBEVENTTYPEDESCR *pei = DbEvent_GetType(dbei.szModule, dbei.eventType);
if (pei && pBlob) {
- comment1 = DbEvent_GetTextW(&dbei, CP_ACP);
+ comment1 = DbEvent_GetTextW(&dbei);
commentFix = pei->descr;
}
else commentFix = POPUP_COMMENT_OTHER;
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 1193f56449..2d109c1540 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -61,7 +61,7 @@ bool Filter::check(ItemData *item) const
if (!item->fetch())
return false;
- return CheckFilter(ptrW(DbEvent_GetTextW(&item->dbe, CP_UTF8)), text);
+ return CheckFilter(ptrW(DbEvent_GetTextW(&item->dbe)), text);
}
return true;
@@ -441,7 +441,7 @@ void ItemData::load(bool bLoadAlways)
break;
default:
- wtext = DbEvent_GetTextW(&dbe, CP_ACP);
+ wtext = DbEvent_GetTextW(&dbe);
break;
}
@@ -457,7 +457,7 @@ void ItemData::load(bool bLoadAlways)
}
else str.AppendFormat(L"%s %s: ", Clist_GetContactDisplayName(hContact, 0), TranslateT("wrote"));
- ptrW wszText(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW wszText(DbEvent_GetTextW(&dbei));
if (mir_wstrlen(wszText) > 43)
wcscpy(wszText.get() + 40, L"...");
str.Append(wszText);
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp
index c012b9651f..e4f966e852 100644
--- a/plugins/NewStory/src/history_dlg.cpp
+++ b/plugins/NewStory/src/history_dlg.cpp
@@ -174,7 +174,7 @@ class CHistoryDlg : public CDlgBase
if (!dbei)
continue;
- ptrW pwszText(DbEvent_GetTextW(&dbei, CP_UTF8));
+ ptrW pwszText(DbEvent_GetTextW(&dbei));
if (!mir_wstrlen(pwszText))
continue;
@@ -215,7 +215,7 @@ class CHistoryDlg : public CDlgBase
flags += "r";
pRoot2.push_back(JSONNode("flags", flags));
- ptrW msg(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW msg(DbEvent_GetTextW(&dbei));
if (msg)
pRoot2.push_back(JSONNode("body", T2Utf(msg).get()));
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index c4b69baf9e..0ab0d77f11 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -382,7 +382,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*)
return;
if (DbEventIsMessageOrCustom(dbei)) {
- ptrW wszText(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW wszText(DbEvent_GetTextW(&dbei));
SetMessageText(Srmm_Quote(wszText));
}
}
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp
index 0f5867f734..cf68b2a7cc 100644
--- a/plugins/Scriver/src/msglog.cpp
+++ b/plugins/Scriver/src/msglog.cpp
@@ -398,7 +398,7 @@ public:
}
bool bIsRtl = (dbei.flags & DBEF_RTL) != 0;
- ptrW wszText(DbEvent_GetTextW(&dbei, CP_UTF8)), wszNick;
+ ptrW wszText(DbEvent_GetTextW(&dbei)), wszNick;
// test contact
if (streamData->dbei == 0) {
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 7db8739e27..90170af3b1 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -934,7 +934,7 @@ void CMsgDialog::onClick_Quote(CCtrlButton*)
if (szQuoted.IsEmpty()) {
DB::EventInfo dbei(hDBEvent);
if (dbei)
- szQuoted = Srmm_Quote(ptrW(DbEvent_GetTextW(&dbei, CP_ACP)), iOutputWidth);
+ szQuoted = Srmm_Quote(ptrW(DbEvent_GetTextW(&dbei)), iOutputWidth);
}
}
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 2ae3bd5186..18759fbbdf 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -573,7 +573,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe
if (!isSent && bIsStatusChangeEvent)
dbei.wipeNotify(streamData->hDbEvent);
- CMStringW msg(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
+ CMStringW msg(ptrW(DbEvent_GetTextW(&dbei)));
if (msg.IsEmpty())
return nullptr;
@@ -981,7 +981,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe
if (blob.isOffline())
InsertFileLink(str, streamData->hDbEvent, blob);
else
- AppendUnicodeToBuffer(str, ptrW(DbEvent_GetTextW(&dbei, CP_ACP)), 0);
+ AppendUnicodeToBuffer(str, ptrW(DbEvent_GetTextW(&dbei)), 0);
}
break;
@@ -991,7 +991,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe
str.AppendChar(' ');
}
- ptrW tszText(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW tszText(DbEvent_GetTextW(&dbei));
AppendUnicodeToBuffer(str, tszText, 0);
}
break;
diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp
index a7aafa717d..34ab44cceb 100644
--- a/plugins/TipperYM/src/subst.cpp
+++ b/plugins/TipperYM/src/subst.cpp
@@ -173,7 +173,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received)
if (dbei.cbBlob == 0 || dbei.pBlob == nullptr)
return nullptr;
- wchar_t *buff = DbEvent_GetTextW(&dbei, CP_ACP);
+ wchar_t *buff = DbEvent_GetTextW(&dbei);
wchar_t *swzMsg = mir_wstrdup(buff);
mir_free(buff);
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 8996cbbc46..1a754bc4d8 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -565,7 +565,7 @@ static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
return nullptr;
DB::EventInfo dbe(hDbEvent);
- return (dbe) ? DbEvent_GetTextW(&dbe, CP_ACP) : nullptr;
+ return (dbe) ? DbEvent_GetTextW(&dbe) : nullptr;
}
static wchar_t* parseTranslate(ARGUMENTSINFO *ai)
diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp
index f456b4aab1..a408f69655 100644
--- a/plugins/wbOSD/src/events.cpp
+++ b/plugins/wbOSD/src/events.cpp
@@ -181,12 +181,12 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
if (i1 == 1)
c1 = mir_wstrdup(Clist_GetContactDisplayName(wParam));
else if (i1 == 2)
- c1 = DbEvent_GetTextW(&dbe, 0);
+ c1 = DbEvent_GetTextW(&dbe);
if (i2 == 1)
c2 = mir_wstrdup(Clist_GetContactDisplayName(wParam));
else if (i2 == 2)
- c2 = DbEvent_GetTextW(&dbe, 0);
+ c2 = DbEvent_GetTextW(&dbe);
wchar_t buffer[512];
mir_snwprintf(buffer, buf, c1, c2);
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 58a66bd90e..2f3686af46 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -395,7 +395,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew)
DB::EventInfo dbei;
dbei.cbBlob = -1;
if (!db_event_get(hOldEvent, &dbei)) {
- ptrW wszOldText(DbEvent_GetTextW(&dbei, CP_UTF8));
+ ptrW wszOldText(DbEvent_GetTextW(&dbei));
if (wszOldText)
wszText.Insert(0, wszOldText);
if (dbei.flags & DBEF_SENT)
diff --git a/protocols/ICQ-WIM/src/menus.cpp b/protocols/ICQ-WIM/src/menus.cpp
index 5c7fca94ad..69d8191157 100644
--- a/protocols/ICQ-WIM/src/menus.cpp
+++ b/protocols/ICQ-WIM/src/menus.cpp
@@ -29,7 +29,7 @@ int CIcqProto::OnPrebuildMenu(WPARAM hContact, LPARAM lParam)
auto *dbei = (DB::EventInfo *)lParam;
Menu_ShowItem(hmiForward, dbei->eventType == EVENTTYPE_MESSAGE || dbei->eventType == EVENTTYPE_FILE);
- ptrW wszText(DbEvent_GetTextW(dbei, CP_UTF8));
+ ptrW wszText(DbEvent_GetTextW(dbei));
Menu_ShowItem(hmiConvert, fileText2url(wszText.get()));
}
return 0;
@@ -123,7 +123,7 @@ void CIcqProto::ForwardMessage(MEVENT hEvent, MCONTACT to)
return;
CMStringW wszId(GetUserId(dbei.hContact));
- ptrW wszText(DbEvent_GetTextW(&dbei, CP_UTF8));
+ ptrW wszText(DbEvent_GetTextW(&dbei));
JSONNode parts(JSON_ARRAY);
JSONNode msgText; msgText << CHAR_PARAM("mediaType", "forward") << WCHAR_PARAM("sn", wszId) << INT_PARAM("time", dbei.timestamp)
@@ -155,7 +155,7 @@ INT_PTR CIcqProto::SvcExecMenu(WPARAM iCommand, LPARAM pHandle)
return 0;
IcqFileInfo *pFileInfo = nullptr;
- CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
+ CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei)));
if (CheckFile(dbei.hContact, wszText, pFileInfo)) {
if (!pFileInfo || pFileInfo->bIsSticker) {
// sticker is a simple text message prcoessed by SmileyAdd
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index f5e60e2b13..dea367270c 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -590,7 +590,7 @@ int CIcqProto::SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszSrc
CMStringA replyId(GetUserId(dbei.hContact));
replyTo << CHAR_PARAM("mediaType", "quote") << CHAR_PARAM("sn", replyId) << INT_PARAM("time", dbei.timestamp)
<< CHAR_PARAM("msgId", dbei.szId) << WCHAR_PARAM("friendly", Clist_GetContactDisplayName(dbei.hContact, 0))
- << WCHAR_PARAM("text", ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
+ << WCHAR_PARAM("text", ptrW(DbEvent_GetTextW(&dbei)));
parts.push_back(replyTo);
}
}
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp
index bd49cf6adf..aa924db49b 100644
--- a/protocols/JabberG/src/jabber_rc.cpp
+++ b/protocols/JabberG/src/jabber_rc.cpp
@@ -451,7 +451,7 @@ int CJabberProto::RcGetUnreadEventsCount()
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
DB::EventInfo dbei(hDbEvent);
if (dbei && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) {
- ptrW szEventText(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW szEventText(DbEvent_GetTextW(&dbei));
if (szEventText)
nEventsSent++;
}
@@ -529,7 +529,7 @@ int CJabberProto::AdhocForwardHandler(const TiXmlElement*, CJabberIqInfo *pInfo,
if (dbei.eventType != EVENTTYPE_MESSAGE || (dbei.flags & (DBEF_READ | DBEF_SENT)))
continue;
- ptrW szEventText(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW szEventText(DbEvent_GetTextW(&dbei));
if (szEventText == nullptr)
continue;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index 55cac4d02f..0c2c8b4d85 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -364,7 +364,7 @@ public:
AppendToBufferWithRTF(buf, szName);
AppendToBufferWithRTF(buf, L" ");
- msg = DbEvent_GetTextW(&dbei, CP_ACP);
+ msg = DbEvent_GetTextW(&dbei);
if (msg) {
AppendToBufferWithRTF(buf, msg);
mir_free(msg);
@@ -394,7 +394,7 @@ public:
case EVENTTYPE_MESSAGE:
default:
- msg = DbEvent_GetTextW(&dbei, CP_ACP);
+ msg = DbEvent_GetTextW(&dbei);
SetToStyle((dbei.eventType == EVENTTYPE_MESSAGE) ? ((dbei.flags & DBEF_SENT) ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG) : MSGFONTID_NOTICE, buf);
AppendToBufferWithRTF(buf, msg);
mir_free(msg);
diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp
index c886b4f341..e335167a67 100644
--- a/src/core/stduihist/src/history.cpp
+++ b/src/core/stduihist/src/history.cpp
@@ -274,7 +274,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
DB::EventInfo dbei(hDbEvent);
if (dbei) {
- ptrW wszDescr(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW wszDescr(DbEvent_GetTextW(&dbei));
if (wszDescr)
SetDlgItemText(hwndDlg, IDC_EDIT, wszDescr);
}
@@ -309,7 +309,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dbei.cbBlob = oldBlobSize;
db_event_get(hDbEvent, &dbei);
- ptrW wszDescr(DbEvent_GetTextW(&dbei, CP_ACP));
+ ptrW wszDescr(DbEvent_GetTextW(&dbei));
if (wszDescr) {
CharUpperW(wszDescr);
if (wcsstr(wszDescr, (const wchar_t *)lParam) != nullptr) {
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index 830430b0d5..6ff849e8b0 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -330,7 +330,7 @@ void CRtfLogWindow::CreateChatRtfMessage(RtfChatLogStreamData *streamData, const
return;
}
}
- lin.write(streamData, false, buf, ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
+ lin.write(streamData, false, buf, ptrW(DbEvent_GetTextW(&dbei)));
return;
}
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 2692678a69..ec5eefaa74 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -735,7 +735,7 @@ void Chat_EventToGC(SESSION_INFO *si, MEVENT hDbEvent)
return;
Utf2T wszUserId(dbei.szUserId);
- CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)));
+ CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei)));
wszText.Replace(L"%", L"%%");
GCEVENT gce = { si, GC_EVENT_MESSAGE };
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp
index 1fb1a25a12..de410800ee 100644
--- a/src/mir_app/src/db_events.cpp
+++ b/src/mir_app/src/db_events.cpp
@@ -185,12 +185,8 @@ static INT_PTR DbEventGetTextWorker(const DB::EventInfo *dbei, int codepage, int
memcpy(str, dbei->pBlob, dbei->cbBlob);
str[dbei->cbBlob] = 0;
- if (dbei->flags & DBEF_UTF) {
- wchar_t *msg = nullptr;
- mir_utf8decodecp(str, codepage, &msg);
- if (msg)
- return (INT_PTR)msg;
- }
+ if (dbei->flags & DBEF_UTF)
+ return (INT_PTR)mir_utf8decodeW(str);
return (INT_PTR)mir_a2u_cp(str, codepage);
}
@@ -210,9 +206,9 @@ MIR_APP_DLL(char*) DbEvent_GetTextA(const DBEVENTINFO *dbei, int codepage)
return (char*)DbEventGetTextWorker((DB::EventInfo *)dbei, codepage, DBVT_ASCIIZ);
}
-MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(const DBEVENTINFO *dbei, int codepage)
+MIR_APP_DLL(wchar_t*) DbEvent_GetTextW(const DBEVENTINFO *dbei)
{
- return (wchar_t*)DbEventGetTextWorker((DB::EventInfo *)dbei, codepage, DBVT_WCHAR);
+ return (wchar_t*)DbEventGetTextWorker((DB::EventInfo *)dbei, CP_ACP, DBVT_WCHAR);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index a744a3e9e3..af0a3bcba8 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -731,7 +731,7 @@ void CSrmmBaseDialog::UpdateChatLog()
continue;
Utf2T wszUserId(dbei.szUserId);
- CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei, CP_ACP)));
+ CMStringW wszText(ptrW(DbEvent_GetTextW(&dbei)));
wszText.Replace(L"%", L"%%");
GCEVENT gce = { m_si, GC_EVENT_MESSAGE };
@@ -1091,7 +1091,7 @@ void CSrmmBaseDialog::SetQuoteEvent(MEVENT hEvent)
if (dbei) {
CMStringW wszText(TranslateT("In reply to"));
wszText += L": ";
- wszText += ptrW(DbEvent_GetTextW(&dbei, CP_UTF8)).get();
+ wszText += ptrW(DbEvent_GetTextW(&dbei)).get();
m_Quote.SetText(wszText);
m_hQuoteEvent = hEvent;