BOOL CUIRecentSessionList::UpdateItemConentBySId(IN const std::string& sId) { Node* pNode = GetItemBySId(sId); PTR_FALSE(pNode); CControlUI* pListElement = pNode->data().list_elment_; PTR_FALSE(pListElement); CLabelUI* plastMsgTimeUI = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, lastContentTimeControlName)); if (!plastMsgTimeUI) { return FALSE; } CLabelUI* plastMsgUI = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, klastmsgControlName)); if (!plastMsgUI) { return FALSE; } CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName)); if (!Unreadcnt_button) { return FALSE; } //更新会话的最后一条消息 module::SessionEntity* pSessionEntity = SessionEntityManager::getInstance()->getSessionEntityBySId(sId); if (!pSessionEntity) { LOG__(ERR, _T("Can't find the SessionEntity")); return FALSE; } std::string msgDecrptyCnt; DECRYPT_MSG(pSessionEntity->latestMsgContent, msgDecrptyCnt); CString strContent = util::stringToCString(msgDecrptyCnt); ReceiveMsgManage::getInstance()->parseContent(strContent, TRUE, 400);//需要转换成本地的格式 module::UserInfoEntity userInfo; CString strMsgTalkName; if (module::SESSION_GROUPTYPE == pSessionEntity->sessionType &&//只有群需要展示 消息的发送者 module::getUserListModule()->getUserInfoBySId(pSessionEntity->latestMsgFromId, userInfo)) { strMsgTalkName = userInfo.getRealName(); strMsgTalkName += CString(_T(":")); } strContent = strMsgTalkName + strContent; plastMsgUI->SetText(strContent); if (!SessionDialogManager::getInstance()->findSessionDialogBySId(sId))//窗口不存在的时候更新计数 { //更新未读计数 UInt32 nCnt = ReceiveMsgManage::getInstance()->getUnReadMsgCountBySId(sId); SetTextUICount(Unreadcnt_button, nCnt); } //更新消息的时间 CString strTime = module::getMiscModule()->makeShortTimeDescription(pSessionEntity->updatedTime); plastMsgTimeUI->SetText(strTime); sort(); return TRUE; }
BOOL UIIMEdit::GetPicPosAndPathbyOrder(IN UInt32 nOrder, OUT UInt32& nPos, OUT CString& path) { IRichEditOle* pRichEditOle = m_pRichEditOle; PTR_FALSE(pRichEditOle); REOBJECT reobj = { 0 }; reobj.cbStruct = sizeof(REOBJECT); HRESULT hr = pRichEditOle->GetObject(nOrder, &reobj, REO_GETOBJ_POLEOBJ); if (SUCCEEDED(hr) && reobj.poleobj) { GifSmiley::IGifSmileyCtrl* lpAnimator = 0; hr = reobj.poleobj->QueryInterface(GifSmiley::IID_IGifSmileyCtrl, (void**)&lpAnimator); if (SUCCEEDED(hr) && lpAnimator) { CComBSTR fileName; hr = lpAnimator->FileName(&fileName); if (SUCCEEDED(hr) && 0 != fileName.Length()) { nPos = reobj.cp; path = CString(fileName.m_str); } lpAnimator->FreeImage(); lpAnimator->Release(); } reobj.poleobj->Release(); return TRUE; } return FALSE; }
BOOL FileTransferSocket::create() { m_pLinkSocket->registerCB(this); BOOL bret = m_pLinkSocket->create(); PTR_FALSE(bret); return TRUE; }
BOOL ServerConfigDialog::_ApplySetting() { module::TTConfig* pTTConfig = module::getSysConfigModule()->getSystemConfig(); PTR_FALSE(pTTConfig); CString strLoginServIP = m_pEditAddress->GetText(); if (strLoginServIP.IsEmpty()) return FALSE; pTTConfig->loginServIP = strLoginServIP; return module::getSysConfigModule()->saveData(); }
BOOL LoginModule_Impl::showLoginDialog() { BOOL bRet = FALSE; LoginDialog* pDialog = new LoginDialog(); PTR_FALSE(pDialog); CString csTitle = util::getMultilingual()->getStringById(_T("STRID_LOGINDIALOG_BTN_LOGIN")); pDialog->Create(NULL, csTitle, UI_CLASSSTYLE_DIALOG, WS_EX_STATICEDGE | WS_EX_APPWINDOW, 0, 0, 0, 0); pDialog->CenterWindow(); bRet = (IDOK == pDialog->ShowModal()); return bRet; }
BOOL CteamtalkApp::_CreateMainDialog() { m_pMainDialog = new MainDialog(); PTR_FALSE(m_pMainDialog); CString csTitle = util::getMultilingual()->getStringById(_T("STRID_GLOBAL_CAPTION_NAME")); if (!m_pMainDialog->Create(NULL, csTitle , UI_CLASSSTYLE_DIALOG, WS_EX_STATICEDGE /*| WS_EX_APPWINDOW*/ | WS_EX_TOOLWINDOW, 0, 0, 600, 800)) return FALSE; m_pMainDialog->BringToTop(); return TRUE; }
BOOL DoLoginServer::createLink() { m_pLinkSocket = new logic::TcpClientSocket; m_pLinkSocket->registerCB(this); m_eventReceived = CreateEvent( NULL, FALSE, FALSE, NULL ); m_eventConnected = CreateEvent( NULL, FALSE, FALSE, NULL ); BOOL bret = m_pLinkSocket->create(); PTR_FALSE(bret); return TRUE; }
BOOL CUIRecentSessionList::UpdateItemInfo(IN const SessionListItemInfo& item) { std::string sid = util::cStringToString(CString(item.id)); Node* pNode = GetItemBySId(sid); if (nullptr == pNode) { return FALSE; } CControlUI* pListElement = pNode->data().list_elment_; PTR_FALSE(pListElement); CContainerUI* logo_Button = static_cast<CContainerUI*>(paint_manager_.FindSubControlByName(pListElement, kLogoButtonControlName)); if (logo_Button != NULL) logo_Button->SetBkImage(item.avatarPath); CLabelUI* nick_name = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kNickNameControlName)); if (nick_name != NULL) nick_name->SetText(item.nickName); return TRUE; }
BOOL isFileExist(IN const LPCTSTR csFileName) { PTR_FALSE(csFileName); WIN32_FIND_DATA FindFileData; HANDLE hFind; hFind = FindFirstFile(csFileName, &FindFileData); if (hFind == INVALID_HANDLE_VALUE) { LOG__(DEBG, _T("Invalid File Handle,maybe file isn't exist! filepath:%s,Get Last Error:%d"),csFileName, GetLastError()); return FALSE; } else { FindClose(hFind); } return TRUE; }
BOOL CGroupsTreelistUI::UpdateItemBySId(const std::string& sId) { if (sId.empty()) { return FALSE; } int nPos = 0; BOOL bFind = FALSE; CControlUI* pListElement = nullptr; Node* node = nullptr; for (; nPos < GetCount(); ++nPos) { pListElement = GetItemAt(nPos); if (pListElement) { UINT_PTR data = pListElement->GetTag(); node = (Node*)data; if (!node) { continue; } CString strID = node->data().sId; if (util::cStringToString(strID) == sId) { bFind = TRUE; break; } } } if (!bFind) { return FALSE; } PTR_FALSE(pListElement); if (!SessionDialogManager::getInstance()->findSessionDialogBySId(sId))//窗口不存在的时候更新计数 { //更新未读计数 CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName)); if (!Unreadcnt_button) { return FALSE; } UInt32 nCnt = ReceiveMsgManage::getInstance()->getUnReadMsgCountBySId(sId); if (0 == nCnt) { Unreadcnt_button->SetVisible(false); //没有消息不用更新 return FALSE; } else if (nCnt <= 99) { Unreadcnt_button->SetText(util::int32ToCString(nCnt)); Unreadcnt_button->SetVisible(true); } else if (nCnt > 99) { Unreadcnt_button->SetText(_T("99+")); Unreadcnt_button->SetVisible(true); } } return TRUE; }