Пример #1
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;
		}
	}
}
Пример #2
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;
}
Пример #3
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);
}