File 0007-no-need-to-notify-if-the-conversation-is-already-ope.patch of Package pidgin-libnotify

From 6e0f91d5a3c365cdb6004051185748ed9b0f888e Mon Sep 17 00:00:00 2001
From: Antony Dovgal <tony@daylessday.org>
Date: Thu, 27 Oct 2011 23:12:00 +0400
Subject: [PATCH 07/10] no need to notify if the conversation is already open

---
 src/pidgin-libnotify.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/pidgin-libnotify.c b/src/pidgin-libnotify.c
index d5fd8a3..ec37607 100644
--- a/src/pidgin-libnotify.c
+++ b/src/pidgin-libnotify.c
@@ -281,6 +281,7 @@ notify (const gchar *title,
 	PurpleBuddyIcon *buddy_icon;
 	gchar *tr_body;
 	PurpleContact *contact;
+	PurpleConversation *conv = NULL;
 
 	contact = purple_buddy_get_contact (buddy);
 
@@ -289,6 +290,15 @@ notify (const gchar *title,
 	else
 		tr_body = NULL;
 
+	conv = purple_find_conversation_with_account (PURPLE_CONV_TYPE_ANY, buddy->name, buddy->account);
+
+	if (conv && conv->ui_ops && conv->ui_ops->has_focus) {
+	    if (conv->ui_ops->has_focus(conv) == TRUE) {
+		/* do not notify if the conversation is currently in focus */
+		return;
+	    }
+	}
+
 	notification = g_hash_table_lookup (buddy_hash, contact);
 
 	if (notification != NULL) {
-- 
1.8.4.5

openSUSE Build Service is sponsored by