about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-02 20:50:21 +0000
committerJames Booth <boothj5@gmail.com>2014-12-02 20:50:21 +0000
commit1a8c805319eb7fea0068bde124f5900877e61ec6 (patch)
tree0ef3bd7c923e60cc195fc4d3826e01988f4757a1 /src/ui
parentaae88753a3593adc78d488576a0e7644f4ccc912 (diff)
downloadprofani-tty-1a8c805319eb7fea0068bde124f5900877e61ec6.tar.gz
Added /resource command
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/titlebar.c23
-rw-r--r--src/ui/window.c2
-rw-r--r--src/ui/window.h1
3 files changed, 26 insertions, 0 deletions
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index ed9588cb..6ef3ec70 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -60,6 +60,7 @@ static GTimer *typing_elapsed;
 static void _title_bar_draw(void);
 static void _show_contact_presence(void);
 static void _show_self_presence(void);
+static void _show_contact_resource(void);
 #ifdef HAVE_LIBOTR
 static void _show_privacy(void);
 #endif
@@ -181,6 +182,10 @@ _title_bar_draw(void)
     mvwprintw(win, 0, 0, " %s", current_title);
 
     if (current && current->type == WIN_CHAT) {
+        if (TRUE) {
+//        if (prefs_get_boolean(PREF_RESOURCE)) {
+            _show_contact_resource();
+        }
         if (prefs_get_boolean(PREF_PRESENCE)) {
             _show_contact_presence();
         }
@@ -321,6 +326,24 @@ _show_privacy(void)
 #endif
 
 static void
+_show_contact_resource(void)
+{
+    int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
+
+    ProfWin *current = wins_get_current();
+    if (current && current->chat_resource) {
+        wprintw(win, " ");
+        wattron(win, bracket_attrs);
+        wprintw(win, "[");
+        wattroff(win, bracket_attrs);
+        wprintw(win, current->chat_resource);
+        wattron(win, bracket_attrs);
+        wprintw(win, "]");
+        wattroff(win, bracket_attrs);
+    }
+}
+
+static void
 _show_contact_presence(void)
 {
     int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
diff --git a/src/ui/window.c b/src/ui/window.c
index ea65f1da..cb2587f8 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -104,6 +104,7 @@ win_create(const char * const title, win_type_t type)
     new_win->is_otr = FALSE;
     new_win->is_trusted = FALSE;
     new_win->form = NULL;
+    new_win->chat_resource = NULL;
     scrollok(new_win->win, TRUE);
 
     return new_win;
@@ -151,6 +152,7 @@ win_free(ProfWin* window)
     if (window->subwin) {
         delwin(window->subwin);
     }
+    free(window->chat_resource);
     free(window->from);
     form_destroy(window->form);
     free(window);
diff --git a/src/ui/window.h b/src/ui/window.h
index e131fbfc..ecf3a771 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -68,6 +68,7 @@ typedef enum {
 
 typedef struct prof_win_t {
     char *from;
+    char *chat_resource;
     WINDOW *win;
     WINDOW *subwin;
     ProfBuff buffer;