本文整理汇总了Python中weechat_otr.command_cb函数的典型用法代码示例。如果您正苦于以下问题:Python command_cb函数的具体用法?Python command_cb怎么用?Python command_cb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了command_cb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_smp_ask_question_secret
def test_smp_ask_question_secret(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
weechat_otr.command_cb(
None, 'server_nick2_buffer', 'smp ask question secret')
self.assertEqual(('secret', 'question'), context.smp_init)
示例2: test_smp_ask_nick_server_secret
def test_smp_ask_nick_server_secret(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
weechat_otr.command_cb(
None, None, 'smp ask nick2 server secret')
self.assertEqual(('secret', None), context.smp_init)
示例3: test_fingerprint_pattern
def test_fingerprint_pattern(self):
fpr_path1 = os.path.join(
sys.modules['weechat'].weechat_dir,
'otr',
'[email protected]')
with open(fpr_path1, 'w') as f:
for fields in [
['[email protected]', '[email protected]', 'irc', 'fp123', ''],
['[email protected]', '[email protected]', 'irc', 'fp123', ''],
['[email protected]', '[email protected]', 'irc', 'fp123', ''],
['[email protected]', '[email protected]', 'irc', 'fp123', ''],
]:
f.write("\t".join(fields))
f.write("\n")
account1 = weechat_otr.ACCOUNTS['[email protected]']
account1.getPrivkey()
weechat_otr.command_cb(None, None, 'fingerprint match')
self.assertNoPrintedContains('', '[email protected]')
self.assertPrinted('', (
'eval(${color:default}:! ${color:brown}otr${color:default}'
' !:)\t'
'(color default)[email protected] |[email protected] |F P 1 2 3 |'
'unverified\r\n'
'(color default)[email protected] |[email protected] |F P 1 2 3 |'
'unverified\r\n'
'(color default)[email protected] |[email protected] |F P 1 2 3 |'
'unverified'))
示例4: test_smp_abort
def test_smp_abort(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
context.in_smp = True
weechat_otr.command_cb(None, 'server_nick2_buffer', 'smp abort')
self.assertEqual([('SMP aborted.',)], context.smp_finishes)
示例5: test_command_cb_start_send_tag_off_with_hints
def test_command_cb_start_send_tag_off_with_hints(self):
sys.modules['weechat'].config_options['otr.general.hints'] = 'on'
weechat_otr.command_cb(None, None, 'start')
self.assertPrinted('server_nick_buffer',
'otr\tTo try OTR on all conversations with [email protected]: /otr ' +
'policy send_tag on')
示例6: test_policy_default_server_nick_buffer
def test_policy_default_server_nick_buffer(self):
weechat_otr.command_cb(None, None, 'policy default')
self.assertPrinted('server_nick_buffer', (
'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
'(color default)'
'Current default OTR policies:\r\n'
'(color default)'
' allow_v2 (allow OTR protocol version 2, effectively enable '
'OTR since v2 is the only supported version) : on\r\n'
'(color default)'
' html_escape (escape HTML special characters in outbound '
'messages) : off\r\n'
'(color default)'
' html_filter (filter HTML in incoming messages) : on\r\n'
'(color default)'
' log (enable logging of OTR conversations) : off\r\n'
'(color default)'
' require_encryption (refuse to send unencrypted messages when '
'OTR is enabled) : off\r\n'
'(color default)'
' send_tag (advertise your OTR capability using the whitespace '
'tag) : off\r\n'
'(color default)'
'Change default policies with: /otr policy default NAME on|off'))
示例7: test_smp_respond_nick_server_secret
def test_smp_respond_nick_server_secret(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
weechat_otr.command_cb(
None, 'server_nick2_buffer', 'smp respond nick2 server secret')
self.assertEqual(('secret', ), context.smp_got_secret)
示例8: test_print_buffer_not_private
def test_print_buffer_not_private(self):
weechat_otr.command_cb(None, None, 'start no_window_nick server')
self.assertPrinted('non_private_buffer', (
'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
'(color lightblue)'
'[no_window_nick] Sending OTR query... Please await confirmation '
'of the OTR session being started before sending a message.'))
示例9: test_smp_respond_secret_non_ascii
def test_smp_respond_secret_non_ascii(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
weechat_otr.command_cb(None, 'server_nick2_buffer',
weechat_otr.PYVER.to_str('smp respond deathtöngue'))
self.assertEqual((weechat_otr.PYVER.to_str('deathtöngue'), ),
context.smp_got_secret)
示例10: test_smp_ask_nick_server_secret_non_ascii
def test_smp_ask_nick_server_secret_non_ascii(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
weechat_otr.command_cb(None, None,
weechat_otr.PYVER.to_str('smp ask nick2 server motörhead'))
self.assertEqual((weechat_otr.PYVER.to_str('motörhead'), None),
context.smp_init)
示例11: test_command_cb_start_send_tag_on
def test_command_cb_start_send_tag_on(self):
sys.modules['weechat'].config_options[
'otr.policy.server.nick.nick.send_tag'] = 'on'
weechat_otr.command_cb(None, None, 'start')
self.assertPrinted('server_nick_buffer',
'otr\tSending OTR query... Please await confirmation of the OTR ' +
'session being started before sending a message.')
示例12: test_command_cb_start_send_tag_off_with_hints
def test_command_cb_start_send_tag_off_with_hints(self):
sys.modules['weechat'].config_options['otr.general.hints'] = 'on'
weechat_otr.command_cb(None, None, 'start')
self.assertPrinted('server_nick_buffer', (
'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
'(color lightblue)'
'To try OTR on all conversations with [email protected]: /otr '
'policy send_tag on'))
示例13: test_command_cb_start_send_tag_off
def test_command_cb_start_send_tag_off(self):
weechat_otr.command_cb(None, None, 'start')
self.assertPrinted('server_nick_buffer',
'otr\tSending OTR query... Please await confirmation of the OTR ' +
'session being started before sending a message.')
self.assertPrinted('server_nick_buffer',
'otr\tTo try OTR on all conversations with [email protected]: /otr ' +
'policy send_tag on')
示例14: test_smp_ask_nick_server_question_secret_multiple_words
def test_smp_ask_nick_server_question_secret_multiple_words(self):
context = self.setup_smp_context('[email protected]', '[email protected]')
weechat_otr.command_cb(
None, None, "smp ask nick2 server 'what is the secret?' "
"'eastmost penninsula is the secret'")
self.assertEqual(
('eastmost penninsula is the secret', 'what is the secret?'),
context.smp_init)
示例15: test_command_cb_start_send_tag_on
def test_command_cb_start_send_tag_on(self):
sys.modules['weechat'].config_options[
'otr.policy.server.nick.nick.send_tag'] = 'on'
weechat_otr.command_cb(None, None, 'start')
self.assertPrinted('server_nick_buffer', (
'eval(${color:default}:! ${color:brown}otr${color:default} !:)\t'
'(color lightblue)'
'Sending OTR query... Please await confirmation of the OTR '
'session being started before sending a message.'))