本文整理汇总了C++中JID函数的典型用法代码示例。如果您正苦于以下问题:C++ JID函数的具体用法?C++ JID怎么用?C++ JID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了JID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
示例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("");
}
示例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();
}
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例11: notifyStreamEvent
void Client::createSession()
{
notifyStreamEvent( StreamEventSessionCreation );
IQ iq( IQ::Set, JID(), getID() );
iq.addExtension( new SessionCreation() );
send( iq, this, CtxSessionEstablishment );
}
示例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;
}
示例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);
}
示例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);
}
示例15: selectedIndexes
JID QtTreeWidget::selectedJID() const {
QModelIndexList list = selectedIndexes();
if (list.size() != 1) {
return JID();
}
return jidFromIndex(list[0]);
}