1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added _rosterwin_contacts_all function

This commit is contained in:
James Booth 2016-01-30 22:54:52 +00:00
parent 7c1db22fac
commit 20659b9841

View File

@ -818,49 +818,8 @@ _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline)
} }
void void
rosterwin_roster(void) _rosterwin_contacts_all(ProfLayoutSplit *layout, gboolean newline)
{ {
ProfWin *console = wins_get_console();
if (!console) {
return;
}
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
return;
}
ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
werase(layout->subwin);
gboolean newline = FALSE;
char *roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) {
_rosterwin_rooms(layout, newline);
newline = TRUE;
}
if (prefs_get_boolean(PREF_ROSTER_CONTACTS)) {
char *by = prefs_get_string(PREF_ROSTER_BY);
if (g_strcmp0(by, "presence") == 0) {
_rosterwin_contacts_by_presence(layout, "chat", "Available for chat", newline);
_rosterwin_contacts_by_presence(layout, "online", "Online", TRUE);
_rosterwin_contacts_by_presence(layout, "away", "Away", TRUE);
_rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE);
_rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb", TRUE);
_rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE);
} else if (g_strcmp0(by, "group") == 0) {
GSList *groups = roster_get_groups();
GSList *curr_group = groups;
while (curr_group) {
_rosterwin_contacts_by_group(layout, curr_group->data, newline);
newline = TRUE;
curr_group = g_slist_next(curr_group);
}
g_slist_free_full(groups, free);
_rosterwin_contacts_by_group(layout, NULL, newline);
} else {
GSList *contacts = NULL; GSList *contacts = NULL;
char *order = prefs_get_string(PREF_ROSTER_ORDER); char *order = prefs_get_string(PREF_ROSTER_ORDER);
@ -926,6 +885,53 @@ rosterwin_roster(void)
} }
} }
g_slist_free(contacts); g_slist_free(contacts);
}
void
rosterwin_roster(void)
{
ProfWin *console = wins_get_console();
if (!console) {
return;
}
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
return;
}
ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
werase(layout->subwin);
gboolean newline = FALSE;
char *roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) {
_rosterwin_rooms(layout, newline);
newline = TRUE;
}
if (prefs_get_boolean(PREF_ROSTER_CONTACTS)) {
char *by = prefs_get_string(PREF_ROSTER_BY);
if (g_strcmp0(by, "presence") == 0) {
_rosterwin_contacts_by_presence(layout, "chat", "Available for chat", newline);
_rosterwin_contacts_by_presence(layout, "online", "Online", TRUE);
_rosterwin_contacts_by_presence(layout, "away", "Away", TRUE);
_rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE);
_rosterwin_contacts_by_presence(layout, "dnd", "Do not disturb", TRUE);
_rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE);
} else if (g_strcmp0(by, "group") == 0) {
GSList *groups = roster_get_groups();
GSList *curr_group = groups;
while (curr_group) {
_rosterwin_contacts_by_group(layout, curr_group->data, newline);
newline = TRUE;
curr_group = g_slist_next(curr_group);
}
g_slist_free_full(groups, free);
_rosterwin_contacts_by_group(layout, NULL, newline);
} else {
_rosterwin_contacts_all(layout, newline);
} }
prefs_free_string(by); prefs_free_string(by);
} }