summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/sendlater.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-02-21 18:35:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-02-21 18:40:14 +0300
commit429c0d0524e7197a593209468fef530344f5ee05 (patch)
tree71df95fdf71c52a956de69b6f31f3a6528053442 /plugins/TabSRMM/src/sendlater.cpp
parent5b6db3290cb9c9817cba126bd7aea798a610c31d (diff)
tabsrmm: C++'11 iterators
Diffstat (limited to 'plugins/TabSRMM/src/sendlater.cpp')
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 2f7ad775b9..eb80099210 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -178,8 +178,7 @@ CSendLater::~CSendLater()
if (m_sendLaterJobList.getCount() == 0)
return;
- for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
- CSendLaterJob *p = m_sendLaterJobList[i];
+ for (auto &p : m_sendLaterJobList) {
mir_free(p->sendBuffer);
mir_free(p->pBuf);
p->fSuccess = false; // avoid clearing jobs from the database
@@ -255,9 +254,9 @@ void CSendLater::processSingleContact(const MCONTACT hContact)
// and process them
void CSendLater::processContacts()
{
- if (m_fAvail && m_sendLaterContactList.getCount() != 0) {
- for (int i = 0; i < m_sendLaterContactList.getCount(); i++)
- processSingleContact((UINT_PTR)m_sendLaterContactList[i]);
+ if (m_fAvail) {
+ for (auto &it : m_sendLaterContactList)
+ processSingleContact((UINT_PTR)it);
m_sendLaterContactList.destroy();
}
@@ -285,11 +284,9 @@ int CSendLater::addJob(const char *szSetting, void *lParam)
return 0;
// check for possible dupes
- for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
- CSendLaterJob *p = m_sendLaterJobList[i];
+ for (auto &p : m_sendLaterJobList)
if (p->hContact == hContact && !mir_strcmp(p->szId, szSetting))
return 0;
- }
if (szSetting[0] == 'S') {
if (0 == db_get_s(hContact, "SendLater", szSetting, &dbv))
@@ -436,8 +433,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack)
if (m_sendLaterJobList.getCount() == 0 || !m_fAvail)
return nullptr;
- for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
- CSendLaterJob *p = m_sendLaterJobList[i];
+ for (auto &p : m_sendLaterJobList)
if (p->hProcess == ack->hProcess && p->hTargetContact == ack->hContact && !(p->fSuccess || p->fFailed)) {
if (!p->fSuccess) {
DBEVENTINFO dbei = {};
@@ -458,7 +454,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack)
qMgrUpdate();
return nullptr;
}
- }
+
return nullptr;
}
@@ -504,8 +500,7 @@ void CSendLater::qMgrFillList(bool fClear)
BYTE bCode = '-';
unsigned uIndex = 0;
- for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
- CSendLaterJob *p = m_sendLaterJobList[i];
+ for (auto &p : m_sendLaterJobList) {
CContactCache *c = CContactCache::getContactCache(p->hContact);
const wchar_t *tszNick = c->getNick();
@@ -713,8 +708,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
m_fIsInteractive = true;
int selection = ::TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwndDlg, nullptr);
if (selection == ID_QUEUEMANAGER_CANCELALLMULTISENDJOBS) {
- for (int i = 0; i < m_sendLaterJobList.getCount(); i++) {
- CSendLaterJob *p = m_sendLaterJobList[i];
+ for (auto &p : m_sendLaterJobList) {
if (p->szId[0] == 'M') {
p->fFailed = true;
p->bCode = CSendLaterJob::JOB_REMOVABLE;