From 881de6a7c02e4c11957a1bb0dd3b31b8884fa8b0 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 29 Oct 2011 07:05:19 +0200 Subject: add get_conversation_messages for the plugin API --- src/core.py | 12 ++++++++++++ src/tabs.py | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/core.py b/src/core.py index 5f734142..b39bf904 100644 --- a/src/core.py +++ b/src/core.py @@ -1734,3 +1734,15 @@ class Core(object): self.remote_fifo = None else: pass + + def get_conversation_messages(self): + """ + Returns a list of all the messages in the current chat. + If the current tab is not a ChatTab, returns None. + + Messages are namedtuples of the form + ('txt nick_color time str_time nickname user') + """ + if not isinstance(self.current_tab(), tabs.ChatTab): + return None + return self.current_tab().get_conversation_messages() diff --git a/src/tabs.py b/src/tabs.py index a349da0b..8606c450 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -368,6 +368,9 @@ class ChatTab(Tab): self.text_win.refresh(self._room) self.input.refresh() + def get_conversation_messages(self): + return self._room.messages + def command_say(self, line): raise NotImplementedError -- cgit v1.2.3