• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UserPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中UserPtr的典型用法代码示例。如果您正苦于以下问题:C++ UserPtr类的具体用法?C++ UserPtr怎么用?C++ UserPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UserPtr类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: onFlagsUpdated

	void HubInfo::onFlagsUpdated(const UserPtr& aUser) noexcept {
		auto ou = ClientManager::getInstance()->findOnlineUser(aUser->getCID(), client->getHubUrl(), false);
		if (ou) {
			onUserUpdated(ou, { PROP_FLAGS });
		}
	}
开发者ID:fhede,项目名称:airdcpp-webclient,代码行数:6,代码来源:HubInfo.cpp


示例2: removePmCache

void LogManager::removePmCache(const UserPtr& aUser) noexcept {
	pmPaths.erase(aUser->getCID());
}
开发者ID:airdcpp,项目名称:airdcpp-core,代码行数:3,代码来源:LogManager.cpp


示例3: BOOST_FOREACH

 BOOST_FOREACH (const UserPtr& user, users) {
     t_task(USER, user.id());
 }
开发者ID:starius,项目名称:thechess,代码行数:3,代码来源:Session.cpp


示例4: createNode

	/*
	 * Creates new (or update existing) node which is NOT added to our routing table
	 */
	Node::Ptr KBucket::createNode(const UserPtr& u, const string& ip, uint16_t port, bool update, bool isUdpKeyValid)
	{
		if(u->isSet(User::DHT)) // is this user already known in DHT?
		{
			Node::Ptr node = NULL;

			// no online node found, try get from routing table
			for(NodeList::iterator it = nodes.begin(); it != nodes.end(); ++it)
			{
				if(u->getCID() == (*it)->getUser()->getCID())
				{
					node = *it;

					// put node at the end of the list
					nodes.erase(it);
					nodes.push_back(node);
					break;
				}
			}

			if(node == NULL && u->isOnline())
			{
				// try to get node from ClientManager (user can be online but not in our routing table)
				// this fixes the bug with DHT node online twice
				node = (Node*)ClientManager::getInstance()->findDHTNode(u->getCID());
				node = node.get();
			}

			if(node != NULL)
			{
				// fine, node found, update it and return it
				if(update)
				{
					string oldIp	= node->getIdentity().getIp();
					string oldPort	= node->getIdentity().getUdpPort();
					if(ip != oldIp || static_cast<uint16_t>(Util::toInt(oldPort)) != port)
					{
						node->setIpVerified(false);

						 // TODO: don't allow update when new IP already exists for different node

						// erase old IP and remember new one
						ipMap.erase(oldIp + ":" + oldPort);
						ipMap.insert(ip + ":" + Util::toString(port));
					}

					if(!node->isIpVerified())
						node->setIpVerified(isUdpKeyValid);

					node->setAlive();
					node->getIdentity().setIp(ip);
					node->getIdentity().setUdpPort(Util::toString(port));

					DHT::getInstance()->setDirty();
				}

				return node;
			}
		}

		u->setFlag(User::DHT);

		Node::Ptr node(new Node(u));
		node->getIdentity().setIp(ip);
		node->getIdentity().setUdpPort(Util::toString(port));
		node->setIpVerified(isUdpKeyValid);
		return node;
	}
开发者ID:pk2010,项目名称:eiskaltdcpp,代码行数:71,代码来源:KBucket.cpp


示例5: x

