-import datetime, time
-
-SCRIPT_NAME = "screen_away"
-SCRIPT_AUTHOR = "xt <xt@bash.no>"
-SCRIPT_VERSION = "0.15"
-SCRIPT_LICENSE = "GPL3"
-SCRIPT_DESC = "Set away status on screen detach"
-
-settings = {
- 'message': ('Detached from screen', 'Away message'),
- 'time_format': ('since %Y-%m-%d %H:%M:%S%z', 'time format append to away message'),
- 'interval': ('5', 'How often in seconds to check screen status'),
- 'away_suffix': ('', 'What to append to your nick when you\'re away.'),
- 'command_on_attach': ('', 'Commands to execute on attach, separated by semicolon'),
- 'command_on_detach': ('', 'Commands to execute on detach, separated by semicolon'),
- 'ignore': ('', 'Comma-separated list of servers to ignore.'),
- 'set_away': ('on', 'Set user as away.'),
- 'ignore_relays': ('off', 'Only check screen status and ignore relay interfaces'),
- 'no_output': ('off','no detach/attach information will be displayed in buffer'),
+import re
+import time
+import weechat as w
+
+
+SCRIPT_NAME = 'screen_away'
+SCRIPT_AUTHOR = 'xt <xt@bash.no>'
+SCRIPT_VERSION = '0.16'
+SCRIPT_LICENSE = 'GPL3'
+SCRIPT_DESC = 'Set away status on screen detach'
+
+SETTINGS = {
+ 'message': ('Detached from screen', 'Away message'),
+ 'time_format': ('since %Y-%m-%d %H:%M:%S%z',
+ 'time format append to away message'),
+ 'interval': ('5', 'How often in seconds to check screen status'),
+ 'away_suffix': ('', 'What to append to your nick when you\'re away.'),
+ 'command_on_attach': ('',
+ ('Commands to execute on attach, separated by '
+ 'semicolon')),
+ 'command_on_detach': ('',
+ ('Commands to execute on detach, separated by '
+ 'semicolon')),
+ 'ignore': ('', 'Comma-separated list of servers to ignore.'),
+ 'set_away': ('on', 'Set user as away.'),
+ 'ignore_relays': ('off',
+ 'Only check screen status and ignore relay interfaces'),
+ 'no_output': ('off',
+ 'no detach/attach information will be displayed in buffer'),
+ 'socket_file': ('', 'Socket file to use (leave blank to auto-detect)'),