void CPaperServer::ThreadLoop( ) { while ( !m_bExitThreadLoop ) { switch ( m_eActionNext ) { case doWait: Sleep( 30 ); break; case doLogon: { m_eActionNext = doWait; Logon( ); } break; case doLogout: break; case doRequestPaper: break; default: break; } } }
BOOL CMapiMail::InitMail(BOOL bAutoLogon/*TRUE*/) { BOOL fInit; if (fInit = InitSimpleMAPI ()) { if (bAutoLogon) fInit = Logon(); } return (fInit); }
void MyProxyEngine::createDialog(qint16 cmd, QString param) { MyDialog *m_dialog=new MyDialog(this); connect(m_server, SIGNAL(receiveMessage(MyPacket &)), m_dialog, SLOT (receiveMessage(MyPacket &))); connect(m_dialog, SIGNAL(Exit(MyDialog *,qint16,qint16)), this, SLOT (DialogAnswer(MyDialog *,qint16,qint16))); connect(m_dialog, SIGNAL(sendMessage(MyPacket &)), m_server, SLOT (sendMessage(MyPacket &))); connect(m_dialog, SIGNAL(Logon(QString, QString, qint32)), m_config, SLOT (setLogin(QString, QString, qint32))); connect(m_dialog, SIGNAL(SessionID(qint32)), m_server, SLOT (setSessionID(qint32))); m_dialog->execute(cmd, m_config->getSessionID(), param, m_config->getClientRSApublic()); }
BCSessionManager::BCSessionManager(bool bAutoLogon) : m_pSession(NULL), m_bLoggedOn(false) { HRESULT hr = m_pSession.CreateInstance( __uuidof( DECoreLib::BCSession ) ); ATLASSERT( S_OK == hr ); if( S_OK == hr ) { LOG_WS_INFO(_T("BCSession Instance created")); if( bAutoLogon ) { Logon(); } } else { LOG_WS_ERROR(_T("Failed to create BCSession Instance")); } }
bool nglMail::Send(const char* pStrSubject, const char* pStrMessage, const char* pStrAttachmentFilePath, const char* pStrRecipient, const char* pStrEmailAdress) { ULONG unlResult = 1; MapiMessage oMapiMessage; MapiFileDesc oAttachment; ZeroMemory ( &oMapiMessage, sizeof ( MapiMessage ) ); ZeroMemory ( &oAttachment, sizeof ( MapiFileDesc ) ); lpMapiRecipDesc pRecips = NULL; //MapiRecipDesc arMailRecipients[1], *tempRecip[1]; MapiRecipDesc arMailRecipients[1]; if (!Logon()) return false; std::string bstrAddress; bstrAddress = "SMTP:"; bstrAddress += pStrEmailAdress; std::string bstrRec, bstrAdd, bstrAttFile, bstrAttPath, bstrSubj, bstrMesg; arMailRecipients[0].ulReserved = 0; arMailRecipients[0].ulRecipClass = MAPI_TO; // recipient name bstrRec = pStrRecipient; arMailRecipients[0].lpszName = (char*)bstrRec.c_str(); // email address bstrAdd = bstrAddress; arMailRecipients[0].lpszAddress = (char*)bstrAdd.c_str(); arMailRecipients[0].ulEIDSize = 0; arMailRecipients[0].lpEntryID = NULL; //std::string bstrFullPath = pStrAttachmentFilePath; //bstrFullPath += pStrAttachmentFile; //oAttachment.lpszFileName = pStrAttachmentFile; oAttachment.lpszPathName = (LPSTR)pStrAttachmentFilePath; oMapiMessage.nRecipCount = 1; // Must be set to the correct number of recipients. oMapiMessage.lpRecips = arMailRecipients; // Address of list of names returned from MAPIAddress. oMapiMessage.ulReserved = 0L; bstrSubj = pStrSubject; oMapiMessage.lpszSubject = (char *)bstrSubj.c_str(); bstrMesg = pStrMessage; oMapiMessage.lpszNoteText = (char *)bstrMesg.c_str(); oMapiMessage.lpOriginator = NULL; if (pStrAttachmentFilePath) { oMapiMessage.nFileCount = 1; oMapiMessage.lpFiles = &oAttachment; } else { oMapiMessage.nFileCount = 0L; oMapiMessage.lpFiles = NULL; } unlResult = mMAPISendMail ( mlhSession, // Global session handle. 0L, // Parent window. Set to 0 since console app. &oMapiMessage, // Address of Message structure MAPI_DIALOG, 0L // Reserved. Must be 0L. ); if (unlResult != SUCCESS_SUCCESS) return false; //mMAPIFreeBuffer(tempRecip); // release the recipient descriptors if (!Logoff()) return false; return true; }