bool sendMsgImage(cgcResponse::pointer response, CUserInfo::pointer fromUser, CFromInfo::pointer fromInfo, long mid, long width, long height, long type, cgcAttachment::pointer attachment, bool bNew, time_t offeventTime) { BOOST_ASSERT (response.get() != 0); BOOST_ASSERT (fromUser.get() != 0); BOOST_ASSERT (fromInfo.get() != 0); BOOST_ASSERT (attachment.get() != 0); if (response->isInvalidate()) return false; response->lockResponse(); if (fromInfo->fromType() == CFromInfo::FromDialogInfo) { response->setParameter(cgcParameter::create(_T("DID"), fromInfo->fromDialog()->dialogId())); } response->setParameter(cgcParameter::create(_T("FromAccount"), fromUser->getAccount())); response->setParameter(cgcParameter::create(_T("MID"), mid)); response->setParameter(cgcParameter::create(_T("Type"), type)); response->setParameter(cgcParameter::create(_T("Width"), width)); response->setParameter(cgcParameter::create(_T("Height"), height)); response->setParameter(cgcParameter::create2(_T("New"), bNew)); if (offeventTime > 0) { char buffer[20]; sprintf(buffer, "%ld", offeventTime); response->setParameter(cgcParameter::create(cgcParameter::PT_DATETIME, _T("Time"), buffer)); } response->setAttachInfo(attachment->getTotal(), attachment->getIndex()); response->setAttachData(attachment->getAttachData(), attachment->getAttachSize()); response->sendResponse(0, 501); return true; }
bool sendMsg(cgcResponse::pointer response, CUserInfo::pointer fromUser, CFromInfo::pointer fromInfo, long mid, cgcAttachment::pointer attachment) { BOOST_ASSERT (response.get() != 0); BOOST_ASSERT (fromUser.get() != 0); BOOST_ASSERT (fromInfo.get() != 0); BOOST_ASSERT (attachment.get() != 0); if (response->isInvalidate()) return false; response->lockResponse(); if (fromInfo->fromType() == CFromInfo::FromDialogInfo) { response->setParameter(cgcParameter::create(_T("DID"), fromInfo->fromDialog()->dialogId())); } response->setParameter(cgcParameter::create(_T("FromAccount"), fromUser->getAccount())); response->setParameter(cgcParameter::create(_T("MID"), mid)); response->setAttachInfo(attachment->getTotal(), attachment->getIndex()); response->setAttachData(attachment->getAttachData(), attachment->getAttachSize()); response->sendResponse(0, 501); return true; }