1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2016-07-25 22:24:36 +01:00
commit 2d212502a9
5 changed files with 47 additions and 26 deletions

View File

@ -2640,9 +2640,9 @@ _join_autocomplete(ProfWin *window, const char *const input)
if (result) { if (result) {
gboolean space_at_end = g_str_has_suffix(input, " "); gboolean space_at_end = g_str_has_suffix(input, " ");
GString *beginning = g_string_new("/join");
int num_args = g_strv_length(args); int num_args = g_strv_length(args);
if ((num_args == 1 && space_at_end) || (num_args == 2 && !space_at_end)) { if ((num_args == 1 && space_at_end) || (num_args == 2 && !space_at_end)) {
GString *beginning = g_string_new("/join");
g_string_append_printf(beginning, " %s", args[0]); g_string_append_printf(beginning, " %s", args[0]);
found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE); found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE);
g_string_free(beginning, TRUE); g_string_free(beginning, TRUE);
@ -2652,6 +2652,7 @@ _join_autocomplete(ProfWin *window, const char *const input)
} }
} }
if ((num_args == 3 && space_at_end) || (num_args == 4 && !space_at_end)) { if ((num_args == 3 && space_at_end) || (num_args == 4 && !space_at_end)) {
GString *beginning = g_string_new("/join");
g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]); g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]);
found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE); found = autocomplete_param_with_ac(input, beginning->str, join_property_ac, TRUE);
g_string_free(beginning, TRUE); g_string_free(beginning, TRUE);

View File

@ -403,7 +403,7 @@ _chat_log_chat(const char *const login, const char *const other, const char *con
void void
groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, const gchar *const msg) groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, const gchar *const msg)
{ {
gchar *room_copy = strdup(room); char *room_copy = strdup(room);
struct dated_chat_log *dated_log = g_hash_table_lookup(groupchat_logs, room_copy); struct dated_chat_log *dated_log = g_hash_table_lookup(groupchat_logs, room_copy);
// no log for room // no log for room
@ -416,6 +416,7 @@ groupchat_log_chat(const gchar *const login, const gchar *const room, const gcha
dated_log = _create_groupchat_log(room_copy, login); dated_log = _create_groupchat_log(room_copy, login);
g_hash_table_replace(logs, room_copy, dated_log); g_hash_table_replace(logs, room_copy, dated_log);
} }
free(room_copy);
GDateTime *dt = g_date_time_new_now_local(); GDateTime *dt = g_date_time_new_now_local();

View File

@ -299,6 +299,7 @@ plugins_run_command(const char * const input)
curr_hash = g_list_next(curr_hash); curr_hash = g_list_next(curr_hash);
} }
g_list_free(command_hashes);
g_strfreev(split); g_strfreev(split);
return FALSE; return FALSE;
} }

View File

@ -740,7 +740,9 @@ python_api_settings_get_string(PyObject *self, PyObject *args)
disable_python_threads(); disable_python_threads();
if (res) { if (res) {
return Py_BuildValue("s", res); PyObject *pyres = Py_BuildValue("s", res);
free(res);
return pyres;
} else { } else {
Py_RETURN_NONE; Py_RETURN_NONE;
} }

View File

