soc.2009.transport: 8377d70e: Added support for PURPLE_TYPE_STRING in ...

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Tue Jul 14 13:05:48 EDT 2009


-----------------------------------------------------------------
Revision: 8377d70e1fca4d7b780e703644af1148dbcc400e
Ancestor: 6d81c0a370fe09bfb2ac55f406691e29ea7cc7ae
Author: hanzz at soc.pidgin.im
Date: 2009-07-14T10:27:30
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/8377d70e1fca4d7b780e703644af1148dbcc400e

Modified files:
        commands.cpp

ChangeLog: 

Added support for PURPLE_TYPE_STRING in PurpleCmds

-------------- next part --------------
============================================================
--- commands.cpp	0092760558252d67d56dac8159b245533eaf8d89
+++ commands.cpp	b04329ddfcd7fe6a9311a558b4907543e882eb4b
@@ -41,10 +41,15 @@ static PurpleCmdRet settings_command_cb(
 			g_hash_table_iter_init (&iter, settings);
 			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
-					g_string_append_printf(s, "%s = False \n", (char *) key);
+				if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN) {
+					if (purple_value_get_boolean(value))
+						g_string_append_printf(s, "%s = True \n", (char *) key);
+					else
+						g_string_append_printf(s, "%s = False \n", (char *) key);
+				}
+				else if (purple_value_get_type(value) == PURPLE_TYPE_STRING) {
+					g_string_append_printf(s, "%s = %s \n", (char *) key, purple_value_get_string(value));
+				}
 			}
 		}
 		else if (cmd == "set") {
@@ -61,6 +66,12 @@ static PurpleCmdRet settings_command_cb(
 						else
 							g_string_append_printf(s, "%s is now False \n", args[1]);
 					}
+					else if (purple_value_get_type(value) == PURPLE_TYPE_STRING) {
+						value = purple_value_new(PURPLE_TYPE_STRING);
+						purple_value_set_string(value, args[2]);
+						user->updateSetting(args[1], value);
+						g_string_append_printf(s, "%s is now \"%s\" \n", args[1], args[2]);
+					}
 				}
 				else {
 					g_string_append_printf(s, " This setting key doesn't exist. Try to use \"/transport settings list\" to get settings keys.\n");


More information about the Commits mailing list