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

C++ JID函数代码示例

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

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



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

示例1: JID

void MainController::handleLoginRequest(const std::string &username, const std::string &password, const std::string& certificatePath, CertificateWithKey::ref certificate, const ClientOptions& options, bool remember, bool loginAutomatically) {
	jid_ = JID(username);
	if (options.singleSignOn && (!jid_.isValid() || !jid_.getNode().empty())) {
		loginWindow_->setMessage(QT_TRANSLATE_NOOP("", "User address invalid. User address should be of the form 'wonderland.lit'"));
		loginWindow_->setIsLoggingIn(false);
	} else if (!options.singleSignOn && (!jid_.isValid() || jid_.getNode().empty())) {
		loginWindow_->setMessage(QT_TRANSLATE_NOOP("", "User address invalid. User address should be of the form '[email protected]'"));
		loginWindow_->setIsLoggingIn(false);
	} else {
#ifdef SWIFTEN_PLATFORM_WIN32
		if (options.singleSignOn) {
			std::string userName;
			std::string clientName;
			std::string serverName;
			boost::shared_ptr<boost::system::error_code> errorCode = getUserNameEx(userName, clientName, serverName);

			if (!errorCode) {
				/* Create JID using the Windows logon name and user provided domain name */
				jid_ = JID(clientName, username);
			}
			else {
				loginWindow_->setMessage(str(format(QT_TRANSLATE_NOOP("", "Error obtaining Windows user name (%1%)")) % errorCode->message()));
				loginWindow_->setIsLoggingIn(false);
				return;
			}
		}
#endif

		loginWindow_->setMessage("");
		loginWindow_->setIsLoggingIn(true);
		profileSettings_ = new ProfileSettingsProvider(username, settings_);
		if (!settings_->getSetting(SettingConstants::FORGET_PASSWORDS)) {
			profileSettings_->storeString("jid", username);
			profileSettings_->storeString("certificate", certificatePath);
			profileSettings_->storeString("pass", (remember || loginAutomatically) ? password : "");
			std::string optionString = serializeClientOptions(options);
			profileSettings_->storeString("options", optionString);
			settings_->storeSetting(SettingConstants::LAST_LOGIN_JID, username);
			settings_->storeSetting(SettingConstants::LOGIN_AUTOMATICALLY, loginAutomatically);
			loginWindow_->addAvailableAccount(profileSettings_->getStringSetting("jid"), profileSettings_->getStringSetting("pass"), profileSettings_->getStringSetting("certificate"), options);
		}

		password_ = password;
		certificate_ = certificate;
		clientOptions_ = options;
		performLoginFromCachedCredentials();
	}
}
开发者ID:scopeInfinity,项目名称:swift,代码行数:48,代码来源:MainController.cpp


示例2: switch

void QtUserSearchWindow::handleAccepted() {
	JID jid;
	std::vector<JID> jids;
	switch(type_) {
		case AddContact:
			jid = getContactJID();
			eventStream_->send(boost::make_shared<AddContactUIEvent>(jid, detailsPage_->getName(), detailsPage_->getSelectedGroups()));
			break;
		case ChatToContact:
			if (contactVector_.size() == 1) {
				boost::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0]->jid));
				eventStream_->send(event);
				break;
			}

			foreach(Contact::ref contact, contactVector_) {
				jids.push_back(contact->jid);
			}

			eventStream_->send(boost::make_shared<CreateImpromptuMUCUIEvent>(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text())));
			break;
		case InviteToChat:
			foreach(Contact::ref contact, contactVector_) {
				jids.push_back(contact->jid);
			}
开发者ID:jyhong836,项目名称:swift,代码行数:25,代码来源:QtUserSearchWindow.cpp


示例3: initscr

