Esempio n. 1
0
void AccountShared::load()
{
	if (!isValidStorage())
		return;

	Shared::load();

	Identity identity = IdentityManager::instance()->byUuid(loadValue<QString>("Identity"));
	if (identity.isNull() && !IdentityManager::instance()->items().isEmpty())
		identity = IdentityManager::instance()->items().at(0);

	setAccountIdentity(identity);

	ProtocolName = loadValue<QString>("Protocol");
	setId(loadValue<QString>("Id"));

	RememberPassword = loadValue<bool>("RememberPassword", true);
	HasPassword = RememberPassword;
	if (RememberPassword)
		Password = pwHash(loadValue<QString>("Password"));

	ProxySettings.setEnabled(loadValue<bool>("UseProxy"));
	ProxySettings.setAddress(loadValue<QString>("ProxyHost"));
	ProxySettings.setPort(loadValue<int>("ProxyPort"));
	ProxySettings.setRequiresAuthentication(loadValue<bool>("ProxyRequiresAuthentication"));
	ProxySettings.setUser(loadValue<QString>("ProxyUser"));
	ProxySettings.setPassword(loadValue<QString>("ProxyPassword"));

	PrivateStatus = loadValue<bool>("PrivateStatus", true);

	triggerAllProtocolsRegistered();
}
Esempio n. 2
0
void AccountShared::store()
{
	if (!isValidStorage())
		return;

	Shared::store();

	storeValue("Identity", AccountIdentity.uuid().toString());

	storeValue("Protocol", ProtocolName);
	storeValue("Id", id());

	storeValue("RememberPassword", RememberPassword);
	if (RememberPassword && HasPassword)
		storeValue("Password", pwHash(password()));
	else
		removeValue("Password");

	storeValue("UseProxy", ProxySettings.enabled());
	storeValue("ProxyHost", ProxySettings.address());
	storeValue("ProxyPort", ProxySettings.port());
	storeValue("ProxyRequiresAuthentication", ProxySettings.requiresAuthentication());
	storeValue("ProxyUser", ProxySettings.user());
	storeValue("ProxyPassword", ProxySettings.password());

	storeValue("PrivateStatus", PrivateStatus);
}
Esempio n. 3
0
void ConfigGGPasswordEdit::saveConfiguration()
{
	if (section.isEmpty())
		return;

	dataManager->writeEntry(section, item, QVariant(pwHash(text())));
}
Esempio n. 4
0
void ConfigGGPasswordEdit::loadConfiguration()
{
	if (section.isEmpty())
		return;

	setText(pwHash(dataManager->readEntry(section, item).toString()));
}
Esempio n. 5
0
void ChangePassword::passwordChanged(bool ok)
{
	kdebugf();

	if (ok)
	{
		config_file.writeEntry("General", "Password", pwHash(newpwd->text()));
		config_file.sync();
		close();
	}

	kdebugf2();
}
Esempio n. 6
0
void GaduImporter::importAccounts()
{
	if (0 == config_file.readNumEntry("General", "UIN"))
		return;

	GaduAccount *defaultGaduGadu = dynamic_cast<GaduAccount *>(
		ProtocolsManager::instance()->byName("gadu")->newAccount());

	defaultGaduGadu->setName("Gadu-Gadu");
	defaultGaduGadu->setId(config_file.readEntry("General", "UIN"));
	defaultGaduGadu->setPassword(unicode2cp(pwHash(config_file.readEntry("General", "Password"))));
	defaultGaduGadu->setRememberPassword(true);
	defaultGaduGadu->setAllowDcc(config_file.readBoolEntry("Network", "AllowDCC"));

	QHostAddress host;
	if (!host.setAddress(config_file.readEntry("Network", "DccIP")))
		host.setAddress("0.0.0.0");
	defaultGaduGadu->setDccIP(host);
	if (!host.setAddress(config_file.readEntry("Network", "ExternalIP")))
		host.setAddress("0.0.0.0");
	defaultGaduGadu->setDccExternalIP(host);

	defaultGaduGadu->setDccExternalPort(config_file.readNumEntry("Network", "ExternalPort"));
	defaultGaduGadu->setDccPort(config_file.readNumEntry("Network", "ExternalPort"));
	defaultGaduGadu->setDccIpDetect(config_file.readBoolEntry("Network", "DccIpDetect"));
	defaultGaduGadu->setDccLocalPort(config_file.readNumEntry("Network", "LocalPort"));
	defaultGaduGadu->setDccForwarding(config_file.readBoolEntry("Network", "DccForwarding"));
	defaultGaduGadu->setRemoveCompletedTransfers(config_file.readBoolEntry("Network", "RemoveCompletedTransfers"));

	defaultGaduGadu->setUseProxy(config_file.readBoolEntry("Network", "UseProxy"));
	if (!host.setAddress(config_file.readEntry("Network", "ProxyHost")))
		host.setAddress("0.0.0.0");
	defaultGaduGadu->setProxyHost(host);
	defaultGaduGadu->setProxyPassword(config_file.readEntry("Network", "ProxyPassword"));
	defaultGaduGadu->setProxyPort(config_file.readNumEntry("Network", "ProxyPort"));
	defaultGaduGadu->setProxyUser(config_file.readEntry("Network", "ProxyUser"));
	defaultGaduGadu->setProxyReqAuthentication(!defaultGaduGadu->proxyUser().isEmpty());

	defaultGaduGadu->import_0_6_5_LastStatus();

	AccountManager::instance()->registerAccount(defaultGaduGadu);
}
Esempio n. 7
0
void ChangePassword::start()
{
	kdebugf();

	if (newpwd->text() != newpwd2->text())
	{
		MessageBox::msg(tr("Error data typed in required fields.\n\nPasswords typed in "
			"both fields (\"New password\" and \"Retype new password\") should be the same!"), false, "Warning", this);
		return;
	}

	QString password = QString(pwHash(config_file.readEntry("General", "Password")));
	QString newpassword = (newpwd->text().isEmpty() ? password : newpwd->text());

	setEnabled(false);
	GaduProtocol *gadu = dynamic_cast<GaduProtocol *>(AccountManager::instance()->defaultAccount()->protocol());
	gadu->changePassword(config_file.readNumEntry("General", "UIN"), emailedit->text(), password, newpassword);

	kdebugf2();
}