diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-10-03 22:03:44 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-10-03 22:03:44 +0200 |
commit | dc0ae2b4a8d4322a2f3c6f8985ca365698cf556e (patch) | |
tree | 3ddb4b133e1d882a6152de42623b913bd9df793c /irssi_socket_control.py | |
parent | e09ad787000a03db3f1d44d2c989e309c26aabf5 (diff) | |
download | bin-dc0ae2b4a8d4322a2f3c6f8985ca365698cf556e.tar.gz bin-dc0ae2b4a8d4322a2f3c6f8985ca365698cf556e.tar.xz |
move irssi afk code to screen-locker.sh
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'irssi_socket_control.py')
-rwxr-xr-x | irssi_socket_control.py | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/irssi_socket_control.py b/irssi_socket_control.py deleted file mode 100755 index e613149..0000000 --- a/irssi_socket_control.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -#---------------------------------------------------- -# Version: 0.1.0 -# Author: Florian "Bluewind" Pritz <flo@xssn.at> -# -# Licensed under WTFPL v2 -# (see COPYING for full license text) -# -#---------------------------------------------------- -# runs commands in irssi using socket_interface.pl -#---------------------------------------------------- - -import socket -import user -import sys - -def smart_bool(s): - """ - Converts many strings to booleans - - from http://codecomments.wordpress.com/2008/04/08/converting-a-string-to-a-boolean-value-in-python/ - """ - if s is True or s is False: - return s - s = str(s).strip().lower() - return not s in ['false','f','n','0',''] - -def handler(away): - s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - - try: - s.connect(user.home + "/.irssi/socket") - except socket.error: - exit(1) - - if away: - s.send("command /away afk") - else: - s.send("command /away") - s.close() - -def main(): - try: - away = smart_bool(sys.argv[1]) - except IndexError: - away=False - handler(away) - -if __name__ == '__main__': - main() |