示例#1
0
void ChatView::notify(const Notify &notify)
{
  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);
    }
  }
}