当前位置: 首页>>代码示例>>C++>>正文


C++ QXmppConfiguration::setHost方法代码示例

本文整理汇总了C++中QXmppConfiguration::setHost方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppConfiguration::setHost方法的具体用法?C++ QXmppConfiguration::setHost怎么用?C++ QXmppConfiguration::setHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QXmppConfiguration的用法示例。


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

示例1: main

int main(int argc,char* argv[])
{
    QCoreApplication a(argc,argv);
    QCoreApplication::setOrganizationName("H-Sec");
    QCoreApplication::setOrganizationDomain("H-Sec.org");
    QCoreApplication::setApplicationName("QHBot");

    qInstallMsgHandler(mMsgOut);

    QXmppLogger::getLogger()->setLoggingType(QXmppLogger::StdoutLogging);

    QHBot bot;
    QXmppConfiguration config;

    QSettings settings("QHBot.ini",QSettings::IniFormat);
    settings.beginGroup("Connection");
    config.setHost(settings.value("Host").toString());
    config.setDomain(settings.value("Domain").toString());
    config.setUser(settings.value("User").toString());
    config.setPassword(settings.value("Password").toString());
    config.setPort(settings.value("Port").toInt());
    //settings.endGroup(); FIXME: FIX PERMISOS

    bot.connectToServer(config);

    /* FIXME: FIX PERMISOS */
    qDebug()<<"AdmList contiene: "<<settings.value("Admlist").toString();
    QStringList admins(settings.value("Admlist").toString().split(" "));
    bot.setAdminList(admins);
    settings.endGroup();
    /* FIXME: FIX PERMISOS */
    return a.exec();
}
开发者ID:Adyrhan,项目名称:QHBot,代码行数:33,代码来源:main.cpp

示例2: connectToServer

void Client::connectToServer(const QString &jid, const QString &password)
{
    QXmppConfiguration conf;
    conf.setHost("yvi-pc");
    conf.setDomain("yvi-pc");
    conf.setUser(jid);
    conf.setJid(jid);
    conf.setPort(5222);
    conf.setPassword(password);
//    conf.setSaslAuthMechanism("mechanism");
    m_client->connectToServer(conf);
}
开发者ID:eltld,项目名称:XmppClient,代码行数:12,代码来源:client.cpp

示例3: connectToServer

void QXmppClient::connectToServer(const QString& host,
                                  const QString& bareJid,
                                  const QString& password,
                                  int port,
                                  const QXmppPresence& initialPresence)
{
    QXmppConfiguration config;
    config.setHost(host);
    config.setUser(jidToUser(bareJid));
    config.setDomain(jidToDomain(bareJid));
    config.setPassword(password);
    config.setPort(port);
    connectToServer(config, initialPresence);
}
开发者ID:berndhs,项目名称:qxmpp,代码行数:14,代码来源:QXmppClient.cpp

示例4: login

void MainWindow::login()
{
    m_loginWidget->lockLogin();
    m_loginWidget->writeData(m_preferences);
    m_loginWidget->showLoginState(tr("Login ..."));
    ui->treeWidget->clear();

    QXmppConfiguration conf;
    conf.setHost(m_preferences->host);
    conf.setDomain(m_preferences->domain);
    conf.setUser(m_preferences->username);
    conf.setJid(m_preferences->jid);
    conf.setPort(m_preferences->port);
    conf.setPassword(m_preferences->password);
    conf.setResource(m_preferences->jid);
    m_xmppClient->connectToServer(conf);
}
开发者ID:newdebug,项目名称:NewDebug,代码行数:17,代码来源:mainwindow.cpp

示例5: testConnect

void tst_QXmppServer::testConnect()
{
    QFETCH(QString, username);
    QFETCH(QString, password);
    QFETCH(QString, mechanism);
    QFETCH(bool, connected);

    const QString testDomain("localhost");
    const QHostAddress testHost(QHostAddress::LocalHost);
    const quint16 testPort = 12345;

    QXmppLogger logger;
    //logger.setLoggingType(QXmppLogger::StdoutLogging);

    // prepare server
    TestPasswordChecker passwordChecker;
    passwordChecker.addCredentials("testuser", "testpwd");

    QXmppServer server;
    server.setDomain(testDomain);
    server.setLogger(&logger);
    server.setPasswordChecker(&passwordChecker);
    server.listenForClients(testHost, testPort);

    // prepare client
    QXmppClient client;
    client.setLogger(&logger);

    QEventLoop loop;
    connect(&client, SIGNAL(connected()),
            &loop, SLOT(quit()));
    connect(&client, SIGNAL(disconnected()),
            &loop, SLOT(quit()));

    QXmppConfiguration config;
    config.setDomain(testDomain);
    config.setHost(testHost.toString());
    config.setPort(testPort);
    config.setUser(username);
    config.setPassword(password);
    config.setSaslAuthMechanism(mechanism);
    client.connectToServer(config);
    loop.exec();
    QCOMPARE(client.isConnected(), connected);
}
开发者ID:qxmpp-project,项目名称:qxmpp,代码行数:45,代码来源:tst_qxmppserver.cpp

示例6: connectHost

void QxmppPeer::connectHost( const std::string & jid, const std::string & password, 
                             const std::string & host, int port, bool tls )
{
    QXmppConfiguration conf;
    conf.setJid( jid.c_str() );
    conf.setPassword( password.c_str() );
    if ( host.size() > 0 )
        conf.setHost( host.c_str() );
    if ( port > 0 )
        conf.setPort( port );
    conf.setAutoReconnectionEnabled( true );
    //conf.setUseNonSASLAuthentication( true );
    if ( tls )
    	conf.setStreamSecurityMode( QXmppConfiguration::TLSEnabled );
    else
        conf.setStreamSecurityMode( QXmppConfiguration::TLSDisabled );

    connectToServer( conf );
}
开发者ID:z80,项目名称:IPM,代码行数:19,代码来源:qxmpp_peer.cpp

示例7: connectToXmppServer

void MyXmppClient::connectToXmppServer() {
    QXmppConfiguration xmppConfig;

    xmppConfig.setJid( m_myjid );
    xmppConfig.setPassword( m_password );
    xmppConfig.setKeepAliveInterval( m_keepAlive );
    xmppConfig.setAutoAcceptSubscriptions(false);
    xmppConfig.setSaslAuthMechanism("DIGEST-MD5");
    xmppConfig.setUseSASLAuthentication(true);
    xmppConfig.setStreamSecurityMode(QXmppConfiguration::TLSEnabled);

    /*******************/

    if( m_resource.isEmpty() || m_resource.isNull() ) xmppConfig.setResource( "Lightbulb" ); else xmppConfig.setResource( m_resource );

    if( !m_host.isEmpty() ) xmppConfig.setHost( m_host );
    if( m_port != 0 ) xmppConfig.setPort( m_port );

    xmppClient->connectToServer( xmppConfig );
}
开发者ID:ksiazkowicz,项目名称:lightbulb,代码行数:20,代码来源:MyXmppClient.cpp


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