void api () { if ((current_.status == Protocol::TS_COMMITED || current_.status == Protocol::TS_ABORTED) && separation_duration_ == 0) // no transaction in progress { // start new transaction // Note that in_ is already locked by Scheduler MessagePtr m (in_.front ()); in_.pop (); if (typeid (*m) == typeid (Send)) { send_ = SendPtr (dynamic_cast<Send*> (m.release ())); } else { // cerr << "Expecting Send but received " << typeid (*m).name () // << endl; ::abort (); } current_.id++; current_.status = Protocol::TS_BEGIN; initiated_ = true; // if (trace_) cerr << "starting transaction with id " << current_.id // << endl; } }
/** * Check the last mail time for the quota message. * * @param lpStore Store that is over quota * * @retval hrSuccess User should not receive quota message * @retval MAPI_E_TIMEOUT User should receive quota message * @return MAPI Error code */ HRESULT ECQuotaMonitor::CheckQuotaInterval(LPMDB lpStore, LPMESSAGE *lppMessage, bool *lpbTimeout) { HRESULT hr = hrSuccess; MessagePtr ptrMessage; SPropValuePtr ptrProp; char *lpResendInterval = NULL; ULONG ulResendInterval = 0; FILETIME ft; FILETIME ftNextRun; hr = GetConfigMessage(lpStore, QUOTA_CONFIG_MSG, &ptrMessage); if (hr != hrSuccess) goto exit; hr = HrGetOneProp(ptrMessage, PR_EC_QUOTA_MAIL_TIME, &ptrProp); if (hr == MAPI_E_NOT_FOUND) { *lppMessage = ptrMessage.release(); *lpbTimeout = true; hr = hrSuccess; goto exit; } if (hr != hrSuccess) goto exit; /* Determine when the last warning mail was send, and if a new one should be send. */ lpResendInterval = m_lpThreadMonitor->lpConfig->GetSetting("mailquota_resend_interval"); ulResendInterval = (lpResendInterval && atoui(lpResendInterval) > 0) ? atoui(lpResendInterval) : 1; GetSystemTimeAsFileTime(&ft); UnixTimeToFileTime(FileTimeToUnixTime(ptrProp->Value.ft.dwHighDateTime, ptrProp->Value.ft.dwLowDateTime) + (ulResendInterval * 60 * 60 * 24) -(2 * 60), &ftNextRun); *lppMessage = ptrMessage.release(); *lpbTimeout = (ft > ftNextRun); exit: return hr; }