Exemple #1
0
	void MRIMAccount::Authorize (QObject *obj)
	{
		qDebug () << Q_FUNC_INFO << GetAccountName ();
		MRIMBuddy *buddy = qobject_cast<MRIMBuddy*> (obj);
		if (!buddy)
		{
			qWarning () << Q_FUNC_INFO
					<< "wrong object"
					<< obj;
			return;
		}

		const QString& id = buddy->GetHumanReadableID ();
		Conn_->Authorize (id);

		buddy->SetAuthorized (true);

		if (!Buddies_.contains (id))
			Buddies_ [id] = buddy;
		if (buddy->GetID () < 0)
		{
			const auto seq = Conn_->AddContact (0, id, buddy->GetEntryName ());
			PendingAdditions_ [seq] = buddy->GetInfo ();
		}
	}
Exemple #2
0
	void MRIMAccount::handleGotContacts (const QList<Proto::ContactInfo>& contacts)
	{
		Q_FOREACH (const Proto::ContactInfo& contact, contacts)
		{
			qDebug () << Q_FUNC_INFO
					<< GetAccountName ()
					<< contact.Email_
					<< contact.Phone_
					<< contact.Alias_
					<< contact.ContactID_
					<< contact.UA_
					<< contact.Features_;
			MRIMBuddy *buddy = GetBuddy (contact);

			if (buddy->GetID () != contact.ContactID_)
				buddy->UpdateID (contact.ContactID_);

			buddy->SetGroup (GM_->GetGroup (contact.GroupNumber_));
			Buddies_ [contact.Email_] = buddy;
		}
Exemple #3
0
	void MRIMAccount::RemoveEntry (QObject *obj)
	{
		MRIMBuddy *buddy = qobject_cast<MRIMBuddy*> (obj);
		if (!buddy)
		{
			qWarning () << Q_FUNC_INFO
					<< "wrong object"
					<< obj;
			return;
		}

		const qint64 id = buddy->GetID ();
		if (id < 0)
		{
			qWarning () << Q_FUNC_INFO
					<< "cannot remove buddy with negative ID";
			return;
		}

		Buddies_.take (buddy->GetHumanReadableID ())->deleteLater ();
		emit removedCLItems (QList<QObject*> () << buddy);

		Conn_->RemoveContact (id, buddy->GetHumanReadableID (), buddy->GetEntryName ());
	}