about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config/preferences.c2
-rw-r--r--src/server_events.c10
-rw-r--r--src/server_events.h2
3 files changed, 12 insertions, 2 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 3a7e489a..3d5c9325 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 
 #include <glib.h>
@@ -86,6 +87,7 @@ prefs_close(void)
 {
     autocomplete_free(boolean_choice_ac);
     g_key_file_free(prefs);
+    prefs = NULL;
 }
 
 char *
diff --git a/src/server_events.c b/src/server_events.c
index d8943885..23e4fce3 100644
--- a/src/server_events.c
+++ b/src/server_events.c
@@ -315,11 +315,17 @@ handle_contact_online(char *barejid, Resource *resource,
 {
     gboolean updated = roster_update_presence(barejid, resource, last_activity);
 
-    if (updated && prefs_get_boolean(PREF_STATUSES)) {
+    if (updated) {
+        char *show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
         PContact contact = roster_get_contact(barejid);
         if (p_contact_subscription(contact) != NULL) {
             if (strcmp(p_contact_subscription(contact), "none") != 0) {
-                cons_show_contact_online(contact, resource, last_activity);
+                if (g_strcmp0(show_console, "all") == 0) {
+                    cons_show_contact_online(contact, resource, last_activity);
+                } else if (g_strcmp0(show_console, "online") == 0 &&
+                        resource->presence == RESOURCE_ONLINE) {
+                    cons_show_contact_online(contact, resource, last_activity);
+                }
                 ui_chat_win_contact_online(contact, resource, last_activity);
             }
         }
diff --git a/src/server_events.h b/src/server_events.h
index ce3c3b49..64bd04a7 100644
--- a/src/server_events.h
+++ b/src/server_events.h
@@ -23,6 +23,8 @@
 #ifndef SERVER_EVENTS_H
 #define SERVER_EVENTS_H
 
+#include "xmpp/xmpp.h"
+
 void handle_error_message(const char *from, const char *err_msg);
 void handle_login_account_success(char *account_name);
 void handle_lost_connection(void);