From fbfa0c71f1dfb7117d39f06d16466043393b045b Mon Sep 17 00:00:00 2001
From: Denis Fomin <fominde@gmail.com>
Date: Mon, 26 Sep 2011 20:47:33 +0300
Subject: [PATCH] New gui_extension_point added. Do not use all args in
 remove_gui_extension_point() to identify elements to be removed. Use only
 first one

---
 src/chat_control.py          | 8 ++++++--
 src/conversation_textview.py | 9 +++++++++
 src/plugins/pluginmanager.py | 8 ++++++--
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/chat_control.py b/src/chat_control.py
index 511a21bbcb..d3dfa6bc27 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -521,8 +521,12 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
         super(ChatControlBase, self).shutdown()
         # PluginSystem: removing GUI extension points connected with ChatControlBase
         # instance object
-        gajim.plugin_manager.remove_gui_extension_point('chat_control_base', self)
-        gajim.plugin_manager.remove_gui_extension_point('chat_control_base_draw_banner', self)
+        gajim.plugin_manager.remove_gui_extension_point('chat_control_base',
+            self)
+        gajim.plugin_manager.remove_gui_extension_point(
+            'chat_control_base_draw_banner', self)
+        gajim.plugin_manager.remove_gui_extension_point('print_special_text',
+            self)
         gajim.ged.remove_event_handler('our-show', ged.GUI1,
             self._nec_our_status)
 
diff --git a/src/conversation_textview.py b/src/conversation_textview.py
index 12912f2144..7de98f3175 100644
--- a/src/conversation_textview.py
+++ b/src/conversation_textview.py
@@ -1039,6 +1039,15 @@ class ConversationTextview(gobject.GObject):
         Is called by detect_and_print_special_text and prints special text
         (emots, links, formatting)
         """
+
+
+        # PluginSystem: adding GUI extension point for ConversationTextview
+        self.plugin_modified = False
+        gajim.plugin_manager.gui_extension_point('print_special_text', self,
+            special_text, other_tags, graphics)
+        if self.plugin_modified:
+            return
+
         tags = []
         use_other_tags = True
         text_is_valid_uri = False
diff --git a/src/plugins/pluginmanager.py b/src/plugins/pluginmanager.py
index 5aed9edba4..18e4765c36 100644
--- a/src/plugins/pluginmanager.py
+++ b/src/plugins/pluginmanager.py
@@ -215,9 +215,13 @@ class PluginManager(object):
                 extension point name) to identify element to be removed.
         :type args: tuple
         '''
-
         if gui_extpoint_name in self.gui_extension_points:
-            self.gui_extension_points[gui_extpoint_name].remove(args)
+            extension_points = list(self.gui_extension_points[gui_extpoint_name])
+            for ext_point in extension_points:
+                if args[0] in ext_point:
+                    self.gui_extension_points[gui_extpoint_name].remove(
+                        ext_point)
+
 
     @log_calls('PluginManager')
     def _add_gui_extension_point_call_to_list(self, gui_extpoint_name, *args):
-- 
GitLab