From 07cc19ce10dcf1cbbdca4797540d4f2bea74b724 Mon Sep 17 00:00:00 2001 From: John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> Date: Thu, 13 Apr 2023 17:16:24 +0200 Subject: Add sessions_alarm Introduce new feature: sessions_alarm. Added new account setting: max_connections. On exceeding this number, user will get an alert. If number is less than 1, no alert will happen. Tests altered to fit new feature. --- src/ui/console.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ui') diff --git a/src/ui/console.c b/src/ui/console.c index d26e559f..b57ac6f4 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1067,6 +1067,9 @@ cons_show_account(ProfAccount* account) if (account->client) { cons_show("Client name : %s", account->client); } + if (account->max_sessions > 0) { + cons_show("Max sessions alarm: %d", account->max_sessions); + } if (account->theme) { cons_show("Theme : %s", account->theme); } @@ -1123,11 +1126,12 @@ cons_show_account(ProfAccount* account) if ((connection_get_status() == JABBER_CONNECTED) && (g_strcmp0(session_get_account_name(), account->name) == 0)) { GList* resources = connection_get_available_resources(); + int resources_count = connection_count_available_resources(); GList* ordered_resources = NULL; GList* curr = resources; if (curr) { - win_println(console, THEME_DEFAULT, "-", "Resources:"); + win_println(console, THEME_DEFAULT, "-", "Resources (%u):", resources_count); // sort in order of availability while (curr) { -- cgit 1.4.1-2-gfad0