about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-07-29 21:47:30 +0100
committerJames Booth <boothj5@gmail.com>2012-07-29 21:47:30 +0100
commit2375b7ae526c585d17286f9ca5519398e88a11fa (patch)
tree1302046e6ac98d270b28a4cf30b36871e64f9580 /src
parentfe12352b57517d4346f3ca391b525894e5a61c7a (diff)
downloadprofani-tty-2375b7ae526c585d17286f9ca5519398e88a11fa.tar.gz
Show tinyurl errors and usage in chat windows
Diffstat (limited to 'src')
-rw-r--r--src/command.c8
-rw-r--r--src/ui.h2
-rw-r--r--src/windows.c24
3 files changed, 32 insertions, 2 deletions
diff --git a/src/command.c b/src/command.c
index 30c76b12..bbc77574 100644
--- a/src/command.c
+++ b/src/command.c
@@ -290,6 +290,9 @@ _cmd_tiny(const char * const inp)
             GString *error = g_string_new("/tiny, badly formed URL: ");
             g_string_append(error, url);
             cons_bad_show(error->str);
+            if (win_in_chat()) {
+                win_bad_show(error->str);
+            }
             g_string_free(error, TRUE);
             free(url);
         } else if (win_in_chat()) {
@@ -305,7 +308,10 @@ _cmd_tiny(const char * const inp)
             free(url);
         }
     } else {
-        cons_show("usage: /tiny url");
+        cons_show("Usage: /tiny url");
+        if (win_in_chat()) {
+            win_show("Usage: /tiny url");
+        }
     }
 
     return TRUE;
diff --git a/src/ui.h b/src/ui.h
index eb10fbad..f0811aca 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -70,6 +70,8 @@ void win_contact_online(const char * const from, const char * const show,
 void win_contact_offline(const char * const from, const char * const show, 
     const char * const status);
 void win_disconnected(void);
+void win_show(const char * const msg);
+void win_bad_show(const char * const msg);
 
 // console window actions
 void cons_help(void);
diff --git a/src/windows.c b/src/windows.c
index bfdaca2a..0c6b577f 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -262,6 +262,28 @@ win_show_outgoing_msg(const char * const from, const char * const to,
 }
 
 void
+win_show(const char * const msg)
+{
+    WINDOW *win = _wins[_curr_prof_win].win;
+    _win_show_time(win);
+    wprintw(win, "%s\n", msg); 
+
+    dirty = TRUE;
+}
+
+void
+win_bad_show(const char * const msg)
+{
+    WINDOW *win = _wins[_curr_prof_win].win;
+    _win_show_time(win);
+    wattron(win, COLOR_PAIR(6));
+    wprintw(win, "%s\n", msg);
+    wattroff(win, COLOR_PAIR(6));
+    
+    dirty = TRUE;
+}
+
+void
 win_contact_online(const char * const from, const char * const show, 
     const char * const status)
 {
@@ -362,7 +384,7 @@ cons_help(void)
     cons_show("/prefs                   : Show current UI preferences.");
     cons_show("/connect user@host       : Login to jabber.");
     cons_show("/msg user@host mesg      : Send mesg to user.");
-    cons_show("/tiny url                : Send url as tinyurl");
+    cons_show("/tiny url                : Send url as tinyurl in current chat.");
     cons_show("/close                   : Close a chat window.");
     cons_show("/who                     : Find out who is online.");
     cons_show("/ros                     : List all contacts.");