summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TabSRMM/src')
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp23
-rw-r--r--plugins/TabSRMM/src/contactcache.h62
-rw-r--r--plugins/TabSRMM/src/container.cpp2
-rw-r--r--plugins/TabSRMM/src/globals.cpp122
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp19
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp146
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp23
8 files changed, 186 insertions, 213 deletions
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 3a9d346383..a92b191e97 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -105,7 +105,6 @@ void CContactCache::closeWindow()
void CContactCache::updateState()
{
updateNick();
- updateStatus();
}
/**
@@ -126,20 +125,6 @@ bool CContactCache::updateNick()
}
/**
- * update status mode
- * @return bool: true if status mode has changed, false if not.
- */
-bool CContactCache::updateStatus()
-{
- if (!m_Valid)
- return false;
-
- m_wOldStatus = m_wStatus;
- m_wStatus = (WORD)db_get_w(getActiveContact(), getActiveProto(), "Status", ID_STATUS_OFFLINE);
- return m_wOldStatus != m_wStatus;
-}
-
-/**
* update meta (subcontact and -protocol) status. This runs when the
* MC protocol fires one of its events OR when a relevant database value changes
* in the master contact.
@@ -156,7 +141,6 @@ void CContactCache::updateMeta()
m_szAccount = pa->tszAccountName;
if (hOldSub != m_hSub) {
- updateStatus();
updateNick();
updateUIN();
}
@@ -569,7 +553,7 @@ HICON CContactCache::getIcon(int& iSize) const
return m_dat->hTabIcon;
}
-int CContactCache::getMaxMessageLength()
+size_t CContactCache::getMaxMessageLength()
{
MCONTACT hContact = getActiveContact();
LPCSTR szProto = getActiveProto();
@@ -593,3 +577,8 @@ int CContactCache::getMaxMessageLength()
}
return m_nMax;
}
+
+int CContactCache::getStatus() const
+{
+ return db_get_w(getActiveContact(), getActiveProto(), "Status", ID_STATUS_OFFLINE);
+}
diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h
index a6e6fa191b..3c19516ec9 100644
--- a/plugins/TabSRMM/src/contactcache.h
+++ b/plugins/TabSRMM/src/contactcache.h
@@ -64,40 +64,42 @@ struct CContactCache : public MZeroedObject
releaseAlloced();
}
- const bool isValid() const { return m_Valid; }
- const WORD getStatus() const { return m_wStatus; }
- const WORD getActiveStatus() const { return m_isMeta ? m_wMetaStatus : m_wStatus; }
- const WORD getOldStatus() const { return m_wOldStatus; }
- const wchar_t* getNick() const { return m_szNick; }
- const MCONTACT getContact() const { return m_hContact; }
- const MCONTACT getActiveContact() const { return (m_isMeta) ? m_hSub : m_hContact; }
- const DWORD getIdleTS() const { return m_idleTS; }
- const char* getProto() const { return cc->szProto; }
- const char* getActiveProto() const { return m_isMeta ? (m_szMetaProto ? m_szMetaProto : cc->szProto) : cc->szProto; }
- bool isMeta() const { return m_isMeta; }
- bool isSubContact() const { return cc->IsSub(); }
- bool isFavorite() const { return m_isFavorite; }
- bool isRecent() const { return m_isRecent; }
- const wchar_t* getRealAccount() const { return m_szAccount ? m_szAccount : C_INVALID_ACCOUNT; }
- const wchar_t* getUIN() const { return m_szUIN; }
- const wchar_t* getStatusMsg() const { return m_szStatusMsg; }
- const wchar_t* getXStatusMsg() const { return m_xStatusMsg; }
- const wchar_t* getListeningInfo() const { return m_ListeningInfo; }
- BYTE getXStatusId() const { return m_xStatus; }
- const HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return m_hwnd; }
- const HWND getHwnd() const { return m_hwnd; }
- int getMaxMessageLength();
-
- TWindowData* getDat() const { return m_dat; }
-
- void updateStats(int iType, size_t value = 0);
- const DWORD getSessionStart() const { return m_stats->started; }
- const int getSessionMsgCount() const { return (int)m_stats->messageCount; }
+ __forceinline bool isValid() const { return m_Valid; }
+ __forceinline WORD getActiveStatus() const { return m_isMeta ? m_wMetaStatus : m_wStatus; }
+ __forceinline WORD getOldStatus() const { return m_wOldStatus; }
+ __forceinline LPCWSTR getNick() const { return m_szNick; }
+ __forceinline MCONTACT getContact() const { return m_hContact; }
+ __forceinline MCONTACT getActiveContact() const { return (m_isMeta) ? m_hSub : m_hContact; }
+ __forceinline DWORD getIdleTS() const { return m_idleTS; }
+ __forceinline LPCSTR getProto() const { return cc->szProto; }
+ __forceinline LPCSTR getActiveProto() const { return m_isMeta ? (m_szMetaProto ? m_szMetaProto : cc->szProto) : cc->szProto; }
+
+ __forceinline bool isMeta() const { return m_isMeta; }
+ __forceinline bool isSubContact() const { return cc->IsSub(); }
+ __forceinline bool isFavorite() const { return m_isFavorite; }
+ __forceinline bool isRecent() const { return m_isRecent; }
+
+ __forceinline LPCWSTR getRealAccount() const { return m_szAccount ? m_szAccount : C_INVALID_ACCOUNT; }
+ __forceinline LPCWSTR getUIN() const { return m_szUIN; }
+ __forceinline LPCWSTR getStatusMsg() const { return m_szStatusMsg; }
+ __forceinline LPCWSTR getXStatusMsg() const { return m_xStatusMsg; }
+ __forceinline LPCWSTR getListeningInfo() const { return m_ListeningInfo; }
+ __forceinline BYTE getXStatusId() const { return m_xStatus; }
+ __forceinline HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return m_hwnd; }
+ __forceinline HWND getHwnd() const { return m_hwnd; }
+
+ __forceinline DWORD getSessionStart() const { return m_stats->started; }
+ __forceinline int getSessionMsgCount() const { return (int)m_stats->messageCount; }
+
+ __forceinline TWindowData* getDat() const { return m_dat; }
+
+ size_t getMaxMessageLength();
+ int getStatus() const;
+ void updateStats(int iType, size_t value = 0);
////////////////////////////////////////////////////////////////////////////
void updateState();
- bool updateStatus();
bool updateNick();
void updateMeta();
bool updateUIN();
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 7d15fcd56d..2678cc0a46 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -1876,7 +1876,7 @@ void TSAPI CloseOtherTabs(HWND hwndTab, TWindowData &dat)
int TSAPI CutContactName(const wchar_t *oldname, wchar_t *newname, size_t size)
{
- if (mir_wstrlen(oldname) <= PluginConfig.m_iTabNameLimit)
+ if ((int)mir_wstrlen(oldname) <= PluginConfig.m_iTabNameLimit)
wcsncpy_s(newname, size, oldname, _TRUNCATE);
else {
wchar_t fmt[30];
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index c66f58eb3c..b9bcd45f2c 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -357,23 +357,17 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM)
int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
- const char *szProto = NULL;
- const char *setting = cws->szSetting;
- CContactCache* c = 0;
- bool fChanged = false, fNickChanged = false, fExtendedStatusChange = false;
+ const char *szProto = NULL;
+ const char *setting = cws->szSetting;
HWND hwnd = M.FindWindow(hContact);
-
if (hwnd == 0 && hContact != 0) { // we are not interested in this event if there is no open message window/tab
if (!strcmp(setting, "Status") || !strcmp(setting, "MyHandle") || !strcmp(setting, "Nick") || !strcmp(cws->szModule, SRMSGMOD_T)) {
- c = CContactCache::getContactCache(hContact);
- if (c) {
- fChanged = c->updateStatus();
- if (strcmp(setting, "Status"))
- c->updateNick();
- if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent"))
- c->updateFavorite();
- }
+ CContactCache *c = CContactCache::getContactCache(hContact);
+ if (strcmp(setting, "Status"))
+ c->updateNick();
+ if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent"))
+ c->updateFavorite();
}
return 0;
}
@@ -383,14 +377,13 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
+ CContactCache *c = NULL;
if (hContact) {
c = CContactCache::getContactCache(hContact);
- if (c) {
- szProto = c->getProto();
- if (!strcmp(cws->szModule, SRMSGMOD_T)) { // catch own relevant settings
- if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent"))
- c->updateFavorite();
- }
+ szProto = c->getProto();
+ if (!strcmp(cws->szModule, SRMSGMOD_T)) { // catch own relevant settings
+ if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent"))
+ c->updateFavorite();
}
}
@@ -401,49 +394,51 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam)
if (hContact != 0 && !strcmp(setting, "Nick")) // filter out this setting to avoid infinite loops while trying to obtain the most online contact
return 0;
- if (hwnd) {
+ if (hwnd == NULL)
+ return 0;
+
+ bool fChanged = !strcmp(cws->szSetting, "Status"), fNickChanged = false, fExtendedStatusChange = false;
+ if (c)
+ fNickChanged = c->updateNick();
+
+ if (strlen(setting) > 6 && strlen(setting) < 9 && !strncmp(setting, "Status", 6)) {
+ fChanged = true;
if (c) {
- fChanged = c->updateStatus();
- fNickChanged = c->updateNick();
- }
- if (strlen(setting) > 6 && strlen(setting) < 9 && !strncmp(setting, "Status", 6)) {
- fChanged = true;
- if (c) {
- c->updateMeta();
- c->updateUIN();
- }
- }
- else if (!strcmp(setting, "MirVer"))
- PostMessage(hwnd, DM_CLIENTCHANGED, 0, 0);
- else if (!strcmp(setting, "display_uid")) {
- if (c)
- c->updateUIN();
- PostMessage(hwnd, DM_UPDATEUIN, 0, 0);
+ c->updateMeta();
+ c->updateUIN();
}
- else if (strlen(setting) > 6 && strstr("StatusMsg,XStatusMsg,XStatusName,XStatusId,ListeningTo", setting)) {
- if (c) {
- c->updateStatusMsg(setting);
- fExtendedStatusChange = true;
- }
+ }
+ else if (!strcmp(setting, "MirVer"))
+ PostMessage(hwnd, DM_CLIENTCHANGED, 0, 0);
+ else if (!strcmp(setting, "display_uid")) {
+ if (c)
+ c->updateUIN();
+ PostMessage(hwnd, DM_UPDATEUIN, 0, 0);
+ }
+ else if (strlen(setting) > 6 && strstr("StatusMsg,XStatusMsg,XStatusName,XStatusId,ListeningTo", setting)) {
+ if (c) {
+ c->updateStatusMsg(setting);
+ fExtendedStatusChange = true;
}
- if (fChanged || fNickChanged || fExtendedStatusChange)
- PostMessage(hwnd, DM_UPDATETITLE, 0, 1);
- if (fExtendedStatusChange)
- PostMessage(hwnd, DM_UPDATESTATUSMSG, 0, 0);
- if (fChanged) {
- if (c && c->getStatus() == ID_STATUS_OFFLINE) { // clear typing notification in the status bar when contact goes offline
- TWindowData *dat = c->getDat();
- if (dat) {
- dat->nTypeSecs = 0;
- dat->bShowTyping = 0;
- dat->szStatusBar[0] = 0;
- PostMessage(c->getHwnd(), DM_UPDATELASTMESSAGE, 0, 0);
- }
+ }
+ if (fChanged || fNickChanged || fExtendedStatusChange)
+ PostMessage(hwnd, DM_UPDATETITLE, 0, 1);
+ if (fExtendedStatusChange)
+ PostMessage(hwnd, DM_UPDATESTATUSMSG, 0, 0);
+ if (fChanged) {
+ if (c && c->getStatus() == ID_STATUS_OFFLINE) { // clear typing notification in the status bar when contact goes offline
+ TWindowData *dat = c->getDat();
+ if (dat) {
+ dat->nTypeSecs = 0;
+ dat->bShowTyping = 0;
+ dat->szStatusBar[0] = 0;
+ PostMessage(c->getHwnd(), DM_UPDATELASTMESSAGE, 0, 0);
}
- if (c)
- PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_LOGSTATUSCHANGE, MAKELONG(c->getStatus(), c->getOldStatus()), (LPARAM)c);
}
+ if (c)
+ PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_LOGSTATUSCHANGE, MAKELONG(c->getStatus(), c->getOldStatus()), (LPARAM)c);
}
+
return 0;
}
@@ -454,8 +449,7 @@ int CGlobals::DBContactDeleted(WPARAM hContact, LPARAM)
{
if (hContact) {
CContactCache *c = CContactCache::getContactCache(hContact);
- if (c)
- c->deletedHandler();
+ c->deletedHandler();
}
return 0;
}
@@ -469,13 +463,11 @@ int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM)
{
if (hContact) {
CContactCache *c = CContactCache::getContactCache(hContact);
- if (c) {
- c->updateMeta();
- if (c->getHwnd()) {
- ::PostMessage(c->getHwnd(), DM_UPDATETITLE, 0, 1);
- ::PostMessage(c->getHwnd(), DM_UPDATEPICLAYOUT, 0, 0);
- InvalidateRect(c->getHwnd(), 0, TRUE); // force redraw
- }
+ c->updateMeta();
+ if (c->getHwnd()) {
+ ::PostMessage(c->getHwnd(), DM_UPDATETITLE, 0, 1);
+ ::PostMessage(c->getHwnd(), DM_UPDATEPICLAYOUT, 0, 0);
+ InvalidateRect(c->getHwnd(), 0, TRUE); // force redraw
}
}
return 0;
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 99ace42793..bc1a607bbe 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -1359,16 +1359,15 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const wchar_t *szT
if (PluginConfig.g_SmileyAddAvail) {
CContactCache *c = CContactCache::getContactCache(m_hContact);
::SendMessage(m_hRich, EM_SETBKGNDCOLOR, 0, (LPARAM)PluginConfig.m_ipBackgroundGradientHigh);
- if (c) {
- SMADD_RICHEDIT3 smadd = { sizeof(smadd) };
- smadd.hwndRichEditControl = m_hRich;
- smadd.Protocolname = const_cast<char *>(c->getActiveProto());
- smadd.hContact = c->getActiveContact();
- smadd.flags = 0;
- smadd.rangeToReplace = NULL;
- smadd.disableRedraw = TRUE;
- CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd);
- }
+
+ SMADD_RICHEDIT3 smadd = { sizeof(smadd) };
+ smadd.hwndRichEditControl = m_hRich;
+ smadd.Protocolname = const_cast<char *>(c->getActiveProto());
+ smadd.hContact = c->getActiveContact();
+ smadd.flags = 0;
+ smadd.rangeToReplace = NULL;
+ smadd.disableRedraw = TRUE;
+ CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd);
}
RECT rcParent;
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 4f647fdd79..a097a5e086 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -656,7 +656,7 @@ wchar_t* TSAPI QuoteText(const wchar_t *text)
int inChar = 0;
int justDoneLineBreak = 1;
for (outChar = 0, lineChar = 0; text[inChar];) {
- if (outChar >= bufSize - 8) {
+ if (outChar >= (int)bufSize - 8) {
bufSize += 20;
strout = (wchar_t*)mir_realloc(strout, bufSize * sizeof(wchar_t));
}
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index e717c1817b..97c12d1764 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -372,9 +372,6 @@ int CSendLater::sendIt(CSendLaterJob *job)
return 0; // this one was sent, but probably failed. Resend it after a while
CContactCache *c = CContactCache::getContactCache(job->hContact);
- if (c == NULL)
- return 0; // should not happen
-
if (!c->isValid()) {
job->fFailed = true;
job->bCode = CSendLaterJob::INVALID_CONTACT;
@@ -514,83 +511,82 @@ void CSendLater::qMgrFillList(bool fClear)
for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
CSendLaterJob *p = m_sendLaterJobList[i];
CContactCache *c = CContactCache::getContactCache(p->hContact);
- if (c) {
- const wchar_t *tszNick = c->getNick();
- if (m_hFilter && m_hFilter != p->hContact) {
- qMgrAddFilter(c->getContact(), tszNick);
- continue;
- }
- lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- wchar_t tszBuf[255];
- mir_snwprintf(tszBuf, L"%s [%s]", tszNick, c->getRealAccount());
- lvItem.pszText = tszBuf;
- lvItem.cchTextMax = _countof(tszBuf);
- lvItem.iItem = uIndex++;
- lvItem.iSubItem = 0;
- lvItem.lParam = LPARAM(p);
- ::SendMessage(m_hwndList, LVM_INSERTITEM, 0, LPARAM(&lvItem));
+ const wchar_t *tszNick = c->getNick();
+ if (m_hFilter && m_hFilter != p->hContact) {
qMgrAddFilter(c->getContact(), tszNick);
+ continue;
+ }
- lvItem.mask = LVIF_TEXT;
- wchar_t tszTimestamp[30];
- wcsftime(tszTimestamp, 30, formatTime, _localtime32((__time32_t *)&p->created));
- tszTimestamp[29] = 0;
- lvItem.pszText = tszTimestamp;
- lvItem.iSubItem = 1;
- ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
-
- wchar_t *msg = mir_utf8decodeW(p->sendBuffer);
- wchar_t *preview = Utils::GetPreviewWithEllipsis(msg, 255);
- lvItem.pszText = preview;
- lvItem.iSubItem = 2;
- ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
- mir_free(preview);
- mir_free(msg);
-
- const wchar_t *tszStatusText = 0;
- if (p->fFailed) {
- tszStatusText = p->bCode == CSendLaterJob::JOB_REMOVABLE ?
- TranslateT("Removed") : TranslateT("Failed");
- }
- else if (p->fSuccess)
- tszStatusText = TranslateT("Sent OK");
- else {
- switch (p->bCode) {
- case CSendLaterJob::JOB_DEFERRED:
- tszStatusText = TranslateT("Deferred");
- break;
- case CSendLaterJob::JOB_AGE:
- tszStatusText = TranslateT("Failed");
- break;
- case CSendLaterJob::JOB_HOLD:
- tszStatusText = TranslateT("Suspended");
- break;
- default:
- tszStatusText = TranslateT("Pending");
- break;
- }
- }
- if (p->bCode)
- bCode = p->bCode;
-
- wchar_t tszStatus[20];
- mir_snwprintf(tszStatus, L"X/%s[%c] (%d)", tszStatusText, bCode, p->iSendCount);
- tszStatus[0] = p->szId[0];
- lvItem.pszText = tszStatus;
- lvItem.iSubItem = 3;
- ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
-
- if (p->lastSent == 0)
- wcsncpy_s(tszTimestamp, L"Never", _TRUNCATE);
- else {
- wcsftime(tszTimestamp, 30, formatTime, _localtime32((__time32_t *)&p->lastSent));
- tszTimestamp[29] = 0;
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
+ wchar_t tszBuf[255];
+ mir_snwprintf(tszBuf, L"%s [%s]", tszNick, c->getRealAccount());
+ lvItem.pszText = tszBuf;
+ lvItem.cchTextMax = _countof(tszBuf);
+ lvItem.iItem = uIndex++;
+ lvItem.iSubItem = 0;
+ lvItem.lParam = LPARAM(p);
+ ::SendMessage(m_hwndList, LVM_INSERTITEM, 0, LPARAM(&lvItem));
+ qMgrAddFilter(c->getContact(), tszNick);
+
+ lvItem.mask = LVIF_TEXT;
+ wchar_t tszTimestamp[30];
+ wcsftime(tszTimestamp, 30, formatTime, _localtime32((__time32_t *)&p->created));
+ tszTimestamp[29] = 0;
+ lvItem.pszText = tszTimestamp;
+ lvItem.iSubItem = 1;
+ ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
+
+ wchar_t *msg = mir_utf8decodeW(p->sendBuffer);
+ wchar_t *preview = Utils::GetPreviewWithEllipsis(msg, 255);
+ lvItem.pszText = preview;
+ lvItem.iSubItem = 2;
+ ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
+ mir_free(preview);
+ mir_free(msg);
+
+ const wchar_t *tszStatusText = 0;
+ if (p->fFailed) {
+ tszStatusText = p->bCode == CSendLaterJob::JOB_REMOVABLE ?
+ TranslateT("Removed") : TranslateT("Failed");
+ }
+ else if (p->fSuccess)
+ tszStatusText = TranslateT("Sent OK");
+ else {
+ switch (p->bCode) {
+ case CSendLaterJob::JOB_DEFERRED:
+ tszStatusText = TranslateT("Deferred");
+ break;
+ case CSendLaterJob::JOB_AGE:
+ tszStatusText = TranslateT("Failed");
+ break;
+ case CSendLaterJob::JOB_HOLD:
+ tszStatusText = TranslateT("Suspended");
+ break;
+ default:
+ tszStatusText = TranslateT("Pending");
+ break;
}
- lvItem.pszText = tszTimestamp;
- lvItem.iSubItem = 4;
- ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
}
+ if (p->bCode)
+ bCode = p->bCode;
+
+ wchar_t tszStatus[20];
+ mir_snwprintf(tszStatus, L"X/%s[%c] (%d)", tszStatusText, bCode, p->iSendCount);
+ tszStatus[0] = p->szId[0];
+ lvItem.pszText = tszStatus;
+ lvItem.iSubItem = 3;
+ ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
+
+ if (p->lastSent == 0)
+ wcsncpy_s(tszTimestamp, L"Never", _TRUNCATE);
+ else {
+ wcsftime(tszTimestamp, 30, formatTime, _localtime32((__time32_t *)&p->lastSent));
+ tszTimestamp[29] = 0;
+ }
+ lvItem.pszText = tszTimestamp;
+ lvItem.iSubItem = 4;
+ ::SendMessage(m_hwndList, LVM_SETITEM, 0, LPARAM(&lvItem));
}
if (m_hFilter == 0)
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 99bab331e2..fc99b2d0a0 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -129,7 +129,7 @@ static void DoSplitSendA(LPVOID param)
memcpy(szTemp, job->szSendBuffer, iLen + 1);
bool fFirstSend = false, fSplitting = true;
- int iCur = 0;
+ size_t iCur = 0;
do {
iCur += job->chunkSize;
if (iCur > iLen)
@@ -192,15 +192,12 @@ size_t SendQueue::getSendLength(const int iEntry)
int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
{
+ HWND hwndDlg = dat->hwnd;
CContactCache *ccActive = CContactCache::getContactCache(dat->hContact);
- if (ccActive == NULL)
- return 0;
-
- HWND hwndDlg = dat->hwnd;
if (dat->sendMode & SMODE_MULTIPLE) {
int iJobs = 0;
- int iMinLength = 0;
+ size_t iMinLength = 0;
m_jobs[iEntry].iStatus = SQ_INPROGRESS;
m_jobs[iEntry].hContact = ccActive->getActiveContact();
@@ -212,8 +209,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
CContactCache *c = CContactCache::getContactCache(hContact);
- if (c)
- iMinLength = (iMinLength == 0 ? c->getMaxMessageLength() : min(c->getMaxMessageLength(), iMinLength));
+ iMinLength = (iMinLength == 0 ? c->getMaxMessageLength() : min(c->getMaxMessageLength(), iMinLength));
}
}
@@ -247,7 +243,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
if (M.GetByte("autosplit", 0) && !(dat->sendMode & SMODE_SENDLATER)) {
// determine send buffer length
BOOL fSplit = FALSE;
- if (getSendLength(iEntry) >= dat->nMax)
+ if ((int)getSendLength(iEntry) >= dat->nMax)
fSplit = true;
if (!fSplit)
@@ -273,7 +269,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
wchar_t tszError[256];
size_t iSendLength = getSendLength(iEntry);
- if (iSendLength >= dat->nMax) {
+ if ((int)iSendLength >= dat->nMax) {
mir_snwprintf(tszError, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax);
SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
clearJob(iEntry);
@@ -494,7 +490,6 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat)
int SendQueue::RTL_Detect(const WCHAR *pszwText)
{
- int i, n = 0;
size_t iLen = mir_wstrlen(pszwText);
WORD *infoTypeC2 = (WORD*)mir_calloc(sizeof(WORD) * (iLen + 2));
@@ -503,7 +498,8 @@ int SendQueue::RTL_Detect(const WCHAR *pszwText)
GetStringTypeW(CT_CTYPE2, pszwText, (int)iLen, infoTypeC2);
- for (i = 0; i < iLen; i++)
+ int n = 0;
+ for (size_t i = 0; i < iLen; i++)
if (infoTypeC2[i] == C2_RIGHTTOLEFT)
n++;
@@ -570,8 +566,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
dat->cache->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1);
else {
CContactCache *cc = CContactCache::getContactCache(job.hContact);
- if (cc)
- cc->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1);
+ cc->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1);
}
if (job.dwFlags & PREF_RTL)