mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 20:16:21 +00:00
Add conf win callback
This commit is contained in:
@@ -346,7 +346,7 @@ ProfWin* win_create_console(void);
|
||||
ProfWin* win_create_xmlconsole(void);
|
||||
ProfWin* win_create_chat(const char *const barejid);
|
||||
ProfWin* win_create_muc(const char *const roomjid);
|
||||
ProfWin* win_create_config(const char *const title, DataForm *form);
|
||||
ProfWin* win_create_config(const char *const title, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel);
|
||||
ProfWin* win_create_private(const char *const fulljid);
|
||||
ProfWin* win_create_plugin(const char *const plugin_name, const char *const tag);
|
||||
void win_update_virtual(ProfWin *window);
|
||||
@@ -380,6 +380,7 @@ char* win_to_string(ProfWin *window);
|
||||
void win_command_list_error(ProfWin *window, const char *const error);
|
||||
void win_command_exec_error(ProfWin *window, const char *const command, const char *const error, ...);
|
||||
void win_handle_command_list(ProfWin *window, GSList *cmds);
|
||||
void win_handle_command_exec_status(ProfWin *window, const char *const type, const char *const value);
|
||||
void win_handle_command_exec_result_note(ProfWin *window, const char *const type, const char *const value);
|
||||
|
||||
// desktop notifications
|
||||
|
||||
@@ -172,12 +172,17 @@ typedef struct prof_muc_win_t {
|
||||
char *message_char;
|
||||
} ProfMucWin;
|
||||
|
||||
typedef struct prof_conf_win_t {
|
||||
typedef struct prof_conf_win_t ProfConfWin;
|
||||
typedef void (*ProfConfWinCallback)(ProfConfWin *);
|
||||
|
||||
struct prof_conf_win_t {
|
||||
ProfWin window;
|
||||
char *roomjid;
|
||||
DataForm *form;
|
||||
unsigned long memcheck;
|
||||
} ProfConfWin;
|
||||
ProfConfWinCallback submit;
|
||||
ProfConfWinCallback cancel;
|
||||
};
|
||||
|
||||
typedef struct prof_private_win_t {
|
||||
ProfWin window;
|
||||
|
||||
@@ -203,13 +203,15 @@ win_create_muc(const char *const roomjid)
|
||||
}
|
||||
|
||||
ProfWin*
|
||||
win_create_config(const char *const roomjid, DataForm *form)
|
||||
win_create_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel)
|
||||
{
|
||||
ProfConfWin *new_win = malloc(sizeof(ProfConfWin));
|
||||
new_win->window.type = WIN_CONFIG;
|
||||
new_win->window.layout = _win_create_simple_layout();
|
||||
new_win->roomjid = strdup(roomjid);
|
||||
new_win->form = form;
|
||||
new_win->submit = submit;
|
||||
new_win->cancel = cancel;
|
||||
|
||||
new_win->memcheck = PROFCONFWIN_MEMCHECK;
|
||||
|
||||
@@ -1768,6 +1770,13 @@ win_handle_command_list(ProfWin *window, GSList *cmds)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
win_handle_command_exec_status(ProfWin *window, const char *const command, const char *const value)
|
||||
{
|
||||
assert(window != NULL);
|
||||
win_println(window, THEME_DEFAULT, '!', "%s %s", command, value);
|
||||
}
|
||||
|
||||
void
|
||||
win_handle_command_exec_result_note(ProfWin *window, const char *const type, const char *const value)
|
||||
{
|
||||
|
||||
@@ -657,12 +657,12 @@ wins_new_muc(const char *const roomjid)
|
||||
}
|
||||
|
||||
ProfWin*
|
||||
wins_new_config(const char *const roomjid, DataForm *form)
|
||||
wins_new_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel)
|
||||
{
|
||||
GList *keys = g_hash_table_get_keys(windows);
|
||||
int result = _wins_get_next_available_num(keys);
|
||||
g_list_free(keys);
|
||||
ProfWin *newwin = win_create_config(roomjid, form);
|
||||
ProfWin *newwin = win_create_config(roomjid, form, submit, cancel);
|
||||
g_hash_table_insert(windows, GINT_TO_POINTER(result), newwin);
|
||||
return newwin;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void wins_init(void);
|
||||
ProfWin* wins_new_xmlconsole(void);
|
||||
ProfWin* wins_new_chat(const char *const barejid);
|
||||
ProfWin* wins_new_muc(const char *const roomjid);
|
||||
ProfWin* wins_new_config(const char *const roomjid, DataForm *form);
|
||||
ProfWin* wins_new_config(const char *const roomjid, DataForm *form, ProfConfWinCallback submit, ProfConfWinCallback cancel);
|
||||
ProfWin* wins_new_private(const char *const fulljid);
|
||||
ProfWin* wins_new_plugin(const char *const plugin_name, const char *const tag);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user