Example #1
0
 def __init__(self, core, jid):
     OneToOneTab.__init__(self, core, jid)
     self.nick = None
     self.nick_sent = False
     self.state = 'normal'
     self.name = jid        # a conversation tab is linked to one specific full jid OR bare jid
     self.text_win = windows.TextWin()
     self._text_buffer.add_window(self.text_win)
     self.upper_bar = windows.ConversationStatusMessageWin()
     self.input = windows.MessageInput()
     # keys
     self.key_func['^I'] = self.completion
     # commands
     self.register_command('version', self.command_version,
             desc='Get the software version of the current interlocutor (usually its XMPP client and Operating System).',
             shortdesc='Get the software version of the user.')
     self.register_command('info', self.command_info,
             shortdesc='Get the status of the contact.')
     self.register_command('last_activity', self.command_last_activity,
             usage='[jid]',
             desc='Get the last activity of the given or the current contact.',
             shortdesc='Get the activity.',
             completion=self.core.completion.last_activity)
     self.register_command('add', self.command_add,
             desc='Add the current JID to your roster, ask them to'
                  ' allow you to see his presence, and allow them to'
                  ' see your presence.',
             shortdesc='Add a user to your roster.')
     self.update_commands()
     self.update_keys()
Example #2
0
 def __init__(self, core, jid):
     OneToOneTab.__init__(self, core, jid)
     self.nick = None
     self.nick_sent = False
     self.state = 'normal'
     self.text_win = windows.TextWin()
     self._text_buffer.add_window(self.text_win)
     self.upper_bar = windows.ConversationStatusMessageWin()
     self.input = windows.MessageInput()
     # keys
     self.key_func['^I'] = self.completion
     # commands
     self.register_command(
         'version',
         self.command_version,
         desc=
         'Get the software version of the current interlocutor (usually its XMPP client and Operating System).',
         shortdesc='Get the software version of the user.')
     self.register_command('info',
                           self.command_info,
                           shortdesc='Get the status of the contact.')
     self.register_command(
         'last_activity',
         self.command_last_activity,
         usage='[jid]',
         desc='Get the last activity of the given or the current contact.',
         shortdesc='Get the activity.',
         completion=self.core.completion.last_activity)
     self.register_command('invite',
                           self.core.command.impromptu,
                           desc='Invite people into an impromptu room.',
                           shortdesc='Invite other users to the discussion',
                           completion=self.core.completion.impromptu)
     self.update_commands()
     self.update_keys()
Example #3
0
 def __init__(self, core, name, nick):
     OneToOneTab.__init__(self, core, name)
     self.own_nick = nick
     self.name = name
     self.text_win = windows.TextWin()
     self._text_buffer.add_window(self.text_win)
     self.info_header = windows.PrivateInfoWin()
     self.input = windows.MessageInput()
     # keys
     self.key_func['^I'] = self.completion
     # commands
     self.register_command(
         'info',
         self.command_info,
         desc=
         'Display some information about the user in the MUC: its/his/her role, affiliation, status and status message.',
         shortdesc='Info about the user.')
     self.register_command(
         'version',
         self.command_version,
         desc=
         'Get the software version of the current interlocutor (usually its XMPP client and Operating System).',
         shortdesc='Get the software version of a jid.')
     self.resize()
     self.parent_muc = self.core.tabs.by_name_and_class(
         safeJID(name).bare, MucTab)
     self.on = True
     self.update_commands()
     self.update_keys()
