Esempio n. 1
0
	void EntryBase::SetVCard (const QXmppVCardIq& vcard, bool initial)
	{
		VCardIq_ = vcard;
		VCardPhotoHash_ = VCardIq_.photo ().isEmpty () ?
				QByteArray () :
				QCryptographicHash::hash (VCardIq_.photo (), QCryptographicHash::Sha1);

		QString text = FormatRawInfo (vcard);
		if (!text.isEmpty ())
			text = QString ("gloox VCard:\n") + text;
		SetRawInfo (text);

		if (!vcard.photo ().isEmpty ())
		{
			SetAvatar (vcard.photo ());
			Core::Instance ().GetAvatarsStorage ()->StoreAvatar (Avatar_, VCardPhotoHash_.toHex ());
		}

		if (VCardDialog_)
			VCardDialog_->UpdateInfo (vcard);

		if (!initial)
			Core::Instance ().ScheduleSaveRoster (10000);

		emit vcardUpdated ();
	}
Esempio n. 2
0
	void EntryBase::SetVCard (const QXmppVCardIq& vcard, bool initial)
	{
#if QXMPP_VERSION >= 0x000801
		if (vcard == VCardIq_)
			return;
#endif

		VCardIq_ = vcard;
		VCardPhotoHash_ = VCardIq_.photo ().isEmpty () ?
				QByteArray () :
				QCryptographicHash::hash (VCardIq_.photo (), QCryptographicHash::Sha1);

		if (!vcard.photo ().isEmpty ())
		{
			SetAvatar (vcard.photo ());
			Core::Instance ().GetAvatarsStorage ()->StoreAvatar (Avatar_, VCardPhotoHash_.toHex ());
		}

		if (VCardDialog_)
			VCardDialog_->UpdateInfo (vcard);

		if (!initial &&
				GetEntryType () == ICLEntry::EntryType::Chat)
			Core::Instance ().ScheduleSaveRoster (10000);

		emit vcardUpdated ();
	}
Esempio n. 3
0
	SelfContact::SelfContact (const QString& fullJid, GlooxAccount *acc)
	: EntryBase (acc->GetSettings ()->GetJID (), acc)
	{
		UpdateJID (fullJid);

		connect (this,
				SIGNAL (vcardUpdated ()),
				this,
				SLOT (handleSelfVCardUpdated ()));
	}
Esempio n. 4
0
	void EntryBase::SetVCard (const QXmppVCardIq& vcard)
	{
		if (VCardDialog_)
			VCardDialog_->UpdateInfo (vcard);

		Account_->GetParentProtocol ()->GetVCardStorage ()->SetVCard (GetHumanReadableID (), vcard);

		emit vcardUpdated ();

		const auto& newPhotoHash = ComputeVCardPhotoHash (vcard);
		if (newPhotoHash != VCardPhotoHash_)
		{
			VCardPhotoHash_ = newPhotoHash;
			WriteDownPhotoHash ();
			emit avatarChanged (this);
		}
	}