diff mcabber/src/screen.c @ 1518:63dc211a4c1a

New command: /echo (display a message in the log window)
author Mikael Berthe <mikael@lilotux.net>
date Sat, 27 Sep 2008 22:41:29 +0200
parents 9013d23f0a86
children ac5a2c262098
line wrap: on
line diff
--- a/mcabber/src/screen.c	Sat Sep 27 21:21:37 2008 +0200
+++ b/mcabber/src/screen.c	Sat Sep 27 22:41:29 2008 +0200
@@ -802,8 +802,27 @@
   return timepreflengths[(n < 3 ? n : 0)];
 }
 
+//  scr_print_logwindow(string)
+// Display the string in the log window.
+// Note: The string must be in the user's locale!
+void scr_print_logwindow(const char *string)
+{
+  time_t timestamp;
+  char strtimestamp[64];
+
+  timestamp = time(NULL);
+  strftime(strtimestamp, 48, "[%H:%M:%S]", localtime(&timestamp));
+  if (Curses) {
+    wprintw(logWnd, "\n%s %s", strtimestamp, string);
+    update_panels();
+  } else {
+    printf("%s %s\n", strtimestamp, string);
+  }
+}
+
 //  scr_LogPrint(...)
-// Display a message in the log window.
+// Display a message in the log window and in the status buffer.
+// Add the message to the tracelog file if the log flag is set.
 // This function will convert from UTF-8 unless the LPRINT_NOTUTF8 flag is set.
 void scr_LogPrint(unsigned int flag, const char *fmt, ...)
 {