Example #4
0
    def __init__(self, core, jid: Union[JID, str]):
        Tab.__init__(self, core)

        if not isinstance(jid, JID):
            jid = JID(jid)
        assert jid.domain
        self._jid = jid
        #: Is the tab currently requesting MAM data?
        self.query_status = False
        self._name = jid.full  # type: Optional[str]
        self.text_win = windows.TextWin()
        self.directed_presence = None
        self._text_buffer = TextBuffer()
        self._text_buffer.add_window(self.text_win)
        self.chatstate = None  # can be "active", "composing", "paused", "gone", "inactive"
        # We keep a reference of the event that will set our chatstate to "paused", so that
        # we can delete it or change it if we need to
        self.timed_event_paused = None
        self.timed_event_not_paused = None
        # Keeps the last sent message to complete it easily in completion_correct, and to replace it.
        self.last_sent_message = {}
        self.key_func['M-v'] = self.move_separator
        self.key_func['M-h'] = self.scroll_separator
        self.key_func['M-/'] = self.last_words_completion
        self.key_func['^M'] = self.on_enter
        self.register_command(
            'say',
            self.command_say,
            usage='<message>',
            shortdesc='Send the message.')
        self.register_command(
            'scrollback',
            self.command_scrollback,
            usage="end home clear status goto <+|-linecount>|<linenum>|<timestamp>",
            shortdesc='Scrollback to the given line number, message, or clear the buffer.')
        self.commands['sb'] = self.commands['scrollback']
        self.register_command(
            'xhtml',
            self.command_xhtml,
            usage='<custom xhtml>',
            shortdesc='Send custom XHTML.')
        self.register_command(
            'clear', self.command_clear, shortdesc='Clear the current buffer.')
        self.register_command(
            'correct',
            self.command_correct,
            desc='Fix the last message with whatever you want.',
            shortdesc='Correct the last message.',
            completion=self.completion_correct)
        self.chat_state = None  # type: Optional[str]
        self.update_commands()
        self.update_keys()
Example #5
0
    def __init__(self, core):
        Tab.__init__(self, core)
        self.name = "Roster"
        self.v_separator = windows.VerticalSeparator()
        self.information_win = windows.TextWin()
        self.core.information_buffer.add_window(self.information_win)
        self.roster_win = windows.RosterWin()
        self.contact_info_win = windows.ContactInfoWin()
        self.default_help_message = windows.HelpText("Enter commands with “/”. “o”: toggle offline show")
        self.input = self.default_help_message
        self.state = 'normal'
        self.key_func['^I'] = self.completion
        self.key_func["/"] = self.on_slash
        # disable most of the roster features when in anonymous mode
        if not self.core.xmpp.anon:
            self.key_func[' '] = self.on_space
            self.key_func["KEY_UP"] = self.move_cursor_up
            self.key_func["KEY_DOWN"] = self.move_cursor_down
            self.key_func["M-u"] = self.move_cursor_to_next_contact
            self.key_func["M-y"] = self.move_cursor_to_prev_contact
            self.key_func["M-U"] = self.move_cursor_to_next_group
            self.key_func["M-Y"] = self.move_cursor_to_prev_group
            self.key_func["M-[1;5B"] = self.move_cursor_to_next_group
            self.key_func["M-[1;5A"] = self.move_cursor_to_prev_group
            self.key_func["l"] = self.command_last_activity
            self.key_func["o"] = self.toggle_offline_show
            self.key_func["v"] = self.get_contact_version
            self.key_func["i"] = self.show_contact_info
            self.key_func["s"] = self.start_search
            self.key_func["S"] = self.start_search_slow
            self.key_func["n"] = self.change_contact_name
            self.register_command('deny', self.command_deny,
                    usage='[jid]',
                    desc='Deny your presence to the provided JID (or the '
                         'selected contact in your roster), who is asking'
                         'you to be in his/here roster.',
                    shortdesc='Deny a user your presence.',
                    completion=self.completion_deny)
            self.register_command('accept', self.command_accept,
                    usage='[jid]',
                    desc='Allow the provided JID (or the selected contact '
                         'in your roster), to see your presence.',
                    shortdesc='Allow a user your presence.',
                    completion=self.completion_deny)
            self.register_command('add', self.command_add,
                    usage='<jid>',
                    desc='Add the specified JID to your roster, ask him to'
                         ' allow you to see his presence, and allow him to'
                         ' see your presence.',
                    shortdesc='Add a user to your roster.')
            self.register_command('name', self.command_name,
                    usage='<jid> [name]',
                    shortdesc='Set the given JID\'s name.',
                    completion=self.completion_name)
            self.register_command('groupadd', self.command_groupadd,
                    usage='[<jid> <group>]|<group>',
                    desc='Add the given JID or selected line to the given group.',
                    shortdesc='Add a user to a group',
                    completion=self.completion_groupadd)
            self.register_command('groupmove', self.command_groupmove,
                    usage='<jid> <old group> <new group>',
                    desc='Move the given JID from the old group to the new group.',
                    shortdesc='Move a user to another group.',
                    completion=self.completion_groupmove)
            self.register_command('groupremove', self.command_groupremove,
                    usage='<jid> <group>',
                    desc='Remove the given JID from the given group.',
                    shortdesc='Remove a user from a group.',
                    completion=self.completion_groupremove)
            self.register_command('remove', self.command_remove,
                    usage='[jid]',
                    desc='Remove the specified JID from your roster. This '
                         'will unsubscribe you from its presence, cancel '
                         'its subscription to yours, and remove the item '
                         'from your roster.',
                    shortdesc='Remove a user from your roster.',
                    completion=self.completion_remove)
            self.register_command('export', self.command_export,
                    usage='[/path/to/file]',
                    desc='Export your contacts into /path/to/file if '
                         'specified, or $HOME/poezio_contacts if not.',
                    shortdesc='Export your roster to a file.',
                    completion=partial(self.completion_file, 1))
            self.register_command('import', self.command_import,
                    usage='[/path/to/file]',
                    desc='Import your contacts from /path/to/file if '
                         'specified, or $HOME/poezio_contacts if not.',
                    shortdesc='Import your roster from a file.',
                    completion=partial(self.completion_file, 1))
            self.register_command('password', self.command_password,
                    usage='<password>',
                    shortdesc='Change your password')

        self.register_command('reconnect', self.command_reconnect,
                desc='Disconnect from the remote server if you are '
                     'currently connected and then connect to it again.',
                shortdesc='Disconnect and reconnect to the server.')
        self.register_command('disconnect', self.command_disconnect,
                desc='Disconnect from the remote server.',
                shortdesc='Disconnect from the server.')
        self.register_command('clear', self.command_clear,
                shortdesc='Clear the info buffer.')
        self.register_command('last_activity', self.command_last_activity,
                usage='<jid>',
                desc='Informs you of the last activity of a JID.',
                shortdesc='Get the activity of someone.',
                completion=self.core.completion.last_activity)

        self.resize()
        self.update_commands()
        self.update_keys()
