mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Show errors in room when can't retrieve room config
This commit is contained in:
parent
2a555157c3
commit
672fcfe009
@ -478,19 +478,7 @@ handle_room_config_submit_result(void)
|
|||||||
void
|
void
|
||||||
handle_room_configuration_form_error(const char * const room, const char * const message)
|
handle_room_configuration_form_error(const char * const room, const char * const message)
|
||||||
{
|
{
|
||||||
if (room != NULL) {
|
ui_handle_room_configuration_form_error(room, message);
|
||||||
if (message != NULL) {
|
|
||||||
cons_show_error("Room config error for %s: %s.", room, message);
|
|
||||||
} else {
|
|
||||||
cons_show_error("Room config error for %s.", room);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (message != NULL) {
|
|
||||||
cons_show_error("Room config error: %s.", message);
|
|
||||||
} else {
|
|
||||||
cons_show_error("Room config error.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2068,6 +2068,30 @@ _ui_handle_room_configuration(const char * const room, DataForm *form)
|
|||||||
ui_show_form(window, room, form);
|
ui_show_form(window, room, form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ui_handle_room_configuration_form_error(const char * const room, const char * const message)
|
||||||
|
{
|
||||||
|
ProfWin *window = NULL;
|
||||||
|
GString *message_str = g_string_new("");
|
||||||
|
|
||||||
|
if (room) {
|
||||||
|
window = wins_get_by_recipient(room);
|
||||||
|
g_string_printf(message_str, "Could not get room configuration for %s", room);
|
||||||
|
} else {
|
||||||
|
window = wins_get_console();
|
||||||
|
g_string_printf(message_str, "Could not get room configuration");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message) {
|
||||||
|
g_string_append(message_str, ": ");
|
||||||
|
g_string_append(message_str, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
win_save_print(window, '-', NULL, 0, COLOUR_ERROR, "", message_str->str);
|
||||||
|
|
||||||
|
g_string_free(message_str, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ui_handle_room_config_submit_result(void)
|
_ui_handle_room_config_submit_result(void)
|
||||||
{
|
{
|
||||||
@ -2420,4 +2444,5 @@ ui_init_module(void)
|
|||||||
ui_show_form_help = _ui_show_form_help;
|
ui_show_form_help = _ui_show_form_help;
|
||||||
ui_show_form_field_help = _ui_show_form_field_help;
|
ui_show_form_field_help = _ui_show_form_field_help;
|
||||||
ui_show_lines = _ui_show_lines;
|
ui_show_lines = _ui_show_lines;
|
||||||
|
ui_handle_room_configuration_form_error = _ui_handle_room_configuration_form_error;
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ void (*ui_handle_error)(const char * const err_msg);
|
|||||||
void (*ui_clear_win_title)(void);
|
void (*ui_clear_win_title)(void);
|
||||||
void (*ui_handle_room_join_error)(const char * const room, const char * const err);
|
void (*ui_handle_room_join_error)(const char * const room, const char * const err);
|
||||||
void (*ui_handle_room_configuration)(const char * const room, DataForm *form);
|
void (*ui_handle_room_configuration)(const char * const room, DataForm *form);
|
||||||
|
void (*ui_handle_room_configuration_form_error)(const char * const room, const char * const message);
|
||||||
void (*ui_handle_room_config_submit_result)(void);
|
void (*ui_handle_room_config_submit_result)(void);
|
||||||
void (*ui_show_form)(ProfWin *window, const char * const room, DataForm *form);
|
void (*ui_show_form)(ProfWin *window, const char * const room, DataForm *form);
|
||||||
void (*ui_show_form_field)(ProfWin *window, DataForm *form, char *tag);
|
void (*ui_show_form_field)(ProfWin *window, DataForm *form, char *tag);
|
||||||
|
Loading…
Reference in New Issue
Block a user