void GamePanelControl::activatePanel(GamePanel *panel, bool activate)
{
  bool block = panel->isBlocking();
  QList<GamePanel*> &list = block ? activeBlockingPanels : activeNonBlockingPanels;

  if (activate)
  {
    if (activePanels.contains(panel))
      return;

    if (list.isEmpty() && block)
      emit blocked();

    list.append(panel);
    activePanels.append(panel);
  }
  else
  {
    if (!activePanels.contains(panel))
      return;

    list.removeAll(panel);
    activePanels.removeAll(panel);

    if (!block && list.isEmpty())
      emit unblocked();
  }
}
Пример #2
0
bool QXmppUserBlacklistManager::handleStanza(const QDomElement &element)
{
  if (element.tagName() != "iq")
    return false;
    
  // XEP-0191: Blocking Command
  if (QXmppUserBlacklistIq::isUserBlacklistIq(element))
  {
    QXmppUserBlacklistIq blockListIq;
    blockListIq.parse(element);
    emit blacklistReceived(blockListIq.blocklist());
    return true;
  } else if (QXmppUserBlacklistBlockIq::isUserBlacklistBlockIq(element))
  {
    QXmppUserBlacklistBlockIq blockIq;
    blockIq.parse(element);
    emit blocked(blockIq.jid());
    return true;
  } else if (QXmppUserBlacklistUnblockIq::isUserBlacklistUnblockIq(element))
  {
    QXmppUserBlacklistUnblockIq unblockIq;
    unblockIq.parse(element);
    emit unblocked(unblockIq.jid());
    return true;
  }

  return false;
}