本文整理汇总了Python中xchat.hook_print函数的典型用法代码示例。如果您正苦于以下问题:Python hook_print函数的具体用法?Python hook_print怎么用?Python hook_print使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hook_print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WhoStoleIt
def WhoStoleIt(userdata):
global dInfo
sServ=xchat.get_info("network")
if sServ in dInfo:
xchat.command("whois %s" % dInfo[sServ]["nick"])
dInfo[sServ]["who1"] = xchat.hook_print("Generic Message", Test)
dInfo[sServ]["who2"] = xchat.hook_print("WhoIs End", WhoEnd)
示例2: __init__
def __init__(self):
""" Costruttore """
self.pattern = []
self.stats = {}
self.pattern_stats = [0, (0, 0)]
self.debug = False
self.label = "Mp3 filter"
self.load_config()
for evnt in filter_event:
xchat.hook_print(evnt, self.ignore_mp3_notification)
xchat.hook_command("mp3filter_reload", self.reload_config,
help="Carica nuovamente i filtri dalla config")
xchat.hook_command("mp3filter_stats", self.pattern_status,
help="Statistiche sui filtri usati")
xchat.hook_command("mp3filter_debug", self.debug_swap,
help="Stampa i messaggi che vengono \
bloccati; Utile per capire \
quali messaggi bloccano gli attuali filtri")
xchat.command('MENU ADD "%s"' % self.label)
xchat.command('MENU ADD "%s/Ricarica filtri" "mp3filter_reload"' %
self.label)
xchat.command('MENU ADD "%s/Statistiche filtri" "mp3filter_stats"' %
self.label)
xchat.command('MENU ADD "%s/Debug" "mp3filter_debug None"' %
self.label)
print "Filtro mp3 caricato su: \x0304%s\x03" % ', '.join(filter_event)
s=self.pattern_stats
print "%d/%d filtri caricati!" % (s[1][0], s[0])
示例3: toggle_cb
def toggle_cb(self, word, word_eol, userdata):
if len(word) < 2 or word[1].lower() not in ['on', 'off', 'status']:
self.notice("Please provide a command: 'on', 'off', or 'status'")
return xchat.EAT_ALL
command = word[1].lower()
if command == "on":
if self.hooks:
self.notice("Hush is already on")
return xchat.EAT_ALL
for event in ["Join", "Part", "Part with Reason", "Quit", "Change Nick"]:
self.hooks.append(xchat.hook_print(event, self.selective_hush_cb))
for event in ["Private Message", "Private Action", "Channel Message", "Channel Action"]:
self.hooks.append(xchat.hook_print(event, self.record_cb))
self.hooks.append(xchat.hook_timer(5 * 60 * 1000, self.reaper_cb))
self.notice("Loaded Hush")
return xchat.EAT_ALL
elif command == "off":
if self.hooks:
map(xchat.unhook, self.hooks)
self.hooks = []
self.active_users = []
self.notice("Unloaded Hush")
else:
self.notice("Hush is already off")
return xchat.EAT_ALL
elif command == "status":
status = {True: "on", False: "off"}
self.notice("Hush is %s" % status[bool(self.hooks)])
return xchat.EAT_ALL
示例4: xchatHook
def xchatHook(self):
print 'rehooking'
if not len(self.hooked):
self.hooked = [xchat.hook_print('Channel Message', alerts.general_message,
userdata=None, priority=xchat.PRI_NORM),
xchat.hook_print('Channel Msg Hilight', alerts.general_message,
userdata=None, priority=xchat.PRI_NORM),
xchat.hook_print('Private Message', alerts.private_message,
userdata=None, priority=xchat.PRI_NORM),
xchat.hook_print('Private Message to Dialog',
alerts.private_message, userdata=None,
priority=xchat.PRI_NORM)]
示例5: __init__
def __init__(self) :
self.start_time = time.time()
for event in XchatSoundHandler.EVENTS :
xchat.hook_print(event, self.handle_message, event)
xchat.hook_command("chatsounds", self.handle_prefs)
xchat.hook_command("cs", self.handle_prefs)
self.player = SoundPlayer()
self.sound_dir = os.path.expanduser("~/.xchat2/sounds/")
self.silenced_channels = SILENCED_CHANNELS
debugprint("Loaded chatsounds.py")
示例6: skip_print
def skip_print(self, name):
def hook_func(word, word_eol, userdata):
return xchat.EAT_XCHAT
hook = xchat.hook_print(name, hook_func, priority=xchat.PRI_HIGHEST)
yield
xchat.unhook(hook)
示例7: __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),
示例8: check_process
def check_process(self, word, word_eol, userdata):
self.checkchannel = word[1]
self.hostlist = []
self.kicklist = []
xchat.hook_print("Join", self.onJoin)
xchat.hook_print("Quit", self.onQuit)
xchat.hook_print("Part", self.onPart)
xchat.hook_print("Kick", self.onKick)
xchat.hook_print("Part with Reason", self.onPartReason)
self.IRCserver = xchat.get_info("server")
self.cnc = xchat.find_context(channel = self.checkchannel, server= self.IRCserver)
userlist = self.cnc.get_list("users")
for i in userlist:
if i.host not in self.hostlist:
self.hostlist.append(i.host)
elif i.host in self.hostlist:
self.cnc.prnt("\0034\007\002CLONE DETECTED = %s" % i.host)
#print(self.hostlist) #DEBUG
print("Script ready")
示例9: init
def init(ignore_data=None):
hooks.append(xchat.hook_timer(500, numerator.update_timer_cb))
hooks.append(xchat.hook_print("Focus Tab",
numerator.reset_activity_cb))
for evt in ('Channel Action Hilight'
,'Channel Msg Hilight'
,'Channel Message'
,'Private Message to Dialog'
,'Private Action to Dialog'):
hooks.append(xchat.hook_print(evt, numerator.activity_cb))
try:
numerator.enumerate_tabs()
except WindowsError as e:
numerator.log("error on initial enumeration")
numerator.log("successfully loaded")
return 0 # do not repeat timer
示例10: __init__
def __init__(self):
#Decode hooks
xchat.hook_print("Private Message", self.decode, "Private Message")
xchat.hook_print("Private Message to Dialog", self.decode, "Private Message to Dialog")
xchat.hook_print("Quit", self.quithook, "Quit")
xchat.hook_print("Connected", self.resetconversationshook, "Connected")
xchat.hook_print("Your Nick Changing", self.resetconversationshook,
"Your Nick Changing")
#Generic encode hook
self.allhook = xchat.hook_command("", self.encode)
#TODO RandomPool is know to be broken
#Random generator
self.randfunc = get_random_bytes
#Initialize configuration directory
confDir = xchat.get_info("xchatdirfs") + "/cryptochati.conf"
if not os.path.isdir(confDir):
os.makedirs(confDir, 0700)
#Friends file
self.friendsPath = os.path.join(confDir, "friends.txt")
#Private key file
self.myKeyPath = os.path.join(confDir, "my.key")
#Friends' public keys file
self.keysPath = os.path.join(confDir, "public.keys")
#Create/load configuration
self.openConfiguration()
#Friend management hook
xchat.hook_command("Friend", self.friendhook, "Friend", help=
"""Usage:
FRIEND ADD <nick> - adds <nick> as a trusted friend
FRIEND DEL <nick> - deletes <nick> from trusted friends
FRIEND LIST - lists current trusted friends""")
示例11: on_join
def on_join(word, word_eol, userdata):
# use global variable for unhooking
global rename_hook
# for comfort instead of word[0], word[1] and word[2]
triggernick, triggerchannel, triggerhost = word
# get the context
destination = xchat.get_context()
# if the channel is bitlbees channel and the nick begins with a dash
if ((triggerchannel == "&bitlbee") and ((triggernick[0] == "-") or (triggernick[0] == "_"))):
# send a whois on the nick
xchat.command("whois %s" % triggernick)
# make a handler that hooks the Name Line of the whois and calls rename_name with this line
rename_hook = xchat.hook_print("Whois Name Line", rename_name)
# unhook the whois
return
示例12: 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__))
示例13: load
def load(*args):
groups_load_from_settings()
compile_strings()
for event in chat_events:
xchat.hook_print(event, dispatch_message, event)
xchat.hook_print("Key Press", dispatch_key)
xchat.hook_command("", dispatch_command)
xchat.hook_command("ov", command_handler)
for event in ["You Join", "You Kicked", "You Part", "you Part with Reason"]:
xchat.hook_print(event, dispatch_channels_change, event)
print(__module_name__, __module_version__, 'loaded')
示例14: enable
def enable(self):
self.is_enabled = True
#read in config
self.config = ConfigParser.RawConfigParser()
self.config.read('config.conf')
#set menus
self.setup_nick_menu()
#create list of channels
try:
for channel in xchat.get_list("channel"):
dir(channel)
except KeyError:
pass
#watch for new channels joined
xchat.hook_command("join", self.on_channel_join)
#watch for channels left
xchat.hook_command("part", self.on_channel_part)
#set hooks for joti/join/part/messages
xchat.hook_command("joti", self.dispatch)
xchat.hook_print('Channel Message', self.on_text)
xchat.hook_print('Join', self.on_join)
xchat.hook_print('Part', self.on_part)
示例15: len
else:
for sI, sV in dSettings.iteritems():
sDots = '.'*(29 - len(sI))
sTmpStr = "%s\x0312%s\x0f\x0311:\x0f %s" % (sI, sDots, sV)
xchat.prnt(sTmpStr)
#endfor
#endif
return xchat.EAT_ALL
#enddef
lEvents4L4l = [
"Channel Action"
, "Channel Action Hilight"
, "Channel Message"
, "Channel Msg Hilight"
]
for sI in lEvents4L4l:
xchat.hook_print(sI, LookForLink, sI)
#endfor
xchat.hook_command("yti", Settings)
xchat.prnt("Loaded %s version %s." % (__module_name__, __module_version__))
GetCategories()
import sys
if len(sys.argv) > 1:
LookForLink(['', sys.argv[1], ''], ['', sys.argv[1], ''], None)