aboutsummaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/degesch.c b/degesch.c
index 358e592..1786770 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1216,6 +1216,31 @@ irc_establish_connection (struct app_context *ctx,
// --- More readline funky stuff -----------------------------------------------
+static char *
+get_unseen_prefix (struct app_context *ctx)
+{
+ struct str active_buffers;
+ str_init (&active_buffers);
+
+ size_t i = 0;
+ LIST_FOR_EACH (struct buffer, iter, ctx->buffers)
+ {
+ i++;
+ if (!iter->unseen_messages_count)
+ continue;
+
+ if (active_buffers.len)
+ str_append_c (&active_buffers, ',');
+ str_append_printf (&active_buffers, "%zu", i);
+ }
+
+ if (active_buffers.len)
+ return str_steal (&active_buffers);
+
+ str_free (&active_buffers);
+ return NULL;
+}
+
static void
refresh_prompt (struct app_context *ctx)
{
@@ -1229,8 +1254,11 @@ refresh_prompt (struct app_context *ctx)
else
{
str_append_c (&prompt, '[');
- // TODO: go through all buffers and prepend the active ones,
- // such as "(1,4) "
+
+ char *unseen_prefix = get_unseen_prefix (ctx);
+ if (unseen_prefix)
+ str_append_printf (&prompt, "(%s) ", unseen_prefix);
+ free (unseen_prefix);
// TODO: name of the current buffer
// TODO: the channel user mode