Example #1
0
CBuddyInfo * CBuddyInfoDlg::GetBuddyInfoPtr()
{
	if (NULL == m_lpQQClient)
		return NULL;

	if (!m_bIsGMember)
	{
		CBuddyInfo * lpUserInfo = m_lpQQClient->GetUserInfo();
		if (lpUserInfo != NULL && lpUserInfo->m_nQQUin == m_nQQUin)
		{
			return lpUserInfo;
		}
		else
		{
			CBuddyList * lpBuddyList = m_lpQQClient->GetBuddyList();
			if (lpBuddyList != NULL)
				return lpBuddyList->GetBuddy(m_nQQUin);
		}
	}
	else
	{
		CGroupList * lpGroupList = m_lpQQClient->GetGroupList();
		if (lpGroupList != NULL)
			return lpGroupList->GetGroupMemberByCode(m_nGroupCode, m_nQQUin);
	}

	return NULL;
}
Example #2
0
void CMsgTipDlg::GetNumber(UINT nGroupCode, UINT nQQUin, UINT& nGroupNum, UINT& nQQNum)
{
	nGroupNum = nQQNum = 0;

	if (nGroupCode != 0 && nQQUin != 0)
	{
		CGroupList * lpGroupList = m_lpQQClient->GetGroupList();
		if (lpGroupList != NULL)
		{
			CBuddyInfo * lpBuddyInfo = lpGroupList->GetGroupMemberByCode(nGroupCode, nQQUin);
			if (lpBuddyInfo != NULL)
				nQQNum = lpBuddyInfo->m_nQQNum;
		}
	}
	else if (nGroupCode != 0)
	{
		CGroupList * lpGroupList = m_lpQQClient->GetGroupList();
		if (lpGroupList != NULL)
		{
			CGroupInfo * lpGroupInfo = lpGroupList->GetGroupByCode(nGroupCode);
			if (lpGroupInfo != NULL)
				nGroupNum = lpGroupInfo->m_nGroupNumber;
		}
	}
	else if (nQQUin != 0)
	{
		CBuddyList * lpBuddyList = m_lpQQClient->GetBuddyList();
		if (lpBuddyList != NULL)
		{
			CBuddyInfo * lpBuddyInfo = lpBuddyList->GetBuddy(nQQUin);
			if (lpBuddyInfo != NULL)
				nQQNum = lpBuddyInfo->m_nQQNum;
		}
	}
}
Example #3
0
CGroupInfo * CGroupInfoDlg::GetGroupInfoPtr()
{
	if (NULL == m_lpQQClient)
		return NULL;

	CGroupList * lpGroupList = m_lpQQClient->GetGroupList();
	if (lpGroupList != NULL)
		return lpGroupList->GetGroupByCode(m_nGroupCode);
	else
		return NULL;
}
Example #4
0
	virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		// Init 'new_macro' container from the global current macro (gCurrentEditMacro)
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
		// Icon
		CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_NEWMACRO_ICON));
		if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro);
		// Name
		CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME));
		if (pEB != NULL) pEB->setInputString(pMCM->CurrentEditMacro.Name);
		// Commands
		CGroupList *pList = dynamic_cast<CGroupList*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS));
		if (pList == NULL) return;
		// Key Shortcut
		CViewText *pVT = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_NEWMACRO_KEY));
		if (pVT != NULL)
		{
			if (pMCM->CurrentEditMacro.Combo.Key == KeyCount)
				pVT->setText(CI18N::get(VIEW_EDITCMD_TEXT_KEY_DEFAULT));
			else
				pVT->setText(pMCM->CurrentEditMacro.Combo.toUCString());
		}

		pList->clearGroups();
		pList->setDynamicDisplaySize(true);

		for (uint i = 0; i < pMCM->CurrentEditMacro.Commands.size(); ++i)
		{
			ucstring commandName;
			for (uint j = 0; j < pMCM->ActionManagers.size(); ++j)
			{
				CAction::CName c(pMCM->CurrentEditMacro.Commands[i].Name.c_str(), pMCM->CurrentEditMacro.Commands[i].Params.c_str());
				if (pMCM->ActionManagers[j]->getBaseAction(c) != NULL)
				{
					commandName = pMCM->ActionManagers[j]->getBaseAction(c)->getActionLocalizedText(c);
					break;
				}
			}

			addCommandLine(pList, i, commandName);
		}
		pMCM->EditCmd->CurAM = pMCM->ActionManagers[0];
	}
