bool ProfileField::isMatch(const Notify ¬ify) { int type = notify.type(); if (type != Notify::FeedReply && type != Notify::FeedData) return false; const FeedNotify &n = static_cast<const FeedNotify &>(notify); return n.match(ChatClient::id(), FEED_NAME_PROFILE); }
void NetworkManager::notify(const Notify ¬ify) { if (notify.type() == Notify::ServerRenamed) { Network item = this->item(ChatClient::serverId()); if (!item) return; item->setName(ChatClient::serverName()); item->write(); } }
void ProfileField::notify(const Notify ¬ify) { if (!isMatch(notify)) return; if (notify.type() == Notify::FeedReply) { const FeedNotify &n = static_cast<const FeedNotify &>(notify); if (!n.json().contains(m_field)) return; } reload(); }
void HistoryChatView::notify(const Notify ¬ify) { if (notify.type() == Notify::FeedReply) { const FeedNotify &n = static_cast<const FeedNotify &>(notify); if (n.feed() == FEED_NAME_MESSAGES && n.path() == MESSAGES_FEED_LAST_KEY) { if (n.status() == Notice::NotModified) { const QList<QByteArray> messages = HistoryDB::last(n.channel()); HistoryImpl::get(n.channel(), messages); emulateLast(n.channel(), messages); } else if (n.status() == Notice::OK && !n.json().contains(MESSAGES_FEED_BEFORE_KEY) && !n.json().contains(MESSAGES_FEED_EMULATED_KEY)) HistoryDB::add(n.channel(), n.json().value(MESSAGES_FEED_MESSAGES_KEY).toStringList()); } } }
void ConsoleCmd::notify(const Notify ¬ify) { if (notify.type() == Notify::FeedReply) { const FeedNotify &n = static_cast<const FeedNotify &>(notify); if (n.channel() == ChatClient::serverId() && n.name() == CONSOLE_FEED_COOKIE_REQ && !m_cookie.isEmpty()) { if (n.status() == Notice::OK) { const QByteArray id = SimpleID::decode(n.json().value(LS("user")).toString()); if (m_cookie == id) AlertMessage::show(LS("<b>Cookie:</b> ") + n.json().value(CONSOLE_FEED_COOKIE_KEY).toString(), ALERT_MESSAGE_INFO); } m_cookie.clear(); } } }
void ChannelsView::notify(const Notify ¬ify) { int type = notify.type(); if (type == Notify::FeedData || type == Notify::FeedReply) { const FeedNotify &n = static_cast<const FeedNotify &>(notify); if (n.channel() != ChatClient::serverId()) return; QVariantMap json = WebBridge::feed(n); if (json.isEmpty()) return; emit feed(json); } else if (type == Notify::ServerRenamed) { emit serverRenamed(ChatClient::serverName()); } }
void ChatView::notify(const Notify ¬ify) { const int type = notify.type(); if (type == Notify::ClearChat) { if (m_id == notify.data().toByteArray()) clearPage(); } else if (type == Notify::FeedData || type == Notify::FeedReply) { const FeedNotify &n = static_cast<const FeedNotify &>(notify); if (n.channel() == id() || n.channel() == ChatClient::id() || (n.channel() == ChatClient::serverId() && n.feed() == FEED_NAME_ACL)) { const QVariantMap json = WebBridge::feed(n); if (json.isEmpty()) return; if (!m_loaded) m_pendingFeeds.enqueue(json); else emit feed(json); } } }
void StatusBar::notify(const Notify ¬ify) { if (notify.type() == Notify::ServerRenamed) setServerName(); }