void SearchManager::onData(const uint8_t* buf, size_t aLen, const string& remoteIp) {
	string x((char*)buf, aLen);
	if(x.compare(0, 4, "$SR ") == 0) {
		string::size_type i, j;
		// Directories: $SR <nick><0x20><directory><0x20><free slots>/<total slots><0x05><Hubname><0x20>(<Hubip:port>)
		// Files:		$SR <nick><0x20><filename><0x05><filesize><0x20><free slots>/<total slots><0x05><Hubname><0x20>(<Hubip:port>)
		i = 4;
		if( (j = x.find(' ', i)) == string::npos) {
			return;
		}
		string nick = x.substr(i, j-i);
		i = j + 1;

		// A file has 2 0x05, a directory only one
		size_t cnt = count(x.begin() + j, x.end(), 0x05);

		SearchResult::Types type = SearchResult::TYPE_FILE;
		string file;
		int64_t size = 0;

		if(cnt == 1) {
			// We have a directory...find the first space beyond the first 0x05 from the back
			// (dirs might contain spaces as well...clever protocol, eh?)
			type = SearchResult::TYPE_DIRECTORY;
			// Get past the hubname that might contain spaces
			if((j = x.rfind(0x05)) == string::npos) {
				return;
			}
			// Find the end of the directory info
			if((j = x.rfind(' ', j-1)) == string::npos) {
				return;
			}
			if(j < i + 1) {
				return;
			}
			file = x.substr(i, j-i) + '\\';
		} else if(cnt == 2) {
			if( (j = x.find((char)5, i)) == string::npos) {
				return;
			}
			file = x.substr(i, j-i);
			i = j + 1;
			if( (j = x.find(' ', i)) == string::npos) {
				return;
			}
			size = Util::toInt64(x.substr(i, j-i));
		}
		i = j + 1;

		if( (j = x.find('/', i)) == string::npos) {
			return;
		}
		int freeSlots = Util::toInt(x.substr(i, j-i));
		i = j + 1;
		if( (j = x.find((char)5, i)) == string::npos) {
			return;
		}
		int slots = Util::toInt(x.substr(i, j-i));
		i = j + 1;
		if( (j = x.rfind(" (")) == string::npos) {
			return;
		}
		string hubName = x.substr(i, j-i);
		i = j + 2;
		if( (j = x.rfind(')')) == string::npos) {
			return;
		}

		string hubIpPort = x.substr(i, j-i);
		string url = ClientManager::getInstance()->findHub(hubIpPort);

		string encoding = ClientManager::getInstance()->findHubEncoding(url);
		nick = Text::toUtf8(nick, encoding);
		file = Text::toUtf8(file, encoding);
		hubName = Text::toUtf8(hubName, encoding);

		UserPtr user = ClientManager::getInstance()->findUser(nick, url);
		if(!user) {
			// Could happen if hub has multiple URLs / IPs
			user = ClientManager::getInstance()->findLegacyUser(nick);
			if(!user)
				return;
		}

		string tth;
		if(hubName.compare(0, 4, "TTH:") == 0) {
			tth = hubName.substr(4);
			StringList names = ClientManager::getInstance()->getHubNames(user->getCID());
			hubName = names.empty() ? _("Offline") : Util::toString(names);
		}

		if(tth.empty() && type == SearchResult::TYPE_FILE) {
			return;
		}


		SearchResultPtr sr(new SearchResult(user, type, slots, freeSlots, size,
			file, hubName, url, remoteIp, TTHValue(tth), Util::emptyString));
		fire(SearchManagerListener::SR(), sr);
		
//.........这里部分代码省略.........
开发者ID:HiT-Hi-FiT-Hai,项目名称:dcplusplus,代码行数:101,代码来源:SearchManager.cpp


示例6: getParentWindow

bool UserPropertiesHandler::handleURI(URI& uri)
{
    bool addUser = uri.action == "add_user";
    bool editUser = uri.action == "edit_user";
    if (!addUser && !editUser)
        return false;

    wxWindow* w = getParentWindow(uri);
    ServerPtr server;
    UserPtr user;
    wxString title(_("Modify User"));
    if (addUser)
    {
        server = extractMetadataItemPtrFromURI<Server>(uri);
        if (!server)
            return true;
        title = _("Create New User");
        user.reset(new User(server));
    }
    else
    {
        user = extractMetadataItemPtrFromURI<User>(uri);
        if (!user)
            return true;
#ifdef __WXGTK__
        if (user->getUsername() == "SYSDBA")
        {
            showWarningDialog(w, _("The password for the SYSDBA user should not be changed here."),
                _("The appropriate way to change the password of the SYSDBA user is to run the changeDBAPassword.sh script in Firebird's bin directory.\n\nOtherwise the scripts will not be updated."),
                AdvancedMessageDialogButtonsOk(), config(), "DIALOG_warn_sysdba_change",
                _("Do not show this information again"));
        }
#endif
        server = user->getServer();
        if (!server)
            return true;
    }

    UserDialog d(w, title, addUser);
    d.setUser(user);
    if (d.ShowModal() == wxID_OK)
    {
        ProgressDialog pd(w, _("Connecting to Server..."), 1);
        pd.doShow();
        IBPP::Service svc;
        if (!getService(server.get(), svc, &pd, true)) // true = need SYSDBA password
            return true;

        try
        {
            IBPP::User u;
            user->assignTo(u);
            if (addUser)
                svc->AddUser(u);
            else
                svc->ModifyUser(u);
            server->notifyObservers();
        }
        catch(IBPP::Exception& e)
        {
            wxMessageBox(e.what(), _("Error"),
                wxOK | wxICON_WARNING);
        }
    }
    return true;
}
开发者ID:AlfiyaZi,项目名称:flamerobin,代码行数:66,代码来源:UserDialog.cpp



注:本文中的UserPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UserResource类代码示例发布时间:2022-05-31
下一篇:
C++ UserProfile类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap