summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-20 13:34:45 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-20 13:34:45 +0300
commite96132b4d5344d2d58d247906bcaefccfb9d5253 (patch)
tree24a9524e4900547f2ba3a461e228fd3c98c0410d /plugins/TabSRMM/src
parent4dac8bd56f9116ac76423b2664286ed894ca80c2 (diff)
DBEVENTINFO::hContact to be returned inside an event, no need to call db_event_getContact() just after db_event_get()
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/globals.cpp7
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp2
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp9
4 files changed, 11 insertions, 9 deletions
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 8c11830517..feba7f7be9 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -504,12 +504,13 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
else
text.Format(TranslateT("changed status from %s to %s."), szOldStatus, szNewStatus);
+ T2Utf szUtf(text);
DB::EventInfo dbei;
- dbei.pBlob = (uint8_t*)T2Utf(text).detach();
- dbei.cbBlob = (int)mir_strlen((char*)dbei.pBlob);
+ dbei.pBlob = szUtf;
+ dbei.cbBlob = (int)mir_strlen(szUtf);
dbei.flags = DBEF_UTF | DBEF_READ;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.timestamp = time(0);
- dbei.szModule = (char*)c->getProto();
+ dbei.szModule = (char *)c->getProto();
dat->LogEvent(dbei);
}
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 1cbdd9be21..825063a022 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -630,7 +630,7 @@ public:
dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType;
if (dbei.eventType == EVENTTYPE_ERRMSG)
dbei.szModule = (char *)TranslateT("Sample error message");
- dbei.pBlob = (uint8_t *)szText.detach();
+ dbei.pBlob = szText;
dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob);
dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0;
dbei.flags |= (m_bRtl ? DBEF_RTL : 0);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 110ec8ed24..7a870800ba 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -794,7 +794,7 @@ HANDLE SendLater::processAck(const ACKDATA *ack)
dbei.szModule = Proto_GetBaseAccountName((p->hContact));
dbei.timestamp = time(0);
dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1;
- dbei.pBlob = (uint8_t*)(p->sendBuffer);
+ dbei.pBlob = p->sendBuffer;
db_event_add(p->hContact, &dbei);
p->cleanDB();
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 4a2f85e618..159b9dafc8 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -347,7 +347,7 @@ void SendQueue::logError(CMsgDialog *dat, int iSendJobIndex, const wchar_t *szEr
DB::EventInfo dbei;
dbei.eventType = EVENTTYPE_ERRMSG;
if (iSendJobIndex >= 0) {
- dbei.pBlob = (uint8_t *)m_jobs[iSendJobIndex].szSendBuffer;
+ dbei.pBlob = m_jobs[iSendJobIndex].szSendBuffer;
iMsgLen = mir_strlen(m_jobs[iSendJobIndex].szSendBuffer) + 1;
}
else {
@@ -473,7 +473,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam)
if (job.dwFlags & PREF_RTL)
dbei.flags |= DBEF_RTL;
- dbei.pBlob = (uint8_t*)job.szSendBuffer;
+ dbei.pBlob = job.szSendBuffer;
dbei.szId = (char *)ack->lParam;
MessageWindowEvent evt = { job.iSendId, job.hContact, &dbei };
@@ -545,13 +545,14 @@ int SendQueue::doSendLater(int iJobIndex, CMsgDialog *dat, MCONTACT hContact, bo
else
szNote = TranslateT("The send later feature is not available on this protocol.");
+ ptrA szUtf(mir_utf8encodeW(szNote));
DB::EventInfo dbei;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = Proto_GetBaseAccountName(dat->m_hContact);
dbei.timestamp = time(0);
- dbei.pBlob = (uint8_t*)mir_utf8encodeW(szNote);
- dbei.cbBlob = (int)mir_strlen((char*)dbei.pBlob);
+ dbei.pBlob = szUtf;
+ dbei.cbBlob = (int)mir_strlen(szUtf);
dat->LogEvent(dbei);
if (dat->m_hDbEventFirst == 0)