当前位置: 首页>>代码示例>>Python>>正文


Python weechat.hook_modifier函数代码示例

本文整理汇总了Python中weechat.hook_modifier函数的典型用法代码示例。如果您正苦于以下问题:Python hook_modifier函数的具体用法?Python hook_modifier怎么用?Python hook_modifier使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hook_modifier函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ns_ban_cb

def ns_ban_cb(data, buffer, args):
	args = args.split()
	oper = args[0]
	nick = args[1]

	channel = weechat.buffer_get_string(buffer, 'localvar_channel')
	server = weechat.buffer_get_string(buffer, 'localvar_server')

	if oper == 'ban':
		found = False
		infolist = weechat.infolist_get("irc_nick", "", "{},{},{}".format(server, channel, nick))
		while weechat.infolist_next(infolist):
			found = True
			account = weechat.infolist_string(infolist, "account")
			if account:
				weechat.command("", '/mode +b $a:{}'.format(account))

		weechat.infolist_free(infolist)

		if not found:
			# TODO: Handle numeric 315 too, ‘End of /WHO list’
			hooks['who'] = weechat.hook_modifier("irc_in_354", "who_mod_cb", "")
			weechat.command("", "/who %s n%%an" % args[1])
			operation[nick] = oper

	else:
		# TODO: Handle numeric 315 too, ‘End of /WHO list’
		hooks['who'] = weechat.hook_modifier("irc_in_354", "who_mod_cb", "")
		weechat.command("", "/who %s n%%an" % args[1])

		operation[nick] = oper

	return weechat.WEECHAT_RC_OK
开发者ID:kyrias,项目名称:dotfiles,代码行数:33,代码来源:nsb.py

示例2: main

def main():
    weechat.hook_modifier("irc_in_notice", "modifier_cb", "")
    weechat.hook_completion("bitlbee", "bitlbee completion",
                            "bitlbee_completion", "")

    weechat.hook_print('', 'irc_332', '', 1, 'print_332', '')
    weechat.hook_print('', 'irc_topic', '', 1, 'print_332', '')
    find_buffer()
开发者ID:DarkDefender,项目名称:scripts,代码行数:8,代码来源:bitlbee_completion.py

示例3: enable_capab

def enable_capab(server):
    server_buffer = weechat.buffer_search('irc', 'server.%s' %server)
    if server_buffer:
        weechat.command(server_buffer, '/quote cap req :identify-msg')
        capab_hooks[server] = (
                weechat.hook_modifier('irc_in_PRIVMSG', 'privmsg_signal_cb', server),
                weechat.hook_modifier('irc_in_NOTICE', 'privmsg_signal_cb', server),
        #weechat.hook_signal('%s,irc_in_PART' %server, 'part_signal_cb', server)
        #weechat.hook_signal('%s,irc_in_QUIT' %server, 'quit_signal_cb', server)
                weechat.hook_modifier('weechat_print', 'privmsg_print_cb', server),
                )
        return True
开发者ID:NuclearW,项目名称:weechat-scripts,代码行数:12,代码来源:capab.py

示例4: hook_all

def hook_all(server):
    global HOOKS

    notice = server + '.notice'
    modifier = server + '.modifier'
    modifier2 = server + '.modifier2'

    if notice not in HOOKS:
        HOOKS[notice] = weechat.hook_signal("%s,irc_raw_in_notice" % server, "auth_success_cb", server)
    if modifier not in HOOKS:
        HOOKS[modifier] = weechat.hook_modifier("irc_out_privmsg", "totp_login_modifier_cb", server)
    if modifier2 not in HOOKS:
        HOOKS[modifier2] = weechat.hook_modifier("irc_out_pass", "totp_login_modifier_cb", server)
开发者ID:Shrews,项目名称:scripts,代码行数:13,代码来源:undernet_totp.py

示例5: main

def main():
    hook = weechat.hook_modifier('weechat_print', 'unhighlight_cb', '')

    description = """
{script_name} lets you set up a regex for things to never highlight.

To use this, set the localvar 'unhighlight_regex' on a buffer. Lines in
that buffer which match will never be highlighted, even if they have
your nick or match highlight_words or highlight_regex.

You will need the script 'buffer_autoset.py' installed to make local
variables persistent; see the examples below.

Examples:
 Temporarily block highlights in the current buffer for lines matching 'banana':
   /buffer set localvar_set_unhighlight_regex banana
 Unhighlight SASL authentication messages for double logins:
   /buffer weechat
   /buffer set localvar_set_unhighlight_regex SaslServ
   /autosetbuffer add core.weechat localvar_set_unhighlight_regex SaslServ
 List buffers with autoset unhighlights:
   /{script_name} list
 Show this help:
   /{script_name}
 Display local variables for current buffer:
   /buffer localvar
""".format(script_name = SCRIPT_NAME)

    weechat.hook_command(SCRIPT_NAME, SCRIPT_DESC, 'list', description, 'list %-', 'command_cb', '')
