void ForumMsgItem::updateAvatar(const QString &peer_id) { if (mGpgIdPrev.empty() == false) { /* Is this one of the ssl ids of the gpg id ? */ std::list<std::string> sslIds; if (rsPeers->getSSLChildListOfGPGId(mGpgIdPrev, sslIds) == false) { return; } if (std::find(sslIds.begin(), sslIds.end(), peer_id.toStdString()) != sslIds.end()) { /* One of the ssl ids of the gpg id */ showAvatar(peer_id.toStdString(), false); } } if (mGpgIdNext.empty() == false) { /* Is this one of the ssl ids of the gpg id ? */ std::list<std::string> sslIds; if (rsPeers->getSSLChildListOfGPGId(mGpgIdNext, sslIds) == false) { return; } if (std::find(sslIds.begin(), sslIds.end(), peer_id.toStdString()) != sslIds.end()) { /* One of the ssl ids of the gpg id */ showAvatar(peer_id.toStdString(), true); } } }
void NpcDialog::postInit() { Window::postInit(); setVisible(Visible_true); requestFocus(); enableVisibleSound(true); soundManager.playGuiSound(SOUND_SHOW_WINDOW); if (actorManager) { const Being *const being = actorManager->findBeing(mNpcId); if (being) { showAvatar(NPCDB::getAvatarFor(fromInt( being->getSubType(), BeingTypeId))); setCaption(being->getName()); } } config.addListener("logNpcInGui", this); }
void ForumMsgItem::updateItemStatic() { if (!rsForums) return; /* fill in */ #ifdef DEBUG_ITEM std::cerr << "ForumMsgItem::updateItemStatic()"; std::cerr << std::endl; #endif canReply = false; ForumInfo fi; if (rsForums->getForumInfo(mForumId, fi)) { QString title = tr("Forum Post") + ": "; title += QString::fromStdWString(fi.forumName); titleLabel->setText(title); if (fi.subscribeFlags & (RS_DISTRIB_ADMIN | RS_DISTRIB_SUBSCRIBED)) { unsubscribeButton->setEnabled(true); replyButton->setEnabled(true); if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ) { signedcheckBox->setChecked(true); signedcheckBox->setEnabled(false); } canReply = true; } else { unsubscribeButton->setEnabled(false); replyButton->setEnabled(false); } } else { titleLabel->setText(tr("Unknown Forum Post")); } /* get actual Message */ ForumMsgInfo msg; if (rsForums->getForumMessage(mForumId, mPostId, msg)) { #ifdef DEBUG_ITEM std::cerr << "Ids: MsgId: " << msg.msgId; std::cerr << std::endl; std::cerr << "Ids: ParentId: " << msg.parentId; std::cerr << std::endl; std::cerr << "Ids: ThreadId: " << msg.threadId; std::cerr << std::endl; #endif /* decide if top or not */ if ((msg.msgId == msg.threadId) || (msg.threadId == "")) { mIsTop = true; } if (mIsTop) { mGpgIdPrev = msg.srcId; if (rsPeers->getPeerName(msg.srcId) !="") { namelabel->setText(QString::fromStdString(rsPeers->getPeerName(msg.srcId))); } else { namelabel->setText(tr("Anonymous")); } prevSubLabel->setText(QString::fromStdWString(msg.title)); prevMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msg.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); QDateTime qtime; qtime.setTime_t(msg.ts); QString timestamp = qtime.toString("dd.MM.yyyy hh:mm:ss"); timestamplabel->setText(timestamp); nextFrame->hide(); } else { mGpgIdNext = msg.srcId; if (rsPeers->getPeerName(msg.srcId) !="") { nextnamelabel->setText(QString::fromStdString(rsPeers->getPeerName(msg.srcId))); } else { nextnamelabel->setText(tr("Anonymous")); } nextSubLabel->setText(QString::fromStdWString(msg.title)); nextMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msg.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); QDateTime qtime; qtime.setTime_t(msg.ts); QString timestamp = qtime.toString("dd.MM.yyyy hh:mm:ss"); timestamplabel->setText(timestamp); prevSHLabel->setText(tr("In Reply to") + ": "); ForumMsgInfo msgParent; if (rsForums->getForumMessage(mForumId, msg.parentId, msgParent)) { mGpgIdPrev = msgParent.srcId; prevSubLabel->setText(QString::fromStdWString(msgParent.title)); prevMsgLabel->setText(RsHtml::formatText(QString::fromStdWString(msgParent.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); if (rsPeers->getPeerName(msgParent.srcId) !="") { namelabel->setText(QString::fromStdString(rsPeers->getPeerName(msgParent.srcId))); } else { namelabel->setText(tr("Anonymous")); } } else { prevSubLabel->setText("???"); prevMsgLabel->setText("???"); } } /* header stuff */ subjectLabel->setText(QString::fromStdWString(msg.title)); srcLabel->setText(QString::fromStdString(msg.srcId)); } if (mIsHome) { /* disable buttons */ clearButton->setEnabled(false); //gotoButton->setEnabled(false); clearButton->hide(); } unsubscribeButton->hide(); showAvatar("", true); showAvatar("", false); }