Example #1
0
KviRegisteredUser * KviIrcUserDataBase::registeredUser(const QString & szNick)
{
	if(szNick.isEmpty())
		return 0;
	KviIrcUserEntry * pEntry = find(szNick);
	if(!pEntry)
		return 0;
	return registeredUser(szNick,pEntry->user(),pEntry->host());
}
Example #2
0
QString KviQueryWindow::getInfoLabelText()
{
	QString szTmp;
	if(KVI_OPTION_BOOL(KviOption_boolShowExtendedInfoInQueryLabel) && connection())
	{
		KviIrcUserEntry * pEntry = connection()->userDataBase()->find(m_szName);
		if(pEntry)
		{
			QString szMask;
			QString szChans;
			if(connection())
			{
				if(pEntry->hasUser())
					szMask += pEntry->user();
				else
					szMask += "*";

				szMask += "@";
				if(pEntry->hasHost())
					szMask += pEntry->host();
				else
					szMask += "*";

				if(pEntry->hasRealName())
					szTmp = __tr2qs("Query with: %1!%2 (%3)").arg(m_szName, szMask, KviControlCodes::stripControlBytes(pEntry->realName()));
				else
					szTmp = __tr2qs("Query with: %1!%2").arg(m_szName, szMask);

				if(pEntry->hasServer())
					szTmp += __tr2qs(", using server: %1").arg(pEntry->server());

				if(pEntry->hasHops())
					szTmp += __tr2qs(", hops: %1").arg(pEntry->hops());

				if(pEntry->hasAccountName())
					szTmp += __tr2qs(", account: %1").arg(pEntry->accountName());

				if(pEntry->isAway())
					szTmp += __tr2qs(", probably away");

				szTmp += "\n";

				if(connection()->getCommonChannels(m_szName, szChans, 0))
					szTmp += __tr2qs("Common channels: %2").arg(szChans);
				else
					szTmp += __tr2qs("No common channels");
			}
			else
			{
				szTmp = __tr2qs("[Dead query]");
			}
		}
		else
			szTmp += "\n";
	}
	return szTmp;
}
Example #3
0
KviRegisteredUser * KviIrcUserDataBase::registeredUser(const QString & szNick, const QString & szUser, const QString & szHost)
{
	if(szNick.isEmpty())
		return 0;
	KviIrcUserEntry * pEntry = find(szNick);
	if(!pEntry)
		return g_pRegisteredUserDataBase->findMatchingUser(szNick,szUser,szHost);

	KviRegisteredUser * pUser = 0;

	if(pEntry->m_bNotFoundRegUserLoockup && pEntry->m_szLastRegisteredMatchNick == szNick)
		return 0;

	if(!pEntry->m_szRegisteredUserName.isEmpty() && pEntry->m_szLastRegisteredMatchNick == szNick)
		pUser = g_pRegisteredUserDataBase->getUser(pEntry->m_szRegisteredUserName);

	if(!pUser)
	{
		//user renamed or it is a first loockup
		if(pEntry->hasHost() && pEntry->hasUser())
		{
			pUser = g_pRegisteredUserDataBase->findMatchingUser(szNick,pEntry->user(),pEntry->host());
			if(pUser)
			{
				pEntry->m_szLastRegisteredMatchNick = szNick;
				pEntry->m_szRegisteredUserName = pUser->name();

				pEntry->m_bUseCustomColor = pUser->getBoolProperty("useCustomColor");
				QString szTmp = pUser->getProperty("customColor");
				KviStringConversion::fromString(szTmp,pEntry->m_cachedColor);

				pEntry->m_bNotFoundRegUserLoockup = false; //to be sure
			} else {
				pEntry->m_szLastRegisteredMatchNick = szNick;
				pEntry->m_bNotFoundRegUserLoockup = true;
			}
		}
	}

	return pUser;
}
Example #4
0
void KviQueryWindow::setAliveQuery()
{
	m_iFlags &= ~Dead;

	KviIrcUserDataBase * pUserDataBase = connection()->userDataBase();

	m_pUserListView->setUserDataBase(pUserDataBase);

	setType(KviWindow::Query);

	if(context())
		context()->unregisterDeadQuery(this);
	if(connection())
		connection()->registerQuery(this);

	QString szNick = target();

	if(!szNick.isEmpty())
	{
		QString szUser;
		QString szHost;

		if(pUserDataBase)
		{
			KviIrcUserEntry * pEntry = pUserDataBase->find(szNick);
			if(pEntry)
			{
				szUser = pEntry->user();
				szHost = pEntry->host();
			}
		}

		setTarget(szNick, szUser, szHost);
	}

	// Update log file name
	if(m_pIrcView->isLogging())
		m_pIrcView->startLogging();

	updateIcon();
}