soc.2009.transport: f1cd596e: Fixed auto-login issue and PurpleCmd lis...

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Thu Jul 9 02:55:21 EDT 2009


-----------------------------------------------------------------
Revision: f1cd596ea3739b552aee12738c3d24f32312e6e5
Ancestor: e6715b8397bbf5709be70510944ab8b8b6bc099f
Author: hanzz at soc.pidgin.im
Date: 2009-07-09T06:52:32
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/f1cd596ea3739b552aee12738c3d24f32312e6e5

Modified files:
        commands.cpp user.cpp

ChangeLog: 

Fixed auto-login issue and PurpleCmd list.

-------------- next part --------------
============================================================
--- commands.cpp	0c87a8dc0da024e7c64ce50acae4c5e226b9121a
+++ commands.cpp	0092760558252d67d56dac8159b245533eaf8d89
@@ -37,10 +37,10 @@ static PurpleCmdRet settings_command_cb(
 			s = g_string_new("Transport: ");
 			GHashTable *settings = user->settings();
 			GHashTableIter iter;
-			gpointer key, value;
+			gpointer key, v;
 			g_hash_table_iter_init (&iter, settings);
-			while (g_hash_table_iter_next (&iter, &key, &value)) {
-				PurpleValue *value = (PurpleValue *) value;
+			while (g_hash_table_iter_next (&iter, &key, &v)) {
+				PurpleValue *value = (PurpleValue *) v;
 				if (purple_value_get_boolean(value))
 					g_string_append_printf(s, "%s = True \n", (char *) key);
 				else
============================================================
--- user.cpp	1166d5f5ea74bd5a98805d12f96327f2f748603d
+++ user.cpp	40187bff7aece6e31d0437cce6a2c73fc511cb3f
@@ -60,7 +60,7 @@ User::User(GlooxMessageHandler *parent, 
 	m_connected = false;
 	m_roster = p->sql()->getRosterByJid(m_jid);
 	m_vip = p->sql()->isVIP(m_jid);
-	m_settings = p->sql()->getSettings(m_jid);
+	m_settings = p->sql()->getSettings(userKey);
 	m_syncTimer = 0;
 	m_readyForConnect = false;
 	m_rosterXCalled = false;
@@ -75,25 +75,25 @@ User::User(GlooxMessageHandler *parent, 
 	
 	// check default settings
 	if ( (value = getSetting("enable_transport")) == NULL ) {
-		p->sql()->addSetting(m_jid, "enable_transport", "1", PURPLE_TYPE_BOOLEAN);
+		p->sql()->addSetting(m_userKey, "enable_transport", "1", PURPLE_TYPE_BOOLEAN);
 		value = purple_value_new(PURPLE_TYPE_BOOLEAN);
 		purple_value_set_boolean(value, true);
 		g_hash_table_replace(m_settings, g_strdup("enable_transport"), value);
 	}
 	if ( (value = getSetting("enable_notify_email")) == NULL ) {
-		p->sql()->addSetting(m_jid, "enable_notify_email", "0", PURPLE_TYPE_BOOLEAN);
+		p->sql()->addSetting(m_userKey, "enable_notify_email", "0", PURPLE_TYPE_BOOLEAN);
 		value = purple_value_new(PURPLE_TYPE_BOOLEAN);
 		purple_value_set_boolean(value, false);
 		g_hash_table_replace(m_settings, g_strdup("enable_notify_email"), value);
 	}
 	if ( (value = getSetting("enable_avatars")) == NULL ) {
-		p->sql()->addSetting(m_jid, "enable_avatars", "1", PURPLE_TYPE_BOOLEAN);
+		p->sql()->addSetting(m_userKey, "enable_avatars", "1", PURPLE_TYPE_BOOLEAN);
 		value = purple_value_new(PURPLE_TYPE_BOOLEAN);
 		purple_value_set_boolean(value, true);
 		g_hash_table_replace(m_settings, g_strdup("enable_avatars"), value);
 	}
 	if ( (value = getSetting("enable_chatstate")) == NULL ) {
-		p->sql()->addSetting(m_jid, "enable_chatstate", "1", PURPLE_TYPE_BOOLEAN);
+		p->sql()->addSetting(m_userKey, "enable_chatstate", "1", PURPLE_TYPE_BOOLEAN);
 		value = purple_value_new(PURPLE_TYPE_BOOLEAN);
 		purple_value_set_boolean(value, true);
 		g_hash_table_replace(m_settings, g_strdup("enable_chatstate"), value);
@@ -671,9 +671,9 @@ void User::updateSetting(const std::stri
 void User::updateSetting(const std::string &key, PurpleValue *value) {
 	if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) {
 		if (purple_value_get_boolean(value))
-			p->sql()->updateSetting(m_jid, key, "1");
+			p->sql()->updateSetting(m_userKey, key, "1");
 		else
-			p->sql()->updateSetting(m_jid, key, "0");
+			p->sql()->updateSetting(m_userKey, key, "0");
 	}
 	g_hash_table_replace(m_settings, g_strdup(key.c_str()), value);
 }
@@ -863,13 +863,11 @@ void User::connect(){
 	if (purple_accounts_find(m_username.c_str(), this->p->protocol()->protocol().c_str()) != NULL){
 		Log().Get(m_jid) << "this account already exists";
 		m_account = purple_accounts_find(m_username.c_str(), this->p->protocol()->protocol().c_str());
-		purple_account_set_ui_bool(m_account,"hiicq","auto-login",false);
 	}
 	else{
 		Log().Get(m_jid) << "creating new account";
 		m_account = purple_account_new(m_username.c_str(), this->p->protocol()->protocol().c_str());
 		purple_account_set_string(m_account,"encoding","windows-1250");
-		purple_account_set_ui_bool(m_account,"hiicq","auto-login",false);
 
 		purple_accounts_add(m_account);
 	}
@@ -897,6 +895,7 @@ void User::connect(){
 	if (valid && purple_value_get_boolean(getSetting("enable_transport"))){
 		purple_account_set_enabled(m_account, HIICQ_UI, TRUE);
 		purple_account_connect(m_account);
+		purple_account_set_ui_bool(m_account,"hiicq","auto-login",false);
 	}
 }
 


More information about the Commits mailing list