summary refs log tree commit diff stats
path: root/plugins/python/python.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/python/python.c')
-rw-r--r--plugins/python/python.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 5f98c6c7..239703a8 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -1610,12 +1610,15 @@ Module_hexchat_pluginpref_get(PyObject *self, PyObject *args)
 	if (!PyArg_ParseTuple(args, "s:get_pluginpref", &var))
 		return NULL;
 	// This will always return numbers as integers.
-	retint = hexchat_pluginpref_get_int(ph, var);
 	if (hexchat_pluginpref_get_str(ph, var, retstr)) {
-		if ((retint == 0) && (strcmp(retstr, "0") != 0))
+		if (strlen (retstr) <= 12) {
+			retint = hexchat_pluginpref_get_int(ph, var);
+			if ((retint == 0) && (strcmp(retstr, "0") != 0))
+				ret = PyString_FromString(retstr);
+			else
+				ret = PyInt_FromLong(retint);
+		} else
 			ret = PyString_FromString(retstr);
-		else
-			ret = PyInt_FromLong(retint);
 	}
 	else
 		ret = Py_None;