soc.2009.transport: 42fb5ba3: Fixed IRC Nickserv

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Wed Jul 15 11:25:39 EDT 2009


-----------------------------------------------------------------
Revision: 42fb5ba3ab61c31c2516349ace31bf87591d7c1a
Ancestor: 8377d70e1fca4d7b780e703644af1148dbcc400e
Author: hanzz at soc.pidgin.im
Date: 2009-07-15T15:18:26
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/42fb5ba3ab61c31c2516349ace31bf87591d7c1a

Modified files:
        protocols/irc.cpp sql.cpp user.cpp

ChangeLog: 

Fixed IRC Nickserv

-------------- next part --------------
============================================================
--- protocols/irc.cpp	d3d011c5e921d54c5b2ec67256ad7f876601fdc3
+++ protocols/irc.cpp	bfeefaf6abd4ab8ddfaf9b764b234674d35370c5
@@ -75,9 +75,11 @@ void IRCProtocol::onConnected(User *user
 
 void IRCProtocol::onConnected(User *user) {
 	IRCProtocolData *data = (IRCProtocolData *) user->protocolData();
-	std::string nickserv(purple_value_get_string(user->getSetting("nickserv")));
+	const char *n = purple_value_get_string(user->getSetting("nickserv"));
+	std::string nickserv(n ? n : "");
 	if (!nickserv.empty()) {
-		Message msg(Message::Chat, JID("NickServ at server.cz"), "identify " + nickserv);
+		// receivedMessage will send PM according to resource, so it doesn't matter what's before it... :)
+		Message msg(Message::Chat, JID("#test%test at server.cz/NickServ"), "identify " + nickserv);
 		msg.setFrom(user->jid());
 		user->receivedMessage(msg);
 	}
============================================================
--- sql.cpp	ba3b49d82c3c5d43beb29d8a662eca6a636752f5
+++ sql.cpp	485c97641ac1c2a1e5f6eec39a27c51027101e25
@@ -377,6 +377,10 @@ GHashTable * SQLClass::getSettings(const
 				value = purple_value_new(PURPLE_TYPE_BOOLEAN);
 				purple_value_set_boolean(value, atoi(row["value"]));
 			}
+			if (type == PURPLE_TYPE_STRING) {
+				value = purple_value_new(PURPLE_TYPE_STRING);
+				purple_value_set_string(value, row["value"]);
+			}
 			g_hash_table_replace(settings, g_strdup(row["var"]), value);
 		}
 	}
============================================================
--- user.cpp	b75f2979ddcc65d9d120b712d8df4e28d5f4f4e9
+++ user.cpp	bfab123fadfde64dca7d4ed18fe2da449dac9eb0
@@ -679,6 +679,9 @@ void User::updateSetting(const std::stri
 		else
 			p->sql()->updateSetting(m_userKey, key, "0");
 	}
+	else if (purple_value_get_type(value) == PURPLE_TYPE_STRING) {
+		p->sql()->updateSetting(m_userKey, key, purple_value_get_string(value));
+	}
 	g_hash_table_replace(m_settings, g_strdup(key.c_str()), value);
 }
 
@@ -768,8 +771,9 @@ void User::receivedMessage(const Message
 	if (!p->protocol()->isMUC(this, username)) {
 		std::for_each( username.begin(), username.end(), replaceJidCharacters() );
 	}
-	else if (!msg.to().resource().empty())
+	else if (!msg.to().resource().empty()) {
 		username = msg.to().resource();
+	}
 	// open new conversation or get the opened one
 	if (!isOpenedConversation(username)){
 		conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,m_account,username.c_str());


More information about the Commits mailing list