diff options
| author | James Booth <boothj5@gmail.com> | 2017-08-10 22:17:05 +0100 |
|---|---|---|
| committer | James Booth <boothj5@gmail.com> | 2017-08-10 22:17:05 +0100 |
| commit | 17b4e45c5795ed191d06964feeb2d20ae7ec6e94 (patch) | |
| tree | 5aea07eb10dd1c0cea5dc50591fed8e5e01f4a0b /src/plugins | |
| parent | e9701cfafa74946dcac944a5ace1e1d747968313 (diff) | |
| download | profani-tty-17b4e45c5795ed191d06964feeb2d20ae7ec6e94.tar.gz | |
Show Python version on --version
issue #956
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/python_plugins.c | 13 | ||||
| -rw-r--r-- | src/plugins/python_plugins.h | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c index f8f35628..934a2e4f 100644 --- a/src/plugins/python_plugins.c +++ b/src/plugins/python_plugins.c @@ -74,11 +74,22 @@ _unref_module(PyObject *module) } const char* -python_get_version(void) +python_get_version_string(void) { return Py_GetVersion(); } +gchar* +python_get_version_number(void) +{ + const char *version_str = Py_GetVersion(); + gchar **split = g_strsplit(version_str, " ", 0); + gchar *version_number = g_strdup(split[0]); + g_strfreev(split); + + return version_number; +} + void python_env_init(void) { diff --git a/src/plugins/python_plugins.h b/src/plugins/python_plugins.h index 778846b2..4b76ce4c 100644 --- a/src/plugins/python_plugins.h +++ b/src/plugins/python_plugins.h @@ -43,7 +43,8 @@ void python_check_error(void); void allow_python_threads(); void disable_python_threads(); -const char* python_get_version(void); +const char* python_get_version_string(void); +gchar* python_get_version_number(void); void python_init_hook(ProfPlugin *plugin, const char *const version, const char *const status, const char *const account_name, const char *const fulljid); |