diff options
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.cpp | 22 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.h | 26 |
3 files changed, 23 insertions, 27 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 4ffdebbc4e..05231b3234 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2608,7 +2608,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (iIndex < SendQueue::NR_SENDJOBS) { // single sendjob timer
SendJob *job = sendQueue->getJobByIndex(iIndex);
KillTimer(m_hwnd, wParam);
- mir_snwprintf(job->szErrorMsg, TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
+ job->wszErrorMsg.Format(TranslateT("Delivery failure: %s"), TranslateT("The message send timed out"));
job->iStatus = SendQueue::SQ_ERROR;
if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound)
Skin_PlaySound("SendError");
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index ba8054bb6d..fe850165e8 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -49,11 +49,8 @@ void SendQueue::handleError(CMsgDialog *dat, const int iEntry) const { if (!dat) return; - wchar_t szErrorMsg[500]; - dat->m_iCurrentQueueError = iEntry; - wcsncpy_s(szErrorMsg, m_jobs[iEntry].szErrorMsg, _TRUNCATE); - logError(dat, iEntry, szErrorMsg); + logError(dat, iEntry, m_jobs[iEntry].wszErrorMsg); recallFailed(dat, iEntry); showErrorControls(dat, TRUE); ::HandleIconFeedback(dat, PluginConfig.g_iconErr); @@ -413,15 +410,14 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) { ACKDATA *ack = (ACKDATA *)lParam; - TContainerData *m_pContainer = nullptr; - if (dat) - m_pContainer = dat->m_pContainer; - int iFound = (int)(LOWORD(wParam)); + if (iFound < 0 || iFound > _countof(m_jobs)) + return 0; + SendJob &job = m_jobs[iFound]; if (job.iStatus == SQ_ERROR) { // received ack for a job which is already in error state... - if (dat) { // window still open + if (dat) { if (dat->m_iCurrentQueueError == iFound) { dat->m_iCurrentQueueError = -1; showErrorControls(dat, FALSE); @@ -438,10 +434,10 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) if (dat) { // "hard" errors are handled differently in multisend. There is no option to retry - once failed, they // are discarded and the user is notified with a small log message. - if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound) + if (!NEN::bNoSounds && !dat->m_pContainer->m_flags.m_bNoSound) Skin_PlaySound("SendError"); - mir_snwprintf(job.szErrorMsg, TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam); + job.wszErrorMsg.Format(TranslateT("Delivery failure: %s"), (wchar_t*)ack->lParam); job.iStatus = SQ_ERROR; KillTimer(dat->GetHwnd(), TIMERID_MSGSEND + iFound); if (!dat->m_bErrorState) @@ -480,8 +476,8 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) job.szSendBuffer = (char*)dbei.pBlob; MEVENT hNewEvent = db_event_add(job.hContact, &dbei); - if (m_pContainer) - if (!NEN::bNoSounds && !m_pContainer->m_flags.m_bNoSound) + if (dat) + if (!NEN::bNoSounds && !dat->m_pContainer->m_flags.m_bNoSound) Skin_PlaySound("SendMsg"); Srmm_Broadcast(DM_APPENDMCEVENT, job.hContact, hNewEvent); diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index 05dfeb4aa7..f2866dac18 100644 --- a/plugins/TabSRMM/src/sendqueue.h +++ b/plugins/TabSRMM/src/sendqueue.h @@ -40,19 +40,19 @@ struct SendJob
{
- int iSendId;
- char *szSendBuffer;
- size_t iSendLength; // length of message in utf-8 octets (used to check maxlen)
- int sendCount;
- MCONTACT hContact;
- HWND hOwnerWnd;
- unsigned iStatus;
- wchar_t szErrorMsg[128];
- uint32_t dwFlags;
- int iAcksNeeded;
- HANDLE hEventSplit;
- int chunkSize;
- uint32_t dwTime;
+ int iSendId;
+ char* szSendBuffer;
+ size_t iSendLength; // length of message in utf-8 octets (used to check maxlen)
+ int sendCount;
+ MCONTACT hContact;
+ HWND hOwnerWnd;
+ unsigned iStatus;
+ CMStringW wszErrorMsg;
+ uint32_t dwFlags;
+ int iAcksNeeded;
+ HANDLE hEventSplit;
+ int chunkSize;
+ uint32_t dwTime;
};
class SendQueue {
|