From 6d0e6b5289d21cd2ab7db5fef7e472258947ee0a Mon Sep 17 00:00:00 2001
From: Jean-Marie Traissard <jim@lapin.org>
Date: Sun, 21 May 2006 19:46:36 +0000
Subject: [PATCH] Do not play incoming message sound when message from unknown
 contact and ignore_unknown_contacts Fixes #1970.

---
 src/gajim.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/gajim.py b/src/gajim.py
index 3d909dfb6..4e4827776 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -507,6 +507,10 @@ class Interface:
 		if not message: # empty message text
 			return
 
+		if gajim.config.get('ignore_unknown_contacts') and \
+			not gajim.contacts.get_contact(account, jid) and not pm:
+			return
+
 		first = False
 		if not chat_control and not gajim.awaiting_events[account].has_key(
 		jid_of_control):
@@ -541,11 +545,6 @@ class Interface:
 			groupchat_control.on_private_message(nick, message, array[2])
 			return
 				
-		# THIS HAS TO BE AFTER PM handling so we can get PMs
-		if gajim.config.get('ignore_unknown_contacts') and \
-			not gajim.contacts.get_contact(account, jid):
-			return
-
 		if first:
 			if gajim.config.get('notify_on_new_message') and \
 			helpers.allow_showing_notification(account):