about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2012-10-17 12:55:48 +0300
committerDmitry Podgorny <pasis.ua@gmail.com>2012-10-17 12:55:48 +0300
commit8200c959f85da1903f22ffc2ae13b8f0649199b7 (patch)
treeabe3e09ba5aace1c89be6886c7e31ff31e613dd9 /src
parent4e05e919b257906c2fef824c9a1745c259d4af20 (diff)
downloadprofani-tty-8200c959f85da1903f22ffc2ae13b8f0649199b7.tar.gz
windows: print outgoing messages for all contacts
When contact list doesn't contain a contact outgoing messages aren't
printed to chat window. But incoming ones is printed.
The patch fixes this and make profanity show "%s is not one of your
contacts." only once on creating window.
Diffstat (limited to 'src')
-rw-r--r--src/windows.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/windows.c b/src/windows.c
index 8ffc5005..dd3af031 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -371,38 +371,38 @@ win_show_outgoing_msg(const char * const from, const char * const to,
 {
     // if the contact is offline, show a message
     PContact contact = contact_list_get_contact(to);
-    
-    if (contact == NULL) {
-        cons_show("%s is not one of your contacts.");
-    } else {
-        int win_index = _find_prof_win_index(to);
-        WINDOW *win = NULL;
-
-        // create new window
-        if (win_index == NUM_WINS) {
-            win_index = _new_prof_win(to);
-            win = _wins[win_index].win;
-            
-            if (prefs_get_chlog() && prefs_get_history()) {
-                _win_show_history(win, win_index, to);
-            }
+    int win_index = _find_prof_win_index(to);
+    WINDOW *win = NULL;
+
+    // create new window
+    if (win_index == NUM_WINS) {
+        win_index = _new_prof_win(to);
+        win = _wins[win_index].win;
+
+        if (prefs_get_chlog() && prefs_get_history()) {
+            _win_show_history(win, win_index, to);
+        }
 
+        // say whether contact is in roster only once on creating window
+        if (contact == NULL) {
+            cons_show("%s is not one of your contacts.");
+        } else {
             if (strcmp(p_contact_show(contact), "offline") == 0) {
                 const char const *show = p_contact_show(contact);
                 const char const *status = p_contact_status(contact);
                 _show_status_string(win, to, show, status, "--", "offline");
             }
-
-        // use existing window
-        } else {
-            win = _wins[win_index].win;
         }
 
-        _win_show_time(win);
-        _win_show_user(win, from, 0);
-        _win_show_message(win, message);
-        _win_switch_if_active(win_index);
+    // use existing window
+    } else {
+        win = _wins[win_index].win;
     }
+
+    _win_show_time(win);
+    _win_show_user(win, from, 0);
+    _win_show_message(win, message);
+    _win_switch_if_active(win_index);
 }
 
 void