Add new extension point method
This commit is contained in:
parent
1a2d32fca5
commit
55889d045f
|
@ -851,7 +851,7 @@ class ChatControl(ChatControlBase):
|
|||
'authenticated': False}
|
||||
|
||||
if self.encryption:
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'encryption_state' + self.encryption, self, encryption_state)
|
||||
|
||||
self._show_lock_image(**encryption_state)
|
||||
|
@ -877,7 +877,7 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
def _on_authentication_button_clicked(self, widget):
|
||||
if self.encryption:
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'encryption_dialog' + self.encryption, self)
|
||||
|
||||
def send_message(self, message, keyID='', chatstate=None, xhtml=None,
|
||||
|
@ -888,7 +888,7 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
if self.encryption:
|
||||
self.sendmessage = True
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'send_message' + self.encryption, self)
|
||||
if not self.sendmessage:
|
||||
return
|
||||
|
@ -1399,7 +1399,7 @@ class ChatControl(ChatControlBase):
|
|||
def _on_message_tv_buffer_changed(self, textbuffer):
|
||||
super()._on_message_tv_buffer_changed(textbuffer)
|
||||
if textbuffer.get_char_count() and self.encryption:
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'typing' + self.encryption, self)
|
||||
if (not self.session or not self.session.status) and \
|
||||
gajim.connections[self.account].archiving_136_supported:
|
||||
|
|
|
@ -527,8 +527,6 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
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)
|
||||
|
||||
|
|
|
@ -2039,7 +2039,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
config_key = '%s-%s' % (self.name, obj.jid)
|
||||
encryption = gajim.config.get_per('encryption', config_key, 'encryption')
|
||||
if encryption:
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'encrypt' + encryption, self, obj, self.send_message)
|
||||
else:
|
||||
self.send_message(obj)
|
||||
|
@ -2646,7 +2646,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
config_key = '%s-%s' % (self.name, obj.jid)
|
||||
encryption = gajim.config.get_per('encryption', config_key, 'encryption')
|
||||
if encryption:
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'gc_encrypt' + encryption, self, obj, self.send_gc_message)
|
||||
else:
|
||||
self.send_gc_message(obj)
|
||||
|
|
|
@ -1084,7 +1084,7 @@ class ConnectionHandlersBase:
|
|||
if obj.conn.name != self.name:
|
||||
return
|
||||
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'decrypt', self, obj, self._on_message_received)
|
||||
if not obj.encrypted:
|
||||
self._on_message_received(obj)
|
||||
|
|
|
@ -822,7 +822,7 @@ class ConversationTextview(GObject.GObject):
|
|||
return True
|
||||
else:
|
||||
self.plugin_modified = False
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'hyperlink_handler', word, kind, self,
|
||||
self.tv.get_toplevel())
|
||||
if self.plugin_modified:
|
||||
|
@ -920,7 +920,7 @@ class ConversationTextview(GObject.GObject):
|
|||
|
||||
# PluginSystem: adding GUI extension point for ConversationTextview
|
||||
self.plugin_modified = False
|
||||
gajim.plugin_manager.gui_extension_point('print_special_text', self,
|
||||
gajim.plugin_manager.extension_point('print_special_text', self,
|
||||
special_text, other_tags, graphics, additional_data)
|
||||
if self.plugin_modified:
|
||||
return
|
||||
|
@ -1397,7 +1397,7 @@ class ConversationTextview(GObject.GObject):
|
|||
|
||||
# PluginSystem: adding GUI extension point for ConversationTextview
|
||||
self.plugin_modified = False
|
||||
gajim.plugin_manager.gui_extension_point('print_real_text', self,
|
||||
gajim.plugin_manager.extension_point('print_real_text', self,
|
||||
text, text_tags, graphics, iter_, additional_data)
|
||||
|
||||
if self.plugin_modified:
|
||||
|
|
|
@ -776,7 +776,7 @@ class GroupchatControl(ChatControlBase):
|
|||
'authenticated': False}
|
||||
|
||||
if self.encryption:
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'encryption_state' + self.encryption, self, encryption_state)
|
||||
|
||||
self._show_lock_image(**encryption_state)
|
||||
|
@ -802,7 +802,7 @@ class GroupchatControl(ChatControlBase):
|
|||
self.lock_image.set_sensitive(visible)
|
||||
|
||||
def _on_authentication_button_clicked(self, widget):
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'encryption_dialog' + self.encryption, self)
|
||||
|
||||
def _change_style(self, model, path, iter_, option):
|
||||
|
@ -2022,7 +2022,7 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
if self.encryption:
|
||||
self.sendmessage = True
|
||||
gajim.plugin_manager.gui_extension_point(
|
||||
gajim.plugin_manager.extension_point(
|
||||
'send_message' + self.encryption, self)
|
||||
if not self.sendmessage:
|
||||
return
|
||||
|
|
|
@ -157,6 +157,26 @@ class PluginManager(metaclass=Singleton):
|
|||
return plugin
|
||||
return None
|
||||
|
||||
@log_calls('PluginManager')
|
||||
def extension_point(self, gui_extpoint_name, *args):
|
||||
'''
|
||||
Invokes all handlers (from plugins) for a particular extension point, but
|
||||
doesnt add it to collection for further processing.
|
||||
For example if you pass a message for encryption via extension point to a
|
||||
plugin, its undesired that the call is stored and replayed on activating the
|
||||
plugin. For example after an update.
|
||||
|
||||
:param gui_extpoint_name: name of GUI extension point.
|
||||
:type gui_extpoint_name: str
|
||||
:param args: parameters to be passed to extension point handlers
|
||||
(typically and object that invokes `gui_extension_point`;
|
||||
however, this can be practically anything)
|
||||
:type args: tuple
|
||||
'''
|
||||
|
||||
self._execute_all_handlers_of_gui_extension_point(gui_extpoint_name,
|
||||
*args)
|
||||
|
||||
@log_calls('PluginManager')
|
||||
def gui_extension_point(self, gui_extpoint_name, *args):
|
||||
'''
|
||||
|
|
Loading…
Reference in New Issue