本文整理汇总了Python中weechat.hook_config函数的典型用法代码示例。如果您正苦于以下问题:Python hook_config函数的具体用法?Python hook_config怎么用?Python hook_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hook_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_hooks
def create_hooks():
# create hooks
weechat.hook_signal('quit', 'quit_signal_cb', '')
weechat.hook_signal('upgrade_ended', 'upgrade_ended_cb', '')
weechat.hook_signal('buffer_opened', 'buffer_opened_cb', '')
weechat.hook_config('plugins.var.python.' + SCRIPT_NAME + '.*', 'toggle_refresh', '' )
weechat.hook_signal('buffer_closing', 'buffer_closing_cb', '')
开发者ID:FiXato,项目名称:weechat-scripts,代码行数:7,代码来源:histman.py
示例2: main
def main():
""" Entry point, initializes everything """
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESCRIPTION,
"", # Shutdown callback function
"", # Charset (blank for utf-8)
)
# Default values for settings
default_settings = {
'dbfile': os.path.join(
weechat.info_get("weechat_dir", ""), "emojis-db.dat")
}
# Apply default configuration values if anything is unset
for option, default in default_settings.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default)
# Hook callbacks
weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*",
"configuration_cb", "")
weechat.hook_command_run("/input return", "transform_cb", "")
weechat.hook_command_run("/input complete*", "complete_cb", "")
#weechat.hook_modifier("input_text_display", "collapse_cb", "")
# Command callbacks
weechat.hook_command( # command name
SCRIPT_NAME,
# description
" display :common_name: with its emoji equivalent",
# arguments
"reload"
" || add <name> <emoji>"
" || show <emoji>",
# description of arguments
" name: emoji name, sans colons\n"
"emoji: text that replaces :name:\n",
# completions
"reload || add || show %(emoji_name)", "emojis_cb", "")
weechat.hook_completion("emoji_name", "Emoji name", "emoji_name_completion_cb", "")
dbfile = weechat.config_get_plugin("dbfile")
weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))
try:
load_emojis(dbfile)
except IOError as e:
weechat.prnt("",
"%s%s: Database file %s is missing or inaccessible." \
% (weechat.prefix("error"), SCRIPT_NAME, dbfile))
raise e # TODO: handle this better instead of brutally aborting
开发者ID:flowbish,项目名称:weechat-emojis,代码行数:58,代码来源:emojis.py
示例3: init_config
def init_config():
for option, (default_value, description) in SW_CONFIG_DEFAULTS.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default_value)
sw_config[option] = default_value
else:
sw_config[option] = weechat.config_get_plugin(option)
weechat.config_set_desc_plugin(option, '%s (default: "%s")' % (description, default_value))
weechat.hook_config('plugins.var.python.' + SCRIPT_NAME + '.*', 'update_config', '')
开发者ID:Shrews,项目名称:scripts,代码行数:10,代码来源:stick_buffer.py
示例4: main
def main():
""" Entry point, initializes everything """
weechat.register(
SCRIPT_NAME,
SCRIPT_AUTHOR,
SCRIPT_VERSION,
SCRIPT_LICENSE,
SCRIPT_DESCRIPTION,
"", # Shutdown callback function
"", # Charset (blank for utf-8)
)
# Default values for settings
default_settings = {
'dbfile': os.path.join(
weechat.info_get("weechat_dir", ""), "emojis-db.dat")
}
# Apply default configuration values if anything is unset
for option, default in default_settings.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default)
# Hook callbacks
weechat.hook_config(
"plugins.var.python." + SCRIPT_NAME + ".*",
"configuration_cb", "")
weechat.hook_command_run("/input return", "transform_cb", "")
weechat.hook_command_run("/input complete*", "complete_cb", "")
# Command callbacks
weechat.hook_command(
"reloademojis", "reload emojis from file",
"", "", "", "reload_emojis_cb", "")
dbfile = weechat.config_get_plugin("dbfile")
weechat.prnt("", "%s: Loading emojis from %s" % (SCRIPT_NAME, dbfile))
try:
load_emojis(dbfile)
except IOError as e:
weechat.prnt(
"",
"%s%s: Database file %s is missing or inaccessible."
% (weechat.prefix("error"), SCRIPT_NAME, dbfile))
raise e # TODO: handle this better instead of brutally aborting
开发者ID:OliverUv,项目名称:weechat-emojis,代码行数:48,代码来源:emojis.py
示例5: init_script
def init_script():
global default_settings
for option, default_value in default_settings.items():
if not weechat.config_is_set_plugin(option):
weechat.config_set_plugin(option, default_value)
weechat.hook_command(
"weemustfeed",
"open/switch to weemustfeed buffer",
"",
"",
"",
"weemustfeed_command_cb", ""
)
weechat.hook_config(
"plugins.var.python.weemustfeed.interval",
"weemustfeed_reset_timer_cb", ""
)
开发者ID:DarkDefender,项目名称:scripts,代码行数:20,代码来源:weemustfeed.py
示例6: config_init
def config_init():
"""Add configuration options to weechat."""
global KEEP_ALIVE_TIMEOUT
config = {
"hide_inactive": ("off", "Hide inactive buffers"),
"hide_private": ("off", "Hide private buffers"),
"unhide_low": ("off",
"Unhide a buffer when a low priority message (like JOIN, PART, etc.) has been received"),
"exemptions": ("", "An enumeration of buffers that should not get hidden"),
"keep_open": ("off", "Keep a buffer open for a short amount of time"),
"keep_open_timeout": ("60 * 1000", "Timeout in milliseconds for how long a selected buffer should be kept around"),
}
for option, default_value in config.items():
if weechat.config_get_plugin(option) == "":
weechat.config_set_plugin(option, default_value[0])
weechat.config_set_desc_plugin(
option, '{} (default: "{}")'.format(default_value[1], default_value[0]))
weechat.hook_config("plugins.var.python.buffer_autohide.keep_open_timeout", "timeout_config_changed_cb", "")
if weechat.config_is_set_plugin("keep_open_timeout"):
KEEP_ALIVE_TIMEOUT = eval_expr(weechat.config_get_plugin("keep_open_timeout"))
开发者ID:qguv,项目名称:config,代码行数:22,代码来源:buffer_autohide.py
示例7: main
def main():
at_config('load')
# hook our config
weechat.hook_config(STRIP_VAR+'*','at_config','')
# hook the nick complete
weechat.hook_command_run('/input complete_next', 'at_completion', '')
# hook the /atcomplete
weechat.hook_command('atcomplete','manage @nick completion plugin',
'[enable|disable|toggle] '
' | [servers [list | add name | del name]]'
' | [buffers [list | add name | del name]]',
'args desc',
'status %-'
' || enable %-'
' || disable %-'
' || toggle %-'
' || server list|add|del %(buffers_names)'
' || buffer list|add|del %(buffers_names)'
,
'at_control','')
# hook the completetion for /atcomplete
weechat.hook_completion('plugin_at_completion','@nick completion','at_complete','')
开发者ID:WarheadsSE,项目名称:weechat-atcompletion,代码行数:22,代码来源:at_completion.py
示例8:
ignore_nick and ignore_text in plugins.var.python.%(script)s
Each config option accepts a comma separated list of patterns.
Wildcards '*', '?' and char groups [..] can be used.
An ignore exception can be added by prefixing '!' in the pattern.
Examples:
Setting 'ignore_nick' to 'troll,b[0o]t':
will ignore notifications from troll, bot and b0t.
Setting 'ignore_channel' to '*ubuntu*,!#ubuntu-offtopic':
will ignore notifications from any channel with the word 'ubuntu'
except from #ubuntu-offtopic.
Daemon:
%(script)s script needs to connect to an external daemon for send
notifications, which can be used in localhost or remotely.
Download the daemon from:
%(daemon_url)s
and check its help with ./%(daemon)s --help.
See also help in script file.
""" %dict(script=SCRIPT_NAME, daemon_url=DAEMON_URL, daemon=DAEMON)
,'test|notify|restart|quit', 'cmd_notify', '')
weechat.hook_config('plugins.var.python.%s.ignore_*' %SCRIPT_NAME, 'ignore_update', '')
weechat.hook_config('plugins.var.python.%s.server_*' %SCRIPT_NAME, 'server_update', '')
weechat.hook_print('', 'notify_message', '', 1, 'notify_msg', workaround)
weechat.hook_print('', 'notify_private', '', 1, 'notify_msg', workaround)
# vim:set shiftwidth=4 tabstop=4 softtabstop=4 expandtab textwidth=100:
开发者ID:KokaKiwi,项目名称:weechat-scripts,代码行数:30,代码来源:inotify.py
示例9: fish_config_init
"\n"
"Without arguments this command lists all keys.\n"
"\n"
"Examples:\n"
"Set the key for a channel: /blowkey set -server freenet #blowfish key\n"
"Remove the key: /blowkey remove #blowfish\n"
"Set the key for a query: /blowkey set nick secret+key\n"
"List all keys: /blowkey\n\n"
"\n** stores keys in plaintext by default **\n\n"
"DH1080: /blowkey exchange nick\n"
"\nPlease read the source for a note about DH1080 key exchange\n",
"list"
"|| genkey"
"|| set %(irc_channel)|%(nicks)|-server %(irc_servers) %- "
"|| remove %(irc_channel)|%(nicks)|-server %(irc_servers) %- "
"|| exchange %(nick)|-server %(irc_servers) %-",
"fish_cmd_blowkey", "")
fish_config_init()
fish_config_read()
fish_secure()
weechat.hook_modifier("irc_in_notice", "fish_modifier_in_notice_cb", "")
weechat.hook_modifier("irc_in_privmsg", "fish_modifier_in_privmsg_cb", "")
weechat.hook_modifier("irc_in_topic", "fish_modifier_in_topic_cb", "")
weechat.hook_modifier("irc_in_332", "fish_modifier_in_332_cb", "")
weechat.hook_modifier("irc_out_privmsg", "fish_modifier_out_privmsg_cb", "")
weechat.hook_modifier("irc_out_topic", "fish_modifier_out_topic_cb", "")
weechat.hook_modifier("input_text_for_buffer", "fish_modifier_input_text", "")
weechat.hook_config("fish.secure.key", "fish_secure_key_cb", "")
开发者ID:oakkitten,项目名称:scripts,代码行数:30,代码来源:fish.py
示例10: purge
" size : greater than <Kib> for log-files to purge\n"
" size_ls : less than <Kib> for log-files to purge\n"
" age : older than <days> for log-files to purge (maximum value: 9999)\n"
" age_ls : younger than <days> for log-files to purge\n"
" delete : argument for security reasons\n"
"\n"
# str_commands + "\n"
"Examples:\n"
" show log-files older than 100 days\n"
" /" + SCRIPT_NAME + " age 100\n"
" purge log-files older than 100 days\n"
" /" + SCRIPT_NAME + " age 100 delete\n"
" show log-files younger than 10 days\n"
" /" + SCRIPT_NAME + " age_ls 10\n"
" purge log-files younger than 10 days\n"
" /" + SCRIPT_NAME + " age_ls 10 delete\n"
" show log-files greater than 100 KiB\n"
" /" + SCRIPT_NAME + " size 100\n"
" purge log-files greater than 100 KiB\n"
" /" + SCRIPT_NAME + " size 100 delete\n",
"age|age_ls|size|size_ls %-",
"purgelogs_cb", "")
w.hook_config('plugins.var.python.%s.blacklist' %SCRIPT_NAME, 'update_blacklist', '')
for option, default_value in purgelogs_options.items():
# for option, default_value in purgelogs_options.iteritems():
if w.config_get_plugin(option) == "":
w.config_set_plugin(option, default_value)
else:
blacklist = w.config_get_plugin('blacklist').split(',')
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:purgelogs.py
示例11: config_changed
def config_changed(data, option, value):
init_config()
return w.WEECHAT_RC_OK
def tc_action_cb():
global tc_options
if tc_options['warn_command']:
if tc_options['warn_command'] == '$bell':
f = open('/dev/tty', 'w')
f.write('\a')
f.close()
else:
os.system(tc_options['warn_command'])
return w.WEECHAT_RC_OK
if __name__ == "__main__" and import_ok:
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION,
SCRIPT_LICENSE, SCRIPT_DESC,
"", ""):
version = w.info_get("version_number", "") or 0
init_config() # read configuration
tc_bar_item_update() # update status bar display
w.hook_signal('input_text_changed', 'tc_bar_item_update', '')
w.hook_signal('input_text_cursor_moved','tc_bar_item_update','')
w.hook_command_run('/input move_previous_char','command_run_cb','')
w.hook_command_run('/input delete_previous_char','command_run_cb','')
w.hook_signal('buffer_switch','tc_bar_item_update','')
w.hook_config('plugins.var.python.' + SCRIPT_NAME + ".*", "config_changed", "")
w.bar_item_new('tc', 'tc_bar_item', '')
开发者ID:MatthewCox,项目名称:dotfiles,代码行数:30,代码来源:typing_counter.py
示例12: Ignores
if __name__ == "__main__":
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
SCRIPT_DESC, "", ""):
# Set default settings
for option, default_value in settings.iteritems():
if not w.config_is_set_plugin(option):
w.config_set_plugin(option, default_value)
ignore_buffers = Ignores('ignore_buffers')
w.hook_print("", "", "://", 1, "url_print_cb", "")
w.hook_timer(\
int(w.config_get_plugin('reannounce_wait')) * 1000 * 60,
0,
0,
"purge_cb",
'')
weechat.hook_config('plugins.var.python.%s.ignore_buffers' %SCRIPT_NAME, 'ignore_update', '')
color_chat_delimiters = weechat.color('chat_delimiters')
color_chat_nick = weechat.color('chat_nick')
color_reset = weechat.color('reset')
color_chat_buffer = weechat.color('chat_buffer')
# pretty printing
script_nick = '%s[%s%s%s]%s' %(color_chat_delimiters,
color_chat_nick,
w.config_get_plugin('global_prefix'),
color_chat_delimiters,
color_reset)
开发者ID:DarkDefender,项目名称:scripts,代码行数:28,代码来源:announce_url_title.py
示例13: Config
## Example
As an example, consider the following rule list:
0: core = 0
1: irc = 2
2: * = 1
3: irc.server.*.#* = 1
4: irc.server.*.* = 0
Rule 0 ensures the core buffer is always sorted first.
Rule 1 sorts IRC buffers last and rule 2 puts all remaining buffers in between the two.
Rule 3 and 4 would make no sense with the group_irc option off.
With the option on though, these rules will sort private buffers before regular channel buffers.
Rule 3 matches channel buffers and assigns them a higher score,
while rule 4 matches the buffers that remain and assigns them a lower score.
The same effect could also be achieved with a single rule:
irc.server.*.[^#]* = 0
'''
command_completion = 'sort||rules list|add|insert|update|delete|move|swap||replacements list|add|insert|update|delete|move|swap'
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
config = Config('autosort')
weechat.hook_config('autosort.*', 'on_config_changed', '')
weechat.hook_command('autosort', command_description, '', '', command_completion, 'on_autosort_command', 'NULL')
on_config_changed()
开发者ID:0xdkay,项目名称:dotfiles,代码行数:29,代码来源:autosort.py
示例14: update_blacklist
return w.WEECHAT_RC_OK
def update_blacklist(*args):
''' Set the blacklist for channels and nicks. '''
global ignore_channels, ignore_nicks
ignore_channels = w.config_string(colorize_config_option['blacklist_channels']).split(',')
ignore_nicks = w.config_string(colorize_config_option['blacklist_nicks']).split(',')
return w.WEECHAT_RC_OK
if __name__ == "__main__":
if w.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE,
SCRIPT_DESC, "", ""):
colorize_config_init()
colorize_config_read()
# Run once to get data ready
update_blacklist()
populate_nicks()
w.hook_signal('nicklist_nick_added', 'add_nick', '')
w.hook_signal('nicklist_nick_removed', 'remove_nick', '')
w.hook_modifier('weechat_print', 'colorize_cb', '')
# Hook config for changing colors
w.hook_config('weechat.color.chat_nick_colors', 'populate_nicks', '')
# Hook for working togheter with other scripts (like colorize_lines)
w.hook_modifier('colorize_nicks', 'colorize_cb', '')
# Hook for modifying input
w.hook_modifier('250|input_text_display', 'colorize_input_cb', '')
# Hook for updating blacklist (this could be improved to use fnmatch)
weechat.hook_config('%s.look.blacklist*' % SCRIPT_NAME, 'update_blacklist', '')
开发者ID:AmusableLemur,项目名称:Dotfiles,代码行数:30,代码来源:colorize_nicks.py
示例15:
" /uotp list\n"+
" /uotp add freenode 4c6fdb7d0659bae2a16d23bab99678462b9f7897\n"+
" /uotp add freenode jrx5 w7ig lg5o filn eo5l tfty iyvz 66ex\n"+
" /uotp remove freenode\n"+
" /uotp enable freenode\n"+
" /uotp disable freenode",
"otp %(irc_servers)"
" || list"
" || add %(irc_servers)"
" || remove %(configured_servers)"
" || enable %(irc_servers)"
" || disable %(disabled_servers)",
"options_cb", "")
weechat.hook_signal("irc_server_connecting", "signal_cb", "")
weechat.hook_signal("irc_server_disconnected", "signal_cb", "")
weechat.hook_config("plugins.var.python.undernet_totp.otp_server_names", "config_update_cb", "")
weechat.hook_completion("configured_servers", "list of otp configured servers", "server_completion_cb", "configured_servers")
weechat.hook_completion("disabled_servers", "list of disabled servers", "server_completion_cb", "enabled_servers")
weechat.hook_modifier("input_text_display", "hide_secret_cb", "")
for option, default_value in SETTINGS.items():
if weechat.config_get_plugin(option) == "":
weechat.config_set_plugin(option, default_value[0])
weechat.config_set_desc_plugin(option, '%s (default: %s)' % (default_value[1], default_value[0]))
# For now we enable the hooks until it's possible to force script plugins to
# load before the irc plugin on weechat startup, otherwise the irc_server_connecting signal
# get missed.
for server in enabled_servers():
hook_all(server)
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:undernet_totp.py
示例16: len
elif len(args) == 2:
msg = u": ".join((args[1], ftext))
else:
msg = ftext
weechat.command(buffer, msg.encode("utf-8"))
return weechat.WEECHAT_RC_OK
def command_factreload(data, buffer, args):
"""Reload factoids."""
return load_factoids()
def kwfactoids_completion_cb(data, completion_item, buffer, completion):
"""Add completion for factoids."""
for factoid in FACTOIDS:
weechat.hook_completion_list_add(completion, factoid, 0, weechat.WEECHAT_LIST_POS_SORT)
return weechat.WEECHAT_RC_OK
load_factoids()
weechat.hook_command("factoid", "Send a factoid to channel.", "[factoid] [user]",
"factoid is name of factoid, user (optional) is user to direct the factoid at.",
"%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("f", "Send a factoid to channel.", "[factoid] [user]",
"factoid is name of factoid, user (optional) is user to direct the factoid at.",
"%(kwfactoidsc) %(nicks)", "command_factoid", "")
weechat.hook_command("factreload", "Reload factoids.", "", "", "", "command_factreload", "")
weechat.hook_completion("kwfactoidsc", "Factoid completion", "kwfactoids_completion_cb", "")
weechat.hook_config("plugins.var.python." + SCRIPT_NAME + ".*", "config_cb", "")
开发者ID:Kwpolska,项目名称:scripts,代码行数:30,代码来源:kwfactoids.py
示例17: load_settings
error = proc.stderr.read()
if error != '':
for line in error.split('\n'):
if line == 'FATAL_ERROR: The server is not running':
return STATUS_NOT_RUNNING
output = proc.stdout.read()
proc.wait()
return output
# ==================================[ main ]==================================
if __name__ == "__main__" and import_ok:
if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "moc_unload", ""):
load_settings('', '', '')
weechat.hook_config('plugins.var.python.moc_control.*', 'load_settings', '')
weechat.bar_item_new('moc_infobar', 'moc_infobar_update', '')
weechat.hook_timer(infobar['update']*1000,0,0,'moc_infobar_updater','')
if infobar['enabled']:
_add_infobar()
weechat.hook_command(
SCRIPT_COMMAND,
'Control moc or display now playing information.',
'play|pause|pp|stop|prev|next|infobar|help',
'Commands Available\n'
' /moc - Display currently playing song.\n'
' /moc play - Start playing music.\n'
' /moc pause - Toggle between pause/playing.\n'
' /moc pp - Toggle between pause/playing.\n'
开发者ID:DarkDefender,项目名称:scripts,代码行数:31,代码来源:moc_control.py
示例18: debug_msg
config_value = weechat.config_get_plugin(option)
if config_value:
# value is set in weechat config, store it here
config[option] = config_value
else:
# value isn't set in weechat config, set config value from defaults
weechat.config_set_plugin(option, default_value)
# warn if value isn't valid
if not config[option]:
weechat.prnt('', 'sendmail_notify:i please set option |%s|' % option)
# setup hooks
weechat.hook_print('', '', '', 1, 'send_message', '')
weechat.hook_config('plugins.var.python.sendmail_notify.*',
'update_config', '')
def debug_msg(msg):
if config['debug'] == 'on':
weechat.prnt('', 'sendmail_notify: ' + msg)
def is_ping(buffer_type, prefix, channel, highlight):
"""Determine if a message was a ping
private type AND prefix nick is channel name = ping
channel type AND highlight = ping
anything else != ping
"""
if buffer_type == 'private' and channel == prefix:
return True
开发者ID:jmeridth,项目名称:weechat_scripts,代码行数:32,代码来源:sendmail_notify.py
示例19: toggle_refresh
else:
OPTIONS[option] = w.config_get_plugin(option)
w.config_set_desc_plugin(option, '%s (default: "%s")' % (value[1], value[0]))
def toggle_refresh(pointer, name, value):
global OPTIONS
option = name[len("plugins.var.python." + SCR_NAME + ".") :] # get optionname
OPTIONS[option] = value # save new value
return w.WEECHAT_RC_OK
if __name__ == "__main__" and import_ok:
if w.register(SCR_NAME, SCR_AUTHOR, SCR_VERSION, SCR_LICENSE, SCR_DESC, "", ""):
init_options()
w.hook_config("plugins.var.python." + SCR_NAME + ".*", "toggle_refresh", "")
parser = MyHTMLParser()
fn_connected("", "", "")
# hook to "connected to a server"-signal
w.hook_signal("irc_server_connected", "fn_connected", "")
w.hook_command( # help-text
SCR_COMMAND,
"",
"""
The script tries to retrieve your external IP, in three cases:
1) When it is loaded
2) whenever you have succesfully connected to a server
3) when the script is called as a command ("/xfer_setip").
""",
开发者ID:Shrews,项目名称:scripts,代码行数:31,代码来源:xfer_setip.py
示例20: hook_it
if w.config_get_plugin('buffer'):
buffer = w.buffer_search('', w.config_get_plugin('buffer'))
hook_it(buffer)
return WEECHAT_RC_OK
def msg_command_buffer_opened_cb(data, signal, signal_data):
buffer = signal_data
buffer_name = w.buffer_get_string(buffer, "name")
if buffer_name == w.config_get_plugin('buffer'):
hook_it(buffer)
return WEECHAT_RC_OK
if __name__ == '__main__' and import_ok and \
weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC,
'', ''):
for opt, val in settings.iteritems():
if not weechat.config_is_set_plugin(opt):
weechat.config_set_plugin(opt, val)
weechat.hook_signal('buffer_opened', 'msg_command_buffer_opened_cb', '')
weechat.hook_config('plugins.var.python.%s' %SCRIPT_NAME, 'msg_command_conf_update', '')
msg_command_conf_update() # To init hook
# vim:set shiftwidth=4 tabstop=4 softtabstop=4 expandtab textwidth=100:
开发者ID:DarkDefender,项目名称:scripts,代码行数:30,代码来源:msg_command.py
注:本文中的weechat.hook_config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论