diff options
| author | Simeon Simeonov | 2014-06-26 22:00:30 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2014-06-26 22:00:30 +0200 |
| commit | 60facea6194cf2c93c55580e9e9e60c304c9c6a8 (patch) | |
| tree | c3eda958be0edffa7ebac0ad46173f24b2dbbd5c /beinc_weechat.py | |
| parent | 3365828b2c2584efad03d85ca6e97346398e08e3 (diff) | |
beinc_config_sample.json.readme ready. config_version is now checked. Minor changes in beinc_weechat
Diffstat (limited to 'beinc_weechat.py')
| -rw-r--r-- | beinc_weechat.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/beinc_weechat.py b/beinc_weechat.py index a8082b7..71d4b10 100644 --- a/beinc_weechat.py +++ b/beinc_weechat.py | |||
| @@ -44,6 +44,7 @@ global_values = dict() | |||
| 44 | BEINC_POLICY_NONE = 0 | 44 | BEINC_POLICY_NONE = 0 |
| 45 | BEINC_POLICY_ALL = 1 | 45 | BEINC_POLICY_ALL = 1 |
| 46 | BEINC_POLICY_LIST_ONLY = 2 | 46 | BEINC_POLICY_LIST_ONLY = 2 |
| 47 | BEINC_CURRENT_CONFIG_VERSION = 1 | ||
| 47 | 48 | ||
| 48 | 49 | ||
| 49 | class ValidHTTPSConnection(httplib.HTTPConnection): | 50 | class ValidHTTPSConnection(httplib.HTTPConnection): |
| @@ -117,7 +118,7 @@ class WeechatTarget(object): | |||
| 117 | '%H:%M:%S') | 118 | '%H:%M:%S') |
| 118 | self.__debug = bool(target_dict.get('debug', False)) | 119 | self.__debug = bool(target_dict.get('debug', False)) |
| 119 | self.__enabled = bool(target_dict.get('enabled', True)) | 120 | self.__enabled = bool(target_dict.get('enabled', True)) |
| 120 | self.__socket_timeout = int(target_dict.get('socket_timeout', 30)) | 121 | self.__socket_timeout = int(target_dict.get('socket_timeout', 3)) |
| 121 | 122 | ||
| 122 | @property | 123 | @property |
| 123 | def name(self): | 124 | def name(self): |
| @@ -396,7 +397,7 @@ def beinc_command(data, buffer_obj, args): | |||
| 396 | elif args == 'reload': | 397 | elif args == 'reload': |
| 397 | beinc_prnt('Reloading BEINC...') | 398 | beinc_prnt('Reloading BEINC...') |
| 398 | beinc_init() | 399 | beinc_init() |
| 399 | elif cmd_tokens[0] == 'broadcast': | 400 | elif cmd_tokens[0] in ('broadcast', 'test'): |
| 400 | return beinc_cmd_broadcast_handler(cmd_tokens[1:]) | 401 | return beinc_cmd_broadcast_handler(cmd_tokens[1:]) |
| 401 | elif cmd_tokens[0] == 'target': | 402 | elif cmd_tokens[0] == 'target': |
| 402 | return beinc_cmd_target_handler(cmd_tokens[1:]) | 403 | return beinc_cmd_target_handler(cmd_tokens[1:]) |
| @@ -515,6 +516,15 @@ def beinc_init(): | |||
| 515 | global_values['use_current_buffer'] = bool( | 516 | global_values['use_current_buffer'] = bool( |
| 516 | config_dict['irc_client'].get( | 517 | config_dict['irc_client'].get( |
| 517 | 'use_current_buffer', False)) | 518 | 'use_current_buffer', False)) |
| 519 | if config_dict.get('config_version', | ||
| 520 | 0) != BEINC_CURRENT_CONFIG_VERSION: | ||
| 521 | beinc_prnt('WARNING: The version of the config-file: {0} ({1}) ' | ||
| 522 | 'does not correspond to the latest version supported ' | ||
| 523 | 'by this program ({2})\nCheck beinc_config_sample.json ' | ||
| 524 | 'for the newest features!'.format( | ||
| 525 | beinc_config_file_str, | ||
| 526 | config_dict.get('config_version', 0), | ||
| 527 | BEINC_CURRENT_CONFIG_VERSION)) | ||
| 518 | for target in config_dict['irc_client']['targets']: | 528 | for target in config_dict['irc_client']['targets']: |
| 519 | try: | 529 | try: |
| 520 | new_target = WeechatTarget(target) | 530 | new_target = WeechatTarget(target) |
