本文整理汇总了C++中QXmppConfiguration类的典型用法代码示例。如果您正苦于以下问题:C++ QXmppConfiguration类的具体用法?C++ QXmppConfiguration怎么用?C++ QXmppConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QXmppConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectToServer
void QXmppClient::connectToServer(const QString &jid, const QString &password)
{
QXmppConfiguration config;
config.setJid(jid);
config.setPassword(password);
connectToServer(config);
}
示例2: connectToServer
void QXmppClient::connectToServer(const QString &jid, const QString &password)
{
QXmppConfiguration config;
config.setUser(jidToUser(jid));
config.setDomain(jidToDomain(jid));
config.setPassword(password);
connectToServer(config);
}
示例3: InsertGlobalData
void FreyaMSConfig::InsertGlobalData(const QXmppConfiguration &config)
{
QVariantMap globalConfigMap;
globalConfigMap.insert(FREYAMS_CFG_CONFIDSERVER, config.host());
globalConfigMap.insert(FREYAMS_CFG_CONFIDPORT, config.port());
globalConfigMap.insert(FREYAMS_CFG_CONFIDDOMAIN, config.domain());
globalConfigMap.insert(FREYAMS_CFG_CONFIDRESOURCE, FREYAMS_INF_DEFCONFRESOURCE);
globalConfigMap.insert(FREYAMS_CFG_CONFIDACCOUND, config.jidBare().split("@").at(0));
QVariantMap defaultConfig;
defaultConfig.insert(FREYAMS_CFG_CONFIDDEFAULT, globalConfigMap);
defaultConfig.insert(FREYAMS_CFG_CONFIDNONE, FreyaCryptogram::EnCryptogram(config.password()));
FreyaBaseControl::GetFreyaControl()->SetConfigToFile(FREYAMS_PTH_GLOBALCONFIGPATH, defaultConfig);
}
示例4: connectToServer
void ChatClient::connectToServer(const QString &jid, const QString &password)
{
QXmppConfiguration config;
config.setResource(qApp->applicationName());
config.setJid(jid);
config.setPassword(password);
// don't ignore SSL errors for wifirst and gmail, but do for other domains
if (config.domain() == "wifirst.net" || config.domain() == "gmail.com" || config.domain() == "googlemail.com") {
config.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
config.setIgnoreSslErrors(false);
}
QXmppClient::connectToServer(config);
}
示例5: connectToGoogle
void ChatClient::connectToGoogle(const QString &jid, const QString &accessToken)
{
QXmppConfiguration config;
config.setResource(qApp->applicationName());
config.setGoogleAccessToken(accessToken);
config.setJid(jid);
config.setSaslAuthMechanism("X-OAUTH2");
config.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
// don't ignore SSL errors for gmail, but do for other domains (google apps hosted domains)
if (config.domain() == "gmail.com" || config.domain() == "googlemail.com")
config.setIgnoreSslErrors(false);
QXmppClient::connectToServer(config);
}
示例6: normalizeUser
void Lvk::CA::XmppChatbot::connectToServer(const QString &user, const QString &passwd,
const QString &domain)
{
m_user = normalizeUser(user);
m_domain = normalizeDomain(domain);
QXmppConfiguration conf;
conf.setDomain(m_domain);
conf.setUser(m_user);
conf.setPassword(passwd);
conf.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
m_xmppClient->connectToServer(conf);
// QString jid = m_user + "@" + m_domain;
// qDebug() << "XmppChatbot: Connecting with jid:" << jid;
// m_xmppClient->connectToServer(jid, passwd);
}
示例7: connectToFacebook
void ChatClient::connectToFacebook(const QString &appId, const QString &accessToken)
{
QXmppConfiguration config;
config.setResource(qApp->applicationName());
config.setFacebookAppId(appId);
config.setFacebookAccessToken(accessToken);
config.setDomain("chat.facebook.com");
config.setSaslAuthMechanism("X-FACEBOOK-PLATFORM");
config.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
config.setIgnoreSslErrors(false);
QXmppClient::connectToServer(config);
}
示例8: 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();
}
示例9: connectToWindowsLive
void ChatClient::connectToWindowsLive(const QString &accessToken)
{
QXmppConfiguration config;
config.setResource(qApp->applicationName());
config.setWindowsLiveAccessToken(accessToken);
config.setDomain("messenger.live.com");
config.setSaslAuthMechanism("X-MESSENGER-OAUTH2");
config.setStreamSecurityMode(QXmppConfiguration::TLSRequired);
// NOTE: messenger.live.com uses a certificate with an incorrect name
config.setIgnoreSslErrors(true);
QXmppClient::connectToServer(config);
}
示例10: 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);
}
示例11: 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);
}
示例12: connectToServer
void QXmppClient::connectToServer(const QXmppConfiguration& config,
const QXmppPresence& initialPresence)
{
d->stream->configuration() = config;
if(!config.autoReconnectionEnabled())
{
delete d->reconnectionManager;
d->reconnectionManager = 0;
}
d->clientPresence = initialPresence;
d->clientPresence.setExtensions(d->stream->presenceExtensions());
d->stream->connectToHost();
}
示例13: 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 );
}
示例14: QFETCH
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);
}
示例15: QT_VERSION_CHECK
void QXmppOutgoingClientPrivate::connectToHost(const QString &host, quint16 port)
{
q->info(QString("Connecting to %1:%2").arg(host, QString::number(port)));
// override CA certificates if requested
if (!config.caCertificates().isEmpty())
q->socket()->setCaCertificates(config.caCertificates());
// set private key and certificate if available
if (!config.sslPrivateKey().isNull())
{
q->socket()->setPrivateKey(config.sslPrivateKey());
}
if (!config.localSslCertificate().isNull())
{
q->socket()->setLocalCertificate(config.localSslCertificate());
}
// respect proxy
q->socket()->setProxy(config.networkProxy());
#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
// set the name the SSL certificate should match
q->socket()->setPeerVerifyName(config.domain());
#endif
// connect to host
const QXmppConfiguration::StreamSecurityMode localSecurity = q->configuration().streamSecurityMode();
if (localSecurity == QXmppConfiguration::LegacySSL) {
if (!q->socket()->supportsSsl()) {
q->warning("Not connecting as legacy SSL was requested, but SSL support is not available");
return;
}
q->socket()->connectToHostEncrypted(host, port);
} else {
q->socket()->connectToHost(host, port);
}
}