Beispiel #1
0
    def init(self):
        # set the default values from the config
        global OTR_DIR
        OTR_DIR = os.path.expanduser(self.config.get('keys_dir', '') or OTR_DIR)
        try:
            os.makedirs(OTR_DIR)
        except OSError as e:
            if e.errno != 17:
                self.api.information('The OTR-specific folder could not '
                                     'be created. Poezio will be unable '
                                     'to save keys and trusts', 'OTR')

        except:
            self.api.information('The OTR-specific folder could not '
                                 'be created. Poezio will be unable '
                                 'to save keys and trusts', 'OTR')

        self.api.add_event_handler('conversation_msg', self.on_conversation_msg)
        self.api.add_event_handler('private_msg', self.on_conversation_msg)
        self.api.add_event_handler('conversation_say_after', self.on_conversation_say)
        self.api.add_event_handler('private_say_after', self.on_conversation_say)

        ConversationTab.add_information_element('otr', self.display_encryption_status)
        PrivateTab.add_information_element('otr', self.display_encryption_status)

        self.account = PoezioAccount(self.core.xmpp.boundjid.bare, OTR_DIR)
        self.account.load_trusts()
        self.contexts = {}
        usage = '<start|refresh|end|fpr|ourfpr|drop|trust|untrust>'
        shortdesc = 'Manage an OTR conversation'
        desc = ('Manage an OTR conversation.\n'
                'start/refresh: Start or refresh a conversation\n'
                'end: End a conversation\n'
                'fpr: Show the fingerprint of the key of the remote user\n'
                'ourfpr: Show the fingerprint of your own key\n'
                'drop: Remove the current key (FOREVER)\n'
                'trust: Set this key for this contact as trusted\n'
                'untrust: Remove the trust for the key of this contact\n')
        smp_usage = '<abort|ask|answer> [question] [answer]'
        smp_short = 'Identify a contact'
        smp_desc = ('Verify the identify of your contact by using a pre-defined secret.\n'
                    'abort: Abort an ongoing verification\n'
                    'ask: Start a verification, with a question or not\n'
                    'answer: Finish a verification\n')

        self.api.add_tab_command(ConversationTab, 'otrsmp', self.command_smp,
                                 help=smp_desc, usage=smp_usage, short=smp_short,
                                 completion=self.completion_smp)
        self.api.add_tab_command(PrivateTab, 'otrsmp', self.command_smp,
                                 help=smp_desc, usage=smp_usage, short=smp_short,
                                 completion=self.completion_smp)

        self.api.add_tab_command(ConversationTab, 'otr', self.command_otr,
                                 help=desc, usage=usage, short=shortdesc,
                                 completion=self.completion_otr)
        self.api.add_tab_command(PrivateTab, 'otr', self.command_otr,
                                 help=desc, usage=usage, short=shortdesc,
                                 completion=self.completion_otr)
Beispiel #2
0
    def init(self):
        # set the default values from the config
        global OTR_DIR
        OTR_DIR = os.path.expanduser(self.config.get('keys_dir', '') or OTR_DIR)
        try:
            os.makedirs(OTR_DIR)
        except OSError as e:
            if e.errno != 17:
                self.api.information('The OTR-specific folder could not '
                                     'be created. Poezio will be unable '
                                     'to save keys and trusts', 'OTR')

        except:
            self.api.information('The OTR-specific folder could not '
                                 'be created. Poezio will be unable '
                                 'to save keys and trusts', 'OTR')

        self.api.add_event_handler('conversation_msg', self.on_conversation_msg)
        self.api.add_event_handler('private_msg', self.on_conversation_msg)
        self.api.add_event_handler('conversation_say_after', self.on_conversation_say)
        self.api.add_event_handler('private_say_after', self.on_conversation_say)

        ConversationTab.add_information_element('otr', self.display_encryption_status)
        PrivateTab.add_information_element('otr', self.display_encryption_status)

        self.account = PoezioAccount(self.core.xmpp.boundjid.bare, OTR_DIR)
        self.account.load_trusts()
        self.contexts = {}
        usage = '<start|refresh|end|fpr|ourfpr|drop|trust|untrust>'
        shortdesc = 'Manage an OTR conversation'
        desc = ('Manage an OTR conversation.\n'
                'start/refresh: Start or refresh a conversation\n'
                'end: End a conversation\n'
                'fpr: Show the fingerprint of the key of the remote user\n'
                'ourfpr: Show the fingerprint of your own key\n'
                'drop: Remove the current key (FOREVER)\n'
                'trust: Set this key for this contact as trusted\n'
                'untrust: Remove the trust for the key of this contact\n')
        smp_usage = '<abort|ask|answer> [question] [answer]'
        smp_short = 'Identify a contact'
        smp_desc = ('Verify the identify of your contact by using a pre-defined secret.\n'
                    'abort: Abort an ongoing verification\n'
                    'ask: Start a verification, with a question or not\n'
                    'answer: Finish a verification\n')

        self.api.add_tab_command(ConversationTab, 'otrsmp', self.command_smp,
                                 help=smp_desc, usage=smp_usage, short=smp_short,
                                 completion=self.completion_smp)
        self.api.add_tab_command(PrivateTab, 'otrsmp', self.command_smp,
                                 help=smp_desc, usage=smp_usage, short=smp_short,
                                 completion=self.completion_smp)

        self.api.add_tab_command(ConversationTab, 'otr', self.command_otr,
                                 help=desc, usage=usage, short=shortdesc,
                                 completion=self.completion_otr)
        self.api.add_tab_command(PrivateTab, 'otr', self.command_otr,
                                 help=desc, usage=usage, short=shortdesc,
                                 completion=self.completion_otr)
