diff options
author | TingPing <tingping@tingping.se> | 2013-08-04 04:36:10 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-08-04 04:36:10 -0400 |
commit | e8456beadc9c065b52291ebdc552564d0a1d9069 (patch) | |
tree | 4a48b30b0f7e88d67b24c046b7e18370eeaae3d6 /src/common/outbound.c | |
parent | bdc814a4a410610d8aee2211b13a3a86fe477dd3 (diff) |
Add reload command for plugins and add to gui
Diffstat (limited to 'src/common/outbound.c')
-rw-r--r-- | src/common/outbound.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/common/outbound.c b/src/common/outbound.c index 91188a8a..21af2940 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -3498,6 +3498,39 @@ cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[]) return FALSE; } +static int +cmd_reload (struct session *sess, char *tbuf, char *word[], char *word_eol[]) +{ +#ifdef USE_PLUGIN + int len, by_file = FALSE; + + len = strlen (word[2]); +#ifdef WIN32 + if (len > 4 && g_ascii_strcasecmp (word[2] + len - 4, ".dll") == 0) +#else +#if defined(__hpux) + if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".sl") == 0) +#else + if (len > 3 && g_ascii_strcasecmp (word[2] + len - 3, ".so") == 0) +#endif +#endif + by_file = TRUE; + + switch (plugin_reload (sess, word[2], by_file)) + { + case 0: /* error */ + PrintText (sess, _("No such plugin found.\n")); + break; + case 1: /* success */ + return TRUE; + case 2: /* fake plugin, we know it exists but scripts should handle it. */ + return TRUE; + } +#endif + + return FALSE; +} + static server * find_server_from_hostname (char *hostname) { @@ -3918,7 +3951,7 @@ const struct commands xc_cmds[] = { N_("RECONNECT [<host>] [<port>] [<password>], Can be called just as /RECONNECT to reconnect to the current server or with /RECONNECT ALL to reconnect to all the open servers")}, #endif {"RECV", cmd_recv, 1, 0, 1, N_("RECV <text>, send raw data to HexChat, as if it was received from the IRC server")}, - + {"RELOAD", cmd_reload, 0, 0, 1, N_("RELOAD <name>, reloads a plugin or script")}, {"SAY", cmd_say, 0, 0, 1, N_("SAY <text>, sends the text to the object in the current window")}, {"SEND", cmd_send, 0, 0, 1, N_("SEND <nick> [<file>]")}, |