示例#1
0
	void EntryBase::SetClientVersion (const QString& variant, const QXmppVersionIq& version)
	{
		qDebug () << Q_FUNC_INFO << variant << version.os ();
		Variant2Version_ [variant] = version;

		emit entryGenerallyChanged ();
	}
示例#2
0
	void MetaEntry::ConnectStandardSignals (QObject *entryObj)
	{
		connect (entryObj,
				SIGNAL (gotMessage (QObject*)),
				this,
				SLOT (handleRealGotMessage (QObject*)));
		connect (entryObj,
				SIGNAL (statusChanged (const EntryStatus&, const QString&)),
				this,
				SLOT (handleRealStatusChanged (const EntryStatus&, const QString&)));
		connect (entryObj,
				SIGNAL (availableVariantsChanged (const QStringList&)),
				this,
				SLOT (handleRealVariantsChanged (const QStringList&)));
		connect (entryObj,
				SIGNAL (nameChanged (const QString&)),
				this,
				SLOT (handleRealNameChanged (const QString&)));
		connect (entryObj,
				SIGNAL (chatPartStateChanged (const ChatPartState&, const QString&)),
				this,
				SLOT (handleRealCPSChanged (const ChatPartState&, const QString&)));
		connect (entryObj,
				SIGNAL (entryGenerallyChanged ()),
				this,
				SIGNAL (entryGenerallyChanged ()));

		const auto entry = qobject_cast<ICLEntry*> (entryObj);
		connect (entry->GetParentAccount ()->GetQObject (),
				SIGNAL (removedCLItems (QList<QObject*>)),
				this,
				SLOT (checkRemovedCLItems (QList<QObject*>)));

		/*
		IAccount *account = qobject_cast<IAccount*> (entry->GetParentAccount ());
		connect (account->GetParentProtocol (),
				SIGNAL (accountRemoved (QObject*)),
				this,
				SLOT (handleAccountRemoved (QObject*)),
				Qt::QueuedConnection);
				*/
	}
示例#3
0
	void VCardDialog::InitConnections (EntryBase *entry)
	{
		connect (entry,
				SIGNAL (statusChanged (const EntryStatus&, const QString&)),
				this,
				SLOT (rebuildClientInfo ()));
		connect (entry,
				SIGNAL (entryGenerallyChanged ()),
				this,
				SLOT (rebuildClientInfo ()));
	}
示例#4
0
	void MRIMBuddy::UpdateInfo (const Proto::ContactInfo& info)
	{
		CmpXchg (Info_, info,
				GetMem<QString> (&Proto::ContactInfo::Alias_),
				[this] (QString name) { emit nameChanged (name); });
		CmpXchg (Info_, info,
				GetMem<QString> (&Proto::ContactInfo::UA_),
				[this] (QString)
				{
					UpdateClientVersion ();
					emit entryGenerallyChanged ();
				});

		bool stChanged = false;
		const int oldVars = Variants ().size ();
		CmpXchg (Info_, info,
				GetMem<quint32> (&Proto::ContactInfo::StatusID_),
				[&stChanged] (quint32) { stChanged = true; });
		CmpXchg (Info_, info,
				GetMem<QString> (&Proto::ContactInfo::StatusTitle_),
				[&stChanged] (QString) { stChanged = true; });
		CmpXchg (Info_, info,
				GetMem<QString> (&Proto::ContactInfo::StatusDesc_),
				[&stChanged] (QString) { stChanged = true; });

		if (stChanged)
		{
			Status_.State_ = VaderUtil::StatusID2State (Info_.StatusID_);
			Status_.StatusString_ = Info_.StatusTitle_;

			if (oldVars != Variants ().size ())
				emit availableVariantsChanged (Variants ());
			emit statusChanged (GetStatus (QString ()), QString ());
		}

		Info_.GroupNumber_ = info.GroupNumber_;
	}
示例#5
0
	void EntryBase::handleTimeReceived (const QXmppEntityTimeIq& iq)
	{
		const auto& from = iq.from ();
		if (!from.startsWith (GetJID ()))
			return;

		const auto& thatTime = iq.utc ();
		if (!thatTime.isValid ())
			return;

		QString bare;
		QString variant;
		ClientConnection::Split (from, &bare, &variant);

		if (variant.isEmpty () || GetEntryType () == EntryType::PrivateChat)
			variant = "";

		const auto secsDiff = QDateTime::currentDateTimeUtc ().secsTo (thatTime);
		Variant2SecsDiff_ [variant] = { static_cast<int> (secsDiff), iq.tzo () };

		emit entryGenerallyChanged ();

		emit entityTimeUpdated ();
	}
示例#6
0
	void EntryBase::SetClientVersion (const QString& variant, const QXmppVersionIq& version)
	{
		Variant2Version_ [variant] = version;

		emit entryGenerallyChanged ();
	}