about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-03 22:06:04 +0100
committerJames Booth <boothj5@gmail.com>2012-10-03 22:06:04 +0100
commit6aa1fe55133b2a06addd598ee19c14dc0bae32d6 (patch)
tree881fc2b9707b1d91ddf1e24ecc50d9530ef84bea /src
parenta1476f1780044014d273fcb6f5facf82c1be724f (diff)
downloadprofani-tty-6aa1fe55133b2a06addd598ee19c14dc0bae32d6.tar.gz
cons_show now uses vargs
Diffstat (limited to 'src')
-rw-r--r--src/command.c7
-rw-r--r--src/ui.h2
-rw-r--r--src/windows.c10
3 files changed, 16 insertions, 3 deletions
diff --git a/src/command.c b/src/command.c
index 90a436a9..ddc4fa7d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -753,6 +753,13 @@ _cmd_set_remind(const char * const inp, struct cmd_help_t help)
         gint period = atoi(period_str);
 
         prefs_set_remind(period);
+        if (period == 0) {
+            cons_show("Message reminders disabled.");
+        } else if (period == 1) {
+            cons_show("Message reminder period set to 1 second.");
+        } else {
+            cons_show("Message reminder period set to %d seconds.", period);
+        }
     }
 
     return TRUE;    
diff --git a/src/ui.h b/src/ui.h
index e866482b..08c6bee9 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -104,7 +104,7 @@ void win_remind(void);
 void cons_help(void);
 void cons_prefs(void);
 void cons_bad_command(const char * const cmd);
-void cons_show(const char * const cmd);
+void cons_show(const char * const cmd, ...);
 void cons_bad_show(const char * const cmd);
 void cons_highlight_show(const char * const cmd);
 void cons_show_online_contacts(GSList * list);
diff --git a/src/windows.c b/src/windows.c
index f6b8b24a..befb5a20 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -631,10 +631,16 @@ cons_bad_show(const char * const msg)
 }
 
 void
-cons_show(const char * const msg)
+cons_show(const char * const msg, ...)
 {
+    va_list arg;
+    va_start(arg, msg);
+    GString *fmt_msg = g_string_new(NULL);
+    g_string_vprintf(fmt_msg, msg, arg);
     _win_show_time(_cons_win);
-    wprintw(_cons_win, "%s\n", msg); 
+    wprintw(_cons_win, "%s\n", fmt_msg->str); 
+    g_string_free(fmt_msg, TRUE);
+    va_end(arg);
     
     if (_curr_prof_win == 0)
         dirty = TRUE;