mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-25 15:36:21 +00:00
Return boolean on prof_settings_string_list_remove_all()
This commit is contained in:
@@ -440,10 +440,10 @@ api_settings_string_list_remove(const char *const group, const char *const key,
|
|||||||
return plugin_settings_string_list_remove(group, key, value);
|
return plugin_settings_string_list_remove(group, key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
api_settings_string_list_remove_all(const char *const group, const char *const key)
|
api_settings_string_list_remove_all(const char *const group, const char *const key)
|
||||||
{
|
{
|
||||||
plugin_settings_string_list_remove_all(group, key);
|
return plugin_settings_string_list_remove_all(group, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void api_settings_set_int(const char *const group, const char *const key, int va
|
|||||||
char** api_settings_get_string_list(const char *const group, const char *const key);
|
char** api_settings_get_string_list(const char *const group, const char *const key);
|
||||||
void api_settings_string_list_add(const char *const group, const char *const key, const char *const value);
|
void api_settings_string_list_add(const char *const group, const char *const key, const char *const value);
|
||||||
int api_settings_string_list_remove(const char *const group, const char *const key, const char *const value);
|
int api_settings_string_list_remove(const char *const group, const char *const key, const char *const value);
|
||||||
void api_settings_string_list_remove_all(const char *const group, const char *const key);
|
int api_settings_string_list_remove_all(const char *const group, const char *const key);
|
||||||
|
|
||||||
void api_incoming_message(const char *const barejid, const char *const resource, const char *const message);
|
void api_incoming_message(const char *const barejid, const char *const resource, const char *const message);
|
||||||
|
|
||||||
|
|||||||
@@ -850,10 +850,13 @@ python_api_settings_get_string_list(PyObject *self, PyObject *args)
|
|||||||
PyObject *py_curr = Py_BuildValue("s", c_list[i]);
|
PyObject *py_curr = Py_BuildValue("s", c_list[i]);
|
||||||
int res = PyList_Append(py_list, py_curr);
|
int res = PyList_Append(py_list, py_curr);
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
|
g_strfreev(c_list);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_strfreev(c_list);
|
||||||
|
|
||||||
return Py_BuildValue("O", py_list);
|
return Py_BuildValue("O", py_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,19 +921,23 @@ python_api_settings_string_list_remove_all(PyObject *self, PyObject *args)
|
|||||||
PyObject *key = NULL;
|
PyObject *key = NULL;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "OO", &group, &key)) {
|
if (!PyArg_ParseTuple(args, "OO", &group, &key)) {
|
||||||
Py_RETURN_NONE;
|
return Py_BuildValue("O", Py_False);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *group_str = python_str_or_unicode_to_string(group);
|
char *group_str = python_str_or_unicode_to_string(group);
|
||||||
char *key_str = python_str_or_unicode_to_string(key);
|
char *key_str = python_str_or_unicode_to_string(key);
|
||||||
|
|
||||||
allow_python_threads();
|
allow_python_threads();
|
||||||
api_settings_string_list_remove_all(group_str, key_str);
|
int res = api_settings_string_list_remove_all(group_str, key_str);
|
||||||
free(group_str);
|
free(group_str);
|
||||||
free(key_str);
|
free(key_str);
|
||||||
disable_python_threads();
|
disable_python_threads();
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
if (res) {
|
||||||
|
return Py_BuildValue("O", Py_True);
|
||||||
|
} else {
|
||||||
|
return Py_BuildValue("O", Py_False);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
|
|||||||
@@ -155,15 +155,17 @@ plugin_settings_string_list_remove(const char *const group, const char *const ke
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
plugin_settings_string_list_remove_all(const char *const group, const char *const key)
|
plugin_settings_string_list_remove_all(const char *const group, const char *const key)
|
||||||
{
|
{
|
||||||
if (!g_key_file_has_key(settings, group, key, NULL)) {
|
if (!g_key_file_has_key(settings, group, key, NULL)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_key_file_remove_key(settings, group, key, NULL);
|
g_key_file_remove_key(settings, group, key, NULL);
|
||||||
_save_settings();
|
_save_settings();
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ void plugin_settings_set_int(const char *const group, const char *const key, int
|
|||||||
char** plugin_settings_get_string_list(const char *const group, const char *const key);
|
char** plugin_settings_get_string_list(const char *const group, const char *const key);
|
||||||
void plugin_settings_string_list_add(const char *const group, const char *const key, const char *const value);
|
void plugin_settings_string_list_add(const char *const group, const char *const key, const char *const value);
|
||||||
int plugin_settings_string_list_remove(const char *const group, const char *const key, const char *const value);
|
int plugin_settings_string_list_remove(const char *const group, const char *const key, const char *const value);
|
||||||
void plugin_settings_string_list_remove_all(const char *const group, const char *const key);
|
int plugin_settings_string_list_remove_all(const char *const group, const char *const key);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user