void HubInfo::on(ClientListener::UserRemoved, const Client*, const OnlineUserPtr& aUser) noexcept { if (!aUser->isHidden()) { view.onItemRemoved(aUser); } maybeSend("hub_user_disconnected", [&] { return Serializer::serializeItem(aUser, onlineUserPropertyHandler); }); }
void Serializer::appendOnlineUserFlags(const OnlineUserPtr& aUser, StringSet& flags_) noexcept { if (aUser->getIdentity().isAway()) { flags_.insert("away"); } if (aUser->getIdentity().isOp()) { flags_.insert("op"); } if (aUser->getIdentity().isBot() || aUser->getIdentity().isHub()) { flags_.insert("bot"); } if (aUser->isHidden()) { flags_.insert("hidden"); } if (aUser->supportsCCPM()) { flags_.insert("ccpm"); } auto cm = aUser->getIdentity().getConnectMode(); if (!aUser->getUser()->isNMDC() && (cm == Identity::MODE_NOCONNECT_PASSIVE || cm == Identity::MODE_NOCONNECT_IP || cm == Identity::MODE_UNDEFINED)) { flags_.insert("noconnect"); } else if (!aUser->getIdentity().isTcpActive(aUser->getClient())) { flags_.insert("passive"); } }
void HubInfo::onUserUpdated(const OnlineUserPtr& aUser, const PropertyIdSet& aUpdatedProperties) noexcept { if (!aUser->isHidden()) { view.onItemUpdated(aUser, aUpdatedProperties); } maybeSend("hub_user_updated", [&] { return Serializer::serializeItem(aUser, onlineUserPropertyHandler); }); }