开发者ID:Zarthus,项目名称:scripts,代码行数:29,代码来源:unhighlight.py

示例6: hook_all

def hook_all():
    """ Hook command_run and modifier """
    global hook_command_run, hooks
    for hook, value in hook_command_run.iteritems():
        if hook not in hooks:
            hooks[hook] = weechat.hook_command_run(value[0], value[1], "")
    if "modifier" not in hooks:
        hooks["modifier"] = weechat.hook_modifier("input_text_display_with_cursor", "input_modifier", "")
开发者ID:ronin13,项目名称:seed,代码行数:8,代码来源:go.py

示例7: init

	def init(self):
		if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
			global SAVEPATH
			SAVEPATH = os.path.join(weechat.info_get('weechat_dir',''),'darktower','adfilter')
			if not os.path.exists(SAVEPATH): os.makedirs(SAVEPATH)
			self.saveFile = os.path.join(SAVEPATH,'adfilter.DT')
			self.exceptFile = os.path.join(SAVEPATH,'AFexceptions.DT')
		
			weechat.hook_command("adfilter", "Dark Tower AdFilter Commands",
				"[COMMANDS]",
				"[COMMANDS DETAIL]",
				"[COMPLETION]",
				"AdFilter", "command_cb:")
			
			weechat.hook_modifier("irc_in_PRIVMSG", "AdFilter","privmsg_event:")
			
		self.loadAds()
		self.loadExceptions()
开发者ID:ruuk,项目名称:dark.tower.fserve,代码行数:18,代码来源:adfilter.py

示例8: ircrypt_init

def ircrypt_init():
	# Initialize configuration
	ircrypt_config_init()
	ircrypt_config_read()
	# Look for GnuPG binary
	if weechat.config_string(weechat.config_get('ircrypt.general.binary')):
		# Initialize public key authentification
		ircrypt_gpg_init()
		# Register Hooks
		weechat.hook_modifier('irc_in_notice', 'ircrypt_notice_hook', '')
		weechat.hook_command('ircrypt-keyex', 'Commands of the Addon IRCrypt-keyex',
				'[list] '
				'| remove-public-key [-server <server>] <nick> '
				'| start [-server <server>] <nick> ',
				SCRIPT_HELP_TEXT,
				'list '
				'|| remove-public-key %(nicks)|-server %(irc_servers) %- '
				'|| start %(nicks)|-server %(irc_servers) %- ',
				'ircrypt_command', '')
	else:
		ircrypt.ircrypt_error('GnuPG not found', weechat.current_buffer())
开发者ID:petvoigt,项目名称:ircrypt-weechat,代码行数:21,代码来源:ircrypt-keyex.py

示例9: hook_modifiers

def hook_modifiers():
	"""Update modifier hooks to match settings."""

	# remove existing modifier hooks
	global hooks
	for hook in hooks:
		weechat.unhook(hook)
	hooks = []

	# add hooks according to settings

	input_option = weechat.config_get_plugin("input")
	if weechat.config_string_to_boolean(input_option):
		hooks.append(weechat.hook_modifier("input_text_display", "modifier_cb", ""))

	send_option = weechat.config_get_plugin("send")
	if weechat.config_string_to_boolean(send_option):
		hooks.append(weechat.hook_modifier("input_text_for_buffer", "modifier_cb", ""))

	buffer_option = weechat.config_get_plugin("buffer")
	if weechat.config_string_to_boolean(buffer_option):
		hooks.append(weechat.hook_modifier("weechat_print", "modifier_cb", ""))
开发者ID:DarkDefender,项目名称:scripts,代码行数:22,代码来源:latex_unicode.py

示例10: hook_all

def hook_all():
    """ Hook command_run and modifier """
    global hook_command_run, hooks
    priority = ""
    version = weechat.info_get("version_number", "") or 0
    # use high priority for hook to prevent conflict with other plugins/scripts
    # (WeeChat >= 0.3.4 only)
    if int(version) >= 0x00030400:
        priority = "2000|"
    for hook, value in hook_command_run.items():
        if hook not in hooks:
            hooks[hook] = weechat.hook_command_run("%s%s" % (priority, value[0]), value[1], "")
    if "modifier" not in hooks:
        hooks["modifier"] = weechat.hook_modifier("input_text_display_with_cursor", "input_modifier", "")
开发者ID:thisismiller,项目名称:dotfiles,代码行数:14,代码来源:go.py

示例11: quit_event