CJabberCore::CJabberCore()
{
    initscr();
    cbreak();
    //keypad(stdscr, TRUE);
    height = LINES;
    width = COLS;

    // setting up chat and input window
    borderWindow = createWindow(5,          width - 3, height - 5, 3);
    inputWindow  = createWindow(3,          width - 5, height - 4, 4);
    chatWindow   = createWindow(height - 5, width    , 0         , 0);
    keypad(inputWindow, TRUE);

    // for proper input cursor position
    wrefresh(inputWindow);
    wmove(inputWindow, 0, 0);
    int y, x;
    getparyx(inputWindow, y, x);
    MessageWindow::getInstance().setInputX(x);
    MessageWindow::getInstance().setInputY(y);

    // setting refs for printMsg
    MessageWindow::getInstance().setWindow(chatWindow, height - 5, width);
    scrollok(MessageWindow::getInstance().getWindow(), TRUE);
    jid = JID("");
}
开发者ID:Erdk,项目名称:CJabber,代码行数:27,代码来源:program.cpp


示例4: switch

void UserSearchController::initializeUserWindow() {
    if (!window_) {
        UserSearchWindow::Type windowType = UserSearchWindow::AddContact;
        switch(type_) {
            case AddContact:
                windowType = UserSearchWindow::AddContact;
                break;
            case StartChat:
                windowType = UserSearchWindow::ChatToContact;
                break;
            case InviteToChat:
                windowType = UserSearchWindow::InviteToChat;
                break;
        }

        window_ = factory_->createUserSearchWindow(windowType, uiEventStream_, rosterController_->getGroups());
        if (!window_) {
            // UI Doesn't support user search
            return;
        }
        window_->onNameSuggestionRequested.connect(boost::bind(&UserSearchController::handleNameSuggestionRequest, this, _1));
        window_->onFormRequested.connect(boost::bind(&UserSearchController::handleFormRequested, this, _1));
        window_->onSearchRequested.connect(boost::bind(&UserSearchController::handleSearch, this, _1, _2));
        window_->onContactSuggestionsRequested.connect(boost::bind(&UserSearchController::handleContactSuggestionsRequested, this, _1));
        window_->onJIDUpdateRequested.connect(boost::bind(&UserSearchController::handleJIDUpdateRequested, this, _1));
        window_->onJIDAddRequested.connect(boost::bind(&UserSearchController::handleJIDAddRequested, this, _1));
        window_->onJIDEditFieldChanged.connect(boost::bind(&UserSearchController::handleJIDEditingFinished, this, _1));
        window_->setSelectedService(JID(jid_.getDomain()));
        window_->clear();
    }
}
开发者ID:swift,项目名称:swift,代码行数:31,代码来源:UserSearchController.cpp


示例5: parseAffiliation

void MUCUserPayloadParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
	if (level == ItemLevel) {
		if (element == "item") {
			MUCUserPayload::Item item;
			std::string affiliation = attributes.getAttribute("affiliation");
			std::string role = attributes.getAttribute("role");
			std::string nick = attributes.getAttribute("nick");
			std::string jid = attributes.getAttribute("jid");
			item.affiliation = parseAffiliation(affiliation);
			item.role = parseRole(role);
			if (!jid.empty()) {
				item.realJID = JID(jid);
			}
			if (!nick.empty()) {
				item.nick = nick;
			}
			getPayloadInternal()->addItem(item);
		} else if (element == "status") {
			MUCUserPayload::StatusCode status;
			try {
				status.code = boost::lexical_cast<int>(attributes.getAttribute("code").c_str());
				getPayloadInternal()->addStatusCode(status);
			} catch (boost::bad_lexical_cast&) {
			}
		}
	}
	++level;
}
开发者ID:bessey,项目名称:picnic-doc-server,代码行数:28,代码来源:MUCUserPayloadParser.cpp


示例6: JID

void UserSearchController::handleVCardChanged(const JID& jid, VCard::ref vcard) {
    if (jid == suggestionsJID_) {
        window_->setNameSuggestions(ContactEditController::nameSuggestionsFromVCard(vcard));
        suggestionsJID_ = JID();
    }
    handleJIDUpdateRequested(std::vector<JID>(1, jid));
}
开发者ID:swift,项目名称:swift,代码行数:7,代码来源:UserSearchController.cpp


