예제 #1
1
void
DigestTreeScene::updateNode(QString sessionPrefix, QString nick, uint64_t seqNo)
{
  Roster_iterator it = m_roster.find(sessionPrefix);
  if (it == m_roster.end()) {
    DisplayUserPtr p(new DisplayUser());
    p->setPrefix(sessionPrefix);
    p->setSeq(seqNo);
    m_roster.insert(p->getPrefix(), p);
    plot(m_rootDigest);
  }
  else {
    it.value()->setSeq(seqNo);
    DisplayUserPtr p = it.value();
    QGraphicsTextItem *item = p->getSeqTextItem();
    QGraphicsRectItem *rectItem = p->getInnerRectItem();
    std::string s = boost::lexical_cast<std::string>(p->getSeqNo());
    item->setPlainText(s.c_str());
    QRectF textBR = item->boundingRect();
    QRectF rectBR = rectItem->boundingRect();
    item->setPos(rectBR.x() + (rectBR.width() - textBR.width())/2,
                 rectBR.y() + (rectBR.height() - textBR.height())/2);
  }
  m_displayRootDigest->setPlainText(m_rootDigest);
  updateNick(sessionPrefix, nick);
}
void OnetAuth::authorize(QString _strNick, QString _strPass)
{
    if (_strNick.isEmpty())
        return; // empty nick

    if (Settings::instance()->getBool("logged"))
        return; // already logged

    if (Settings::instance()->getBool("authorizing"))
        return; // already authorizing

    Settings::instance()->setBool("authorizing", true);
    emit authStateChanged();

    strFullNick = _strNick.left(32);
    strNick = (_strNick.at(0) == '~' ? _strNick.remove(0,1).left(31) : _strNick.left(32));
    strPass = _strPass;
    strNickLen = QString::number(strNick.length());
    bRegisteredNick = strFullNick.at(0) != '~';
    bOverride = Settings::instance()->getBool("override");

    if (Settings::instance()->getBool("debug"))
    {
        qDebug() << "Override: " << bOverride;
        qDebug() << "Logged: " << Settings::instance()->get("logged");
        qDebug() << "Authorizing: " << Settings::instance()->get("authorizing");
    }

    // update nick
    emit updateNick(strFullNick);

    // remove cookies
    removeCookies();

    getChat();
}
예제 #3
0
/**
 * update meta (subcontact and -protocol) status. This runs when the
 * MC protocol fires one of its events OR when a relevant database value changes
 * in the master contact.
 */
void CContactCache::updateMeta()
{
	if (m_Valid) {
		MCONTACT hOldSub = m_hSub;
		m_hSub = db_mc_getSrmmSub(cc->contactID);
		m_szMetaProto = GetContactProto(m_hSub);
		m_wMetaStatus = (WORD)db_get_w(m_hSub, m_szMetaProto, "Status", ID_STATUS_OFFLINE);
		PROTOACCOUNT *pa = Proto_GetAccount(m_szMetaProto);
		if (pa)
			m_szAccount = pa->tszAccountName;

		if (hOldSub != m_hSub) {
			updateStatus();
			updateNick();
			updateUIN();
		}
	}
	else {
		m_hSub = 0;
		m_szMetaProto = NULL;
		m_wMetaStatus = ID_STATUS_OFFLINE;
		m_xStatus = 0;
	}
}
void CContactCache::updateState()
{
	updateNick();
	updateStatus();
}