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 (); } }
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 ()); }