示例7: JID

  bool SOCKS5Bytestream::connect()
  {
    if( !m_connection || !m_socks5 || !m_manager )
      return false;

    if( m_open )
      return true;

    StreamHostList::const_iterator it = m_hosts.begin();
    for( ; it != m_hosts.end(); ++it )
    {
      if( ++it == m_hosts.end() )
        m_connected = true;
      --it; // FIXME ++it followed by --it is kinda ugly
      m_connection->setServer( (*it).host, (*it).port );
      if( m_socks5->connect() == ConnNoError )
      {
        m_proxy = (*it).jid;
        m_connected = true;
        return true;
      }
    }

    m_manager->acknowledgeStreamHost( false, JID(), EmptyString );
    return false;
  }
开发者ID:crazyit,项目名称:iGame,代码行数:26,代码来源:socks5bytestream.cpp


示例8: Q_D

MessageSession *MessageSessionManager::session(const JID &jid, Message::Type type, bool create)
{
	Q_D(MessageSessionManager);
	QList<QPointer<MessageSession> > sessions = d->fullSessions.values(jid.full());
	Logger::debug() << "d->full_sessions" << d->fullSessions;
	foreach(MessageSession *session, sessions)
		Logger::debug() << "MessageSession" << (session ? session->jid() : JID());
	for(int i = 0; i < sessions.size(); i++)
	{
		if(sessions[i].isNull())
		{
			d->fullSessions.remove(jid.full(), sessions[i]);
			continue;
		}
		return sessions[i];
	}
	if(!create)
		return 0;
	MessageSessionHandler *handler = d->sessionHandlers.value(type);
	if(!handler)
		return 0;
	MessageSession *session = new MessageSession(this, jid.full(), false, QString());
	handler->handleMessageSession(session);
	return session;
}
开发者ID:magist3r,项目名称:jreen,代码行数:25,代码来源:messagesession.cpp


示例9: Q_D

VCardReply *VCardManager::store(const Jreen::VCard::Ptr &vcard)
{
	Q_D(VCardManager);
	IQ iq(IQ::Set, JID());
	iq.addExtension(vcard);
	return new VCardReply(d->client->jid().bareJID(), NULL, d->client->send(iq));
}
开发者ID:magist3r,项目名称:jreen,代码行数:7,代码来源:vcardmanager.cpp


示例10: doAction

void PichiEvent::doAction(std::string action, std::string value, std::string option, std::string coincidence)
{
	std::vector<std::string> exploder;
	if(action == "send_message")
	{
		std::string room;
		if(coincidence != "")
		{
			exploder = system::explode(",", coincidence);
			exploder = system::explode("=", exploder[0]);
			if(exploder[0] == "room")
			{
				room = exploder[1];
			}
			else
			{
				//$this->log->log("Old send_message handler", PichiLog::LEVEL_WARNING);
				return;
			}
		}
		else
		{
			return;
		}
		if(option == "")
			if(value != "")
				pichi->jabber->sendMessage(JID(room), value);
		//$this->log->log("EVENT: {$action} (Send message {$value})", PichiLog::LEVEL_VERBOSE);
		return;
	}
	//($hook = PichiPlugin::fetch_hook('event_action')) ? eval($hook) : false;
}
开发者ID:Ingener74,项目名称:pichi,代码行数:32,代码来源:pichievent.cpp


示例11: notifyStreamEvent

 void Client::createSession()
 {
   notifyStreamEvent( StreamEventSessionCreation );
   IQ iq( IQ::Set, JID(), getID() );
   iq.addExtension( new SessionCreation() );
   send( iq, this, CtxSessionEstablishment );
 }
开发者ID:RankoR,项目名称:mqutim,代码行数:7,代码来源:client.cpp


示例12: if

void SearchPayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
    if (level == TopLevel) {
    }
    else if (level == PayloadLevel) {
        if (element == "x" && ns == "jabber:x:data") {
            assert(!formParser);
            formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser());
        }
        else if (element == "item") {
            assert(!currentItem);
            currentItem.reset(SearchPayload::Item());
            currentItem->jid = JID(attributes.getAttribute("jid"));
        }
        else {
            currentText.clear();
        }
    }
    else if (level == ItemLevel && currentItem) {
        currentText.clear();
    }

    if (formParser) {
        formParser->handleStartElement(element, ns, attributes);
    }

    ++level;
}
开发者ID:swift,项目名称:swift,代码行数:27,代码来源:SearchPayloadParser.cpp


