本文整理汇总了C++中Subscription::fromString方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscription::fromString方法的具体用法?C++ Subscription::fromString怎么用?C++ Subscription::fromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::fromString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromOptions
void UserAccount::fromOptions(OptionsTree *o, QString base)
{
// WARNING: If you add any new option here, only read the option if
// allSetOptions (defined below) contains the new option. If not
// the code should just leave the default value from the reset()
// call in place.
optionsBase = base;
reset();
QStringList allSetOptions = o->getChildOptionNames(base, true, true);
opt_enabled = o->getOption(base + ".enabled").toBool();
opt_auto = o->getOption(base + ".auto").toBool();
opt_keepAlive = o->getOption(base + ".keep-alive").toBool();
opt_compress = o->getOption(base + ".compress").toBool();
req_mutual_auth = o->getOption(base + ".require-mutual-auth").toBool();
legacy_ssl_probe = o->getOption(base + ".legacy-ssl-probe").toBool();
opt_automatic_resource = o->getOption(base + ".automatic-resource").toBool();
opt_log = o->getOption(base + ".log").toBool();
opt_reconn = o->getOption(base + ".reconn").toBool();
opt_ignoreSSLWarnings = o->getOption(base + ".ignore-SSL-warnings").toBool();
// FIX-ME: See FS#771
if (o->getChildOptionNames().contains(base + ".connect-after-sleep")) {
opt_connectAfterSleep = o->getOption(base + ".connect-after-sleep").toBool();
}
else {
o->setOption(base + ".connect-after-sleep", opt_connectAfterSleep);
}
name = o->getOption(base + ".name").toString();
jid = o->getOption(base + ".jid").toString();
customAuth = o->getOption(base + ".custom-auth.use").toBool();
authid = o->getOption(base + ".custom-auth.authid").toString();
realm = o->getOption(base + ".custom-auth.realm").toString();
// read password (we must do this after reading the jid, to decode properly)
QString tmp = o->getOption(base + ".password").toString();
if(!tmp.isEmpty()) {
opt_pass = true;
pass = decodePassword(tmp, jid);
}
opt_host = o->getOption(base + ".use-host").toBool();
security_level = o->getOption(base + ".security-level").toInt();
tmp = o->getOption(base + ".ssl").toString();
if (tmp == "no") {
ssl = SSL_No;
} else if (tmp == "yes") {
ssl = SSL_Yes;
} else if (tmp == "auto") {
ssl = SSL_Auto;
} else if (tmp == "legacy") {
ssl = SSL_Legacy;
} else {
ssl = SSL_Yes;
}
host = o->getOption(base + ".host").toString();
port = o->getOption(base + ".port").toInt();
resource = o->getOption(base + ".resource").toString();
priority = o->getOption(base + ".priority").toInt();
QString pgpSecretKeyID = o->getOption(base + ".pgp-secret-key-id").toString();
if (!pgpSecretKeyID.isEmpty()) {
QCA::KeyStoreEntry e = PGPUtil::instance().getSecretKeyStoreEntry(pgpSecretKeyID);
if (!e.isNull())
pgpSecretKey = e.pgpSecretKey();
}
tmp = o->getOption(base + ".allow-plain").toString();
if (tmp == "never") {
allow_plain = XMPP::ClientStream::NoAllowPlain;
} else if (tmp == "always") {
allow_plain = XMPP::ClientStream::AllowPlain;
} else if (tmp == "over encryped") {
allow_plain = XMPP::ClientStream::AllowPlainOverTLS;
} else {
allow_plain = XMPP::ClientStream::NoAllowPlain;
}
QStringList rosterCache = o->getChildOptionNames(base + ".roster-cache", true, true);
foreach(QString rbase, rosterCache) {
RosterItem ri;
ri.setJid(Jid(o->getOption(rbase + ".jid").toString()));
ri.setName(o->getOption(rbase + ".name").toString());
Subscription s;
s.fromString(o->getOption(rbase + ".subscription").toString());
ri.setSubscription(s);
ri.setAsk(o->getOption(rbase + ".ask").toString());
ri.setGroups(o->getOption(rbase + ".groups").toStringList());
roster += ri;
}