summaryrefslogtreecommitdiff
path: root/poezio/tabs
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2018-12-01 22:48:50 +0000
committerMaxime “pep” Buquet <pep@bouah.net>2018-12-15 21:00:46 +0000
commit0c9c4edfa2ed213baf600957a05b3f54d395996b (patch)
tree1661649840c187bb2842c371877feecadde2ed78 /poezio/tabs
parente992107ecff9a2f3f1282a87bdc8edfadcd01090 (diff)
downloadpoezio-0c9c4edfa2ed213baf600957a05b3f54d395996b.tar.gz
poezio-0c9c4edfa2ed213baf600957a05b3f54d395996b.tar.bz2
poezio-0c9c4edfa2ed213baf600957a05b3f54d395996b.tar.xz
poezio-0c9c4edfa2ed213baf600957a05b3f54d395996b.zip
Allow additional information elements in MucInfoWin same as ConversationInfoWin
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'poezio/tabs')
-rw-r--r--poezio/tabs/muctab.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index bc82b2fe..54795bc3 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -52,6 +52,7 @@ class MucTab(ChatTab):
message_type = 'groupchat'
plugin_commands = {} # type: Dict[str, Command]
plugin_keys = {} # type: Dict[str, Callable]
+ additional_information = {} # type: Dict[str, Callable[[str], str]]
def __init__(self, core, jid, nick, password=None):
ChatTab.__init__(self, core, jid)
@@ -106,6 +107,20 @@ class MucTab(ChatTab):
return last_message.time
return None
+ @staticmethod
+ def add_information_element(plugin_name: str, callback: Callable[[str], str]) -> None:
+ """
+ Lets a plugin add its own information to the MucInfoWin
+ """
+ MucTab.additional_information[plugin_name] = callback
+
+ @staticmethod
+ def remove_information_element(plugin_name: str) -> None:
+ """
+ Lets a plugin add its own information to the MucInfoWin
+ """
+ del MucTab.additional_information[plugin_name]
+
def cancel_config(self, form):
"""
The user do not want to send his/her config, send an iq cancel
@@ -440,7 +455,9 @@ class MucTab(ChatTab):
if self.core.tabs.current_tab is self:
self.text_win.refresh()
self.user_win.refresh_if_changed(self.users)
- self.info_header.refresh(self, self.text_win, user=self.own_user)
+ self.info_header.refresh(
+ self, self.text_win, user=self.own_user,
+ information=MucTab.additional_information)
self.input.refresh()
self.core.doupdate()
@@ -1225,7 +1242,9 @@ class MucTab(ChatTab):
if display_user_list:
self.v_separator.refresh()
self.user_win.refresh(self.users)
- self.info_header.refresh(self, self.text_win, user=self.own_user)
+ self.info_header.refresh(
+ self, self.text_win, user=self.own_user,
+ information=MucTab.additional_information)
self.refresh_tab_win()
if display_info_win:
self.info_win.refresh()