mirror of
https://github.com/hexchat/hexchat.git
synced 2024-11-10 13:12:34 +01:00
hook reload command
This commit is contained in:
parent
541f221a61
commit
9917b7e3df
@ -327,6 +327,9 @@ Usage: /PY LOAD <filename>\n\
|
||||
ABOUT\n\
|
||||
\n";
|
||||
|
||||
/* Remove if/when HexChat supports this command for plugins */
|
||||
static const char reload[] = "Usage: RELOAD <name>, reloads a python script";
|
||||
|
||||
static const char about[] = "\
|
||||
\n\
|
||||
X-Chat Python Interface " VERSION "\n\
|
||||
@ -2232,6 +2235,17 @@ Command_Unload(char *word[], char *word_eol[], void *userdata)
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
Command_Reload(char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
int len = strlen(word[2]);
|
||||
if (len > 3 && strcasecmp(".py", word[2]+len-3) == 0) {
|
||||
Command_PyReload(word[2]);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
/* ===================================================================== */
|
||||
/* Autoload function */
|
||||
|
||||
@ -2320,6 +2334,7 @@ hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
hexchat_hook_command(ph, "PY", HEXCHAT_PRI_NORM, Command_Py, usage, 0);
|
||||
hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, Command_Load, 0, 0);
|
||||
hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, Command_Unload, 0, 0);
|
||||
hexchat_hook_command(ph, "RELOAD", HEXCHAT_PRI_NORM, Command_Reload, reload, 0);
|
||||
#ifdef WITH_THREAD
|
||||
thread_timer = hexchat_hook_timer(ph, 300, Callback_ThreadTimer, NULL);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user