def quit_event(data, signal, signal_data):
	if (check_split(signal_data)):
		weechat.prnt("", "Netsplit? YES - %s" % signal_data)
		strip_string = signal_data
			# Create functions to:
			# Add user/host details to a dictionary to wait for their return
			# Stop the line from appearing in the channel's buffer
			# Count total number of splits
			# Print number of splits and the affected host to the channel's buffer
	else:
		weechat.prnt("", "Netsplit? NO - %s" % signal_data)
		#strip_string = signal_data
		# Check for user/host returning from a split (details will be contained in the dictionary)
		# TODO - Move the following hook so that it only blocks QUITS when they are net splits
	print_hook = weechat.hook_modifier("weechat_print", "strip_print", "")        # Replace string printed to buffer with "" <--- HACKY	
	return weechat.WEECHAT_RC_OK
开发者ID:dregin,项目名称:Weechat-Scripts,代码行数:16,代码来源:split_squash.py

示例12: cmd_help_toggle

def cmd_help_toggle():
    """Toggle help on/off."""
    global cmdhelp_hooks, cmdhelp_settings
    if cmdhelp_hooks['modifier']:
        unhook(('timer', 'modifier'))
    else:
        cmdhelp_hooks['modifier'] = weechat.hook_modifier(
            'input_text_display_with_cursor', 'input_modifier_cb', '')
        timer = cmdhelp_settings['timer']
        if timer and timer != '0':
            try:
                value = float(timer)
                if value > 0:
                    weechat.hook_timer(value * 1000, 0, 1, 'timer_cb', '')
            except ValueError:
                pass
    weechat.bar_item_update('input_text')
开发者ID:DarkDefender,项目名称:scripts,代码行数:17,代码来源:cmd_help.py

示例13: go_hook_all

def go_hook_all():
    """Hook command_run and modifier."""
    global hooks
    priority = ''
    version = weechat.info_get('version_number', '') or 0
    # use high priority for hook to prevent conflict with other plugins/scripts
    # (WeeChat >= 0.3.4 only)
    if int(version) >= 0x00030400:
        priority = '2000|'
    for hook, value in HOOK_COMMAND_RUN.items():
        if hook not in hooks:
            hooks[hook] = weechat.hook_command_run(
                '%s%s' % (priority, value[0]),
                value[1], '')
    if 'modifier' not in hooks:
        hooks['modifier'] = weechat.hook_modifier(
            'input_text_display_with_cursor', 'go_input_modifier', '')
开发者ID:gilbertw1,项目名称:scripts,代码行数:17,代码来源:go.py

示例14: transform_message

    if 'irc_privmsg' in tags:
        message = transform_message(message)
    elif 'irc_notice' in tags:
        target, msg = re.search(NOTICE_PATTERN, message).groups()
        msg = transform_message(msg)
        message = target+msg

    return message


def list_icons_cb(data, buf, args):
    global ICONS

    l = dict()
    for key, val in ICONS.items():
        if val in l:
            l[val] += ", " + key
        else:
            l[val] = key

    weechat.prnt(buf, "%s - list of supported emoticons:" % SCRIPT_NAME)
    [weechat.prnt(buf, " %s  = %s" % (key.encode('utf-8'), l[key])) for key in l.keys()]

    return weechat.WEECHAT_RC_OK


if __name__ == "__main__" and import_ok:
    if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
        weechat.hook_modifier('weechat_print', 'convert_icon_cb', '')
        weechat.hook_command(SCRIPT_COMMAND, "List supported emoticons", "", "", "", "list_icons_cb", "")
开发者ID:KokaKiwi,项目名称:weechat-scripts,代码行数:30,代码来源:weemoticons.py

示例15: encode_beepboop

    msgprefix = ""
    if aftermsg != msgmsg:
        msgprefix = "[BEEPBOOP]: "

    return ":%s PRIVMSG %s :%s%s" % (msgwho, msgwhere, msgprefix, aftermsg)

def encode_beepboop(text):
    res = ""

    text = text.upper()
    for c in text:
        if c == " ":
            res += word_sep
            continue
        if c in morse:
            res += morse[c]
            res += char_sep
    return res

def beepboop_cb(data, buffer, args):
    weechat.command(buffer, encode_beepboop(args))
    return weechat.WEECHAT_RC_OK

weechat.hook_modifier("irc_in_privmsg", "privmsg_mod_cb", "")
weechat.hook_command("beepboop", "converts text to beep boop language",
        "<msg>",
        "The message to convert to message",
        "%(filters_names)",
        "beepboop_cb", "")
开发者ID:aeruder,项目名称:weechat-beepboop,代码行数:29,代码来源:beepboop.py


注:本文中的weechat.hook_modifier函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。