diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/plugins/scripts/weechat-script.c | 40 | ||||
-rw-r--r-- | weechat/ChangeLog | 3 | ||||
-rw-r--r-- | weechat/src/plugins/scripts/weechat-script.c | 40 |
4 files changed, 82 insertions, 4 deletions
@@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-03-25 +ChangeLog - 2006-03-26 Version 0.1.9 (under dev!): + * improved script plugin loader * added hostname/IP option for connection to server * fixed --disable-plugins option in configure script * added /setp command (set plugin options) diff --git a/src/plugins/scripts/weechat-script.c b/src/plugins/scripts/weechat-script.c index c5ee3cca3..f95809426 100644 --- a/src/plugins/scripts/weechat-script.c +++ b/src/plugins/scripts/weechat-script.c @@ -96,9 +96,47 @@ weechat_script_search_full_name (t_weechat_plugin *plugin, int length; struct stat st; - if ((strstr(filename, "/")) || (strstr(filename, "\\"))) + if (filename[0] == '~') + { + dir_home = getenv ("HOME"); + if (!dir_home) + return NULL; + length = strlen (dir_home) + strlen (filename + 1) + 1; + final_name = (char *) malloc (length); + if (final_name) + { + snprintf (final_name, length, "%s%s", dir_home, filename + 1); + return final_name; + } + return NULL; + } + +#ifdef _WIN32 + if (strstr(filename, "\\")) +#else + if (strstr(filename, "/")) +#endif return strdup(filename); + /* try WeeChat user's autoload dir */ + dir_home = plugin->get_info (plugin, "weechat_dir", NULL); + if (dir_home) + { + length = strlen (dir_home) + strlen (language) + 8 + strlen (filename) + 16; + final_name = (char *) malloc (length); + if (final_name) + { + snprintf (final_name, length, "%s/%s/autoload/%s", dir_home, language, filename); + if ((stat (final_name, &st) == 0) && (st.st_size > 0)) + { + free (dir_home); + return final_name; + } + free (final_name); + } + free (dir_home); + } + /* try WeeChat user's dir */ dir_home = plugin->get_info (plugin, "weechat_dir", NULL); if (dir_home) diff --git a/weechat/ChangeLog b/weechat/ChangeLog index cb31a0e95..7306344c5 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-03-25 +ChangeLog - 2006-03-26 Version 0.1.9 (under dev!): + * improved script plugin loader * added hostname/IP option for connection to server * fixed --disable-plugins option in configure script * added /setp command (set plugin options) diff --git a/weechat/src/plugins/scripts/weechat-script.c b/weechat/src/plugins/scripts/weechat-script.c index c5ee3cca3..f95809426 100644 --- a/weechat/src/plugins/scripts/weechat-script.c +++ b/weechat/src/plugins/scripts/weechat-script.c @@ -96,9 +96,47 @@ weechat_script_search_full_name (t_weechat_plugin *plugin, int length; struct stat st; - if ((strstr(filename, "/")) || (strstr(filename, "\\"))) + if (filename[0] == '~') + { + dir_home = getenv ("HOME"); + if (!dir_home) + return NULL; + length = strlen (dir_home) + strlen (filename + 1) + 1; + final_name = (char *) malloc (length); + if (final_name) + { + snprintf (final_name, length, "%s%s", dir_home, filename + 1); + return final_name; + } + return NULL; + } + +#ifdef _WIN32 + if (strstr(filename, "\\")) +#else + if (strstr(filename, "/")) +#endif return strdup(filename); + /* try WeeChat user's autoload dir */ + dir_home = plugin->get_info (plugin, "weechat_dir", NULL); + if (dir_home) + { + length = strlen (dir_home) + strlen (language) + 8 + strlen (filename) + 16; + final_name = (char *) malloc (length); + if (final_name) + { + snprintf (final_name, length, "%s/%s/autoload/%s", dir_home, language, filename); + if ((stat (final_name, &st) == 0) && (st.st_size > 0)) + { + free (dir_home); + return final_name; + } + free (final_name); + } + free (dir_home); + } + /* try WeeChat user's dir */ dir_home = plugin->get_info (plugin, "weechat_dir", NULL); if (dir_home) |