about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-13 21:14:43 +0000
committerJames Booth <boothj5@gmail.com>2012-11-13 21:14:43 +0000
commit2afe7b83aba2581cc33cee64b34eb9faf608bdab (patch)
tree8fa9251c08b9501dcd2b33d59f9116a6f2a775b3
parent13689a1f8453c3ffed93ac2fd9378129686ef4a1 (diff)
downloadprofani-tty-2afe7b83aba2581cc33cee64b34eb9faf608bdab.tar.gz
Handle typing notifications in private room chat
-rw-r--r--src/windows.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/windows.c b/src/windows.c
index 2f11c04c..0350cc59 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -96,7 +96,7 @@ static void _win_notify(const char * const message, int timeout,
     const char * const category);
 static void _win_notify_remind(gint unread);
 static void _win_notify_message(const char * const short_from);
-static void _win_notify_typing(char * short_from);
+static void _win_notify_typing(const char * const from);
 #endif
 
 void
@@ -216,20 +216,16 @@ win_get_recipient(void)
 void
 win_show_typing(const char * const from)
 {
-    char from_cpy[strlen(from) + 1];
-    strcpy(from_cpy, from);
-    char *short_from = strtok(from_cpy, "/");
-
-    int win_index = _find_prof_win_index(short_from);
+    int win_index = _find_prof_win_index(from);
 
     if (prefs_get_intype()) {
         // no chat window for user
         if (win_index == NUM_WINS) {
-            _cons_show_typing(short_from);
+            _cons_show_typing(from);
 
         // have chat window but not currently in it
         } else if (win_index != _curr_prof_win) {
-            _cons_show_typing(short_from);
+            _cons_show_typing(from);
             dirty = TRUE;
 
         // in chat window with user
@@ -244,7 +240,7 @@ win_show_typing(const char * const from)
 
 #ifdef HAVE_LIBNOTIFY
     if (prefs_get_notify_typing())
-        _win_notify_typing(short_from);
+        _win_notify_typing(from);
 #endif
 }
 
@@ -511,10 +507,10 @@ _win_notify_message(const char * const short_from)
 }
 
 static void
-_win_notify_typing(char * short_from)
+_win_notify_typing(const char * const from)
 {
-    char message[strlen(short_from) + 1 + 11];
-    sprintf(message, "%s: typing...", short_from);
+    char message[strlen(from) + 1 + 11];
+    sprintf(message, "%s: typing...", from);
 
     _win_notify(message, 10000, "Incoming message");
 }