mirror of
https://github.com/profanity-im/profanity.git
synced 2025-07-26 12:14:28 -04:00
Show offline contacts with unread messages in roster
This commit is contained in:
parent
e816b124ee
commit
1c65c36cb6
@ -923,7 +923,6 @@ _rosterwin_private_header(ProfLayoutSplit *layout, GList *privs)
|
|||||||
static GSList*
|
static GSList*
|
||||||
_filter_contacts(GSList *contacts)
|
_filter_contacts(GSList *contacts)
|
||||||
{
|
{
|
||||||
char *countpref = prefs_get_string(PREF_ROSTER_COUNT);
|
|
||||||
GSList *filtered_contacts = NULL;
|
GSList *filtered_contacts = NULL;
|
||||||
|
|
||||||
// if show offline, include all contacts
|
// if show offline, include all contacts
|
||||||
@ -935,43 +934,25 @@ _filter_contacts(GSList *contacts)
|
|||||||
}
|
}
|
||||||
// if dont show offline
|
// if dont show offline
|
||||||
} else {
|
} else {
|
||||||
// if header count unread
|
GSList *curr = contacts;
|
||||||
if (g_strcmp0(countpref, "unread") == 0) {
|
while (curr) {
|
||||||
GSList *curr = contacts;
|
PContact contact = curr->data;
|
||||||
while (curr) {
|
const char *presence = p_contact_presence(contact);
|
||||||
PContact contact = curr->data;
|
|
||||||
const char *presence = p_contact_presence(contact);
|
|
||||||
|
|
||||||
// include if not offline
|
// include if offline and unread messages
|
||||||
if (g_strcmp0(presence, "offline") != 0) {
|
if (g_strcmp0(presence, "offline") == 0) {
|
||||||
filtered_contacts = g_slist_append(filtered_contacts, contact);
|
ProfChatWin *chatwin = wins_get_chat(p_contact_barejid(contact));
|
||||||
|
if (chatwin && chatwin->unread > 0) {
|
||||||
// include if offline and unread messages
|
|
||||||
} else {
|
|
||||||
ProfChatWin *chatwin = wins_get_chat(p_contact_barejid(contact));
|
|
||||||
if (chatwin && chatwin->unread > 0) {
|
|
||||||
filtered_contacts = g_slist_append(filtered_contacts, contact);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
curr = g_slist_next(curr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// header count not unread
|
|
||||||
} else {
|
|
||||||
GSList *curr = contacts;
|
|
||||||
while (curr) {
|
|
||||||
PContact contact = curr->data;
|
|
||||||
const char *presence = p_contact_presence(contact);
|
|
||||||
|
|
||||||
// include if not offline
|
|
||||||
if (g_strcmp0(presence, "offline") != 0) {
|
|
||||||
filtered_contacts = g_slist_append(filtered_contacts, contact);
|
filtered_contacts = g_slist_append(filtered_contacts, contact);
|
||||||
}
|
}
|
||||||
curr = g_slist_next(curr);
|
|
||||||
|
// include if not offline
|
||||||
|
} else {
|
||||||
|
filtered_contacts = g_slist_append(filtered_contacts, contact);
|
||||||
}
|
}
|
||||||
|
curr = g_slist_next(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prefs_free_string(countpref);
|
|
||||||
|
|
||||||
return filtered_contacts;
|
return filtered_contacts;
|
||||||
}
|
}
|
||||||
@ -983,7 +964,6 @@ _filter_contacts_with_presence(GSList *contacts, const char *const presence)
|
|||||||
|
|
||||||
// handling offline contacts
|
// handling offline contacts
|
||||||
if (g_strcmp0(presence, "offline") == 0) {
|
if (g_strcmp0(presence, "offline") == 0) {
|
||||||
char *countpref = prefs_get_string(PREF_ROSTER_COUNT);
|
|
||||||
|
|
||||||
// if show offline, include all contacts
|
// if show offline, include all contacts
|
||||||
if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
|
if (prefs_get_boolean(PREF_ROSTER_OFFLINE)) {
|
||||||
@ -993,8 +973,8 @@ _filter_contacts_with_presence(GSList *contacts, const char *const presence)
|
|||||||
curr = g_slist_next(curr);
|
curr = g_slist_next(curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if header count unread, include those with unread messages
|
// otherwise show if unread messages
|
||||||
} else if (g_strcmp0(countpref, "unread") == 0) {
|
} else {
|
||||||
GSList *curr = contacts;
|
GSList *curr = contacts;
|
||||||
while (curr) {
|
while (curr) {
|
||||||
PContact contact = curr->data;
|
PContact contact = curr->data;
|
||||||
@ -1006,8 +986,6 @@ _filter_contacts_with_presence(GSList *contacts, const char *const presence)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs_free_string(countpref);
|
|
||||||
|
|
||||||
// any other presence, include all
|
// any other presence, include all
|
||||||
} else {
|
} else {
|
||||||
GSList *curr = contacts;
|
GSList *curr = contacts;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user