diff options
author | Emmanuel Bouthenot <kolter@openics.org> | 2006-06-10 21:34:16 +0000 |
---|---|---|
committer | Emmanuel Bouthenot <kolter@openics.org> | 2006-06-10 21:34:16 +0000 |
commit | b48fb5c0ec387cf5be61a80c51c4b95589c56179 (patch) | |
tree | d87b5156c9f7593ed8ee9907885fd765918321d4 /src/plugins/scripts/python/weechat-python.c | |
parent | 08aa5570d87b6a971933e1a85f5277543a1e0786 (diff) | |
download | weechat-b48fb5c0ec387cf5be61a80c51c4b95589c56179.zip |
add get_irc_color function in plugins/scripts
Diffstat (limited to 'src/plugins/scripts/python/weechat-python.c')
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 36c699778..0ccb43611 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -1251,6 +1251,43 @@ weechat_python_get_nick_info (PyObject *self, PyObject *args) } /* + * weechat_python_get_irc_color: + * get the numeric value which identify an irc color by its name + */ + +static PyObject * +weechat_python_get_irc_color (PyObject *self, PyObject *args) +{ + char *color; + + /* make gcc happy */ + (void) self; + + if (!python_current_script) + { + python_plugin->print_server (python_plugin, + "Python error: unable to get irc color, " + "script not initialized"); + return Py_BuildValue ("i", -1); + } + + color = NULL; + + if (!PyArg_ParseTuple (args, "s", &color)) + { + python_plugin->print_server (python_plugin, + "Python error: wrong parameters for " + "\"get_irc_color\" function"); + return Py_BuildValue ("i", -1); + } + + if (color) + return Py_BuildValue ("i", python_plugin->get_irc_color (python_plugin, color)); + + return Py_BuildValue ("i", -1); +} + +/* * Python subroutines */ @@ -1278,6 +1315,7 @@ PyMethodDef weechat_python_funcs[] = { { "get_server_info", weechat_python_get_server_info, METH_VARARGS, "" }, { "get_channel_info", weechat_python_get_channel_info, METH_VARARGS, "" }, { "get_nick_info", weechat_python_get_nick_info, METH_VARARGS, "" }, + { "get_irc_color", weechat_python_get_irc_color, METH_VARARGS, "" }, { NULL, NULL, 0, NULL } }; |