示例13: m_from

ConfigHandler::ConfigHandler(User *user, const std::string &from, const std::string &id) : m_from(from), m_user(user) {
    setRequestType(CALLER_ADHOC);
    std::string bare(JID(from).bare());

    IQ _response(IQ::Result, from, id);
    Tag *response = _response.tag();
    response->addAttribute("from", Transport::instance()->jid());

    AdhocTag *adhocTag = new AdhocTag(Transport::instance()->getId(), "transport_irc_config", "executing");
    adhocTag->setAction("complete");
    adhocTag->setTitle("IRC Nickserv password configuration");
    adhocTag->setInstructions("Choose the server you want to change password for.");

    std::map <std::string, std::string> values;
    std::map<std::string, UserRow> users = Transport::instance()->sql()->getUsersByJid(bare);
    for (std::map<std::string, UserRow>::iterator it = users.begin(); it != users.end(); it++) {
        std::string server = (*it).second.jid.substr(bare.size());
        values[server] = stringOf((*it).second.id);
        m_userId.push_back(stringOf((*it).second.id));
    }
    adhocTag->addListSingle("IRC server", "irc_server", values);

    adhocTag->addTextPrivate("New NickServ password", "password");

    response->addChild(adhocTag);
    Transport::instance()->send(response);
}
开发者ID:hanzz,项目名称:spectrum,代码行数:27,代码来源:irc.cpp


示例14: CPPUNIT_ASSERT

void CapabilityHandlerTest::handleDiscoInfoBadIdentity() {
	int context = m_handler->waitForCapabilities("http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0=", "[email protected]/psi");
	CPPUNIT_ASSERT (m_handler->hasVersion(context));

	Tag *query = new Tag("query");
	query->addAttribute("xmlns", "http://jabber.org/protocol/disco#info");
	query->addAttribute("node", "http://code.google.com/p/exodus#QgayPKawpkPSDYmwT/WM94uAlu0=");
	
	Tag *identity = new Tag("identity");
	identity->addAttribute("category", "not-client");
	identity->addAttribute("name", "Exodus 0.9.1");
	identity->addAttribute("type", "pc");
	query->addChild(identity);

	m_user->setConnected(false);
	m_user->setReadyForConnect(true);
	m_user->setResource("psi", 50, 0);
	m_handler->handleDiscoInfo(JID("[email protected]/psi"), query, context);

	CPPUNIT_ASSERT (m_user->isConnected() == false);
	CPPUNIT_ASSERT (m_user->hasFeature(GLOOX_FEATURE_ROSTERX, "psi") == false);
	CPPUNIT_ASSERT (m_user->hasFeature(GLOOX_FEATURE_FILETRANSFER, "psi") == false);
	CPPUNIT_ASSERT (m_user->hasFeature(GLOOX_FEATURE_CHATSTATES, "psi") == false);
	CPPUNIT_ASSERT (m_user->hasFeature(GLOOX_FEATURE_XHTML_IM, "psi") == false);
}
开发者ID:Svedrin,项目名称:spectrum,代码行数:25,代码来源:capabilityhandlertest.cpp


示例15: selectedIndexes

JID QtTreeWidget::selectedJID() const {
    QModelIndexList list = selectedIndexes();
    if (list.size() != 1) {
        return JID();
    }
    return jidFromIndex(list[0]);
}
开发者ID:swift,项目名称:swift,代码行数:7,代码来源:QtTreeWidget.cpp


示例16: loadSavedDirectories

void UserSearchController::loadSavedDirectories() {
    savedDirectories_.clear();
    for (auto&& stringItem : String::split(settings_->getStringSetting(SEARCHED_DIRECTORIES), '\n')) {
        if(!stringItem.empty()) {
            savedDirectories_.push_back(JID(stringItem));
        }
    }
}
开发者ID:swift,项目名称:swift,代码行数:8,代码来源:UserSearchController.cpp


