diff mcabber/src/jabglue.c @ 819:c2d7d9dd4193

New option 'block_unsubscribed'
author Mikael Berthe <mikael@lilotux.net>
date Sat, 22 Apr 2006 10:50:54 +0200
parents 55cd45481a07
children 19c615fd071e
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Fri Apr 21 19:08:04 2006 +0200
+++ b/mcabber/src/jabglue.c	Sat Apr 22 10:50:54 2006 +0200
@@ -785,7 +785,16 @@
 
   rname = strchr(from, '/');
   if (rname) rname++;
-  hk_message_in(jid, rname, timestamp, body, type);
+
+  // We don't call the message_in hook if 'block_unsubscribed' is true and
+  // this is a regular message from an unsubscribed user.
+  if (!settings_opt_get_int("block_unsubscribed") ||
+      (roster_getsubscription(jid) & sub_from) ||
+      (type && strcmp(type, "chat"))) {
+    hk_message_in(jid, rname, timestamp, body, type);
+  } else {
+    scr_LogPrint(LPRINT_LOGNORM, "Blocked a message from <%s>", jid);
+  }
   g_free(jid);
 }