void MyWriteMsg::sendMsg() { try { checkInput(); QList<Message> & msgs = getMsgs(); server->sendMessages(msgs); MessageService * msgServer = new MessageService; for (int i = 0; i < msgs.length(); ++i) { msgs[i].setSenderNum(server->getPhoneNum()); msgs[i].setTime(QDateTime::currentDateTime()); msgs[i].setType(Message::SENT); msgServer->saveMsg(msgs[i]); } delete msgServer; msgs.clear(); delete &msgs; this->accept(); } CATCH_BLOCKS }
void MyWriteMsg::sendTimedMsg() { try { checkInput(); MySetTime * setTime = new MySetTime(this); if (setTime->exec() != QDialog::Accepted) { setTime->deleteLater(); return; } setTime->deleteLater(); QDateTime chosenTime = setTime->getTime(); QList<Message> & msgs = getMsgs(); MessageService * msgServer = new MessageService; for (int i = 0; i < msgs.length(); ++i) { msgs[i].setSenderNum(server->getPhoneNum()); msgs[i].setTime(chosenTime); msgs[i].setType(Message::TIMED); msgServer->saveMsg(msgs[i]); } delete msgServer; msgs.clear(); delete &msgs; this->accept(); } CATCH_BLOCKS }
free(pRcv); RETiRet; } /* This function is called to gather input. */ BEGINrunInput CODESTARTrunInput /* this is an endless loop - it is terminated when the thread is * signalled to do so. This, however, is handled by the framework, * right into the sleep below. */ DBGPRINTF("imsolaris: doing startup poll before openeing door()\n"); CHKiRet(getMsgs(pThrd, 0)); /* note: sun's syslogd code claims that the door should only * be opened when the log stream has been polled. So file header * comment of this file for more details. */ sun_open_door(); DBGPRINTF("imsolaris: starting regular poll loop\n"); iRet = getMsgs(pThrd, -1); /* this is the primary poll loop, infinite timeout */ DBGPRINTF("imsolaris: terminating (bShallStop=%d)\n", pThrd->bShallStop); finalize_it: RETiRet; ENDrunInput