about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJohn Hernandez <129467592+H3rnand3zzz@users.noreply.github.com>2023-04-13 17:16:24 +0200
committerJohn Hernandez <129467592+H3rnand3zzz@users.noreply.github.com>2023-04-18 14:28:20 +0200
commit07cc19ce10dcf1cbbdca4797540d4f2bea74b724 (patch)
treec82ade1b904636717a352b809652523b56bdacb6 /src/ui
parent9bce23e075e4ec4ad7c888688226c7136d5f9257 (diff)
downloadprofani-tty-07cc19ce10dcf1cbbdca4797540d4f2bea74b724.tar.gz
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.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/console.c6
1 files changed, 5 insertions, 1 deletions
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) {