Guest User

Untitled

a guest
Mar 22nd, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import xchat
  2.  
  3. __module_name__ = "ac100 flashlight"
  4. __module_version__ = "1.0"
  5. __module_description__ = ""
  6.  
  7. fl_contexts = []
  8.  
  9. def set_flashlight(hl_type=1):
  10. sys_fs = open('/sys/class/leds/nvec-led/brightness','w')
  11. sys_fs.write(str(hl_type))
  12. sys_fs.close()
  13.  
  14. def fl_hook(word, word_eol, userdata):
  15. set_flashlight(1)
  16. global fl_contexts
  17. context = xchat.get_context()
  18. if context not in fl_contexts:
  19. fl_contexts.append(xchat.get_context())
  20. return xchat.EAT_NONE
  21.  
  22. def focus_hook(word, word_eol, userdata):
  23. context = xchat.get_context()
  24. global fl_contexts
  25. if context in fl_contexts:
  26. fl_contexts.remove(context)
  27. if not len(fl_contexts):
  28. set_flashlight(0)
  29. return xchat.EAT_NONE
  30.  
  31. #xchat.hook_print("Channel Msg Hilight", hl_hook)
  32. xchat.hook_print("Focus Tab", focus_hook)
  33. xchat.hook_print("Channel Action Hilight", fl_hook)
  34. xchat.hook_print("Channel Msg Hilight", fl_hook)
Advertisement
Add Comment
Please, Sign In to add comment