Example #6
0
    def __init__(self, core):
        Tab.__init__(self, core)
        self.state = 'normal'
        self.name = 'XMLTab'
        self.filters = []

        self.core_buffer = self.core.xml_buffer
        self.filtered_buffer = text_buffer.TextBuffer()

        self.info_header = windows.XMLInfoWin()
        self.text_win = windows.TextWin()
        self.core_buffer.add_window(self.text_win)
        self.default_help_message = windows.HelpText("/ to enter a command")

        self.register_command('close', self.close, shortdesc="Close this tab.")
        self.register_command('clear',
                              self.command_clear,
                              shortdesc='Clear the current buffer.')
        self.register_command('filter_reset',
                              self.command_filter_reset,
                              shortdesc='Reset the stanza filter.')
        self.register_command('filter_id',
                              self.command_filter_id,
                              usage='<id>',
                              desc='Show only the stanzas with the id <id>.',
                              shortdesc='Filter by id.')
        self.register_command(
            'filter_xpath',
            self.command_filter_xpath,
            usage='<xpath>',
            desc='Show only the stanzas matching the xpath <xpath>.'
            ' Any occurrences of %n will be replaced by jabber:client.',
            shortdesc='Filter by XPath.')
        self.register_command(
            'filter_jid',
            self.command_filter_jid,
            usage='<jid>',
            desc=
            'Show only the stanzas matching the jid <jid> in from= or to=.',
            shortdesc='Filter by JID.')
        self.register_command(
            'filter_from',
            self.command_filter_from,
            usage='<jid>',
            desc='Show only the stanzas matching the jid <jid> in from=.',
            shortdesc='Filter by JID from.')
        self.register_command(
            'filter_to',
            self.command_filter_to,
            usage='<jid>',
            desc='Show only the stanzas matching the jid <jid> in to=.',
            shortdesc='Filter by JID to.')
        self.register_command(
            'filter_xmlmask',
            self.command_filter_xmlmask,
            usage='<xml mask>',
            desc='Show only the stanzas matching the given xml mask.',
            shortdesc='Filter by xml mask.')
        self.register_command(
            'dump',
            self.command_dump,
            usage='<filename>',
            desc='Writes the content of the XML buffer into a file.',
            shortdesc='Write in a file.')
        self.input = self.default_help_message
        self.key_func['^T'] = self.close
        self.key_func['^I'] = self.completion
        self.key_func["KEY_DOWN"] = self.on_scroll_down
        self.key_func["KEY_UP"] = self.on_scroll_up
        self.key_func["^K"] = self.on_freeze
        self.key_func["/"] = self.on_slash
        self.resize()
        # Used to display the infobar
        self.filter_type = ''
        self.filter = ''
