1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added simple roster

This commit is contained in:
James Booth 2014-11-10 00:31:11 +00:00
parent eed8f6c76d
commit 36331e4908
3 changed files with 34 additions and 0 deletions

View File

@ -454,6 +454,8 @@ handle_contact_offline(char *barejid, char *resource, char *status)
prefs_free_string(show_chat_win);
jid_destroy(jid);
}
ui_roster();
}
void
@ -494,6 +496,8 @@ handle_contact_online(char *barejid, Resource *resource,
prefs_free_string(show_console);
prefs_free_string(show_chat_win);
}
ui_roster();
}
void

View File

@ -2804,6 +2804,34 @@ _ui_show_lines(ProfWin *window, const gchar** lines)
}
}
static void
_ui_roster(void)
{
ProfWin *window = wins_get_console();
if (window) {
GSList *contacts = roster_get_contacts();
if (contacts) {
werase(window->subwin);
wattron(window->subwin, COLOUR_ROOMINFO);
wprintw(window->subwin, " -Roster\n");
wattroff(window->subwin, COLOUR_ROOMINFO);
GSList *curr = contacts;
while (curr) {
PContact contact = curr->data;
const char *name = p_contact_name_or_jid(contact);
const char *presence = p_contact_presence(contact);
int presence_colour = win_presence_colour(presence);
wattron(window->subwin, presence_colour);
wprintw(window->subwin, " %s\n", name);
wattroff(window->subwin, presence_colour);
curr = g_slist_next(curr);
}
}
g_slist_free(contacts);
}
}
static void
_ui_muc_roster(const char * const room)
{
@ -3212,6 +3240,7 @@ ui_init_module(void)
ui_handle_room_role_list_error = _ui_handle_room_role_list_error;
ui_handle_room_role_list = _ui_handle_room_role_list;
ui_muc_roster = _ui_muc_roster;
ui_roster = _ui_roster;
ui_room_show_occupants = _ui_room_show_occupants;
ui_room_hide_occupants = _ui_room_hide_occupants;
ui_room_role_change = _ui_room_role_change;

View File

@ -246,6 +246,7 @@ void (*ui_open_xmlconsole_win)(void);
gboolean (*ui_win_has_unsaved_form)(int num);
void (*ui_muc_roster)(const char * const room);
void (*ui_roster)(void);
// console window actions
void (*cons_show)(const char * const msg, ...);