Advertisement
thefinn93

Untitled

Dec 8th, 2012
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import xchat
  3. import re
  4. import pynotify
  5. from subprocess import Popen
  6.  
  7. n = pynotify.init("Xchat2 Ingress Notifications")
  8.  
  9. __module_name__ = "Notify on Ingress Invite"
  10. __module_description__ = "Pops up a libnotify message when a message contianing something that looks like an Ingress invite is posted"
  11. __module_version__ = "0.1"
  12.  
  13. def checkForIngress(word, word_eol, userdata):
  14.     if word[2] == "#invites":
  15.         msg = " ".join(word[3:])
  16.         search = re.search("[0-9A-Z]{8}",msg)
  17.         if search is not None:
  18.             code = msg[search.start():search.end()]
  19.             nick = word[0].split("!")[0].strip(":")
  20.             n = pynotify.Notification(code,nick + " just posted it","ingress")
  21.             n.show()
  22.             Popen(["adb", "shell", "am", "start", "com.nianticproject.ingress/com.niantic.nemesis.NemesisActivity"])
  23.             cb = Popen(["adb", "shell", "service", "call", "clipboard", "2", "i32", "1", "i32", "18", "s16", code])
  24.            
  25.     return xchat.EAT_NONE
  26.  
  27. xchat.hook_server("PRIVMSG", checkForIngress)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement