예제 #1
0
QString StatusIcons::iconsetByJid(const Jid &AContactJid) const
{
	QString &substorage = FJid2Storage[AContactJid];
	if (substorage.isEmpty())
	{
		QRegExp regExp;
		regExp.setCaseSensitivity(Qt::CaseSensitive);

		QString contactStr = AContactJid.pFull();

		for (QMap<QString, QString>::const_iterator it=FUserRules.constBegin(); substorage.isEmpty() && it!=FUserRules.constEnd(); ++it)
		{
			regExp.setPattern(it.key());
			if (contactStr.contains(regExp))
				substorage = it.value();
		}

		for (QMap<QString, QString>::const_iterator it=FDefaultRules.constBegin(); substorage.isEmpty() && it!=FDefaultRules.constEnd(); ++it)
		{
			regExp.setPattern(it.key());
			if (contactStr.contains(regExp))
				substorage = it.value();
		}

		if (substorage.isEmpty())
			substorage = FDefaultStorage!=NULL ? FDefaultStorage->subStorage() : FILE_STORAGE_SHARED_DIR;
	}
	return substorage;
}
예제 #2
0
void Annotations::updateDataHolder(const Jid &AStreamJid, const QList<Jid> &AContactJids)
{
	IRosterIndex *sroot = FRostersModel!=NULL ? FRostersModel->streamRoot(AStreamJid) : NULL;
	if (sroot && !AContactJids.isEmpty())
	{
		QMultiMap<int,QVariant> findData;
		foreach(const Jid &contactJid, AContactJids)
			findData.insertMulti(RDR_PREP_BARE_JID,contactJid.pBare());
		findData.insertMulti(RDR_STREAM_JID,AStreamJid.pFull());

		foreach (IRosterIndex *index, sroot->findChilds(findData,true))
			emit rosterDataChanged(index,RDR_ANNOTATIONS);
	}
예제 #3
0
uint qHash(const Jid &AKey)
{
	return qHash(AKey.pFull());
}
예제 #4
0
QString SocksStreams::connectionKey(const QString &ASessionId, const Jid &AInitiator, const Jid &ATarget) const
{
	QString keyString = ASessionId + AInitiator.pFull() + ATarget.pFull();
	QByteArray keyData = QCryptographicHash::hash(keyString.toUtf8(), QCryptographicHash::Sha1).toHex();
	return QString::fromUtf8(keyData.constData(), keyData.size()).toLower();
}