mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Tidy occupantswin.c
This commit is contained in:
parent
4dc48b4b48
commit
76c665e986
@ -39,6 +39,21 @@
|
|||||||
#include "ui/windows.h"
|
#include "ui/windows.h"
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
_occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant)
|
||||||
|
{
|
||||||
|
const char *presence_str = string_from_resource_presence(occupant->presence);
|
||||||
|
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
||||||
|
wattron(layout->subwin, theme_attrs(presence_colour));
|
||||||
|
|
||||||
|
GString *msg = g_string_new(" ");
|
||||||
|
g_string_append(msg, occupant->nick);
|
||||||
|
win_printline_nowrap(layout->subwin, msg->str);
|
||||||
|
g_string_free(msg, TRUE);
|
||||||
|
|
||||||
|
wattroff(layout->subwin, theme_attrs(presence_colour));
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_occupantswin_occupants(const char * const roomjid)
|
_occupantswin_occupants(const char * const roomjid)
|
||||||
{
|
{
|
||||||
@ -59,16 +74,7 @@ _occupantswin_occupants(const char * const roomjid)
|
|||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
Occupant *occupant = roster_curr->data;
|
Occupant *occupant = roster_curr->data;
|
||||||
if (occupant->role == MUC_ROLE_MODERATOR) {
|
if (occupant->role == MUC_ROLE_MODERATOR) {
|
||||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
_occuptantswin_occupant(layout, occupant);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
|
|
||||||
GString *msg = g_string_new(" ");
|
|
||||||
g_string_append(msg, occupant->nick);
|
|
||||||
win_printline_nowrap(layout->subwin, msg->str);
|
|
||||||
g_string_free(msg, TRUE);
|
|
||||||
|
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
}
|
}
|
||||||
roster_curr = g_list_next(roster_curr);
|
roster_curr = g_list_next(roster_curr);
|
||||||
}
|
}
|
||||||
@ -80,16 +86,7 @@ _occupantswin_occupants(const char * const roomjid)
|
|||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
Occupant *occupant = roster_curr->data;
|
Occupant *occupant = roster_curr->data;
|
||||||
if (occupant->role == MUC_ROLE_PARTICIPANT) {
|
if (occupant->role == MUC_ROLE_PARTICIPANT) {
|
||||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
_occuptantswin_occupant(layout, occupant);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
|
|
||||||
GString *msg = g_string_new(" ");
|
|
||||||
g_string_append(msg, occupant->nick);
|
|
||||||
win_printline_nowrap(layout->subwin, msg->str);
|
|
||||||
g_string_free(msg, TRUE);
|
|
||||||
|
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
}
|
}
|
||||||
roster_curr = g_list_next(roster_curr);
|
roster_curr = g_list_next(roster_curr);
|
||||||
}
|
}
|
||||||
@ -101,16 +98,7 @@ _occupantswin_occupants(const char * const roomjid)
|
|||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
Occupant *occupant = roster_curr->data;
|
Occupant *occupant = roster_curr->data;
|
||||||
if (occupant->role == MUC_ROLE_VISITOR) {
|
if (occupant->role == MUC_ROLE_VISITOR) {
|
||||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
_occuptantswin_occupant(layout, occupant);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
|
|
||||||
GString *msg = g_string_new(" ");
|
|
||||||
g_string_append(msg, occupant->nick);
|
|
||||||
win_printline_nowrap(layout->subwin, msg->str);
|
|
||||||
g_string_free(msg, TRUE);
|
|
||||||
|
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
}
|
}
|
||||||
roster_curr = g_list_next(roster_curr);
|
roster_curr = g_list_next(roster_curr);
|
||||||
}
|
}
|
||||||
@ -121,16 +109,7 @@ _occupantswin_occupants(const char * const roomjid)
|
|||||||
GList *roster_curr = occupants;
|
GList *roster_curr = occupants;
|
||||||
while (roster_curr) {
|
while (roster_curr) {
|
||||||
Occupant *occupant = roster_curr->data;
|
Occupant *occupant = roster_curr->data;
|
||||||
const char *presence_str = string_from_resource_presence(occupant->presence);
|
_occuptantswin_occupant(layout, occupant);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence_str);
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
|
|
||||||
GString *msg = g_string_new(" ");
|
|
||||||
g_string_append(msg, occupant->nick);
|
|
||||||
win_printline_nowrap(layout->subwin, msg->str);
|
|
||||||
g_string_free(msg, TRUE);
|
|
||||||
|
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
roster_curr = g_list_next(roster_curr);
|
roster_curr = g_list_next(roster_curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user