/*! * Создание итема на основе текущего активного подключения. * * \param id Base32 кодированный идентификатор сервера с именем провайдера. */ NetworkItem* NetworkItem::item(const QByteArray &id) { SimpleClient *client = ChatClient::io(); NetworkItem *item = new NetworkItem(id); item->m_name = ChatClient::serverName(); item->m_url = client->url().toString(); item->m_cookie = client->cookie().toByteArray(); item->m_userId = client->channelId(); return item; }
void Benchmark::clientStateChanged(int state, int previousState) { if (state == SimpleClient::ClientOnline) { ++m_accepted; emit accepted(m_accepted); SimpleClient *client = qobject_cast<SimpleClient*>(sender()); if (!client) return; QVariantMap data; data["nick"] = client->nick(); data["uniqueId"] = SimpleID::encode(client->uniqueId()); data["cookie"] = SimpleID::encode(client->cookie()); m_authOut.append(data); qDebug() << client->nick(); } else if (previousState == SimpleClient::ClientOnline) { ++m_disconnected; emit disconnected(m_disconnected); } qDebug() << sender(); }