Example #7
0
    def __init__(self, core):
        Tab.__init__(self, core)
        self.name = "Roster"
        self.v_separator = windows.VerticalSeparator()
        self.information_win = windows.TextWin()
        self.core.information_buffer.add_window(self.information_win)
        self.roster_win = windows.RosterWin()
        self.contact_info_win = windows.ContactInfoWin()
        self.avatar_win = windows.ImageWin()
        self.default_help_message = windows.HelpText(
            "Enter commands with “/”. “o”: toggle offline show")
        self.input = self.default_help_message
        self.state = 'normal'
        self.key_func['^I'] = self.completion
        self.key_func["/"] = self.on_slash
        # disable most of the roster features when in anonymous mode
        if not self.core.xmpp.anon:
            self.key_func[' '] = self.on_space
            self.key_func["KEY_UP"] = self.move_cursor_up
            self.key_func["KEY_DOWN"] = self.move_cursor_down
            self.key_func["M-u"] = self.move_cursor_to_next_contact
            self.key_func["M-y"] = self.move_cursor_to_prev_contact
            self.key_func["M-U"] = self.move_cursor_to_next_group
            self.key_func["M-Y"] = self.move_cursor_to_prev_group
            self.key_func["M-[1;5B"] = self.move_cursor_to_next_group
            self.key_func["M-[1;5A"] = self.move_cursor_to_prev_group
            self.key_func["l"] = self.command_last_activity
            self.key_func["o"] = self.toggle_offline_show
            self.key_func["v"] = self.get_contact_version
            self.key_func["i"] = self.show_contact_info
            self.key_func["s"] = self.start_search
            self.key_func["S"] = self.start_search_slow
            self.key_func["n"] = self.change_contact_name
        self.register_command(
            'name',
            self.command_name,
            usage='<jid> [name]',
            shortdesc='Set the given JID\'s name.',
            completion=self.completion_name)
        self.register_command(
            'groupadd',
            self.command_groupadd,
            usage='[<jid> <group>]|<group>',
            desc='Add the given JID or selected line to the given group.',
            shortdesc='Add a user to a group',
            completion=self.completion_groupadd)
        self.register_command(
            'groupmove',
            self.command_groupmove,
            usage='<jid> <old group> <new group>',
            desc='Move the given JID from the old group to the new group.',
            shortdesc='Move a user to another group.',
            completion=self.completion_groupmove)
        self.register_command(
            'groupremove',
            self.command_groupremove,
            usage='<jid> <group>',
            desc='Remove the given JID from the given group.',
            shortdesc='Remove a user from a group.',
            completion=self.completion_groupremove)
        self.register_command(
            'export',
            self.command_export,
            usage='[/path/to/file]',
            desc='Export your contacts into /path/to/file if '
            'specified, or $HOME/poezio_contacts if not.',
            shortdesc='Export your roster to a file.',
            completion=partial(self.completion_file, 1))
        self.register_command(
            'import',
            self.command_import,
            usage='[/path/to/file]',
            desc='Import your contacts from /path/to/file if '
            'specified, or $HOME/poezio_contacts if not.',
            shortdesc='Import your roster from a file.',
            completion=partial(self.completion_file, 1))
        self.register_command(
            'password',
            self.command_password,
            usage='<password>',
            shortdesc='Change your password')
        self.register_command(
            'disconnect',
            self.command_disconnect,
            desc='Disconnect from the remote server.',
            shortdesc='Disconnect from the server.')
        self.register_command(
            'clear', self.command_clear, shortdesc='Clear the info buffer.')
        self.register_command(
            'last_activity',
            self.command_last_activity,
            usage='<jid>',
            desc='Informs you of the last activity of a JID.',
            shortdesc='Get the activity of someone.',
            completion=self.core.completion.last_activity)

        self.resize()
        self.update_commands()
        self.update_keys()