diff options
Diffstat (limited to 'beinc_weechat.py')
| -rw-r--r-- | beinc_weechat.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/beinc_weechat.py b/beinc_weechat.py index 1e8afb8..486c4f7 100644 --- a/beinc_weechat.py +++ b/beinc_weechat.py | |||
| @@ -21,7 +21,6 @@ import datetime | |||
| 21 | import httplib | 21 | import httplib |
| 22 | import json | 22 | import json |
| 23 | import os | 23 | import os |
| 24 | import random | ||
| 25 | import socket | 24 | import socket |
| 26 | import ssl | 25 | import ssl |
| 27 | import sys | 26 | import sys |
| @@ -61,6 +60,7 @@ class BEINCCustomHTTPSConnection(httplib.HTTPConnection): | |||
| 61 | allows the server certificate to be validated against CA | 60 | allows the server certificate to be validated against CA |
| 62 | This functionality lacks in Python < 2.7.9 | 61 | This functionality lacks in Python < 2.7.9 |
| 63 | """ | 62 | """ |
| 63 | |||
| 64 | default_port = httplib.HTTPS_PORT | 64 | default_port = httplib.HTTPS_PORT |
| 65 | 65 | ||
| 66 | def __init__(self, host, port=None, key_file=None, cert_file=None, | 66 | def __init__(self, host, port=None, key_file=None, cert_file=None, |
| @@ -86,6 +86,9 @@ class BEINCCustomHTTPSConnection(httplib.HTTPConnection): | |||
| 86 | 86 | ||
| 87 | 87 | ||
| 88 | class BEINCCustomSafeTransport(xmlrpclib.Transport): | 88 | class BEINCCustomSafeTransport(xmlrpclib.Transport): |
| 89 | """ | ||
| 90 | Provides an alternative HTTPS transport for clients running on Python<2.7.9 | ||
| 91 | """ | ||
| 89 | 92 | ||
| 90 | def __init__(self, use_datetime=0, custom_ssl_options={}): | 93 | def __init__(self, use_datetime=0, custom_ssl_options={}): |
| 91 | xmlrpclib.Transport.__init__(self, use_datetime=use_datetime) | 94 | xmlrpclib.Transport.__init__(self, use_datetime=use_datetime) |
| @@ -122,12 +125,10 @@ class WeechatTarget(object): | |||
| 122 | """ | 125 | """ |
| 123 | self.__name = target_dict.get('name', '') | 126 | self.__name = target_dict.get('name', '') |
| 124 | if self.__name == '': | 127 | if self.__name == '': |
| 125 | beinc_prnt('WARNING: Adding a target with no name ' | 128 | raise Exception('"name" not defined for target') |
| 126 | 'will make the target useless') | ||
| 127 | self.__url = target_dict.get('target_url', '') | 129 | self.__url = target_dict.get('target_url', '') |
| 128 | if self.__url == '': | 130 | if self.__url == '': |
| 129 | beinc_prnt('WARNING: Adding a target with no URL ' | 131 | raise Exception('"target_url" not defined for target') |
| 130 | 'will make the target useless') | ||
| 131 | self.__password = target_dict.get('target_password', '') | 132 | self.__password = target_dict.get('target_password', '') |
| 132 | self.__pm_title_template = target_dict.get('pm_title_template', | 133 | self.__pm_title_template = target_dict.get('pm_title_template', |
| 133 | '%s @ %S') | 134 | '%s @ %S') |
| @@ -723,8 +724,10 @@ if int(version) < 0x00040000: | |||
| 723 | weechat.prnt('', 'WeeChat version >= 0.4.0 is required to run beinc') | 724 | weechat.prnt('', 'WeeChat version >= 0.4.0 is required to run beinc') |
| 724 | else: | 725 | else: |
| 725 | weechat.hook_command('beinc', | 726 | weechat.hook_command('beinc', |
| 726 | 'beinc on off toggle', '<on | off | reload>', | 727 | 'BEINC command', ('< broadcast <message> | on | off |' |
| 727 | 'description...', | 728 | ' reload | target <action> >'), |
| 729 | ('Available target actions:\n' | ||
| 730 | 'disable <target name>\nenable <target name>\nlist'), | ||
| 728 | 'None', | 731 | 'None', |
| 729 | 'beinc_command', | 732 | 'beinc_command', |
| 730 | '') | 733 | '') |