Beispiel #3
0
    def init(self):
        # set the default values from the config
        allow_v2 = self.config.get('allow_v2', True)
        POLICY_FLAGS['ALLOW_V2'] = allow_v2
        allow_v1 = self.config.get('allow_v1', False)
        POLICY_FLAGS['ALLOW_v1'] = allow_v1

        global OTR_DIR
        OTR_DIR = os.path.expanduser(self.config.get('keys_dir', '') or OTR_DIR)
        try:
            os.makedirs(OTR_DIR)
        except OSError as e:
            if e.errno != 17:
                self.api.information('The OTR-specific folder could not be created'
                        ' poezio will be unable to save keys and trusts', 'OTR')

        except:
            self.api.information('The OTR-specific folder could not be created'
                    ' poezio will be unable to save keys and trusts', 'OTR')

        self.api.add_event_handler('conversation_msg', self.on_conversation_msg)
        self.api.add_event_handler('private_msg', self.on_conversation_msg)
        self.api.add_event_handler('conversation_say_after', self.on_conversation_say)
        self.api.add_event_handler('private_say_after', self.on_conversation_say)

        ConversationTab.add_information_element('otr', self.display_encryption_status)
        PrivateTab.add_information_element('otr', self.display_encryption_status)

        self.account = PoezioAccount(self.core.xmpp.boundjid.bare, OTR_DIR)
        self.account.load_trusts()
        self.contexts = {}
        usage = '[start|refresh|end|fpr|ourfpr|drop|trust|untrust]'
        shortdesc = 'Manage an OTR conversation'
        desc = ('Manage an OTR conversation.\n'
                'start/refresh: Start or refresh a conversation\n'
                'end: End a conversation\n'
                'fpr: Show the fingerprint of the key of the remote user\n'
                'ourfpr: Show the fingerprint of your own key\n'
                'drop: Remove the current key (FOREVER)\n'
                'trust: Set this key for this contact as trusted\n'
                'untrust: Remove the trust for the key of this contact\n')
        self.api.add_tab_command(ConversationTab, 'otr', self.command_otr,
                help=desc,
                usage=usage,
                short=shortdesc,
                completion=self.completion_otr)
        self.api.add_tab_command(PrivateTab, 'otr', self.command_otr,
                help=desc,
                usage=usage,
                short=shortdesc,
                completion=self.completion_otr)
Beispiel #4
0
    def init(self):
        # set the default values from the config
        allow_v2 = self.config.get('allow_v2', True)
        POLICY_FLAGS['ALLOW_V2'] = allow_v2
        allow_v1 = self.config.get('allow_v1', False)
        POLICY_FLAGS['ALLOW_v1'] = allow_v1

        global OTR_DIR
        OTR_DIR = os.path.expanduser(
            self.config.get('keys_dir', '') or OTR_DIR)
        try:
            os.makedirs(OTR_DIR)
        except OSError as e:
            if e.errno != 17:
                self.api.information(
                    'The OTR-specific folder could not be created'
                    ' poezio will be unable to save keys and trusts', 'OTR')

        except:
            self.api.information(
                'The OTR-specific folder could not be created'
                ' poezio will be unable to save keys and trusts', 'OTR')

        self.api.add_event_handler('conversation_msg',
                                   self.on_conversation_msg)
        self.api.add_event_handler('private_msg', self.on_conversation_msg)
        self.api.add_event_handler('conversation_say_after',
                                   self.on_conversation_say)
        self.api.add_event_handler('private_say_after',
                                   self.on_conversation_say)

        ConversationTab.add_information_element('otr',
                                                self.display_encryption_status)
        PrivateTab.add_information_element('otr',
                                           self.display_encryption_status)

        self.account = PoezioAccount(self.core.xmpp.boundjid.bare, OTR_DIR)
        self.account.load_trusts()
        self.contexts = {}
        usage = '[start|refresh|end|fpr|ourfpr|drop|trust|untrust]'
        shortdesc = 'Manage an OTR conversation'
        desc = ('Manage an OTR conversation.\n'
                'start/refresh: Start or refresh a conversation\n'
                'end: End a conversation\n'
                'fpr: Show the fingerprint of the key of the remote user\n'
                'ourfpr: Show the fingerprint of your own key\n'
                'drop: Remove the current key (FOREVER)\n'
                'trust: Set this key for this contact as trusted\n'
                'untrust: Remove the trust for the key of this contact\n')
        self.api.add_tab_command(ConversationTab,
                                 'otr',
                                 self.command_otr,
                                 help=desc,
                                 usage=usage,
                                 short=shortdesc,
                                 completion=self.completion_otr)
        self.api.add_tab_command(PrivateTab,
                                 'otr',
                                 self.command_otr,
                                 help=desc,
                                 usage=usage,
                                 short=shortdesc,
                                 completion=self.completion_otr)