Move /clear to the chattab instead of the muctab

This commit is contained in:
mathieui 2011-11-13 14:31:11 +01:00
parent 6dfc2ef9b5
commit 30b9827a27

View file

@ -303,6 +303,8 @@ class ChatTab(Tab):
_("""Usage: /say <message>\nSay: Just send the message. _("""Usage: /say <message>\nSay: Just send the message.
Useful if you want your message to begin with a '/'."""), None) Useful if you want your message to begin with a '/'."""), None)
self.commands['xhtml'] = (self.command_xhtml, _("Usage: /xhtml <custom xhtml>\nXHTML: Send custom XHTML."), None) self.commands['xhtml'] = (self.command_xhtml, _("Usage: /xhtml <custom xhtml>\nXHTML: Send custom XHTML."), None)
self.commands['clear'] = (self.command_clear,
_('Usage: /clear\nClear: Clear the current buffer.'), None)
self.chat_state = None self.chat_state = None
self.update_commands() self.update_commands()
@ -357,6 +359,15 @@ class ChatTab(Tab):
self.refresh() self.refresh()
msg.send() msg.send()
def command_clear(self, args):
"""
/clear
"""
self._text_buffer.messages = []
self.text_win.rebuild_everything(self._text_buffer)
self.refresh()
self.core.doupdate()
def send_chat_state(self, state, always_send=False): def send_chat_state(self, state, always_send=False):
""" """
Send an empty chatstate message Send an empty chatstate message
@ -476,8 +487,6 @@ class MucTab(ChatTab):
self.commands['configure'] = (self.command_configure, _('Usage: /configure\nConfigure: Configure the current room, through a form.'), None) self.commands['configure'] = (self.command_configure, _('Usage: /configure\nConfigure: Configure the current room, through a form.'), None)
self.commands['version'] = (self.command_version, _('Usage: /version <jid or nick>\nVersion: Get the software version of the given JID or nick in room (usually its XMPP client and Operating System).'), None) self.commands['version'] = (self.command_version, _('Usage: /version <jid or nick>\nVersion: Get the software version of the given JID or nick in room (usually its XMPP client and Operating System).'), None)
self.commands['names'] = (self.command_names, _('Usage: /names\nNames: Get the list of the users in the room, and the list of the people assuming the different roles.'), None) self.commands['names'] = (self.command_names, _('Usage: /names\nNames: Get the list of the users in the room, and the list of the people assuming the different roles.'), None)
self.commands['clear'] = (self.command_clear,
_('Usage: /clear\nClear: Clear the current buffer.'), None)
self.resize() self.resize()
self.update_commands() self.update_commands()
@ -526,15 +535,6 @@ class MucTab(ChatTab):
self.core.xmpp.plugin['xep_0045'].configureRoom(self.get_name(), form) self.core.xmpp.plugin['xep_0045'].configureRoom(self.get_name(), form)
self.core.close_tab() self.core.close_tab()
def command_clear(self, args):
"""
/clear
"""
self._text_buffer.messages = []
self.text_win.rebuild_everything(self._text_buffer)
self.refresh()
self.core.doupdate()
def command_cycle(self, arg): def command_cycle(self, arg):
if self.joined: if self.joined:
muc.leave_groupchat(self.core.xmpp, self.get_name(), self.own_nick, arg) muc.leave_groupchat(self.core.xmpp, self.get_name(), self.own_nick, arg)