summary refs log tree commit diff stats
path: root/plugins
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-04-08 17:16:32 -0300
committerTingPing <tngpng@gmail.com>2013-04-08 17:16:32 -0300
commitad820cef8a5ae228193f090518eb81638c2dc061 (patch)
treeec67d0b42fd09e9462be5156d7b840351cd6112f /plugins
parent68de2bcb00161656a90ee0a396482daac4c639d0 (diff)
Give both modules the version too.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/python/python.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/plugins/python/python.c b/plugins/python/python.c
index b0748e97..098abb3e 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -1122,7 +1122,7 @@ static PyObject *
 Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
 {
 	PluginObject *plugin = NULL;
-	PyObject *m, *o;
+	PyObject *m, *hm, *xm, *o;
 	char *argv[] = {"<xchat>", 0};
 
 	if (filename) {
@@ -1166,44 +1166,45 @@ Plugin_New(char *filename, PyMethodDef *xchat_methods, PyObject *xcoobj)
 	PySys_SetObject("stderr", xcoobj);
 
 	/* Add xchat module to the environment. */
-	m = Py_InitModule("xchat", xchat_methods);
-	if (m == NULL) {
+	xm = Py_InitModule("xchat", xchat_methods);
+	if (xm == NULL) {
 		hexchat_print(ph, "Can't create xchat module");
 		goto error;
 	}
-	
-	PyModule_AddIntConstant(m, "EAT_NONE", HEXCHAT_EAT_NONE);
-	PyModule_AddIntConstant(m, "EAT_XCHAT", HEXCHAT_EAT_HEXCHAT);
-	PyModule_AddIntConstant(m, "EAT_PLUGIN", HEXCHAT_EAT_PLUGIN);
-	PyModule_AddIntConstant(m, "EAT_ALL", HEXCHAT_EAT_ALL);
-	PyModule_AddIntConstant(m, "PRI_HIGHEST", HEXCHAT_PRI_HIGHEST);
-	PyModule_AddIntConstant(m, "PRI_HIGH", HEXCHAT_PRI_HIGH);
-	PyModule_AddIntConstant(m, "PRI_NORM", HEXCHAT_PRI_NORM);
-	PyModule_AddIntConstant(m, "PRI_LOW", HEXCHAT_PRI_LOW);
-	PyModule_AddIntConstant(m, "PRI_LOWEST", HEXCHAT_PRI_LOWEST);
-	
-	m = Py_InitModule("hexchat", xchat_methods);
-	if (m == NULL) {
+	hm = Py_InitModule("hexchat", xchat_methods);
+	if (hm == NULL) {
 		hexchat_print(ph, "Can't create hexchat module");
 		goto error;
 	}
+	
+	PyModule_AddIntConstant(xm, "EAT_NONE", HEXCHAT_EAT_NONE);
+	PyModule_AddIntConstant(xm, "EAT_XCHAT", HEXCHAT_EAT_HEXCHAT);
+	PyModule_AddIntConstant(xm, "EAT_PLUGIN", HEXCHAT_EAT_PLUGIN);
+	PyModule_AddIntConstant(xm, "EAT_ALL", HEXCHAT_EAT_ALL);
+	PyModule_AddIntConstant(xm, "PRI_HIGHEST", HEXCHAT_PRI_HIGHEST);
+	PyModule_AddIntConstant(xm, "PRI_HIGH", HEXCHAT_PRI_HIGH);
+	PyModule_AddIntConstant(xm, "PRI_NORM", HEXCHAT_PRI_NORM);
+	PyModule_AddIntConstant(xm, "PRI_LOW", HEXCHAT_PRI_LOW);
+	PyModule_AddIntConstant(xm, "PRI_LOWEST", HEXCHAT_PRI_LOWEST);
+	PyModule_AddIntConstant(hm, "EAT_NONE", HEXCHAT_EAT_NONE);
+	PyModule_AddIntConstant(hm, "EAT_XCHAT", HEXCHAT_EAT_HEXCHAT);
+	PyModule_AddIntConstant(hm, "EAT_PLUGIN", HEXCHAT_EAT_PLUGIN);
+	PyModule_AddIntConstant(hm, "EAT_ALL", HEXCHAT_EAT_ALL);
+	PyModule_AddIntConstant(hm, "PRI_HIGHEST", HEXCHAT_PRI_HIGHEST);
+	PyModule_AddIntConstant(hm, "PRI_HIGH", HEXCHAT_PRI_HIGH);
+	PyModule_AddIntConstant(hm, "PRI_NORM", HEXCHAT_PRI_NORM);
+	PyModule_AddIntConstant(hm, "PRI_LOW", HEXCHAT_PRI_LOW);
+	PyModule_AddIntConstant(hm, "PRI_LOWEST", HEXCHAT_PRI_LOWEST);
+
 
-	PyModule_AddIntConstant(m, "EAT_NONE", HEXCHAT_EAT_NONE);
-	PyModule_AddIntConstant(m, "EAT_XCHAT", HEXCHAT_EAT_HEXCHAT);
-	PyModule_AddIntConstant(m, "EAT_PLUGIN", HEXCHAT_EAT_PLUGIN);
-	PyModule_AddIntConstant(m, "EAT_ALL", HEXCHAT_EAT_ALL);
-	PyModule_AddIntConstant(m, "PRI_HIGHEST", HEXCHAT_PRI_HIGHEST);
-	PyModule_AddIntConstant(m, "PRI_HIGH", HEXCHAT_PRI_HIGH);
-	PyModule_AddIntConstant(m, "PRI_NORM", HEXCHAT_PRI_NORM);
-	PyModule_AddIntConstant(m, "PRI_LOW", HEXCHAT_PRI_LOW);
-	PyModule_AddIntConstant(m, "PRI_LOWEST", HEXCHAT_PRI_LOWEST);
 
 	o = Py_BuildValue("(ii)", VERSION_MAJOR, VERSION_MINOR);
 	if (o == NULL) {
 		hexchat_print(ph, "Can't create version tuple");
 		goto error;
 	}
-	PyObject_SetAttrString(m, "__version__", o);
+	PyObject_SetAttrString(xm, "__version__", o);
+	PyObject_SetAttrString(hm, "__version__", o);
 
 	if (filename) {
 #ifdef WIN32