static void setGroupListBoxValues(CListBox &GroupListBox, const CGroupList &GroupList) {
	GroupListBox.ResetContent();
	CGroupList::EConstIterator it;
	for (it = GroupList.Begin(); !it.IsDone(); it++) {
		CString tmpCStr;
		tmpCStr = _TEXT("[");
		tmpCStr += ((*it).m_Label);
		tmpCStr += _TEXT("] ");
		GroupListBox.AddString(tmpCStr);
	}
}
Example #6
0
	virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		// Init 'macros' container from the macro manager
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();

		CGroupList *pList = dynamic_cast<CGroupList*>(CWidgetManager::getInstance()->getElementFromId(WIN_MACRO_CONTENT));
		if (pList == NULL) return;

		pList->clearGroups();
		pList->setDynamicDisplaySize(true);

		// Refresh the shortcut key that can be changed in the keys container
		pMCM->refreshMacroCombo();

		// Add all macros template
		const vector<CMacroCmd> &vM = pMCM->getMacros();
		for (uint i = 0; i < vM.size(); ++i)
		{
			addMacroLine(pList, i, vM[i]);
		}
	}
Example #7
0
void CMsgTipDlg::_AddMsgSender(int nIndex, CMessageSender * lpMsgSender)
{
	if (NULL == lpMsgSender || NULL == m_lpQQClient)
		return;

	tstring strHeadPicFileName;
	CString strSenderName, strMsgCnt, strMsgType;

	QQ_MSG_TYPE nMsgType = lpMsgSender->GetMsgType();
	UINT nMsgCnt = lpMsgSender->GetMsgCount();
	UINT nSenderId = lpMsgSender->GetSenderId();
	UINT nGroupCode = lpMsgSender->GetGroupCode();

	switch (nMsgType)
	{
	case QQ_MSG_TYPE_BUDDY:
		{
			strHeadPicFileName = GetHeadPicFullName(0, nSenderId);
			if (!ZYM::CPath::IsFileExist(strHeadPicFileName.c_str()))
				strHeadPicFileName = ZYM::CPath::GetAppPath() + _T("Image\\DefBuddyHeadPic.png");

			CBuddyList * lpBuddyList = m_lpQQClient->GetBuddyList();
			if (lpBuddyList != NULL)
			{
				CBuddyInfo * lpBuddyInfo = lpBuddyList->GetBuddy(nSenderId);
				if (lpBuddyInfo != NULL)
				{
					CString strBuddyName;

					if (!lpBuddyInfo->m_strMarkName.empty())
						strBuddyName = lpBuddyInfo->m_strMarkName.c_str();
					else
						strBuddyName = lpBuddyInfo->m_strNickName.c_str();

					if (lpBuddyInfo->m_nQQNum != 0)
						strSenderName.Format(_T("%s(%u)"), strBuddyName, lpBuddyInfo->m_nQQNum);
					else
						strSenderName.Format(_T("%s"), strBuddyName);
				}
			}
		}
		break;
	case QQ_MSG_TYPE_GROUP:
		{
			strHeadPicFileName = GetHeadPicFullName(nSenderId, 0);
			if (!ZYM::CPath::IsFileExist(strHeadPicFileName.c_str()))
				strHeadPicFileName = ZYM::CPath::GetAppPath() + _T("Image\\DefGroupHeadPic.jpg");

			CGroupList * lpGroupList = m_lpQQClient->GetGroupList();
			if (lpGroupList != NULL)
			{
				CGroupInfo * lpGroupInfo = lpGroupList->GetGroupByCode(nSenderId);
				if (lpGroupInfo != NULL)
				{
					if (lpGroupInfo->m_nGroupNumber != 0)
						strSenderName.Format(_T("%s(%u)"), lpGroupInfo->m_strName.c_str(), lpGroupInfo->m_nGroupNumber);
					else
						strSenderName.Format(_T("%s"), lpGroupInfo->m_strName.c_str());
				}
			}
		}
		break;
	case QQ_MSG_TYPE_SESS:
		{
			strHeadPicFileName = GetHeadPicFullName(nGroupCode, nSenderId);
			if (!ZYM::CPath::IsFileExist(strHeadPicFileName.c_str()))
				strHeadPicFileName = ZYM::CPath::GetAppPath() + _T("Image\\DefBuddyHeadPic.png");

			CGroupList * lpGroupList = m_lpQQClient->GetGroupList();
			if (lpGroupList != NULL)
			{
				CBuddyInfo * lpBuddyInfo = lpGroupList->GetGroupMemberByCode(nGroupCode, nSenderId);
				if (lpBuddyInfo != NULL)
				{
					CString strBuddyName;

					if (!lpBuddyInfo->m_strGroupCard.empty())
						strBuddyName = lpBuddyInfo->m_strGroupCard.c_str();
					else
						strBuddyName = lpBuddyInfo->m_strNickName.c_str();

					if (lpBuddyInfo->m_nQQNum != 0)
						strSenderName.Format(_T("%s(%u)"), strBuddyName, lpBuddyInfo->m_nQQNum);
					else
						strSenderName.Format(_T("%s"), strBuddyName);
				}
			}
		}
		break;
	case QQ_MSG_TYPE_SYSGROUP:
		{
			strHeadPicFileName = ZYM::CPath::GetAppPath() + _T("Image\\DefSysHeadPic.ico");
			strSenderName = _T("群系统消息");
		}
		break;
	}
	strMsgCnt.Format(_T("(%d)"), nMsgCnt);
	strMsgType.Format(_T("%d"), nMsgType);

	int nItem = m_ListCtrl.InsertItem(nIndex, _T(""), _T(""), FALSE, DT_LEFT, nSenderId);
	m_ListCtrl.SetItemFormat(nIndex, 0, DT_LEFT);
	m_ListCtrl.SetItemFormat(nIndex, 1, DT_LEFT);
	m_ListCtrl.SetItemFormat(nIndex, 2, DT_RIGHT);
	m_ListCtrl.SetItemFormat(nIndex, 3, DT_RIGHT);
	m_ListCtrl.SetItemImage(nIndex, 0, strHeadPicFileName.c_str());
	m_ListCtrl.SetItemText(nIndex, 1, strSenderName);
	m_ListCtrl.SetItemText(nIndex, 2, strMsgCnt);
	m_ListCtrl.SetItemText(nIndex, 3, strMsgType);
}
void CStudentDemoListDlg::InitAvailableList(int nType)
{
	if (!m_pTeacherFrame)
		return;

	if (!m_pDemoMemberInfo)
		return;

	m_wndAvailableList.DeleteAllItems();
	m_wndAvailableList.EnableWindow(0 != nType);

	PMEMBERINFO ppMemberInfo[ELC_MAX_MEMBER_COUNT] = {0};
	int nCount = m_pTeacherFrame->GetAllMemberInfoPtrs(ppMemberInfo);

	if (DEMO_TO_ALL == nType) 
	{		
	}
	else if (DEMO_TO_GROUP == nType) 
	{
		typedef map<CString, CString> CGroupList;
		CGroupList listGroup;

		PMEMBERINFO pTemp = NULL;
		for (int i = 0; i < nCount; i++) 
		{
			pTemp = ppMemberInfo[i];
			if (m_pDemoMemberInfo == pTemp)
				continue;

			if (pTemp && (_tcslen(pTemp->szGroupName) > 0))
			{
				CGroupList::iterator it = listGroup.find(pTemp->szGroupName);
				if (it == listGroup.end()) 
				{
					listGroup.insert(CGroupList::value_type(pTemp->szGroupName, pTemp->szGroupName));
					int nItem = m_wndAvailableList.InsertItem(m_wndAvailableList.GetItemCount(), pTemp->szGroupName);
					m_wndAvailableList.SetCheck(nItem, FALSE);
				}
			}
		}
	}
	else if (DEMO_TO_PART == nType) 
	{
		PMEMBERINFO pTemp = NULL;
		for (int i = 0; i < nCount; i++) 
		{
			pTemp = ppMemberInfo[i];
			if (m_pDemoMemberInfo == pTemp)
				continue;

			if (pTemp && pTemp->bLoggedIn) 
			{
				int nItem = m_wndAvailableList.InsertItem(m_wndAvailableList.GetItemCount(), pTemp->szDefaultName);
				m_wndAvailableList.SetItemData(nItem, (DWORD_PTR)pTemp);
				m_wndAvailableList.SetCheck(nItem, FALSE);
			}
		}
	}
	else 
		ASSERT(0);
}