mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge remote-tracking branch 'origin/osx-functional' into osx-functional
This commit is contained in:
commit
f2bb867934
@ -12,9 +12,7 @@
|
|||||||
otrl_init
|
otrl_init
|
||||||
Memcheck:Leak
|
Memcheck:Leak
|
||||||
...
|
...
|
||||||
fun:_otr_init
|
fun:otrl_init
|
||||||
fun:_init
|
|
||||||
fun:prof_run
|
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ static struct cmd_t command_defs[] =
|
|||||||
CMD_SYN(
|
CMD_SYN(
|
||||||
"/group",
|
"/group",
|
||||||
"/group show <group>",
|
"/group show <group>",
|
||||||
"/group add <group> <contat>"
|
"/group add <group> <contat>",
|
||||||
"/group remove <group> <contact>")
|
"/group remove <group> <contact>")
|
||||||
CMD_DESC(
|
CMD_DESC(
|
||||||
"View, add to, and remove from roster groups. "
|
"View, add to, and remove from roster groups. "
|
||||||
|
@ -5160,7 +5160,7 @@ cmd_log(ProfWin *window, const char *const command, gchar **args)
|
|||||||
gboolean res = strtoi_range(value, &intval, PREFS_MIN_LOG_SIZE, INT_MAX, &err_msg);
|
gboolean res = strtoi_range(value, &intval, PREFS_MIN_LOG_SIZE, INT_MAX, &err_msg);
|
||||||
if (res) {
|
if (res) {
|
||||||
prefs_set_max_log_size(intval);
|
prefs_set_max_log_size(intval);
|
||||||
cons_show("Log maxinum size set to %d bytes", intval);
|
cons_show("Log maximum size set to %d bytes", intval);
|
||||||
} else {
|
} else {
|
||||||
cons_show(err_msg);
|
cons_show(err_msg);
|
||||||
free(err_msg);
|
free(err_msg);
|
||||||
|
@ -411,6 +411,8 @@ tlscerts_free(TLSCertificate *cert)
|
|||||||
|
|
||||||
free(cert->key_alg);
|
free(cert->key_alg);
|
||||||
free(cert->signature_alg);
|
free(cert->signature_alg);
|
||||||
|
|
||||||
|
free(cert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +197,17 @@ api_get_current_muc(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
api_current_win_is_console(void)
|
||||||
|
{
|
||||||
|
ProfWin *current = wins_get_current();
|
||||||
|
if (current && current->type == WIN_CONSOLE) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
api_log_debug(const char *message)
|
api_log_debug(const char *message)
|
||||||
{
|
{
|
||||||
@ -228,12 +239,16 @@ api_win_exists(const char *tag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
api_win_create(const char *tag, void *callback,
|
api_win_create(
|
||||||
|
const char *tag,
|
||||||
|
void *callback,
|
||||||
|
void(*destroy)(void *callback),
|
||||||
void(*callback_func)(PluginWindowCallback *window_callback, const char *tag, const char * const line))
|
void(*callback_func)(PluginWindowCallback *window_callback, const char *tag, const char * const line))
|
||||||
{
|
{
|
||||||
PluginWindowCallback *window = malloc(sizeof(PluginWindowCallback));
|
PluginWindowCallback *window = malloc(sizeof(PluginWindowCallback));
|
||||||
window->callback = callback;
|
window->callback = callback;
|
||||||
window->callback_func = callback_func;
|
window->callback_func = callback_func;
|
||||||
|
window->destroy = destroy;
|
||||||
callbacks_add_window_handler(tag, window);
|
callbacks_add_window_handler(tag, window);
|
||||||
wins_new_plugin(tag);
|
wins_new_plugin(tag);
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ int api_cons_show_themed(const char *const group, const char *const item, const
|
|||||||
int api_cons_bad_cmd_usage(const char *const cmd);
|
int api_cons_bad_cmd_usage(const char *const cmd);
|
||||||
void api_notify(const char *message, const char *category, int timeout_ms);
|
void api_notify(const char *message, const char *category, int timeout_ms);
|
||||||
void api_send_line(char *line);
|
void api_send_line(char *line);
|
||||||
|
|
||||||
char * api_get_current_recipient(void);
|
char * api_get_current_recipient(void);
|
||||||
char * api_get_current_muc(void);
|
char * api_get_current_muc(void);
|
||||||
|
gboolean api_current_win_is_console(void);
|
||||||
|
|
||||||
void api_register_command(const char *command_name, int min_args, int max_args,
|
void api_register_command(const char *command_name, int min_args, int max_args,
|
||||||
const char **synopsis, const char *description, const char *arguments[][2], const char **examples,
|
const char **synopsis, const char *description, const char *arguments[][2], const char **examples,
|
||||||
@ -59,7 +61,10 @@ void api_log_warning(const char *message);
|
|||||||
void api_log_error(const char *message);
|
void api_log_error(const char *message);
|
||||||
|
|
||||||
int api_win_exists(const char *tag);
|
int api_win_exists(const char *tag);
|
||||||
void api_win_create(const char *tag, void *callback,
|
void api_win_create(
|
||||||
|
const char *tag,
|
||||||
|
void *callback,
|
||||||
|
void(*destroy)(void *callback),
|
||||||
void(*callback_func)(PluginWindowCallback *window_callback, char *tag, char *line));
|
void(*callback_func)(PluginWindowCallback *window_callback, char *tag, char *line));
|
||||||
int api_win_focus(const char *tag);
|
int api_win_focus(const char *tag);
|
||||||
int api_win_show(const char *tag, const char *line);
|
int api_win_show(const char *tag, const char *line);
|
||||||
|
@ -67,10 +67,12 @@ autocompleters_complete(const char * const input)
|
|||||||
while (curr) {
|
while (curr) {
|
||||||
result = autocomplete_param_with_ac(input, curr->data, g_hash_table_lookup(autocompleters, curr->data), TRUE);
|
result = autocomplete_param_with_ac(input, curr->data, g_hash_table_lookup(autocompleters, curr->data), TRUE);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
g_list_free(keys);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
curr = g_list_next(curr);
|
curr = g_list_next(curr);
|
||||||
}
|
}
|
||||||
|
g_list_free(keys);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -84,6 +86,8 @@ autocompleters_reset(void)
|
|||||||
autocomplete_reset(curr->data);
|
autocomplete_reset(curr->data);
|
||||||
curr = g_list_next(curr);
|
curr = g_list_next(curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_list_free(acs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void autocompleters_destroy(void)
|
void autocompleters_destroy(void)
|
||||||
|
@ -126,6 +126,12 @@ c_api_get_current_muc(void)
|
|||||||
return api_get_current_muc();
|
return api_get_current_muc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
c_api_current_win_is_console()
|
||||||
|
{
|
||||||
|
return api_current_win_is_console();
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
c_api_log_debug(const char *message)
|
c_api_log_debug(const char *message)
|
||||||
{
|
{
|
||||||
@ -161,7 +167,7 @@ c_api_win_create(char *tag, void(*callback)(char *tag, char *line))
|
|||||||
{
|
{
|
||||||
WindowWrapper *wrapper = malloc(sizeof(WindowWrapper));
|
WindowWrapper *wrapper = malloc(sizeof(WindowWrapper));
|
||||||
wrapper->func = callback;
|
wrapper->func = callback;
|
||||||
api_win_create(tag, wrapper, c_window_callback);
|
api_win_create(tag, wrapper, free, c_window_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -220,6 +226,7 @@ c_api_init(void)
|
|||||||
prof_send_line = c_api_send_line;
|
prof_send_line = c_api_send_line;
|
||||||
prof_get_current_recipient = c_api_get_current_recipient;
|
prof_get_current_recipient = c_api_get_current_recipient;
|
||||||
prof_get_current_muc = c_api_get_current_muc;
|
prof_get_current_muc = c_api_get_current_muc;
|
||||||
|
prof_current_win_is_console = c_api_current_win_is_console;
|
||||||
prof_log_debug = c_api_log_debug;
|
prof_log_debug = c_api_log_debug;
|
||||||
prof_log_info = c_api_log_info;
|
prof_log_info = c_api_log_info;
|
||||||
prof_log_warning = c_api_log_warning;
|
prof_log_warning = c_api_log_warning;
|
||||||
|
@ -46,6 +46,27 @@ static GSList *p_commands = NULL;
|
|||||||
static GSList *p_timed_functions = NULL;
|
static GSList *p_timed_functions = NULL;
|
||||||
static GHashTable *p_window_callbacks = NULL;
|
static GHashTable *p_window_callbacks = NULL;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_free_window_callback(PluginWindowCallback *window_callback)
|
||||||
|
{
|
||||||
|
if (window_callback->destroy) {
|
||||||
|
window_callback->destroy(window_callback->callback);
|
||||||
|
}
|
||||||
|
free(window_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
callbacks_init(void)
|
||||||
|
{
|
||||||
|
p_window_callbacks = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_free_window_callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
callbacks_close(void)
|
||||||
|
{
|
||||||
|
g_hash_table_destroy(p_window_callbacks);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
callbacks_add_command(PluginCommand *command)
|
callbacks_add_command(PluginCommand *command)
|
||||||
{
|
{
|
||||||
@ -64,10 +85,6 @@ callbacks_add_timed(PluginTimedFunction *timed_function)
|
|||||||
void
|
void
|
||||||
callbacks_add_window_handler(const char *tag, PluginWindowCallback *window_callback)
|
callbacks_add_window_handler(const char *tag, PluginWindowCallback *window_callback)
|
||||||
{
|
{
|
||||||
if (p_window_callbacks == NULL) {
|
|
||||||
p_window_callbacks = g_hash_table_new(g_str_hash, g_str_equal);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_insert(p_window_callbacks, strdup(tag), window_callback);
|
g_hash_table_insert(p_window_callbacks, strdup(tag), window_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,13 @@ typedef struct p_timed_function {
|
|||||||
|
|
||||||
typedef struct p_window_input_callback {
|
typedef struct p_window_input_callback {
|
||||||
void *callback;
|
void *callback;
|
||||||
|
void (*destroy)(void *callback);
|
||||||
void (*callback_func)(struct p_window_input_callback *window_callback, const char *tag, const char * const line);
|
void (*callback_func)(struct p_window_input_callback *window_callback, const char *tag, const char * const line);
|
||||||
} PluginWindowCallback;
|
} PluginWindowCallback;
|
||||||
|
|
||||||
|
void callbacks_init(void);
|
||||||
|
void callbacks_close(void);
|
||||||
|
|
||||||
void callbacks_add_command(PluginCommand *command);
|
void callbacks_add_command(PluginCommand *command);
|
||||||
void callbacks_add_timed(PluginTimedFunction *timed_function);
|
void callbacks_add_timed(PluginTimedFunction *timed_function);
|
||||||
void callbacks_add_window_handler(const char *tag, PluginWindowCallback *window_callback);
|
void callbacks_add_window_handler(const char *tag, PluginWindowCallback *window_callback);
|
||||||
|
@ -57,6 +57,7 @@ void
|
|||||||
plugins_init(void)
|
plugins_init(void)
|
||||||
{
|
{
|
||||||
plugins = NULL;
|
plugins = NULL;
|
||||||
|
callbacks_init();
|
||||||
autocompleters_init();
|
autocompleters_init();
|
||||||
plugin_themes_init();
|
plugin_themes_init();
|
||||||
|
|
||||||
@ -404,6 +405,7 @@ plugins_shutdown(void)
|
|||||||
|
|
||||||
autocompleters_destroy();
|
autocompleters_destroy();
|
||||||
plugin_themes_close();
|
plugin_themes_close();
|
||||||
|
callbacks_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
|
@ -56,6 +56,7 @@ void (*prof_send_line)(char *line) = NULL;
|
|||||||
|
|
||||||
char* (*prof_get_current_recipient)(void) = NULL;
|
char* (*prof_get_current_recipient)(void) = NULL;
|
||||||
char* (*prof_get_current_muc)(void) = NULL;
|
char* (*prof_get_current_muc)(void) = NULL;
|
||||||
|
int (*prof_current_win_is_console)(void) = NULL;
|
||||||
|
|
||||||
void (*prof_log_debug)(const char *message) = NULL;
|
void (*prof_log_debug)(const char *message) = NULL;
|
||||||
void (*prof_log_info)(const char *message) = NULL;
|
void (*prof_log_info)(const char *message) = NULL;
|
||||||
|
@ -56,6 +56,7 @@ void (*prof_send_line)(char *line);
|
|||||||
|
|
||||||
char* (*prof_get_current_recipient)(void);
|
char* (*prof_get_current_recipient)(void);
|
||||||
char* (*prof_get_current_muc)(void);
|
char* (*prof_get_current_muc)(void);
|
||||||
|
int (*prof_current_win_is_console)(void);
|
||||||
|
|
||||||
void (*prof_log_debug)(const char *message);
|
void (*prof_log_debug)(const char *message);
|
||||||
void (*prof_log_info)(const char *message);
|
void (*prof_log_info)(const char *message);
|
||||||
|
@ -350,7 +350,7 @@ win_get_string(ProfWin *window)
|
|||||||
{
|
{
|
||||||
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
||||||
GString *gstring = g_string_new("");
|
GString *gstring = g_string_new("");
|
||||||
g_string_append_printf(gstring, "%s plugin", pluginwin->tag);
|
g_string_append_printf(gstring, "Plugin: %s", pluginwin->tag);
|
||||||
char *res = gstring->str;
|
char *res = gstring->str;
|
||||||
g_string_free(gstring, FALSE);
|
g_string_free(gstring, FALSE);
|
||||||
return res;
|
return res;
|
||||||
@ -419,27 +419,42 @@ win_free(ProfWin* window)
|
|||||||
}
|
}
|
||||||
free(window->layout);
|
free(window->layout);
|
||||||
|
|
||||||
if (window->type == WIN_CHAT) {
|
switch (window->type) {
|
||||||
|
case WIN_CHAT:
|
||||||
|
{
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||||
free(chatwin->barejid);
|
free(chatwin->barejid);
|
||||||
free(chatwin->resource_override);
|
free(chatwin->resource_override);
|
||||||
chat_state_free(chatwin->state);
|
chat_state_free(chatwin->state);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case WIN_MUC:
|
||||||
if (window->type == WIN_MUC) {
|
{
|
||||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||||
free(mucwin->roomjid);
|
free(mucwin->roomjid);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case WIN_MUC_CONFIG:
|
||||||
if (window->type == WIN_MUC_CONFIG) {
|
{
|
||||||
ProfMucConfWin *mucconf = (ProfMucConfWin*)window;
|
ProfMucConfWin *mucconf = (ProfMucConfWin*)window;
|
||||||
free(mucconf->roomjid);
|
free(mucconf->roomjid);
|
||||||
form_destroy(mucconf->form);
|
form_destroy(mucconf->form);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case WIN_PRIVATE:
|
||||||
if (window->type == WIN_PRIVATE) {
|
{
|
||||||
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
ProfPrivateWin *privatewin = (ProfPrivateWin*)window;
|
||||||
free(privatewin->fulljid);
|
free(privatewin->fulljid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case WIN_PLUGIN:
|
||||||
|
{
|
||||||
|
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
||||||
|
free(pluginwin->tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(window);
|
free(window);
|
||||||
|
@ -212,6 +212,7 @@ wins_get_plugin(const char *const tag)
|
|||||||
if (window->type == WIN_PLUGIN) {
|
if (window->type == WIN_PLUGIN) {
|
||||||
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
||||||
if (g_strcmp0(pluginwin->tag, tag) == 0) {
|
if (g_strcmp0(pluginwin->tag, tag) == 0) {
|
||||||
|
g_list_free(values);
|
||||||
return pluginwin;
|
return pluginwin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -389,6 +390,11 @@ wins_get_by_string(char *str)
|
|||||||
return (ProfWin*)privwin;
|
return (ProfWin*)privwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfPluginWin *pluginwin = wins_get_plugin(str);
|
||||||
|
if (pluginwin) {
|
||||||
|
return (ProfWin*)pluginwin;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,6 +545,13 @@ wins_close_by_num(int i)
|
|||||||
autocomplete_remove(wins_close_ac, "xmlconsole");
|
autocomplete_remove(wins_close_ac, "xmlconsole");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WIN_PLUGIN:
|
||||||
|
{
|
||||||
|
ProfPluginWin *pluginwin = (ProfPluginWin*)window;
|
||||||
|
autocomplete_remove(wins_ac, pluginwin->tag);
|
||||||
|
autocomplete_remove(wins_close_ac, pluginwin->tag);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case WIN_MUC_CONFIG:
|
case WIN_MUC_CONFIG:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -640,10 +653,12 @@ wins_new_plugin(const char * const tag)
|
|||||||
{
|
{
|
||||||
GList *keys = g_hash_table_get_keys(windows);
|
GList *keys = g_hash_table_get_keys(windows);
|
||||||
int result = get_next_available_win_num(keys);
|
int result = get_next_available_win_num(keys);
|
||||||
ProfWin *new = win_create_plugin(tag);
|
|
||||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), new);
|
|
||||||
g_list_free(keys);
|
g_list_free(keys);
|
||||||
return new;
|
ProfWin *newwin = win_create_plugin(tag);
|
||||||
|
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||||
|
autocomplete_add(wins_ac, tag);
|
||||||
|
autocomplete_add(wins_close_ac, tag);
|
||||||
|
return newwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user