示例17: iq

 void FlexibleOffline::messageOperation( int context, const StringList& msgs )
 {
   const std::string& id = m_parent->getID();
   IQ::IqType iqType = context == FORequestMsgs ? IQ::Get : IQ::Set;
   IQ iq( iqType, JID(), id );
   iq.addExtension( new Offline( context, msgs ) );
   m_parent->send( iq, this, context );
 }
开发者ID:Artoria2e5,项目名称:avbot,代码行数:8,代码来源:flexoff.cpp


示例18: replaceBadJidCharacters

void IRCProtocol::makeRoomJID(User *user, std::string &name) {
    // #pidgin" -> "#pidgin%[email protected]"
    std::transform(name.begin(), name.end(), name.begin(),(int(*)(int)) std::tolower);
    std::string name_safe = name;
    std::for_each( name_safe.begin(), name_safe.end(), replaceBadJidCharacters() ); // OK
    name.assign(name_safe + "%" + JID(user->username()).server() + "@" + Transport::instance()->jid());
    std::cout << "ROOMJID: " << name << "\n";
}
开发者ID:hanzz,项目名称:spectrum,代码行数:8,代码来源:irc.cpp


示例19: getPayloadInternal

void MUCDestroyPayloadParser::handleTree(ParserElement::ref root) {
    std::string ns = root->getNamespace();
    std::string jid = root->getAttributes().getAttribute("jid");
    if (!jid.empty()) {
        getPayloadInternal()->setNewVenue(JID(jid));
    }
    getPayloadInternal()->setReason(root->getChild("reason", ns)->getText());
}
开发者ID:smuralireddy,项目名称:swift,代码行数:8,代码来源:MUCDestroyPayloadParser.cpp


示例20: onElementReceived

void ServerFromClientSession::handleElement(boost::shared_ptr<Element> element) {
	if (isInitialized()) {
		onElementReceived(element);
	}
	else {
		if (AuthRequest* authRequest = dynamic_cast<AuthRequest*>(element.get())) {
			if (authRequest->getMechanism() == "PLAIN" || (allowSASLEXTERNAL && authRequest->getMechanism() == "EXTERNAL")) {
				if (authRequest->getMechanism() == "EXTERNAL") {
						getXMPPLayer()->writeElement(boost::make_shared<AuthSuccess>());
						authenticated_ = true;
						getXMPPLayer()->resetParser();
				}
				else {
					PLAINMessage plainMessage(authRequest->getMessage() ? *authRequest->getMessage() : createSafeByteArray(""));
					if (userRegistry_->isValidUserPassword(JID(plainMessage.getAuthenticationID(), getLocalJID().getDomain()), plainMessage.getPassword())) {
						getXMPPLayer()->writeElement(boost::make_shared<AuthSuccess>());
						user_ = plainMessage.getAuthenticationID();
						authenticated_ = true;
						getXMPPLayer()->resetParser();
					}
					else {
						getXMPPLayer()->writeElement(boost::shared_ptr<AuthFailure>(new AuthFailure));
						finishSession(AuthenticationFailedError);
					}
				}
			}
			else {
				getXMPPLayer()->writeElement(boost::shared_ptr<AuthFailure>(new AuthFailure));
				finishSession(NoSupportedAuthMechanismsError);
			}
		}
		else if (IQ* iq = dynamic_cast<IQ*>(element.get())) {
			if (boost::shared_ptr<ResourceBind> resourceBind = iq->getPayload<ResourceBind>()) {
				setRemoteJID(JID(user_, getLocalJID().getDomain(), resourceBind->getResource()));
				boost::shared_ptr<ResourceBind> resultResourceBind(new ResourceBind());
				resultResourceBind->setJID(getRemoteJID());
				getXMPPLayer()->writeElement(IQ::createResult(JID(), iq->getID(), resultResourceBind));
			}
			else if (iq->getPayload<StartSession>()) {
				getXMPPLayer()->writeElement(IQ::createResult(getRemoteJID(), iq->getID()));
				setInitialized();
			}
		}
	}
}
开发者ID:loewis,项目名称:swift,代码行数:45,代码来源:ServerFromClientSession.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ JITDUMP函数代码示例发布时间:2022-05-30
下一篇:
C++ JI2B函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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