about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-28 02:59:20 +0000
committerJames Booth <boothj5@gmail.com>2012-10-28 02:59:20 +0000
commit9f266ac00029cd1af3e8da6589cd92f3c315b4e5 (patch)
tree3e05fc7f50df95d518f0500b850ab8892cc46c6c /src
parent90606141a92fbff4a97282c44dc923944526c977 (diff)
parentcd56134ebb8f0789c776477a1a1b6e337e6d0e70 (diff)
downloadprofani-tty-9f266ac00029cd1af3e8da6589cd92f3c315b4e5.tar.gz
Merge branch 'master' into chatstates
Diffstat (limited to 'src')
-rw-r--r--src/chat_log.c12
-rw-r--r--src/command.c2
-rw-r--r--src/windows.c37
3 files changed, 43 insertions, 8 deletions
diff --git a/src/chat_log.c b/src/chat_log.c
index 2e53dfc7..5ea40911 100644
--- a/src/chat_log.c
+++ b/src/chat_log.c
@@ -80,9 +80,17 @@ chat_log_chat(const gchar * const login, gchar *other,
     FILE *logp = fopen(dated_log->filename, "a");
 
     if (direction == IN) {
-        fprintf(logp, "%s - %s: %s\n", date_fmt, other_copy, msg);
+        if (strncmp(msg, "/me ", 4) == 0) {
+            fprintf(logp, "%s - *%s %s\n", date_fmt, other_copy, msg + 4);
+        } else {
+            fprintf(logp, "%s - %s: %s\n", date_fmt, other_copy, msg);
+        }
     } else {
-        fprintf(logp, "%s - me: %s\n", date_fmt, msg);
+        if (strncmp(msg, "/me ", 4) == 0) {
+            fprintf(logp, "%s - *me %s\n", date_fmt, msg + 4);
+        } else {
+            fprintf(logp, "%s - me: %s\n", date_fmt, msg);
+        }
     }
     fflush(logp);
     int result = fclose(logp);
diff --git a/src/command.c b/src/command.c
index 0fd093bb..e9f40409 100644
--- a/src/command.c
+++ b/src/command.c
@@ -442,6 +442,8 @@ cmd_init(void)
         p_autocomplete_add(who_ac, (gchar *)strdup(pcmd->cmd+1));
     }
 
+    p_autocomplete_add(who_ac, "offline");
+
     history_init();
 }
 
diff --git a/src/windows.c b/src/windows.c
index b7486c92..f1c8f0fe 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -275,8 +275,17 @@ win_show_incomming_msg(const char * const from, const char * const message)
     // currently viewing chat window with sender
     if (win_index == _curr_prof_win) {
         _win_show_time(win);
-        _win_show_user(win, short_from, 1);
-        _win_show_message(win, message);
+
+        if (strncmp(message, "/me ", 4) == 0) {
+            wattron(win, COLOUR_ONLINE);
+            wprintw(win, "*%s ", short_from);
+            wprintw(win, message + 4);
+            wprintw(win, "\n");
+            wattroff(win, COLOUR_ONLINE);
+        } else {
+            _win_show_user(win, short_from, 1);
+            _win_show_message(win, message);
+        }
         title_bar_set_typing(FALSE);
         title_bar_draw();
         status_bar_active(win_index);
@@ -295,8 +304,16 @@ win_show_incomming_msg(const char * const from, const char * const message)
         }
 
         _win_show_time(win);
-        _win_show_user(win, short_from, 1);
-        _win_show_message(win, message);
+        if (strncmp(message, "/me ", 4) == 0) {
+            wattron(win, COLOUR_ONLINE);
+            wprintw(win, "*%s ", short_from);
+            wprintw(win, message + 4);
+            wprintw(win, "\n");
+            wattroff(win, COLOUR_ONLINE);
+        } else {
+            _win_show_user(win, short_from, 1);
+            _win_show_message(win, message);
+        }
     }
 
     if (prefs_get_beep())
@@ -423,8 +440,16 @@ win_show_outgoing_msg(const char * const from, const char * const to,
     }
 
     _win_show_time(win);
-    _win_show_user(win, from, 0);
-    _win_show_message(win, message);
+    if (strncmp(message, "/me ", 4) == 0) {
+        wattron(win, COLOUR_ONLINE);
+        wprintw(win, "*%s ", from);
+        wprintw(win, message + 4);
+        wprintw(win, "\n");
+        wattroff(win, COLOUR_ONLINE);
+    } else {
+        _win_show_user(win, from, 1);
+        _win_show_message(win, message);
+    }
     _win_switch_if_active(win_index);
 }