about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-05 23:06:30 +0000
committerJames Booth <boothj5@gmail.com>2013-02-05 23:06:30 +0000
commit5e5590b04774ff5c3d53ede62ddac677383f7692 (patch)
treea7c75ddebfdea69776dbff82e89ed07874eb1fec /src/ui
parent895399427e794ff97ef71c2c8e7073e7c02820b8 (diff)
downloadprofani-tty-5e5590b04774ff5c3d53ede62ddac677383f7692.tar.gz
Show detailed software/os information if available in capabilities
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/windows.c69
1 files changed, 53 insertions, 16 deletions
diff --git a/src/ui/windows.c b/src/ui/windows.c
index 88d34ad2..331e78eb 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -2427,28 +2427,26 @@ _win_show_info(WINDOW *win, PContact pcontact)
     wprintw(win, "\n");
     _win_show_time(win, '-');
     _presence_colour_on(win, presence);
-    wprintw(win, "%s:\n", jid);
-    _presence_colour_off(win, presence);
-
+    wprintw(win, "%s", jid);
     if (name != NULL) {
-        _win_show_time(win, '-');
-        wprintw(win, "Name          : %s\n", name);
-    }
-
-    if (sub != NULL) {
-        _win_show_time(win, '-');
-        wprintw(win, "Subscription  : %s\n", sub);
+        wprintw(win, " (%s)", name);
     }
+    wprintw(win, ":\n");
+    _presence_colour_off(win, presence);
 
     _win_show_time(win, '-');
     wprintw(win, "Presence      : ");
     _presence_colour_on(win, presence);
-    wprintw(win, "%s\n", presence);
+    wprintw(win, "%s", presence);
+    if (status != NULL) {
+        wprintw(win, ", \"%s\"", status);
+    }
+    wprintw(win, "\n");
     _presence_colour_off(win, presence);
 
-    if (status != NULL) {
+    if (sub != NULL) {
         _win_show_time(win, '-');
-        wprintw(win, "Message       : %s\n", status);
+        wprintw(win, "Subscription  : %s\n", sub);
     }
 
     if (last_activity != NULL) {
@@ -2478,9 +2476,48 @@ _win_show_info(WINDOW *win, PContact pcontact)
 
     if (caps_str != NULL) {
         Capabilities *caps = caps_get(caps_str);
-        if ((caps != NULL) && (caps->client != NULL)) {
-            _win_show_time(win, '-');
-            wprintw(win, "Client        : %s\n", caps->client);
+        if (caps != NULL) {
+            // show identity
+            if ((caps->category != NULL) || (caps->type != NULL) || (caps->name != NULL)) {
+                _win_show_time(win, '-');
+                wprintw(win, "Identity      : ");
+                if (caps->name != NULL) {
+                    wprintw(win, "%s", caps->name);
+                    if ((caps->category != NULL) || (caps->type != NULL)) {
+                        wprintw(win, " ");
+                    }
+                }
+                if (caps->type != NULL) {
+                    wprintw(win, "%s", caps->type);
+                    if (caps->category != NULL) {
+                        wprintw(win, " ");
+                    }
+                }
+                if (caps->category != NULL) {
+                    wprintw(win, "%s", caps->category);
+                }
+                wprintw(win, "\n");
+            }
+            if (caps->software != NULL) {
+                _win_show_time(win, '-');
+                wprintw(win, "Software      : %s", caps->software);
+            }
+            if (caps->software_version != NULL) {
+                wprintw(win, ", %s", caps->software_version);
+            }
+            if ((caps->software != NULL) || (caps->software_version != NULL)) {
+                wprintw(win, "\n");
+            }
+            if (caps->os != NULL) {
+                _win_show_time(win, '-');
+                wprintw(win, "OS            : %s", caps->os);
+            }
+            if (caps->os_version != NULL) {
+                wprintw(win, ", %s\n", caps->os_version);
+            }
+            if ((caps->os != NULL) || (caps->os_version != NULL)) {
+                wprintw(win, "\n");
+            }
         }
     }