// MBAMContactWnd.cpp : implementation file
|
//
|
|
#include "stdafx.h"
|
#include "mbamui.h"
|
#include "MBAMContactWnd.h"
|
#include "MBAMWnd.h"
|
#include "ImgProvider.h"
|
#include "helper\SAdapterBase.h"
|
#include "helper\SMenuEx.h"
|
#include "extend.ctrls/imre/ImgProvider.h"
|
#include "ExtendEvents.h"
|
#include "utils.h"
|
#include "imre/ClipboardConverter.h"
|
#include "imre/RichEditObjEvents.h"
|
#include "imre\RichEditOleCtrls.h"
|
// CMBAMContactWnd
|
|
#define TIMERID_LOAD_MSG 1499
|
|
#define OLENAME_FETCHMORE _T("FetchMoreOle")
|
|
CMBAMContactWnd::CMBAMContactWnd()
|
{
|
m_pPageRoot = NULL;
|
m_hWnd = NULL;
|
m_pHostWnd = NULL;
|
m_pOrgWebCMgr = NULL;
|
m_pServerMgr = NULL;
|
m_pUserLogin = NULL;
|
m_bLayoutInited = false;
|
m_pAMMessengerPro = NULL;
|
m_pTreeContact = NULL;
|
m_pAdapterContactTree = NULL;
|
m_pAMContactCommomFunction = NULL;
|
m_pAMContactCommomFunction = new CMBAMContactCommomFunction();
|
m_pMBAMWnd = NULL;
|
m_bIsLoadContacts = FALSE;
|
}
|
|
CMBAMContactWnd::~CMBAMContactWnd()
|
{
|
MBSAFE_DELETE(m_pAMContactCommomFunction)
|
}
|
|
|
// CMBAMContactWnd member functions
|
void CMBAMContactWnd::OnInit(SWindow *pRoot)
|
{
|
m_pHostWnd = (SHostWnd*)pRoot;
|
if( NULL == m_pHostWnd )
|
return ;
|
if(m_bLayoutInited)
|
{
|
LoadContacts();
|
return ;
|
}
|
m_hWnd = m_pHostWnd->m_hWnd;
|
m_pPageRoot = pRoot->FindChildByName(_T("page_recentcontactlist"));
|
m_pAMContactCommomFunction->SetPageRootPtr(m_pPageRoot);
|
m_pAMContactCommomFunction->SetServerMgrPtr(m_pServerMgr);
|
m_pAMContactCommomFunction->SetMessengerProPtr(m_pAMMessengerPro);
|
m_pAMContactCommomFunction->SetAMWndPtr(this);
|
m_pAMContactCommomFunction->SetWndPtr(m_hWnd);
|
|
m_pTreeContact = m_pPageRoot->FindChildByName2<SUserTreeView>(_T("treectrl_contact"));
|
if(m_pTreeContact)
|
{
|
m_pAdapterContactTree = new CMBContactTreeViewAdapter;
|
m_pAdapterContactTree->SetTreeView(m_pTreeContact);
|
m_pAdapterContactTree->SetAMContactCommomFunctonPtr(m_pAMContactCommomFunction);
|
m_pTreeContact->SetAdapter(m_pAdapterContactTree);
|
m_pAdapterContactTree->Release();
|
}
|
m_bLayoutInited = true;
|
LoadContacts();
|
|
}
|
|
void CMBAMContactWnd::OnClose()
|
{
|
// ·´×¢²áʼþ
|
//UnRegisterNotifyCenter();
|
|
}
|
|
void CMBAMContactWnd::DoMessageLoop()
|
{
|
MSG msg;
|
while ( ::PeekMessage( &msg, m_hWnd, 0, 0, PM_REMOVE ) )
|
{
|
::TranslateMessage( &msg );
|
::DispatchMessage( &msg );
|
}
|
}
|
void CMBAMContactWnd::SetServerMgrPtr( CMBServerMgr *pMBServerMgr )
|
{
|
m_pServerMgr = pMBServerMgr;
|
m_pUserLogin = pMBServerMgr->GetUserLogin();
|
m_pOrgWebCMgr = pMBServerMgr->GetOrgWebCMgr();
|
}
|
void CMBAMContactWnd::SetMessengerProPtr( CMessengerPro *pAMMessengerPro )
|
{
|
m_pAMMessengerPro = pAMMessengerPro;
|
}
|
void CMBAMContactWnd::SetAMWndPtr( CMBAMWnd *pMBAMWnd )
|
{
|
m_pMBAMWnd = pMBAMWnd;
|
}
|
// ¶¨Ê±Æ÷
|
void CMBAMContactWnd::OnTimer(UINT_PTR nIDEvent)
|
{
|
if(!m_bLayoutInited)
|
return;
|
if (nIDEvent == TIMER_UPDATEUSERTREE)
|
{
|
m_pHostWnd->KillTimer( nIDEvent );
|
m_pTreeContact->onBranchChanged(ITvAdapter::ITEM_ROOT);
|
}
|
}
|
void CMBAMContactWnd::ShowConcactChat( CMBContactItem *pContactItem,bool bDBClik )
|
{
|
if( !pContactItem)
|
{
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode != 1)
|
{
|
STabCtrl *pTab2 = m_pHostWnd->FindChildByName2<STabCtrl>(L"tab_sharework_panel");
|
if(pTab2)
|
{
|
EventCloseGungHoDetailWnd *pTmpEvt = new EventCloseGungHoDetailWnd(NULL);
|
SNotifyCenter::getSingleton().FireEventAsync(pTmpEvt);
|
pTmpEvt->Release();
|
pTab2->SetCurSel(4);
|
}
|
return;
|
}
|
}
|
if(pContactItem->m_nType == AM_VIEWITEMTYPE_USER)
|
{
|
CMBOrgUser *pUser = m_pAMContactCommomFunction->GetMBOrgUser(pContactItem->m_strID);
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode != 1)
|
{
|
STabCtrl *pTab2 = m_pHostWnd->FindChildByName2<STabCtrl>(L"tab_sharework_panel");
|
if(!pUser)
|
{
|
EventCloseGungHoDetailWnd *pTmpEvt = new EventCloseGungHoDetailWnd(NULL);
|
SNotifyCenter::getSingleton().FireEventAsync(pTmpEvt);
|
pTmpEvt->Release();
|
if(pTab2)
|
pTab2->SetCurSel(4);
|
return;
|
}
|
if(pTab2)
|
pTab2->SetCurSel(0);
|
}
|
if(m_pMBAMWnd)
|
m_pMBAMWnd->ShowUserChat(*pUser,bDBClik);
|
|
}
|
else if(pContactItem->m_nType == AM_VIEWITEMTYPE_CROWD)
|
{
|
CCrowdItem *pItem = m_pAMContactCommomFunction->GetCrowdItem(pContactItem->m_strID,pContactItem->m_strName);
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode != 1)
|
{
|
EventCloseGungHoDetailWnd *pTmpEvt = new EventCloseGungHoDetailWnd(NULL);
|
SNotifyCenter::getSingleton().FireEventAsync(pTmpEvt);
|
pTmpEvt->Release();
|
STabCtrl *pTab2 = m_pHostWnd->FindChildByName2<STabCtrl>(L"tab_sharework_panel");
|
if(!pItem)
|
{
|
if(pTab2)
|
pTab2->SetCurSel(4);
|
return;
|
}
|
if(pTab2)
|
pTab2->SetCurSel(2);
|
}
|
if(m_pMBAMWnd)
|
m_pMBAMWnd->ShowGroupChat(pItem,bDBClik);
|
|
}
|
else
|
{
|
EventCloseGungHoDetailWnd *pTmpEvt = new EventCloseGungHoDetailWnd(NULL);
|
SNotifyCenter::getSingleton().FireEventAsync(pTmpEvt);
|
pTmpEvt->Release();
|
STabCtrl *pTab2 = m_pHostWnd->FindChildByName2<STabCtrl>(L"tab_sharework_panel");
|
if(pTab2)
|
pTab2->SetCurSel(4);
|
}
|
|
}
|
void CMBAMContactWnd::UpdateUserShow( )
|
{
|
if( !m_bLayoutInited)
|
return;
|
m_pTreeContact->onBranchChanged(ITvAdapter::ITEM_ROOT);
|
}
|
void CMBAMContactWnd::OnOrgTvSelchangedEvent(EventArgs *pEvt)
|
{
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode == 1)
|
return;
|
EventTVSelChanged* pEventTVSelChanged = (EventTVSelChanged*)pEvt;
|
SOUI::HTREEITEM hSelItem = pEventTVSelChanged->hNewSel;
|
SASSERT(hSelItem);
|
ContactTreeItemData treeItemData = m_pAdapterContactTree->GetItemData(hSelItem);
|
CObject* pObj = (CObject*)treeItemData.pData;
|
if( NULL == pObj )
|
return;
|
if( pObj->IsKindOf(RUNTIME_CLASS(CMBContactItem)) ) //
|
{
|
CMBContactItem *pContactItem = (CMBContactItem*)pObj;
|
|
ShowConcactChat(pContactItem,false);
|
}
|
else
|
{
|
EventCloseGungHoDetailWnd *pTmpEvt = new EventCloseGungHoDetailWnd(NULL);
|
SNotifyCenter::getSingleton().FireEventAsync(pTmpEvt);
|
pTmpEvt->Release();
|
STabCtrl *pTab2 = m_pHostWnd->FindChildByName2<STabCtrl>(L"tab_sharework_panel");
|
if(pTab2)
|
pTab2->SetCurSel(4);
|
}
|
}
|
|
//void CMBAMContactWnd::OnOrgLvSelchangedEvent(EventArgs *pEvt)
|
// {
|
// EventLVSelChanged* pEventLVSelChanged = (EventLVSelChanged*)pEvt;
|
// int iNewSel = pEventLVSelChanged->iNewSel;
|
// if(iNewSel < 0)
|
// {
|
// m_pAMUserChatFrame->SetVisible(false,true);
|
// return;
|
// }
|
// CObject * pObj= m_pAdapterRecentContact->GetData(iNewSel);
|
// if( !pObj)
|
// {
|
// m_pAMUserChatFrame->SetVisible(false,true);
|
// return;
|
// }
|
// if( pObj->IsKindOf(RUNTIME_CLASS(CMBContactItem)) ) //
|
// {
|
// CMBContactItem *pContactItem = (CMBContactItem*)pObj;
|
// ShowConcactChat(pContactItem);
|
// }
|
// else
|
// {
|
// m_pAMUserChatFrame->SetVisible(false,true);
|
// }
|
//}
|
void CMBAMContactWnd::LoadContacts()
|
{
|
if(!m_bLayoutInited)
|
return;
|
if(m_bIsLoadContacts )
|
return;
|
POSITION pos = NULL;
|
SOUI::HTREEITEM hChildItem;
|
SOUI::HTREEITEM hRootItem = ITvAdapter::ITEM_ROOT;
|
CMBContactItem *pContactItem;
|
SOUI::HTREEITEM hFirstItem = NULL;
|
m_bIsLoadContacts = TRUE;
|
|
m_pTreeContact->SetSelNULL();
|
m_pAdapterContactTree->RemoveChildTreeItem(hRootItem);
|
m_pTreeContact->onBranchChanged(hRootItem);
|
for ( pos = m_pAMMessengerPro->m_mbLastContact.m_listContact.GetHeadPosition(); pos; pos )
|
{
|
|
pContactItem= (CMBContactItem *)m_pAMMessengerPro->m_mbLastContact.m_listContact.GetNext( pos );
|
if(pContactItem->m_nType != AM_VIEWITEMTYPE_USER && pContactItem->m_nType != AM_VIEWITEMTYPE_CROWD )
|
continue;
|
|
ContactTreeItemData data;
|
data.strName = pContactItem->m_strName;
|
data.pData = pContactItem;
|
data.strID = pContactItem->m_strID;
|
data.nType = pContactItem->m_nType;
|
data.strDate = pContactItem->m_strMsgDate;
|
hChildItem = m_pAdapterContactTree->GetTreeChildItem(hRootItem,pContactItem->m_strID,pContactItem->m_nType);
|
if( !hChildItem)
|
hChildItem = m_pAdapterContactTree->InsertItem(data,hRootItem);//STVI_FIRST
|
if( !hFirstItem && data.nType == AM_VIEWITEMTYPE_USER )
|
hFirstItem= hChildItem;
|
}
|
if(hFirstItem)
|
{
|
m_pTreeContact->SetSel(hFirstItem, TRUE);
|
/*ContactTreeItemData dataFisrt = m_pAdapterContactTree->GetItemData(hFirstItem);
|
pContactItem = (CMBContactItem*)dataFisrt.pData;
|
ShowConcactChat(pContactItem);*/
|
}
|
m_pTreeContact->onBranchChanged(hRootItem);
|
}
|
void CMBAMContactWnd::RemoveTreeAllItem()
|
{
|
if(!m_bLayoutInited)
|
return;
|
m_bIsLoadContacts = FALSE;
|
SOUI::HTREEITEM hRootItem = ITvAdapter::ITEM_ROOT;
|
m_pTreeContact->SetSelNULL();
|
m_pAdapterContactTree->RemoveChildTreeItem(hRootItem);
|
m_pTreeContact->onBranchChanged(hRootItem);
|
}
|
void CMBAMContactWnd::AddContactItem( CString strID, int nType )
|
{
|
if( !m_bLayoutInited)
|
return;
|
POSITION pos = NULL;
|
SOUI::HTREEITEM hChildItem;
|
SOUI::HTREEITEM hRootItem = ITvAdapter::ITEM_ROOT;
|
CMBContactItem *pContactItem = NULL;
|
SOUI::HTREEITEM hFirstItem = NULL;
|
pos = m_pAMMessengerPro->m_mbLastContact.FindContactItem(strID,nType);
|
if( pos)
|
pContactItem= (CMBContactItem *)m_pAMMessengerPro->m_mbLastContact.m_listContact.GetAt( pos );
|
if(!pContactItem)
|
return;
|
if(pContactItem->m_nType != AM_VIEWITEMTYPE_USER && pContactItem->m_nType != AM_VIEWITEMTYPE_CROWD )
|
return;
|
SOUI::HTREEITEM hSelItem = m_pTreeContact->GetSel();
|
ContactTreeItemData data;
|
data.strName = pContactItem->m_strName;
|
data.pData = pContactItem;
|
data.strID = pContactItem->m_strID;
|
data.nType = pContactItem->m_nType;
|
data.strDate = pContactItem->m_strMsgDate;
|
hChildItem = m_pAdapterContactTree->GetTreeChildItem(hRootItem,pContactItem->m_strID,pContactItem->m_nType);
|
if( hChildItem)
|
{
|
hFirstItem =m_pAdapterContactTree->GetFirstVisibleItem();
|
if(hFirstItem != hChildItem)
|
{
|
if(hSelItem == hChildItem)
|
{
|
m_pTreeContact->RemoveSel(hChildItem);
|
m_pAdapterContactTree->DeleteItem(hChildItem);
|
hChildItem = m_pAdapterContactTree->InsertItem(data,hRootItem,STVI_FIRST);//
|
m_pTreeContact->SetSel(hChildItem, TRUE);
|
}
|
else
|
{
|
m_pTreeContact->RemoveSel(hChildItem);
|
m_pAdapterContactTree->DeleteItem(hChildItem);
|
hChildItem = m_pAdapterContactTree->InsertItem(data,hRootItem,STVI_FIRST);//
|
}
|
}
|
}
|
else
|
hChildItem = m_pAdapterContactTree->InsertItem(data,hRootItem,STVI_FIRST);//
|
m_pTreeContact->onBranchChanged(hRootItem);
|
|
}
|
void CMBAMContactWnd::RemoveContactItem( CString strID, int nType )
|
{
|
if( !m_bLayoutInited)
|
return;
|
if (!m_pTreeContact || !m_pAMMessengerPro | !m_pAdapterContactTree)
|
return;
|
POSITION pos = NULL;
|
SOUI::HTREEITEM hChildItem;
|
SOUI::HTREEITEM hRootItem = ITvAdapter::ITEM_ROOT;
|
if(strID.IsEmpty() )
|
return;
|
if(nType != AM_VIEWITEMTYPE_USER && nType != AM_VIEWITEMTYPE_CROWD )
|
return;
|
SOUI::HTREEITEM hSelItem = m_pTreeContact->GetSel();
|
hChildItem = m_pAdapterContactTree->GetTreeChildItem(hRootItem,strID,nType);
|
if( hChildItem)
|
{
|
|
if(hSelItem == hChildItem)
|
{
|
m_pTreeContact->RemoveSel(hChildItem);
|
m_pAdapterContactTree->DeleteItem(hChildItem);
|
}
|
else
|
{
|
m_pTreeContact->RemoveSel(hChildItem);
|
m_pAdapterContactTree->DeleteItem(hChildItem);
|
m_pTreeContact->onBranchChanged(hRootItem);
|
return;
|
}
|
}
|
m_pTreeContact->onBranchChanged(hRootItem);
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode == 1)
|
return;
|
hChildItem = m_pAdapterContactTree->GetFirstVisibleItem();
|
if(hChildItem)
|
{
|
m_pTreeContact->SetSel(hChildItem, TRUE);
|
ContactTreeItemData dataFisrt = m_pAdapterContactTree->GetItemData(hChildItem);
|
CMBContactItem *pContactItem = (CMBContactItem*)dataFisrt.pData;
|
ShowConcactChat(pContactItem,false);
|
}
|
else
|
{
|
m_pTreeContact->SetSel(NULL, TRUE);
|
ShowConcactChat(NULL,false);
|
}
|
}
|
void CMBAMContactWnd::SelConcactTreeItem( CString strID, int nType )
|
{
|
if( !m_bLayoutInited)
|
return;
|
if(strID.IsEmpty())
|
return;
|
SOUI::HTREEITEM hChildItem;
|
SOUI::HTREEITEM hRootItem = ITvAdapter::ITEM_ROOT;
|
hChildItem = m_pAdapterContactTree->GetTreeChildItem(hRootItem,strID,nType);
|
if( hChildItem)
|
{
|
m_pTreeContact->SetSel(hChildItem, TRUE);
|
}
|
}
|
void CMBAMContactWnd::GelConcactTreeItem( CString &strID, int &nType )
|
{
|
strID = _T("");
|
nType = 0;
|
if( !m_bLayoutInited)
|
return;
|
SOUI::HTREEITEM hSelItem = m_pTreeContact->GetSel();
|
if(!hSelItem)
|
return;
|
m_pAdapterContactTree->GetOrgItemIdAndType(hSelItem,strID,nType);
|
}
|
void CMBAMContactWnd::ShowWnd()
|
{
|
if( !m_bLayoutInited)
|
return;
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode == 1)
|
return;
|
SOUI::HTREEITEM hSelItem = m_pTreeContact->GetSel();
|
if(hSelItem)
|
{
|
ContactTreeItemData dataFisrt = m_pAdapterContactTree->GetItemData(hSelItem);
|
CMBContactItem *pContactItem = (CMBContactItem*)dataFisrt.pData;
|
ShowConcactChat(pContactItem,false);
|
}
|
}
|
// ´¦Àí²Ëµ¥----»á»°¶ÔÏóÊôÐÔ
|
bool CMBAMContactWnd::OnMenuContactAttrClick(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact)
|
return true;
|
SOUI::HTREEITEM hItem = m_pTreeContact->GetSel();
|
if (!hItem)
|
return true;
|
CString strID = _T("");
|
CString strName = _T("");
|
int nType = 0;
|
m_pAdapterContactTree->GetOrgItemIdNameAndType(hItem,strID,strName,nType);
|
if(m_pMBAMWnd)
|
m_pMBAMWnd->OnShowContanctAttr(strID,strName,nType);
|
return true;
|
}
|
// ´¦Àí²Ëµ¥----Ìí¼Óµ½ÁªÏµÈËÁбí
|
bool CMBAMContactWnd::OnMenuAddToFriendList(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact || !m_pMBAMWnd | !m_pAdapterContactTree)
|
return true;
|
if (!m_pTreeContact)
|
return true;
|
SArrayHTreeItem arSel;
|
arSel.RemoveAll();
|
SOUI::HTREEITEM hItem;
|
m_pTreeContact->GetMulSels(arSel);
|
CString strLoginName = m_pServerMgr->GetUserLogin()->m_strLoginName;
|
CMBSelOrgList lstSelOrg;
|
|
for(int i =0; i < arSel.GetCount();i++)
|
{
|
hItem = arSel.GetAt(i);
|
ContactTreeItemData itemData = m_pAdapterContactTree->GetItemData(hItem);
|
if (itemData.nType != AM_VIEWITEMTYPE_USER)
|
continue;
|
if(itemData.strID.CompareNoCase(strLoginName) == 0)
|
{
|
continue;
|
}
|
lstSelOrg.AddOrgItem(itemData.strID, itemData.strName,AM_VIEWITEMTYPE_USER);
|
}
|
m_pMBAMWnd->OnAddUserToFirend(lstSelOrg);
|
return true;
|
}
|
// ´¦Àí²Ëµ¥----ÒÆ³ö»á»°Áбí
|
bool CMBAMContactWnd::OnMenuRemoveFromContactList(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact || !m_pAMMessengerPro | !m_pAdapterContactTree)
|
return true;
|
SArrayHTreeItem arSel;
|
arSel.RemoveAll();
|
SOUI::HTREEITEM hChildItem;
|
SOUI::HTREEITEM hRootItem = ITvAdapter::ITEM_ROOT;
|
m_pTreeContact->GetMulSels(arSel);
|
|
for(int i =0; i < arSel.GetCount();i++)
|
{
|
hChildItem = arSel.GetAt(i);
|
ContactTreeItemData itemData = m_pAdapterContactTree->GetItemData(hChildItem);
|
m_pTreeContact->RemoveSel(hChildItem);
|
m_pAdapterContactTree->DeleteItem(hChildItem);
|
m_pAMMessengerPro->m_mbLastContact.DeleteContactItem(itemData.strID,itemData.nType);
|
m_pAMMessengerPro->m_AMDBMgr.RemoveLastContact(itemData.strID,itemData.nType);
|
}
|
m_pTreeContact->onBranchChanged(hRootItem);
|
if(m_pServerMgr->GetUserLogin()->m_nMBCShowMode == 1)
|
return true;
|
hChildItem = m_pAdapterContactTree->GetFirstVisibleItem();
|
if(hChildItem)
|
{
|
m_pTreeContact->SetSel(hChildItem, TRUE);
|
ContactTreeItemData dataFisrt = m_pAdapterContactTree->GetItemData(hChildItem);
|
CMBContactItem *pContactItem = (CMBContactItem*)dataFisrt.pData;
|
ShowConcactChat(pContactItem,false);
|
}
|
else
|
{
|
m_pTreeContact->SetSel(NULL, TRUE);
|
ShowConcactChat(NULL,false);
|
}
|
return true;
|
}
|
// ´¦Àí²Ëµ¥----´´½¨¶àÈ˻Ự
|
bool CMBAMContactWnd::OnMenuNewDissGroup(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact)
|
return true;
|
SArrayHTreeItem arSel;
|
arSel.RemoveAll();
|
SOUI::HTREEITEM hItem;
|
CString strID = _T("");
|
int nType = 0;
|
CString strGroupID = _T("");
|
CString strNames = _T("");
|
CString strUserName = _T("");
|
CString strTmpNames = _T("");
|
CString strData = _T("");
|
CString strTmpUserInfo = _T("");
|
CString strLoginName = m_pUserLogin->m_strLoginName;
|
CMBOrgUser *pUser = NULL;
|
int nUserCount = 1;
|
m_pTreeContact->GetMulSels(arSel);
|
for(int i =0; i < arSel.GetCount();i++)
|
{
|
hItem = arSel.GetAt(i);
|
ContactTreeItemData itemData = m_pAdapterContactTree->GetItemData(hItem);
|
if (itemData.nType != AM_VIEWITEMTYPE_USER)
|
continue;
|
if(itemData.strID.CompareNoCase(strLoginName) == 0)
|
{
|
continue;
|
}
|
if( !m_pAMMessengerPro->m_pMBOrgListMgr->LookupUser(itemData.strID,pUser ))
|
{
|
strTmpUserInfo.Format(_T("%s;%s;%d"), itemData.strID, itemData.strName,0);
|
strTmpNames +=itemData.strName;
|
strUserName = itemData.strName;
|
}
|
else
|
{
|
strTmpUserInfo.Format(_T("%s;%s;%s"), itemData.strID, pUser->m_strUserName, pUser->m_strSex);
|
strTmpNames += pUser->m_strUserName;
|
strUserName = pUser->m_strUserName;
|
}
|
nUserCount++;
|
strData += strTmpUserInfo + APART_MULLOGIN;
|
if(strTmpNames.GetLength() < 20)
|
{
|
strNames += strUserName + _T("¡¢");
|
strTmpNames =strNames;
|
}
|
else
|
{
|
if(strNames.IsEmpty())
|
strNames = strUserName;
|
}
|
}
|
if(strNames.Right(1) == _T("¡¢"))
|
strNames = strNames.Left(strNames.GetLength() -1);
|
if(m_pMBAMWnd)
|
m_pMBAMWnd->NewDissGroup(strNames,strData,nUserCount);
|
return true;
|
}
|
// ´¦Àí²Ëµ¥----·¢ËÍÏûÏ¢
|
bool CMBAMContactWnd::OnMenuSendMsgClick(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact)
|
return true;
|
SArrayHTreeItem arSel;
|
arSel.RemoveAll();
|
SOUI::HTREEITEM hItem;
|
CMBOrgUser *pUser = NULL;
|
CMBSelOrgList lstSelOrg;
|
m_pTreeContact->GetMulSels(arSel);
|
for(int i =0; i < arSel.GetCount();i++)
|
{
|
hItem = arSel.GetAt(i);
|
ContactTreeItemData itemData = m_pAdapterContactTree->GetItemData(hItem);
|
if (itemData.nType != AM_VIEWITEMTYPE_USER)
|
continue;
|
if( !m_pAMMessengerPro->m_pMBOrgListMgr->LookupUser(itemData.strID,pUser ))
|
{
|
lstSelOrg.AddOrgItem(itemData.strID,itemData.strName,itemData.nType);
|
}
|
else
|
{
|
lstSelOrg.AddOrgItem(itemData.strID,pUser->m_strUserName,itemData.nType);
|
}
|
}
|
if(m_pMBAMWnd)
|
m_pMBAMWnd->SendModeMsg(lstSelOrg);
|
return true;
|
}
|
// ´¦Àí²Ëµ¥----·¢ËÍ½ØÆÁ
|
bool CMBAMContactWnd::OnMenuSendCaptureClick(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact)
|
return true;
|
SOUI::HTREEITEM hItem = m_pTreeContact->GetSel();
|
if (!hItem)
|
return true;
|
CString strID = _T("");
|
CString strName = _T("");
|
int nType = 0;
|
m_pAdapterContactTree->GetOrgItemIdNameAndType(hItem,strID,strName,nType);
|
if(m_pMBAMWnd)
|
m_pMBAMWnd->OpenCapture(strID,strName);
|
return true;
|
}
|
// ´¦Àí²Ëµ¥----»ñÈ¡Óû§µÇ¼IP
|
bool CMBAMContactWnd::OnMenuGetUserIPClick(EventArgs *pEvt)
|
{
|
if (!m_pTreeContact)
|
return true;
|
SOUI::HTREEITEM hItem = m_pTreeContact->GetSel();
|
if (!hItem)
|
return true;
|
CString strID = _T("");
|
CString strName = _T("");
|
int nType = 0;
|
m_pAdapterContactTree->GetOrgItemIdNameAndType(hItem,strID,strName,nType);
|
if (nType == AM_VIEWITEMTYPE_USER)
|
{
|
int nUserStatus = AM_USERSTATUS_NONE;
|
CMBOrgUser *pUserItem = NULL;
|
if ( m_pAMMessengerPro->m_pMBOrgListMgr->LookupUser( strID ,pUserItem) )
|
{
|
if ( pUserItem )
|
{
|
nUserStatus = pUserItem->m_nStatus;
|
strName =pUserItem->m_strUserName;
|
}
|
}
|
if(CMBOrgFunc::IsOnlineUser(nUserStatus))
|
{
|
CString strUserInfo;
|
CString strErrInfo;
|
if( m_pServerMgr->GetOrgWebCMgr()->GetUserLastTerminalInfo(strID,strUserInfo,strErrInfo))
|
{
|
CString strLocalIP = _T("");
|
CString strConnIP = _T("");
|
CMBAMUIBaseFun::ParseUserLastTerminalInfo(strUserInfo,strLocalIP,strConnIP);
|
CString strMessage;
|
CString strTitle;
|
strTitle.Format(_T("%sµÄµÇ¼IPÐÅÏ¢"),strName);
|
strMessage.Format(_T(" ÄÚÍøIP:%s\n ÍâÍøIP:%s"),strLocalIP,strConnIP);
|
MBMessageBox(m_hWnd,strMessage,strTitle,MB_OK);
|
}
|
}
|
|
}
|
return true;
|
}
|
void CMBAMContactWnd::SortContactreeItem()
|
{
|
if(!m_bLayoutInited)
|
return;
|
SOUI::HTREEITEM hItem = ITvAdapter::ITEM_ROOT;
|
m_pAdapterContactTree->SortTreeChildItem(hItem);
|
m_pTreeContact->onBranchChanged(hItem);
|
}
|
|
int CMBAMContactWnd::GetContactMsgRight(CString strID, int nType)
|
{
|
if(m_pMBAMWnd)
|
return m_pMBAMWnd->GetContactMsgRight(strID,nType);
|
return 0;
|
}
|
void CMBAMContactWnd::SetContactMsgRight(CString strID,int nMsgRight, int nType)
|
{
|
if(m_pMBAMWnd)
|
return m_pMBAMWnd->SetContactMsgRight(strID,nMsgRight,nType);
|
}
|