Example #1
0
	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");
		}
	}
Example #2
0
void UserManager::checkUser(const OnlineUserPtr& user)
{
	if (BOOLSETTING(CHECK_NEW_USERS))
	{
		if (!ClientManager::getInstance()->isMe(user))
		{
			const Client& client = user->getClient();
			if (!client.getExcludeCheck() && client.isOp() &&
			        (client.isActive() || user->getIdentity().isTcpActive()))
			{
				if (!BOOLSETTING(PROT_FAVS) || !FavoriteManager::getInstance()->isNoFavUserOrUserBanUpload(user->getUser()))   // !SMT!-opt
				{
					if (!isInProtectedUserList(user->getIdentity().getNick()))
					{
						try
						{
							QueueManager::getInstance()->addList(HintedUser(user->getUser(), client.getHubUrl()), QueueItem::FLAG_USER_CHECK);
						}
						catch (const Exception& e)
						{
							LogManager::getInstance()->message(e.getError());
						}
					}
				}
			}
		}
	}
}
Example #3
0
	std::string OnlineUserUtils::getStringInfo(const OnlineUserPtr& aUser, int aPropertyName) noexcept {
		switch (aPropertyName) {
		case HubInfo::PROP_NICK: return aUser->getIdentity().getNick();
		case HubInfo::PROP_DESCRIPTION: return aUser->getIdentity().getDescription();
		case HubInfo::PROP_EMAIL: return aUser->getIdentity().getEmail();
		case HubInfo::PROP_TAG: return aUser->getIdentity().getTag();
		case HubInfo::PROP_HUB_URL: return aUser->getHubUrl();
		case HubInfo::PROP_HUB_NAME: return aUser->getClient()->getHubName();
		case HubInfo::PROP_IP4: return aUser->getIdentity().getIp4();
		case HubInfo::PROP_IP6: return aUser->getIdentity().getIp6();
		case HubInfo::PROP_CID: return aUser->getUser()->getCID().toBase32();
		default: dcassert(0); return 0;
		}
	}
Example #4
0
string OnlineUser::HubName::operator()(const OnlineUserPtr& u) { 
	return u->getClient()->getHubName(); 
}