mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 18:16:21 +00:00
Moved UI error handler code to ui/core
This commit is contained in:
@@ -187,27 +187,7 @@ prof_handle_group_remove(const char * const contact,
|
|||||||
void
|
void
|
||||||
prof_handle_error_message(const char *from, const char *err_msg)
|
prof_handle_error_message(const char *from, const char *err_msg)
|
||||||
{
|
{
|
||||||
win_type_t win_type = ui_current_win_type();
|
ui_handle_error_message(from, err_msg);
|
||||||
if (err_msg == NULL) {
|
|
||||||
cons_show_error("Unknown error received from service.");
|
|
||||||
} else if (strcmp(err_msg, "conflict") == 0) {
|
|
||||||
if (win_type == WIN_MUC) {
|
|
||||||
ui_current_print_line("Nickname already in use.");
|
|
||||||
} else {
|
|
||||||
cons_show_error("Error received from server: %s", err_msg);
|
|
||||||
}
|
|
||||||
// remove the room from muc
|
|
||||||
Jid *room_jid = jid_create(from);
|
|
||||||
if (!muc_get_roster_received(room_jid->barejid)) {
|
|
||||||
muc_leave_room(room_jid->barejid);
|
|
||||||
}
|
|
||||||
jid_destroy(room_jid);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
cons_show_error("Error received from server: %s", err_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui_print_error_from_recipient(from, err_msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -402,6 +402,32 @@ ui_group_removed(const char * const contact, const char * const group)
|
|||||||
cons_show("%s removed from group %s", contact, group);
|
cons_show("%s removed from group %s", contact, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_handle_error_message(const char * const from, const char * const err_msg)
|
||||||
|
{
|
||||||
|
win_type_t win_type = ui_current_win_type();
|
||||||
|
if (err_msg == NULL) {
|
||||||
|
cons_show_error("Unknown error received from service.");
|
||||||
|
} else if (strcmp(err_msg, "conflict") == 0) {
|
||||||
|
if (win_type == WIN_MUC) {
|
||||||
|
ui_current_print_line("Nickname already in use.");
|
||||||
|
} else {
|
||||||
|
cons_show_error("Error received from server: %s", err_msg);
|
||||||
|
}
|
||||||
|
// remove the room from muc
|
||||||
|
Jid *room_jid = jid_create(from);
|
||||||
|
if (!muc_get_roster_received(room_jid->barejid)) {
|
||||||
|
muc_leave_room(room_jid->barejid);
|
||||||
|
}
|
||||||
|
jid_destroy(room_jid);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
cons_show_error("Error received from server: %s", err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui_print_error_from_recipient(from, err_msg);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_contact_online(const char * const barejid, const char * const resource,
|
ui_contact_online(const char * const barejid, const char * const resource,
|
||||||
const char * const show, const char * const status, GDateTime *last_activity)
|
const char * const show, const char * const status, GDateTime *last_activity)
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ void ui_reset_idle_time(void);
|
|||||||
void ui_new_chat_win(const char * const to);
|
void ui_new_chat_win(const char * const to);
|
||||||
void ui_print_error_from_recipient(const char * const from, const char *err_msg);
|
void ui_print_error_from_recipient(const char * const from, const char *err_msg);
|
||||||
void ui_print_system_msg_from_recipient(const char * const from, const char *message);
|
void ui_print_system_msg_from_recipient(const char * const from, const char *message);
|
||||||
|
void ui_handle_error_message(const char * const from, const char * const err_msg);
|
||||||
gint ui_unread(void);
|
gint ui_unread(void);
|
||||||
void ui_close_connected_win(int index);
|
void ui_close_connected_win(int index);
|
||||||
int ui_close_all_wins(void);
|
int ui_close_all_wins(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user