Beispiel #1
0
void Roster::removeContact(const Contact &contact) const
{
	if (!contact)
		return;

	auto service = rosterService(contact);
	if (service)
	{
		service->removeContact(contact);
	}
}
Beispiel #2
0
void GaduProtocol::afterLoggedIn()
{
    m_gaduContactAvatarService->download(ContactAvatarId{{account().accountContact().id().toUtf8()}, {}});

    auto contacts = contactManager()->contacts(account(), ContactManager::ExcludeAnonymous);
    CurrentNotifyService->sendInitialData(contacts);

    static_cast<GaduRosterService *>(rosterService())->prepareRoster();

    sendStatusToServer();
}
Beispiel #3
0
void Roster::addContact(const Contact &contact) const
{
	if (!contact)
		return;

	auto service = rosterService(contact);
	if (service)
	{
		contact.rosterEntry()->setHasLocalChanges();
		service->addContact(contact);
	}
}
Beispiel #4
0
void GaduProtocol::socketContactStatusChanged(
    UinType uin, unsigned int ggStatusId, const QString &description, unsigned int maxImageSize)
{
    auto newStatus = Status{};
    newStatus.setType(GaduProtocolHelper::statusTypeFromGaduStatus(ggStatusId));
    newStatus.setDescription(description);

    if (uin == GaduLoginParams.uin)
    {
        if ((!m_lastRemoteStatusRequest.isValid() || m_lastRemoteStatusRequest.elapsed() > 10) &&
            newStatus != m_lastSentStatus)
        {
            emit remoteStatusChangeRequest(account(), newStatus);
            if (m_lastRemoteStatusRequest.isValid())
                m_lastRemoteStatusRequest.restart();
            else
                m_lastRemoteStatusRequest.start();
        }
        return;
    }

    auto contact = contactManager()->byId(account(), QString::number(uin), ActionReturnNull);
    contact.setMaximumImageSize(maxImageSize);

    auto oldStatus = contact.currentStatus();
    contact.setCurrentStatus(newStatus);
    contact.setBlocking(GaduProtocolHelper::isBlockingStatus(ggStatusId));

    if (contact.isAnonymous())
    {
        if (contact.ownerBuddy())
            emit userStatusChangeIgnored(contact.ownerBuddy());
        rosterService()->removeContact(contact);
        return;
    }

    // see issue #2159 - we need a way to ignore first status of given contact
    if (contact.ignoreNextStatusChange())
        contact.setIgnoreNextStatusChange(false);
    else
        emit contactStatusChanged(contact, oldStatus);
}