diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.c | 37 | ||||
-rw-r--r-- | src/ui/notifier.c | 14 | ||||
-rw-r--r-- | src/ui/notifier.h | 3 | ||||
-rw-r--r-- | src/ui/ui.h | 1 |
4 files changed, 32 insertions, 23 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 36358635..ef94f58c 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -314,6 +314,24 @@ cons_show_wins(void) } void +cons_show_room_invites(GSList *invites) +{ + cons_show(""); + if (invites == NULL) { + cons_show("No outstanding chat room invites."); + } else { + cons_show("Chat room invites, use /join or /decline commands:"); + while (invites != NULL) { + cons_show(" %s", invites->data); + invites = g_slist_next(invites); + } + } + + ui_console_dirty(); + _cons_alert(); +} + +void cons_show_info(PContact pcontact) { const char *barejid = p_contact_barejid(pcontact); @@ -653,12 +671,6 @@ void cons_show_room_invite(const char * const invitor, const char * const room, const char * const reason) { - char *display_room = NULL; - char *domain = strdup(jabber_get_domain()); - Jid *room_jid = jid_create(room); - GString *default_service = g_string_new("conference."); - g_string_append(default_service, domain); - cons_show(""); cons_show("Chat room invite received:"); cons_show(" From : %s", invitor); @@ -668,21 +680,12 @@ cons_show_room_invite(const char * const invitor, const char * const room, cons_show(" Message: %s", reason); } - if (strcmp(room_jid->domainpart, default_service->str) == 0) { - display_room = room_jid->localpart; - } else { - display_room = room_jid->barejid; - } - - cons_show("Type \"/join %s\" to accept the invitation", display_room); + cons_show("Use /join or /decline"); if (prefs_get_boolean(PREF_NOTIFY_INVITE)) { - notify_invite(invitor, room); + notify_invite(invitor, room, reason); } - jid_destroy(room_jid); - g_string_free(default_service, TRUE); - ui_console_dirty(); _cons_alert(); } diff --git a/src/ui/notifier.c b/src/ui/notifier.c index 941feba9..54951fde 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -33,6 +33,7 @@ #endif #include "log.h" +#include "muc.h" #include "ui/ui.h" static void _notify(const char * const message, int timeout, @@ -66,12 +67,16 @@ notify_typing(const char * const from) } void -notify_invite(const char * const from, const char * const room) +notify_invite(const char * const from, const char * const room, + const char * const reason) { GString *message = g_string_new("Room invite\nfrom: "); g_string_append(message, from); g_string_append(message, "\nto: "); g_string_append(message, room); + if (reason != NULL) { + g_string_append_printf(message, "\n\"%s\"", reason); + } _notify(message->str, 10000, "Incoming message"); @@ -91,8 +96,7 @@ void notify_remind(void) { gint unread = ui_unread(); - //gint open = jabber_open_invites(); - gint open = 0; + gint open = muc_invite_count(); GString *text = g_string_new(""); @@ -109,9 +113,9 @@ notify_remind(void) g_string_append(text, "\n"); } if (open == 1) { - g_string_append(text, "1 open invite"); + g_string_append(text, "1 room invite"); } else { - g_string_append_printf(text, "%d open invites", open); + g_string_append_printf(text, "%d room invites", open); } } diff --git a/src/ui/notifier.h b/src/ui/notifier.h index 60b2e337..8565f771 100644 --- a/src/ui/notifier.h +++ b/src/ui/notifier.h @@ -26,4 +26,5 @@ void notifier_uninit(void); void notify_typing(const char * const from); void notify_message(const char * const short_from); void notify_remind(void); -void notify_invite(const char * const from, const char * const room); +void notify_invite(const char * const from, const char * const room, + const char * const reason); diff --git a/src/ui/ui.h b/src/ui/ui.h index 4dbde5ee..36e0fd56 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -166,6 +166,7 @@ void cons_show_room_invite(const char * const invitor, const char * const room, void cons_check_version(gboolean not_available_msg); void cons_show_typing(const char * const short_from); void cons_show_incoming_message(const char * const short_from, const int win_index); +void cons_show_room_invites(GSList *invites); // status bar actions void status_bar_refresh(void); |