diff options
author | James Booth <boothj5@gmail.com> | 2017-01-18 22:46:29 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2017-01-18 22:46:29 +0000 |
commit | fccf56be1059a2c254b9ed08fc385ee4e0513dee (patch) | |
tree | fd0a65c17b7a5e1186643c2f5a7b1aceab979998 /src/plugins/python_api.c | |
parent | 70e831e08b803fe894296fc1f6b0f4157198a833 (diff) | |
download | profani-tty-fccf56be1059a2c254b9ed08fc385ee4e0513dee.tar.gz |
Add prof.encryption_reset to Plugins API
issue #885
Diffstat (limited to 'src/plugins/python_api.c')
-rw-r--r-- | src/plugins/python_api.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c index b7145ecc..b92cdc88 100644 --- a/src/plugins/python_api.c +++ b/src/plugins/python_api.c @@ -1031,6 +1031,24 @@ python_api_disco_add_feature(PyObject *self, PyObject *args) Py_RETURN_NONE; } +static PyObject* +python_api_encryption_reset(PyObject *self, PyObject *args) +{ + PyObject *barejid = NULL; + if (!PyArg_ParseTuple(args, "O", &barejid)) { + Py_RETURN_NONE; + } + + char *barejid_str = python_str_or_unicode_to_string(barejid); + + allow_python_threads(); + api_encryption_reset(barejid_str); + free(barejid_str); + disable_python_threads(); + + Py_RETURN_NONE; +} + void python_command_callback(PluginCommand *command, gchar **args) { @@ -1139,6 +1157,7 @@ static PyMethodDef apiMethods[] = { { "settings_string_list_clear", python_api_settings_string_list_clear, METH_VARARGS, "Remove all items from string list setting." }, { "incoming_message", python_api_incoming_message, METH_VARARGS, "Show an incoming message." }, { "disco_add_feature", python_api_disco_add_feature, METH_VARARGS, "Add a feature to disco info response." }, + { "encryption_reset", python_api_encryption_reset, METH_VARARGS, "End encrypted chat session with barejid, if one exists" }, { NULL, NULL, 0, NULL } }; |