Para mayor informacion de como extender las funcionalidades de xchat:
http://xchat.org/docs/
'''
Created on 04/02/2012
querywhois.py
@author: christian
cquispe.dev@gmail.com
'''
__module_name__ = "querywhois"
__module_version__ = "1.0"
__module_description__ = "muestra la informacion de whois del otro usuario cuando se abre o recibe un mensaje privado. Probado en xchat 2.8.8"
__module_author__ = "Christian "
import xchat #@UnresolvedImport
def mensaje_nuevo(word, word_eol, userdata):
cntx = xchat.get_context()
user = cntx.get_info("channel")
if user[0] != "#":
cntx.command("whois " + user)
return xchat.EAT_NONE
def whois_info(word, word_eol, userdata):
#print word
cntx = xchat.find_context(channel = word[0])
if cntx is None:
#para cuando se hace whois sin abrir privado, lo envia a la salida normal
cntx = xchat.get_context()
cntx.prnt(" ".join(word))
return xchat.EAT_XCHAT
#capturamos todos los eventos de whois
WHOIS_EVENTS = [
"WhoIs Authenticated",
"WhoIs Away Line",
"WhoIs Channel/Oper Line",
"WhoIs End",
"WhoIs Identified",
"WhoIs Idle Line",
"WhoIs Idle Line with Signon",
"WhoIs Name Line",
"WhoIs Real Host",
"WhoIs Server Line",
"WhoIs Special"
]
for whois_event in WHOIS_EVENTS:
xchat.hook_print(whois_event, whois_info)
# xchat.hook_print("WhoIs Channel/Oper Line", whois_info)
# xchat.hook_print("WhoIs Authenticated", whois_info)
# xchat.hook_print("WhoIs Away Line", whois_info)
# xchat.hook_print("WhoIs End", whois_info)
# xchat.hook_print("WhoIs Identified", whois_info)
# xchat.hook_print("WhoIs Idle Line with Signon", whois_info)
# xchat.hook_print("WhoIs Idle Line", whois_info)
# xchat.hook_print("WhoIs Name Line", whois_info)
# xchat.hook_print("WhoIs Real Host", whois_info)
# xchat.hook_print("WhoIs Server Line", whois_info)
# xchat.hook_print("WhoIs Special", whois_info)
#captura los eventos de creacion de ventana, cuando se hace abre o recibe un privado
#Open Context esta mencionado en la documentacion de plugin de C++ pero no en la de python
xchat.hook_print("Open Context", mensaje_nuevo)
print "querywhois loaded"