aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-01-31 19:38:06 +0000
committerJames Booth <boothj5@gmail.com>2016-01-31 19:38:06 +0000
commitdd250c679960b60a5cee86c4cafd6c9855401117 (patch)
tree7a09465de2cbe78f00752f0aafacba457919f1f3
parenta0f43adf5ba49f9024445202394ae14ecabd4d2a (diff)
downloadprofani-tty-dd250c679960b60a5cee86c4cafd6c9855401117.tar.gz
Show orphaned private chats
-rw-r--r--src/ui/rosterwin.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c
index 60d2fa91..db7a12be 100644
--- a/src/ui/rosterwin.c
+++ b/src/ui/rosterwin.c
@@ -65,7 +65,7 @@ static void _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline);
static void _rosterwin_rooms_header(ProfLayoutSplit *layout, gboolean newline, GList *rooms);
static void _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin);
-static void _rosterwin_private_chats(ProfLayoutSplit *layout);
+static void _rosterwin_private_chats(ProfLayoutSplit *layout, GList *orphaned_privchats);
static void _rosterwin_private_header(ProfLayoutSplit *layout, GList *privs);
static GSList* _filter_contacts(GSList *contacts);
@@ -541,11 +541,25 @@ _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline)
g_list_free(rooms_sorted);
+ GList *orphaned_privchats = NULL;
+ GList *privchats = wins_get_private_chats(NULL);
+ GList *curr = privchats;
+ while (curr) {
+ ProfPrivateWin *privwin = curr->data;
+ Jid *jidp = jid_create(privwin->fulljid);
+ if (!muc_active(jidp->barejid)) {
+ orphaned_privchats = g_list_append(orphaned_privchats, privwin);
+ }
+ jid_destroy(jidp);
+ curr = g_list_next(curr);
+ }
+
char *privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
- if (g_strcmp0(privpref, "group") == 0) {
- _rosterwin_private_chats(layout);
+ if (g_strcmp0(privpref, "group") == 0 || orphaned_privchats) {
+ _rosterwin_private_chats(layout, orphaned_privchats);
}
prefs_free_string(privpref);
+ g_list_free(orphaned_privchats);
}
static void
@@ -673,9 +687,21 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
}
static void
-_rosterwin_private_chats(ProfLayoutSplit *layout)
+_rosterwin_private_chats(ProfLayoutSplit *layout, GList *orphaned_privchats)
{
- GList *privs = wins_get_private_chats(NULL);
+ GList *privs = NULL;
+
+ char *privpref = prefs_get_string(PREF_ROSTER_PRIVATE);
+ if (g_strcmp0(privpref, "group") == 0) {
+ privs = wins_get_private_chats(NULL);
+ } else {
+ GList *curr = orphaned_privchats;
+ while (curr) {
+ privs = g_list_append(privs, curr->data);
+ curr = g_list_next(curr);
+ }
+ }
+
if (privs || prefs_get_boolean(PREF_ROSTER_EMPTY)) {
_rosterwin_private_header(layout, privs);