about summary refs log tree commit diff stats
path: root/app.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-02-08 22:46:35 +0000
committerJames Booth <boothj5@gmail.com>2012-02-08 22:46:35 +0000
commit8c24a7c4750f0da57d466699c3707f1856b85bdd (patch)
tree1666ce7d7d11c57edf62645f55c78b5f676ac850 /app.c
parent17a284b24befa7bf459b9d08bd018403c99ee86b (diff)
downloadprofani-tty-8c24a7c4750f0da57d466699c3707f1856b85bdd.tar.gz
Basic multiwindow chat
Diffstat (limited to 'app.c')
-rw-r--r--app.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/app.c b/app.c
index a11ed56f..f6cc32af 100644
--- a/app.c
+++ b/app.c
@@ -87,16 +87,26 @@ static void main_event_loop(void)
         // null terminate the input    
         command[size++] = '\0';
 
-        // newline was hit, check if /quit command issued
+        // deal with input
+
+        // /quit command -> exit
         if (strcmp(command, "/quit") == 0) {
             break;
+
+        // /help -> print help to console
         } else if (strncmp(command, "/help", 5) == 0) {
             cons_help();
             inp_clear();
+
+        // send message to recipient if chat window
         } else {
-            jabber_send(command);
-            show_outgoing_msg("me", command);
-            inp_clear();
+            if (in_chat()) {
+                char recipient[100] = "";
+                get_recipient(recipient);
+                jabber_send(command, recipient);
+                show_outgoing_msg("me", command);
+                inp_clear();
+            }
         }
     }