void JabberAddAccountWidget::apply() { Account jabberAccount = Account::create("jabber"); jabberAccount.setId(Username->text() + '@' + Domain->currentText()); jabberAccount.setPassword(AccountPassword->text()); jabberAccount.setHasPassword(!AccountPassword->text().isEmpty()); jabberAccount.setRememberPassword(RememberPassword->isChecked()); // bad code: order of calls is important here // we have to set identity after password // so in cache of identity status container it already knows password and can do status change without asking user for it jabberAccount.setAccountIdentity(Identity->currentIdentity()); JabberAccountDetails *details = dynamic_cast<JabberAccountDetails *>(jabberAccount.details()); if (details) { details->setState(StorableObject::StateNew); details->setResource("Kadu"); details->setPriority(5); bool isGoogleAppsAccount = Factory->name() == "gmail/google talk" && !Domain->currentText().contains("gmail"); // Google Apps account sometimes needs custom host/port settings to work if (isGoogleAppsAccount) { details->setUseCustomHostPort(true); details->setCustomHost("talk.google.com"); details->setCustomPort(5222); } } resetGui(); emit accountCreated(jabberAccount); }
void JabberCreateAccountWidget::jidRegistered(const QString &jid, const QString &tlsDomain) { if (jid.isEmpty()) return; Account jabberAccount = Account::create(); jabberAccount.setProtocolName("jabber"); jabberAccount.setAccountIdentity(IdentityCombo->currentIdentity()); jabberAccount.setId(jid); jabberAccount.setHasPassword(true); jabberAccount.setPassword(NewPassword->text()); jabberAccount.setRememberPassword(RememberPassword->isChecked()); JabberAccountDetails *details = dynamic_cast<JabberAccountDetails *>(jabberAccount.details()); if (details) { details->setState(StorableObject::StateNew); details->setTlsOverrideDomain(tlsDomain); } resetGui(); emit accountCreated(jabberAccount); }