Added option to show jids in occupants panel
This commit is contained in:
@@ -906,6 +906,11 @@ cons_occupants_setting(void)
|
||||
else
|
||||
cons_show("Occupants (/occupants) : hide");
|
||||
|
||||
if (prefs_get_boolean(PREF_OCCUPANTS_JID))
|
||||
cons_show("Occupant jids (/occupants) : show");
|
||||
else
|
||||
cons_show("Occupant jids (/occupants) : hide");
|
||||
|
||||
int size = prefs_get_occupants_size();
|
||||
cons_show("Occupants size (/occupants) : %d", size);
|
||||
}
|
||||
|
||||
@@ -2962,6 +2962,15 @@ ui_show_lines(ProfWin *window, const gchar** lines)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_room_update_occupants(const char * const roomjid)
|
||||
{
|
||||
ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
|
||||
if (window && win_has_active_subwin(window)) {
|
||||
occupantswin_occupants(roomjid);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_room_show_occupants(const char * const roomjid)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "config/preferences.h"
|
||||
|
||||
static void
|
||||
_occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant)
|
||||
_occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean showjid)
|
||||
{
|
||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
||||
@@ -51,6 +51,13 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant)
|
||||
win_printline_nowrap(layout->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
|
||||
if (showjid && occupant->jid) {
|
||||
GString *msg = g_string_new(" ");
|
||||
g_string_append(msg, occupant->jid);
|
||||
win_printline_nowrap(layout->subwin, msg->str);
|
||||
g_string_free(msg, TRUE);
|
||||
}
|
||||
|
||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
||||
}
|
||||
|
||||
@@ -74,7 +81,7 @@ occupantswin_occupants(const char * const roomjid)
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
if (occupant->role == MUC_ROLE_MODERATOR) {
|
||||
_occuptantswin_occupant(layout, occupant);
|
||||
_occuptantswin_occupant(layout, occupant, mucwin->showjid);
|
||||
}
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
@@ -86,7 +93,7 @@ occupantswin_occupants(const char * const roomjid)
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
if (occupant->role == MUC_ROLE_PARTICIPANT) {
|
||||
_occuptantswin_occupant(layout, occupant);
|
||||
_occuptantswin_occupant(layout, occupant, mucwin->showjid);
|
||||
}
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
@@ -98,7 +105,7 @@ occupantswin_occupants(const char * const roomjid)
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
if (occupant->role == MUC_ROLE_VISITOR) {
|
||||
_occuptantswin_occupant(layout, occupant);
|
||||
_occuptantswin_occupant(layout, occupant, mucwin->showjid);
|
||||
}
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
@@ -109,7 +116,7 @@ occupantswin_occupants(const char * const roomjid)
|
||||
GList *roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
_occuptantswin_occupant(layout, occupant);
|
||||
_occuptantswin_occupant(layout, occupant, mucwin->showjid);
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ void ui_room_member_nick_change(const char * const roomjid,
|
||||
void ui_room_nick_change(const char * const roomjid, const char * const nick);
|
||||
void ui_room_member_presence(const char * const roomjid,
|
||||
const char * const nick, const char * const show, const char * const status);
|
||||
void ui_room_update_occupants(const char * const roomjid);
|
||||
void ui_room_show_occupants(const char * const roomjid);
|
||||
void ui_room_hide_occupants(const char * const roomjid);
|
||||
void ui_show_roster(void);
|
||||
|
||||
@@ -177,6 +177,11 @@ win_create_muc(const char * const roomjid)
|
||||
|
||||
new_win->roomjid = strdup(roomjid);
|
||||
new_win->unread = 0;
|
||||
if (prefs_get_boolean(PREF_OCCUPANTS_JID)) {
|
||||
new_win->showjid = TRUE;
|
||||
} else {
|
||||
new_win->showjid = FALSE;
|
||||
}
|
||||
|
||||
new_win->memcheck = PROFMUCWIN_MEMCHECK;
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ typedef struct prof_muc_win_t {
|
||||
ProfWin window;
|
||||
char *roomjid;
|
||||
int unread;
|
||||
gboolean showjid;
|
||||
unsigned long memcheck;
|
||||
} ProfMucWin;
|
||||
|
||||
|
||||
@@ -497,7 +497,13 @@ wins_resize_all(void)
|
||||
}
|
||||
wresize(layout->base.win, PAD_SIZE, cols - subwin_cols);
|
||||
wresize(layout->subwin, PAD_SIZE, subwin_cols);
|
||||
rosterwin_roster();
|
||||
if (window->type == WIN_CONSOLE) {
|
||||
rosterwin_roster();
|
||||
} else if (window->type == WIN_MUC) {
|
||||
ProfMucWin *mucwin = (ProfMucWin *)window;
|
||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||
occupantswin_occupants(mucwin->roomjid);
|
||||
}
|
||||
} else {
|
||||
wresize(layout->base.win, PAD_SIZE, cols);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user