本文整理汇总了Python中xchat.hook_unload函数的典型用法代码示例。如果您正苦于以下问题:Python hook_unload函数的具体用法?Python hook_unload怎么用?Python hook_unload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hook_unload函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
def setup(self):
# Register contact events raised by minbif.
xchat.hook_print('Channel DeVoice', self.replicate_event, (1, 'is away'))
xchat.hook_print('Channel Voice', self.replicate_event, (1, 'is back'))
xchat.hook_print('Join', self.replicate_event, (0, 'has joined'))
# The following is already notified.
#xchat.hook_print('Quit', self.replicate_event, (0, 'has quit'))
xchat.hook_unload(self.unload_cb)
xchat.prnt('%s version %s by %s loaded' % (
__module_name__, __module_version__, __author__))
示例2: setup
def setup(self):
self._process = self._create_pipe()
# Register timed check of screensaver status.
self._hook = self._register_hook()
xchat.hook_unload(self.unload_cb)
# Register some commands.
xchat.hook_command("xs_start_polling", self.on_start)
xchat.hook_command("xs_stop_polling", self.on_stop)
xchat.prnt('%s version %s by %s loaded' % (
__module_name__, __module_version__, __author__))
示例3: __init__
def __init__(self, reg_hooks=True):
# Maps networks to a dict of their active channels against their
# ChannelCollector objects
#: @type: dict from str to (dict from str to ChannelCollector)
self.networks = defaultdict(
lambda: DefaultDict(lambda channel: ChannelCollector(channel)))
xchat.prnt('%sYak\'s Highlight Collector loaded! :D' % LOG_TAG)
if reg_hooks:
def hook(evt, highlight=False, action=False, me=False):
xchat.hook_print(evt, self.hook, (highlight, action, me))
hook(EVENT_CHANNEL_MESSAGE)
hook(EVENT_CHANNEL_MESSAGE_HIGHLIGHT, True)
hook(EVENT_CHANNEL_ACTION, action=True)
hook(EVENT_CHANNEL_ACTION_HIGHLIGHT, True, True)
hook(EVENT_YOUR_MESSAGE, me=True)
hook(EVENT_YOUR_ACTION, action=True, me=True)
xchat.hook_unload(self.on_unload)
示例4: __init__
def __init__(self):
self.id_dh = {}
self.hooks = [
xchat.hook_command('', self.on_send_message),
xchat.hook_command('ME', self.on_send_me),
xchat.hook_command('MSG', self.on_send_msg),
xchat.hook_command('NOTICE', self.on_send_notice),
xchat.hook_server('notice', self.on_recv_notice, priority=xchat.PRI_HIGHEST),
xchat.hook_print('Change Nick', self.on_change_nick),
xchat.hook_unload(self.unload),
]
for name in (
'Channel Action', 'Private Action to Dialog', 'Private Action', 'Channel Message',
'Private Message to Dialog', 'Private Message'
):
xchat.hook_print(name, self.on_recv_message, name, priority=xchat.PRI_HIGHEST),
示例5: addJob
xchat.prnt("Last error: " + LAST_ERROR)
xchat.hook_command("LASTERROR", readError, help = "/LASTERROR - prints out the last error message to screen locally.")
'''
Adds a new translation job to the queue.
'''
def addJob(word, word_eol, userdata):
channel = xchat.get_info('channel')
key = channel + " " + word[0].lower()
if(AUTOUSER.has_key(key)):
dest, src = AUTOUSER[key]
ThreadController.addJob((xchat.get_context(), word[0], src, dest, word[1]))
return xchat.EAT_NONE
xchat.hook_print("Channel Message", addJob)
'''
Shuts down the threads and thread controller when unloading the module.
'''
def unload_translator(userdata):
ThreadController.worker.kill = True
ThreadController.addJob(None)
print 'Translator is unloaded'
xchat.hook_unload(unload_translator)
# Load successful, print message
print 'Translator script loaded successfully.'
示例6: otcauth_unload_cb
eauthCheck = True
elif switch == "bauth":
xchat.prnt("RESERVED FOR FUTURE FUNCTIONALITY")
else:
xchat.prnt("\002\00304Invalid Option:\00304\002 %s not defined" % (word[1]))
return xchat.EAT_XCHAT
# Hook our functions to the callback handler
xchat.hook_command("OTCTK", otcauth_cb, help="'/OTCTK help' for more help")
# An unload callback function to clean up
def otcauth_unload_cb(userdata):
# Remove our MENU's
xchat.command('MENU DEL "OTC Toolkit/GPG EAuth" "otctk eauth"')
xchat.command('MENU DEL "OTC Toolkit/-"')
xchat.command('MENU DEL "OTC Toolkit/Get Voice"')
xchat.command('MENU DEL "OTC Toolkit"')
# Remove nicklist popup menus
xchat.command('MENU DEL "$NICK/OTC Toolkit/Get WoT Rating"')
xchat.command('MENU DEL "$NICK/OTC Toolkit/GPG Information"')
xchat.command('MENU DEL "$NICK/OTC Toolkit"')
# Print out our unloaded message.
xchat.prnt("\002\00302%s:\00302 \00304[[[UNLOADED]]]\00304\002" % __module_name__)
return xchat.EAT_XCHAT
# And hook into our unload event
xchat.hook_unload(otcauth_unload_cb)
示例7: unload_cb
#respuestas = remoto[1].split(",")
xchat.command("say Esto no esta implementado aun")
else:
xchat.command("say {0}".format(remoto[1]))
##############################################################################
## Definimos la funcion para la descarga del programa
##############################################################################
def unload_cb(userdata):
"""Esta funcion debe desenlazar todas las funciones del modulo al
descargarse el script.
Argumentos:
userdata -- variable opcional que se puede enviar a un hook (ignorado)
"""
# Desconectamos los comandos
# Controles remotos
xchat.unhook(HOOKREMOTO)
# Descarga
xchat.unhook(HOOKREMOTOS)
##############################################################################
## Conectamos los "lanzadores" de xchat con las funciones que hemos definido
## para ellos
##############################################################################
# Controles remotos
HOOKREMOTO = xchat.hook_server('PRIVMSG', remoto_cb)
# Descarga del script
HOOKREMOTOS = xchat.hook_unload(unload_cb)
示例8: Rules
noteType=notif,
title=title,
description=message,
sticky=False,
icon=icon,
priority=1,)
# Initialize Alert Object
sufix = '...'
print __module_name__ + ": Initializing" + sufix
rules = Rules()
alerts = SmartAlert(rules)
# Hook Print Events
print __module_name__ + ": Loading hooks" + sufix
# Possible Event binds:
# Your Message
# Message Send -- when sending a priv message
# Private Message
# Private Message to Dialog
# Generic Message -- doesn't seem to work -- probably only at server level
# Channel Message
# add channel hooks on join... also unloads and reloads every join...
# prevents floods!
xchat.hook_command('SMARTALERT', alerts.command, userdata=None, priority=xchat.PRI_HIGHEST)
xchat.hook_server('JOIN', alerts.joiner, userdata=None, priority=xchat.PRI_HIGHEST)
alerts.xchatHook()
xchat.hook_unload(alerts.unload)
示例9: len
if len(word) >= 3 and word[2] != '--network':
if word_eol[2]=="1" or word_eol[2]=="True" or word_eol[2]=="true":
key.aes = True
if word_eol[2]=="0" or word_eol[2]=="False" or word_eol[2]=="false":
key.aes = False
KEY_MAP[id_] = key
elif len(word) >= 5 and word[2] == '--network':
if word_eol[4]=="1" or word_eol[4]=="True" or word_eol[4]=="true":
key.aes = True
if word_eol[4]=="0" or word_eol[4]=="False" or word_eol[4]=="false":
key.aes = False
print 'Key aes', id_, 'set', key.aes
return xchat.EAT_ALL
import xchat
xchat.hook_command('key', key, help='show information or set key, /key <nick> [<--network> <network>] [new_key]')
xchat.hook_command('key_exchange', key_exchange, help='exchange a new key, /key_exchange <nick>')
xchat.hook_command('key_list', key_list, help='list keys, /key_list')
xchat.hook_command('key_load', key_load, help='load keys, /key_load')
xchat.hook_command('key_pass', key_pass, help='set key file pass, /key_pass password')
xchat.hook_command('aes', aes, help='aes #channel/nick 1|0 or True|False')
xchat.hook_command('key_remove', key_remove, help='remove key, /key_remove <nick>')
xchat.hook_server('notice', dh1080)
xchat.hook_print('Channel Message', decrypt_print, 'Channel Message')
xchat.hook_print('Change Nick', change_nick)
xchat.hook_print('Private Message to Dialog', decrypt_print, 'Private Message to Dialog')
xchat.hook_server('332', server_332)
xchat.hook_command('', encrypt_privmsg)
xchat.hook_unload(unload)
load()
示例10: select
#try:
reason = select((
'Goodbye!','See you later.','Cya.','Bye.','Later!',
'Kindergarden is elsewhere!','Ugh. BYE!','G\'day',
'Seeya later!','Be gone!','This is awkward. Bye.',
'I didn\'t do it!'
))
if len(word) == 2:
# Assume they supplied a username
return xchat.command('kick %s %s' % (word[1], reason))
elif len(word) == 1:
# Assume they want a random user
list = xchat.get_list("users")
if not list:
return xchat.prnt(help)
user = select((list))
return xchat.command('kick %s %s' % (user.nick, reason))
else:
# Assume they entered some weird stuff
return xchat.prnt(help)
#except:
# xchat.prnt(help)
return xchat.EAT_ALL
def onUnload(userdata):
xchat.prnt('%s%s has been unloaded.' % (c, __module_name__))
xchat.hook_command('rkick', rkick, help=help)
xchat.hook_unload(onUnload)
示例11: test
else:
xchat.prnt('Found %s' % version)
ircrypt_options['BINARY'] = ircrypt_gpg_binary
def test(word, word_eol, userdata):
xchat.prnt(word[-2])
return xchat.EAT_ALL
# Initialize
ircrypt_init()
# Chek if gpg binary is set
ircrypt_check_binary()
# hook for ircrypt command
xchat.hook_command('ircrypt', ircrypt_command_hook, help=ircrypt_help_text)
# hook for encryption
xchat.hook_command('', ircrypt_encrypt_hook)
# hook for decryption
xchat.hook_print('Channel Message', ircrypt_decrypt_hook, 'Channel Message')
# hook to check for asymmetric encryption in notices
xchat.hook_print('Notice', ircrypt_notice_hook)
# Unload
xchat.hook_unload(ircrypt_unload)
示例12: elif
text = undobuflist.pop()
hexchat.command('settext {}'.format(text))
hexchat.command('setcursor {}'.format(len(text)))
redobuflist.append(text)
except IndexError: pass # No undos left
elif ((key, mod) == ('121', ctrlmod) or # ctrl+y
(key, mod) == ('90', shiftctrlmod)): # ctrl+shift+z
try:
text = redobuflist.pop()
if text == inputtext:
text = redobuflist.pop()
hexchat.command('settext {}'.format(text))
hexchat.command('setcursor {}'.format(len(text)))
except IndexError: pass
else:
# Just throw anything else in here if it has changed
if not undobuflist or undobuflist[-1] != inputtext:
undobuflist.append(inputtext)
def unload_cb(userdata):
print(__module_name__, 'version', __module_version__, 'unloaded.')
hexchat.hook_print('Key Press', keypress_cb)
hexchat.hook_unload(unload_cb)
print(__module_name__, 'version', __module_version__, 'loaded.')
示例13: label
def label(self, line, align="left"):
""" Stampa i label del layout """
c = 0
for l in line:
maxchars = self.table[c][1]
label = len(l[0]) > self.table[c][1] and "%s...." % \
l[0][:maxchars-4] or l[0]
print '\x0301,00', label.ljust(l[1], " "),
c += 1
print
def write(self, line, align="left", delimiter=" "):
""" Stampa i campi della tabella """
c = 0
for l in line:
maxchars = self.table[c][1]
str = len(l) > self.table[c][1] and "%s...." % \
l[:maxchars-4] or l
strlen = len(str)
if align == 'left': print str.ljust(maxchars, delimiter),
else: print str.rust(maxchars, delimiter)
c += 1
print
mp3blocker = mp3filter()
cososwap = mp3filter.debug_swap
xchat.hook_unload(mp3blocker.unload)
示例14: printStats
printStats(nick, data)
return xchat.EAT_NONE
def printStats(nick, data):
msgOut = []
msgOut.append("Statistiche del giono %s" % data)
msgOut.append("Grafico join: %s" % makeChartOfDayJoin(data))
for joinOra in userList[data]['stats']['joins']:
msgOut.append("Join alle ore %s: %s" %
(joinOra, str(userList[data]['stats']['joins'][joinOra])))
msgOut.append("Grafico utenti online: %s" % makeChartOfDay(data))
for onlineOra in userList[data]['stats']['online']:
msgOut.append("Online alle ore %s: %s" %
(onlineOra, str(userList[data]['stats']['online'][onlineOra])))
msgOut.append("Totale utenti unici: %s" % str(len(userList[data]['users'])))
for messageOut in msgOut:
channelObj.command('notice %s %s' % (nick, messageOut))
def saveState(data):
cPickle.dump(userList, open('ffstats.p','w'))
channelObj = xchat.find_context(channel='#forumfree')
getUserList()
xchat.hook_server('JOIN', onJoin)
xchat.hook_server('PART', onPart)
#xchat.hook_server('KICK', onPart)
xchat.hook_server('PRIVMSG', onMsg)
xchat.hook_unload(saveState)
示例15: _
ascii["furiosa"] =[" (__)"," (\\/)"," \\/"]
ascii["ambiciosa"] =[" (__)"," ($$)"," \\/"]
ascii["aburrida"] =[" (__)"," (--)"," \\/"]
ascii["guerrilla"] =[" (__)"," (oo)"," / \\/ \\"," D===b=-----"]
ascii["flaca"] =[" _(~)_"," )\"("," (@[email protected])"," ) ( autor:hjw"]
ascii["rellenita"] =[" _ (.\".) _"," '-'/. .\\'-'"," ( o o )"," `\"-\"` autor:jgs"]
xchat.command("MENU -p5 ADD Huayra")
xchat.command("MENU ADD Huayra/AsciiArt")
xchat.command("MENU ADD Huayra/AsciiArt/Panadero1 \".asciihuayra panadero1\"")
xchat.command("MENU ADD Huayra/AsciiArt/Panadero2 \".asciihuayra panadero2\"")
xchat.command("MENU ADD Huayra/AsciiArt/Netbook \".asciihuayra netbook\"")
xchat.command("MENU ADD Huayra/AsciiArt/Vaquita \".asciihuayra vaquita\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Inexpresiva \".asciihuayra inexpresiva\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Hipnotizada \".asciihuayra hipnotizada\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Muerta \".asciihuayra muerta\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Sarcástica \".asciihuayra sarcastica\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Incredula \".asciihuayra incredula\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Furiosa \".asciihuayra furiosa\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Ambiciosa \".asciihuayra ambiciosa\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Aburrida \".asciihuayra aburrida\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Guerrilla \".asciihuayra guerrilla\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Estilizadas")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Estilizadas/Flaca \".asciihuayra flaca\"")
xchat.command("MENU ADD Huayra/AsciiArt/Emotica/Estilizadas/Rellenita \".asciihuayra rellenita\"")
__unhook__ = xchat.hook_command(".asciihuayra",dispatch,help="Ascii Art de vacas y panaderos.")
xchat.hook_unload(unload_ah)