@ -172,6 +172,7 @@ python_init_hook(ProfPlugin *plugin, const char *const version, const char *cons
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -189,6 +190,7 @@ python_on_start_hook(ProfPlugin *plugin)
PyObject_CallObject(p_function, NULL); PyObject_CallObject(p_function, NULL);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
allow_python_threads(); allow_python_threads();
@ -249,6 +251,7 @@ python_on_connect_hook(ProfPlugin *plugin, const char *const account_name, const
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -269,6 +272,7 @@ python_on_disconnect_hook(ProfPlugin *plugin, const char *const account_name, co
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -287,13 +291,14 @@ python_pre_chat_message_display_hook(ProfPlugin *plugin, const char *const jid,
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -315,7 +320,7 @@ python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const jid,
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -334,13 +339,14 @@ python_pre_chat_message_send_hook(ProfPlugin *plugin, const char * const jid, co
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -362,7 +368,7 @@ python_post_chat_message_send_hook(ProfPlugin *plugin, const char *const jid, co
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -381,13 +387,14 @@ python_pre_room_message_display_hook(ProfPlugin *plugin, const char * const room
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -410,7 +417,7 @@ python_post_room_message_display_hook(ProfPlugin *plugin, const char *const room
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -429,13 +436,14 @@ python_pre_room_message_send_hook(ProfPlugin *plugin, const char *const room, co
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -457,7 +465,7 @@ python_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, c
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -479,7 +487,7 @@ python_on_room_history_message_hook(ProfPlugin *plugin, const char *const room,
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -499,13 +507,14 @@ python_pre_priv_message_display_hook(ProfPlugin *plugin, const char *const room,
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -528,7 +537,7 @@ python_post_priv_message_display_hook(ProfPlugin *plugin, const char *const room
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -548,13 +557,14 @@ python_pre_priv_message_send_hook(ProfPlugin *plugin, const char *const room, co
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -577,7 +587,7 @@ python_post_priv_message_send_hook(ProfPlugin *plugin, const char *const room, c
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -596,13 +606,14 @@ python_on_message_stanza_send_hook(ProfPlugin *plugin, const char *const text)
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -622,6 +633,7 @@ python_on_message_stanza_receive_hook(ProfPlugin *plugin, const char *const text
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
if (PyObject_IsTrue(result)) { if (PyObject_IsTrue(result)) {
allow_python_threads(); allow_python_threads();
return TRUE; return TRUE;
@ -631,7 +643,7 @@ python_on_message_stanza_receive_hook(ProfPlugin *plugin, const char *const text
} }
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return TRUE; return TRUE;
} }
@ -651,13 +663,14 @@ python_on_presence_stanza_send_hook(ProfPlugin *plugin, const char *const text)
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -677,6 +690,7 @@ python_on_presence_stanza_receive_hook(ProfPlugin *plugin, const char *const tex
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
if (PyObject_IsTrue(result)) { if (PyObject_IsTrue(result)) {
allow_python_threads(); allow_python_threads();
return TRUE; return TRUE;
@ -686,7 +700,7 @@ python_on_presence_stanza_receive_hook(ProfPlugin *plugin, const char *const tex
} }
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return TRUE; return TRUE;
} }
@ -706,13 +720,14 @@ python_on_iq_stanza_send_hook(ProfPlugin *plugin, const char *const text)
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
char *result_str = python_str_or_unicode_to_string(result); char *result_str = python_str_or_unicode_to_string(result);
allow_python_threads(); allow_python_threads();
return result_str; return result_str;
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return NULL; return NULL;
} }
@ -732,6 +747,7 @@ python_on_iq_stanza_receive_hook(ProfPlugin *plugin, const char *const text)
PyObject *result = PyObject_CallObject(p_function, p_args); PyObject *result = PyObject_CallObject(p_function, p_args);
python_check_error(); python_check_error();
Py_XDECREF(p_function); Py_XDECREF(p_function);
Py_XDECREF(p_args);
if (PyObject_IsTrue(result)) { if (PyObject_IsTrue(result)) {
allow_python_threads(); allow_python_threads();
return TRUE; return TRUE;
@ -741,7 +757,7 @@ python_on_iq_stanza_receive_hook(ProfPlugin *plugin, const char *const text)
} }
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
return TRUE; return TRUE;
} }
@ -764,7 +780,7 @@ python_on_contact_offline_hook(ProfPlugin *plugin, const char *const barejid, co
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -786,7 +802,7 @@ python_on_contact_presence_hook(ProfPlugin *plugin, const char *const barejid, c
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -807,7 +823,7 @@ python_on_chat_win_focus_hook(ProfPlugin *plugin, const char *const barejid)
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }
@ -828,7 +844,7 @@ python_on_room_win_focus_hook(ProfPlugin *plugin, const char *const roomjid)
Py_XDECREF(p_function); Py_XDECREF(p_function);
} }
} }
Py_XDECREF(p_args);
allow_python_threads(); allow_python_threads();
} }