Changeset - c48fa3e77d40
[Not reviewed]
0 1 0
Jan Kaluza - 14 years ago 2011-11-30 11:36:41
hanzz.k@gmail.com
Allow change the legacy name in registration for MySQL
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/mysqlbackend.cpp
Show inline comments
 
@@ -317,13 +317,13 @@ bool MySQLBackend::connect() {
 
		LOG4CXX_ERROR(logger, "Can't connect database: " << mysql_error(&m_conn));
 
		return false;
 
	}
 

	
 
	createDatabase();
 

	
 
	m_setUser = new Statement(&m_conn, "sssssbs", "INSERT INTO " + m_prefix + "users (jid, uin, password, language, encoding, last_login, vip) VALUES (?, ?, ?, ?, ?, NOW(), ?) ON DUPLICATE KEY UPDATE password=?");
 
	m_setUser = new Statement(&m_conn, "sssssbs", "INSERT INTO " + m_prefix + "users (jid, uin, password, language, encoding, last_login, vip) VALUES (?, ?, ?, ?, ?, NOW(), ?) ON DUPLICATE KEY UPDATE uin=?, password=?");
 
	m_getUser = new Statement(&m_conn, "s|isssssb", "SELECT id, jid, uin, password, encoding, language, vip FROM " + m_prefix + "users WHERE jid=?");
 

	
 
	m_removeUser = new Statement(&m_conn, "i", "DELETE FROM " + m_prefix + "users WHERE id=?");
 
	m_removeUserBuddies = new Statement(&m_conn, "i", "DELETE FROM " + m_prefix + "buddies WHERE user_id=?");
 
	m_removeUserSettings = new Statement(&m_conn, "i", "DELETE FROM " + m_prefix + "users_settings WHERE user_id=?");
 
	m_removeUserBuddiesSettings = new Statement(&m_conn, "i", "DELETE FROM " + m_prefix + "buddies_settings WHERE user_id=?");
 
@@ -411,13 +411,13 @@ bool MySQLBackend::exec(const std::string &query) {
 

	
 
void MySQLBackend::setUser(const UserInfo &user) {
 
	std::string encrypted = user.password;
 
	if (!CONFIG_STRING(m_config, "database.encryption_key").empty()) {
 
		encrypted = Util::encryptPassword(encrypted, CONFIG_STRING(m_config, "database.encryption_key"));
 
	}
 
	*m_setUser << user.jid << user.uin << encrypted << user.language << user.encoding << user.vip << user.password;
 
	*m_setUser << user.jid << user.uin << encrypted << user.language << user.encoding << user.vip << user.uin << user.password;
 
	EXEC(m_setUser, setUser(user));
 
}
 

	
 
bool MySQLBackend::getUser(const std::string &barejid, UserInfo &user) {
 
	*m_getUser << barejid;
 
	EXEC(m_getUser, getUser(barejid, user));
0 comments (0 inline, 0 general)