void SessionLayout::_AddGroupMemberToList(IN const std::string& sID, IN const BOOL bCreator) { module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo)) { LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sID),util::stringToCString(m_sId)); return; } CDialogBuilder dlgBuilder; CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager); if (!pListElement) { LOG__(ERR, _T("群item创建失败")); return; } CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo"))); PTR_VOID(pLogo); pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); if (bCreator) { CButtonUI* pCreator = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("Creator"))); PTR_VOID(pCreator); pCreator->SetVisible(true); pCreator->SetUserData(_T("Creator")); } CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname"))); PTR_VOID(pNameLable); pNameLable->SetText(userInfo.getRealName()); pListElement->SetUserData(util::stringToCString(userInfo.sId)); m_pGroupMemberList->Add(pListElement); }
void HttpPool::postRequest(HttpRequest* http_request,IAsyncHttpDelegate* delegate) { const Util::ScopedLock scoped_lock(*_work_lock); PTR_VOID(http_request); PTR_VOID(delegate); HttpWorkItem* item = new HttpWorkItem(http_request,delegate); _http_work_list.push_back(item); ReleaseSemaphore(_work_semaphore,1,0); }
void ServerConfigDialog::OnWindowInitialized(TNotifyUI& msg) { m_pbtnApply = (CButtonUI*)m_PaintManager.FindControl(_T("applybtn")); PTR_VOID(m_pbtnApply); m_pEditAddress = (CEditUI*)m_PaintManager.FindControl(_T("Address")); PTR_VOID(m_pEditAddress); _InitlizeSetting(); }
void LoginDialog::OnHttpCallbackOperation(std::shared_ptr<void> param) { DoLoginServerParam* pParam = (DoLoginServerParam*)param.get(); if (DOLOGIN_SUCC == pParam->result) { module::TTConfig* pCfg = module::getSysConfigModule()->getSystemConfig(); PTR_VOID(pCfg); LoginParam loginparam; loginparam.csUserName = pCfg->userName; loginparam.password = pCfg->password; loginparam.csUserName.Trim(); LoginOperation* pOperation = new LoginOperation( BIND_CALLBACK_1(LoginDialog::OnOperationCallback), loginparam); imcore::IMLibCoreStartOperation(pOperation); } else { m_ptxtTip->SetText(pParam->resMsg); module::TTConfig* pCfg = module::getSysConfigModule()->getSystemConfig(); LOG__(ERR, _T("get MsgServer config faild,login server addres:%s:%d"), pCfg->loginServIP,pCfg->loginServPort); CString csTxt = util::getMultilingual()->getStringById(_T("STRID_LOGINDIALOG_BTN_LOGIN")); m_pBtnLogin->SetText(csTxt); m_pBtnLogin->SetEnabled(true); } }
void NativeWindow::SetIcon(HICON icon) { assert(::IsWindow(hwnd_)); PTR_VOID(icon); ::SendMessage(hwnd_, WM_SETICON, (WPARAM)TRUE, (LPARAM)icon); ::SendMessage(hwnd_, WM_SETICON, (WPARAM)FALSE, (LPARAM)icon); }
void NativeWindow::SetIcon(const wchar_t *icon_filepath) { assert(::IsWindow(hwnd_)); PTR_VOID(icon_filepath); HICON icon = (HICON)LoadImage(NULL,icon_filepath,IMAGE_ICON,0,0,LR_LOADFROMFILE); SetIcon(icon); }
void MainDialog::_UpdateTotalUnReadMsgCount(void) { PTR_VOID(m_pTextUnreadMsgCount); UInt32 nCount = module::getMessageModule()->getTotalUnReadMsgCount(); if (0 == nCount)//没有消息 { m_pTextUnreadMsgCount->SetVisible(false); } else if (nCount <= 99) { m_pTextUnreadMsgCount->SetText(util::int32ToCString(nCount)); m_pTextUnreadMsgCount->SetVisible(true); } else if (nCount > 99) { m_pTextUnreadMsgCount->SetText(_T("99+")); m_pTextUnreadMsgCount->SetVisible(true); } CString sText = util::getMultilingual()->getStringById(_T("STRID_GLOBAL_CAPTION_NAME")); #ifdef _DEBUG sText += _T("-Debug"); #endif CString sUnreadCnt; if (0 != nCount) { CString sFormat = util::getMultilingual()->getStringById(_T("STRID_MAINDIALOG_TOOLTIP_MSGCNT")); sUnreadCnt.Format(sFormat, nCount); } SetTrayTooltipText(sText + sUnreadCnt); }
void DoLoginServer::onReceiveData(const char* data, UInt32 size) { m_serailBuffer.clear(); m_serailBuffer.append(data, size); APP_LOG(LOG_DEBUG,_T("LoginServerLink onPacket size:%d"),m_serailBuffer.size()); try { m_pImPdu = CImPdu::ReadPdu((uchar_t*)m_serailBuffer.data(),(uint32_t)m_serailBuffer.size()); } catch(CPduException e) { APP_LOG(LOG_ERROR, _T("LoginServerLink onPacket CPduException serviceId:%d,commandId:%d,errCode:%d") ,e.GetModuleId(),e.GetCommandId(),e.GetErrorCode()); return; } catch(...) { APP_LOG(LOG_ERROR, TRUE, _T("LoginServerLink onPacket unknown exception")); return; } PTR_VOID(m_pImPdu); ::SetEvent(m_eventReceived); }
void GroupListModule_Impl::onPacket(std::auto_ptr<CImPdu> pdu) { CImPdu* pPdu = pdu.get(); PTR_VOID(pPdu); switch (pdu->GetCommandId()) { case CID_GROUP_LIST_RESPONSE://固定群列表 _grouplistResponse(pPdu); break; case CID_GROUP_DIALOG_LIST_RESPONSE://讨论组 _groupDiscussListResponse(pPdu); break; case CID_GROUP_USER_LIST_RESPONSE://陌生群/讨论组 详细信息(在收到陌生群信息的时候,请求该群信息,返回) _groupuserlistResponse(pPdu); break; case CID_GROUP_UNREAD_CNT_RESPONSE: _groupUnreadCntResponse(pPdu); //离线消息计数 break; case CID_GROUP_UNREAD_MSG_RESPONSE://具体的群消息内容 module::getSessionModule()->OnGroupUnreadMsgRespone(pPdu); break; case CID_GROUP_CREATE_TMP_GROUP_RESPONSE: APP_LOG(LOG_DEBUG, _T("创建临时群返回")); _groupCreatTempGroupRespone(pPdu); break; case CID_GROUP_CHANGE_MEMBER_RESPONSE: //群成员发生变动 _groupChangedGroupMembersResponse(pPdu); break; default: return; } }
void MainDialog::OnClick(TNotifyUI& msg) { PTR_VOID(msg.pSender); if (msg.pSender == m_pbtnSysConfig) { //系统设置 module::getSysConfigModule()->showSysConfigDialog(m_hWnd); } else if (msg.pSender == m_pbtnOnlineStatus) { CMenuWnd* pMenu = new CMenuWnd(m_hWnd); DuiLib::CPoint point = msg.ptMouse; ClientToScreen(m_hWnd, &point); STRINGorID xml(_T("menu\\lineStatus.xml")); pMenu->Init(NULL, xml, _T("xml"), point); } else if (msg.pSender == m_pbtnMyFace) { } else if (msg.pSender == m_pbtnClose || msg.pSender == m_pbtnMinMize) { ShowWindow(false); return; } __super::OnClick(msg); }
void MainDialog::OnWindowInitialized(TNotifyUI& msg) { module::getScreenCaptureModule()->initCapture(m_hWnd); module::getLoginModule()->addObserver(this, BIND_CALLBACK_2(MainDialog::MKOForLoginModuleCallBack)); module::getUserListModule()->addObserver(this, BIND_CALLBACK_2(MainDialog::MKOForUserListModuleCallBack)); module::getSessionModule()->addObserver(this, BIND_CALLBACK_2(MainDialog::MKOForSessionModuleCallBack)); m_pbtnSysConfig = (CButtonUI*)m_PaintManager.FindControl(_T("sysconfig")); m_pbtnOnlineStatus = (CButtonUI*)m_PaintManager.FindControl(_T("onlineStatus")); m_pbtnMyFace = (CButtonUI*)m_PaintManager.FindControl(_T("myfacebtn")); m_pEditSignature = (CEditUI*)m_PaintManager.FindControl(_T("signature")); m_ptxtUname = (CTextUI*)m_PaintManager.FindControl(_T("unametxt")); m_pbtnClose = (CButtonUI*)m_PaintManager.FindControl(_T("closebtn")); m_pbtnMinMize = (CButtonUI*)m_PaintManager.FindControl(_T("minbtn")); m_pTextUnreadMsgCount = static_cast<CTextUI*>(m_PaintManager.FindControl(_T("msgCount"))); PTR_VOID(m_pTextUnreadMsgCount); _FreshMySignature(); if (m_ptxtUname) { CString strVersion; strVersion.Format(_T("V.%d"), TEAMTALK_VERSION); m_ptxtUname->SetToolTip(strVersion); } //加载图标 LoadIcons(); //创建系统托盘 CreateTrayIcon(); //初始化 Initilize(); }
void SessionModule_Impl::onPacket(std::auto_ptr<CImPdu> pdu) { CImPdu* pPdu = pdu.get(); PTR_VOID(pPdu); switch (pdu->GetCommandId()) { case CID_MSG_DATA: _sessionMsgResponse(pPdu); break; case CID_MSG_DATA_ACK: _sessionMsgACK(pPdu); break; case CID_MSG_TIME_RESPONSE: _sessionMsgTimeResponse(pPdu); break; case CID_MSG_UNREAD_CNT_RESPONSE: _sessionMsgUnreadCntResponse(pPdu); break; case CID_MSG_UNREAD_MSG_RESPONSE: _sessionMsgUnreadMsgResponse(pPdu); break; default: return; } }
void UserListModule_Impl::onPacket(std::auto_ptr<CImPdu> pdu) { CImPdu* pPdu = pdu.get(); PTR_VOID(pPdu); switch (pdu->GetCommandId()) { case CID_BUDDY_LIST_DEPARTMENT_RESPONSE: _departmentResponse(pPdu); break; case CID_BUDDY_LIST_ALL_USER_RESPONSE: _allUserlistResponse(pPdu); break; case CID_BUDDY_LIST_FRIEND_LIST: _recentlistResponse(pPdu); break; case CID_BUDDY_LIST_USER_INFO_RESPONSE: _newUserListInfoResponse(pPdu); break; case CID_BUDDY_LIST_ONLINE_FRIEND_LIST: _allUserlistLineStatusResponse(pPdu); break; case CID_BUDDY_LIST_STATUS_NOTIFY: _userLineStatusResponse(pPdu); break; default: return; } }
void LoginDialog::OnTextChanged(TNotifyUI& msg) { PTR_VOID(msg.pSender); if (msg.pSender == m_pedtPassword) { m_bPassChanged = TRUE; } }
void UserDetailInfoDialog::OnClick(TNotifyUI& msg) { PTR_VOID(msg.pSender); if (msg.pSender == m_AvatarUI) { module::getSessionModule()->asynNotifyObserver(module::KEY_SESSION_OPENNEWSESSION, m_sid);//通知主窗口创建会话 } __super::OnClick(msg); }
void ServerConfigDialog::OnClick(TNotifyUI& msg) { PTR_VOID(msg.pSender); if (msg.pSender == m_pbtnApply) { if(_ApplySetting()) Close(IDOK); } __super::OnClick(msg); }
void LoginDialog::OnClick(TNotifyUI& msg) { PTR_VOID(msg.pSender); if (msg.pSender == m_pBtnLogin) { _DoLogin(); return; } else if (msg.pSender == m_pBtnSysSetting) { module::getSysConfigModule()->showServerConfigDialog(m_PaintManager.GetPaintWindow()); return; } __super::OnClick(msg); }
void MainDialog::_FreshMySignature(void) { PTR_VOID(m_pEditSignature); module::UserInfoEntity myInfo; if (module::getUserListModule()->getMyInfo(myInfo)) { m_pEditSignature->SetText(util::stringToCString(myInfo.signature)); if (myInfo.signature.empty()) { m_pEditSignature->SetToolTip(_T("编辑个性签名")); } else { m_pEditSignature->SetToolTip(util::stringToCString(myInfo.signature)); } } }
void HttpRequest::addFile(const std::string& name,IHttpPostFile* post_file) { PTR_VOID(post_file); for (size_t i = 0; i < _post_files.size(); i ++) { const std::string& add_name = _post_files[i]->_name; if (_strcmpi(name.c_str(),add_name.c_str()) == 0) { //不允许重名 assert(false); return; } } HttpFile* http_file = new HttpFile(name,post_file); _post_files.push_back(http_file); _is_multipart = true; }
// 选择图像 void HeadModifyForm::OnButtonSelectImage() { if(is_loading_image_) return; select_image_btn_->SetEnabled(false); std::wstring file_type = ui::MutiLanSupport::GetInstance()->GetStringViaID(L"STRING_PIC_FILE"); LPCTSTR filter_text = L"*.jpg;*.jpeg;*.png"; std::wstring text = nbase::StringPrintf(L"%s(%s)", file_type.c_str(),filter_text); CFileDialogEx* file_dlg = new CFileDialogEx(); PTR_VOID(file_dlg); std::map<LPCTSTR,LPCTSTR> filters; filters[text.c_str()] = filter_text; file_dlg->SetFilter(filters); file_dlg->SetParentWnd(m_hWnd); CFileDialogEx::FileDialogCallback2 callback2 = nbase::Bind(&HeadModifyForm::OnButtonSelectImageCallback, this, std::placeholders::_1, std::placeholders::_2); file_dlg->AyncShowOpenFileDlg(ToWeakCallback(callback2)); }
void CUIRecentSessionList::ClearItemMsgCount(IN const std::string& sId) { Node* pNode = GetItemBySId(sId); if (!pNode) return; CControlUI* pListElement = pNode->data().list_elment_; PTR_VOID(pListElement); //清除未读计数 CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName)); if (!Unreadcnt_button) { LOG__(DEBG, _T("can't find the Unreadcnt_button")); return; } Unreadcnt_button->SetText(_T("")); Unreadcnt_button->SetVisible(false); return; }
void SessionLayout::_SendSessionMsg(IN MixedMsg mixMsg) { if (mixMsg.IsPureTextMsg()) { MessageEntity msg; std::string msgEncrypt; ENCRYPT_MSG(util::cStringToString(mixMsg.m_strTextData), msgEncrypt); msg.content = msgEncrypt; msg.sessionId = m_sId; msg.talkerSid = module::getSysConfigModule()->userID(); msg.msgRenderType = MESSAGE_RENDERTYPE_TEXT; module::SessionEntity* pSessionInfo = SessionEntityManager::getInstance()->getSessionEntityBySId(m_sId); PTR_VOID(pSessionInfo); msg.msgType = (pSessionInfo->sessionType == module::SESSION_USERTYPE) ? MSG_TYPE_TEXT_P2P : MSG_TYPE_TEXT_GROUP; msg.msgSessionType = pSessionInfo->sessionType; msg.msgTime = module::getSessionModule()->getTime(); SendMsgManage::getInstance()->pushSendingMsg(msg); //更新会话时间 module::SessionEntity* pSessionEntity = SessionEntityManager::getInstance()->getSessionEntityBySId(msg.sessionId); if (pSessionEntity) { pSessionEntity->updatedTime = msg.msgTime; } //主界面 消息内容,时间更新 module::getSessionModule()->asynNotifyObserver(module::KEY_SESSION_TRAY_NEWMSGSEND, msg.sessionId); } else { for (ST_picData& picData : mixMsg.m_picDataVec) { //图片需要上传 SendImgParam param; param.csFilePath = picData.strLocalPicPath; m_pSendImgHttpOper = new SendImgHttpOperation(param , BIND_CALLBACK_1(SessionLayout::OnSendImageCallback)); module::getHttpPoolModule()->pushHttpOperation(m_pSendImgHttpOper, TRUE); } m_SendingMixedMSGList.push_back(mixMsg); } }
void FileTransferSocket::onReceiveData(const char* data, UInt32 size) { CImPdu* pPdu = 0; try { pPdu = CImPdu::ReadPdu((uchar_t*)data, (uint32_t)size); PTR_VOID(pPdu); if (IM_PDU_TYPE_HEARTBEAT == pPdu->GetCommandId() && SID_OTHER == pPdu->GetModuleId()) return; } catch (CPduException e) { APP_LOG(LOG_ERROR, _T("FileTransferSocket onPacket CPduException serviceId:%d,commandId:%d,errCode:%d") , e.GetModuleId(), e.GetCommandId(), e.GetErrorCode()); return; } catch (...) { APP_LOG(LOG_ERROR, _T("FileTransferSocket onPacket unknown exception")); return; } UInt16 ncmdid = pPdu->GetCommandId(); switch (pPdu->GetCommandId()) { case CID_FILE_LOGIN_RES: _fileLoginResponse(pPdu); break; case CID_FILE_PULL_DATA_REQ: _filePullDataReqResponse(pPdu); break; case CID_FILE_PULL_DATA_RSP: _filePullDataRspResponse(pPdu); break; case CID_FILE_STATE: _fileState(pPdu); default: break; } delete pPdu; pPdu = 0; }
void UIIMEdit::ReleaseAllGif() { SetText(_T("")); IRichEditOle *pRichEditOle = m_pRichEditOle; PTR_VOID(pRichEditOle); for (int i = 0; i < pRichEditOle->GetObjectCount(); i++) { REOBJECT reobj = { 0 }; reobj.cbStruct = sizeof(REOBJECT); pRichEditOle->GetObject(i, &reobj, REO_GETOBJ_POLEOBJ); GifSmiley::IGifSmileyCtrl* lpAnimator = 0; HRESULT hr = reobj.poleobj->QueryInterface(GifSmiley::IID_IGifSmileyCtrl, (void**)&lpAnimator); if (SUCCEEDED(hr) && lpAnimator) { lpAnimator->FreeImage(); lpAnimator->Release(); } reobj.poleobj->Release(); } }
void LoginDialog::OnWindowInitialized(TNotifyUI& msg) { m_ptxtTip = (CTextUI*)m_PaintManager.FindControl(_T("tipText")); PTR_VOID(m_ptxtTip); m_pedtUserName = (CEditUI*)m_PaintManager.FindControl(_T("edit_name")); PTR_VOID(m_pedtUserName); m_pedtPassword = (CEditUI*)m_PaintManager.FindControl(_T("edit_pwd")); PTR_VOID(m_pedtPassword); m_pBtnLogin = (CButtonUI*)m_PaintManager.FindControl(_T("loginBtn")); PTR_VOID(m_pBtnLogin); m_pBtnSysSetting = (CButtonUI*)m_PaintManager.FindControl(_T("setting")); PTR_VOID(m_pBtnSysSetting); m_pChkRememberPWD = (CCheckBoxUI*)m_PaintManager.FindControl(_T("isRememberPWD")); PTR_VOID(m_pChkRememberPWD); _Initlize(); m_pBtnLogin->SetFocus(); }
void NativeWindow::SetWindowText(const wchar_t *text) { assert(::IsWindow(hwnd_)); PTR_VOID(text); ::SetWindowText(hwnd_,text); }
void UIWindow::SetRootControl(UIControl *pControl) { PTR_VOID(pControl); if (mp_root_control != NULL) { delete mp_root_control; } mp_root_control = pControl; mp_root_control->SetParentWnd(this); }
void HttpClient::setProxy(const Http::ProxyConfig *proxy_config) { PTR_VOID(proxy_config); ProxySocket::setProxy(*proxy_config); }
void SysConfigDialog::OnWindowInitialized(TNotifyUI& msg) { m_pbtnApply = (CButtonUI*)m_PaintManager.FindControl(_T("applybtn")); PTR_VOID(m_pbtnApply); //m_pbtnClose = (CButtonUI*)m_PaintManager.FindControl(_T("closebtn")); //PTR_VOID(m_pbtnClose); m_topmostBtn = (CCheckBoxUI*)m_PaintManager.FindControl(_T("topmostBtn")); PTR_VOID(m_topmostBtn); m_newmessagealertBtn = (CCheckBoxUI*)m_PaintManager.FindControl(_T("newmessagealertBtn")); PTR_VOID(m_newmessagealertBtn); m_soundBtn = (CCheckBoxUI*)m_PaintManager.FindControl(_T("soundBtn")); PTR_VOID(m_soundBtn); m_DingdongRdo = (COptionUI*)m_PaintManager.FindControl(_T("DingdongRdo")); PTR_VOID(m_DingdongRdo); m_HujiaoRdo = (COptionUI*)m_PaintManager.FindControl(_T("HujiaoRdo")); PTR_VOID(m_HujiaoRdo); m_JianpanRdo = (COptionUI*)m_PaintManager.FindControl(_T("JianpanRdo")); PTR_VOID(m_JianpanRdo); m_DinglinRdo = (COptionUI*)m_PaintManager.FindControl(_T("DinglinRdo")); PTR_VOID(m_DinglinRdo); m_TestSoundBtn = (CButtonUI*)m_PaintManager.FindControl(_T("TestSoundBtn")); PTR_VOID(m_TestSoundBtn); m_CtrlEntrtRdo = (COptionUI*)m_PaintManager.FindControl(_T("CtrlEntrtRdo")); PTR_VOID(m_CtrlEntrtRdo); m_EnterRdo = (COptionUI*)m_PaintManager.FindControl(_T("EnterRdo")); PTR_VOID(m_EnterRdo); _InitlizeSetting(); }