diff options
-rw-r--r-- | README | 60 | ||||
-rw-r--r-- | plugins/lua/lua.c | 4 | ||||
-rw-r--r-- | plugins/perl/perl.c | 6 | ||||
-rw-r--r-- | plugins/python/python.c | 12 | ||||
-rw-r--r-- | plugins/tcl/tclplugin.c | 6 | ||||
-rw-r--r-- | src/common/plugin.c | 35 | ||||
-rw-r--r-- | src/fe-gtk/plugingui.c | 15 |
7 files changed, 86 insertions, 52 deletions
diff --git a/README b/README index 935e441c..93ef6691 100644 --- a/README +++ b/README @@ -26,17 +26,17 @@ Requirements: HexChat is known to work on, at least: - * Windows XP/Vista/7/8 - * Linux - * FreeBSD - * OpenBSD - * NetBSD - * Solaris - * AIX - * IRIX - * DEC/Compaq Tru64 UNIX - * HP-UX 10.20 and 11 - * MacOS X + * Windows XP/Vista/7/8 + * Linux + * FreeBSD + * OpenBSD + * NetBSD + * Solaris + * AIX + * IRIX + * DEC/Compaq Tru64 UNIX + * HP-UX 10.20 and 11 + * MacOS X Notes for packagers: @@ -60,38 +60,42 @@ Perl Scripts: Perl 5.8 or newer is required. Scripts for 1.8.x are compatible with the following exceptions: -* IRC::command will not interpret %C, %B, %U etc. + * IRC::command will not interpret %C, %B, %U etc. -* user_list and user_list_short: + * user_list and user_list_short: If a user has both op and voice, only the op flag will be 1. -* add_user_list/sub_user_list/clear_user_list + * add_user_list/sub_user_list/clear_user_list These functions do nothing. -* notify_list + * notify_list Not implemented. Always returns an empty list. -* server_list + * server_list Lists servers that are not connected aswell. -* Some print events may have new names and some were added. + * Some print events may have new names and some were added. -* Text printed by scripts must now be UTF8. + * Text printed by scripts must now be UTF8. -* Text passed to scripts (via add_message_handler) will be encoded in UTF8. + * Text passed to scripts (via add_message_handler) will be encoded in UTF8. Autoloading Scripts and Plugins ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - HexChat automatically loads, at startup: - - ~/.config/hexchat/scripts/*.lua Lua scripts - ~/.config/hexchat/scripts/*.pl Perl scripts - ~/.config/hexchat/scripts/*.py Python scripts - ~/.config/hexchat/scripts/*.tcl Tcl scripts - ~/.config/hexchat/*.so Plugins - $(libdir)/hexchat/plugins/*.so plugins - (this usually translates to /usr/lib/hexchat/plugins/*.so) + The root of your HexChat config is: + + * Windows: %APPDATA%\HexChat + * Unix: ~/.config/hexchat + + Referred to as <config> from now. HexChat automatically loads, at startup: + + * <config>/addons/*.lua Lua scripts + * <config>/addons/*.pl Perl scripts + * <config>/addons/*.py Python scripts + * <config>/addons/*.tcl Tcl scripts + * <config>/addons/*.dll Plugins (Windows) + * <config>/addons/*.so Plugins (Unix) Control Codes: diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index a70ad0d6..8fc55a26 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -525,7 +525,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata) else { xdir = xchat_get_info (ph, "xchatdirfs"); - snprintf (file, PATH_MAX, "%s/scripts/%s", xdir, word[2]); + snprintf (file, PATH_MAX, "%s/addons/%s", xdir, word[2]); } } @@ -679,7 +679,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, xchat_hook_command(ph, "LUA", XCHAT_PRI_NORM, lxc_cb_lua, "Usage: LUA <code>, executes <code> in a new lua state", NULL); xdir = xchat_get_info (ph, "xchatdirfs"); - xsubdir = g_build_filename (xdir, "scripts", NULL); + xsubdir = g_build_filename (xdir, "addons", NULL); lxc_autoload_from_path (xsubdir); g_free (xsubdir); diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 7eea9efb..c9bfa5e9 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -145,15 +145,15 @@ perl_auto_load (void *unused) xdir = xchat_get_info (ph, "xchatdir"); /* don't pollute the filesystem with script files, this only causes misuse of the folders - * only use ~/.config/hexchat/scripts/ and %APPDATA%\HexChat\scripts */ + * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ #if 0 /* autoload from ~/.config/hexchat/ or %APPDATA%\HexChat\ on win32 */ perl_auto_load_from_path (xdir); #endif - sub_dir = malloc (strlen (xdir) + 9); + sub_dir = malloc (strlen (xdir) + 8); strcpy (sub_dir, xdir); - strcat (sub_dir, "/scripts"); + strcat (sub_dir, "/addons"); perl_auto_load_from_path (sub_dir); free (sub_dir); diff --git a/plugins/python/python.c b/plugins/python/python.c index 477cbc74..38b98c4a 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -392,16 +392,16 @@ Util_Autoload() xdir = xchat_get_info(ph, "xchatdirfs"); /* don't pollute the filesystem with script files, this only causes misuse of the folders - * only use ~/.config/hexchat/scripts/ and %APPDATA%\HexChat\scripts */ + * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ #if 0 /* auto-load from ~/.config/hexchat/ or %APPDATA%\HexChat\ */ Util_Autoload_from(xchat_get_info(ph, "xchatdirfs")); #endif - /* auto-load from subdirectory scripts */ - sub_dir = malloc (strlen (xdir) + 9); + /* auto-load from subdirectory addons */ + sub_dir = malloc (strlen (xdir) + 8); strcpy (sub_dir, xdir); - strcat (sub_dir, "/scripts"); + strcat (sub_dir, "/addons"); Util_Autoload_from(sub_dir); free (sub_dir); @@ -444,9 +444,9 @@ Util_Expand(char *filename) return expanded; g_free(expanded); - /* Check if ~/.config/hexchat/scripts/<filename> exists. */ + /* Check if ~/.config/hexchat/addons/<filename> exists. */ expanded = g_build_filename(xchat_get_info(ph, "xchatdir"), - "scripts", filename, NULL); + "addons", filename, NULL); if (g_file_test(expanded, G_FILE_TEST_EXISTS)) return expanded; g_free(expanded); diff --git a/plugins/tcl/tclplugin.c b/plugins/tcl/tclplugin.c index 168e0f54..1c434d40 100644 --- a/plugins/tcl/tclplugin.c +++ b/plugins/tcl/tclplugin.c @@ -90,9 +90,9 @@ static char unknown[] = { }; /* don't pollute the filesystem with script files, this only causes misuse of the folders - * only use ~/.config/hexchat/scripts/ and %APPDATA%\HexChat\scripts */ + * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ static char sourcedirs[] = { - "set files [lsort [glob -nocomplain -directory [xchatdir] \"/scripts/*.tcl\"]]\n" + "set files [lsort [glob -nocomplain -directory [xchatdir] \"/addons/*.tcl\"]]\n" "set init [lsearch -glob $files \"*/init.tcl\"]\n" "if { $init > 0 } {\n" "set initfile [lindex $files $init]\n" @@ -2039,7 +2039,7 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata) } else { if (!strchr(word_eol[2], '/')) { Tcl_DStringAppend(&ds, xchatdir, strlen(xchatdir)); - Tcl_DStringAppend(&ds, "/scripts/", 9); + Tcl_DStringAppend(&ds, "/addons/", 8); Tcl_DStringAppend(&ds, word_eol[2], strlen(word_eol[2])); } } diff --git a/src/common/plugin.c b/src/common/plugin.c index 1bec7a7a..6756e0fc 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -457,19 +457,38 @@ plugin_auto_load_cb (char *filename) void plugin_auto_load (session *sess) { - ps = sess; - /* let's do it the Perl way */ const char *xdir; char *sub_dir; + ps = sess; xdir = get_xdir_fs (); - sub_dir = malloc (strlen (xdir) + 9); + sub_dir = malloc (strlen (xdir) + 8); strcpy (sub_dir, xdir); - strcat (sub_dir, "/plugins"); + strcat (sub_dir, "/addons"); #ifdef WIN32 - for_files ("./plugins", "*.dll", plugin_auto_load_cb); + /* a long list of bundled plugins that should be loaded automatically, + * user plugins should go to <config>, leave Program Files alone! */ + for_files ("./plugins", "hcchecksum.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcdns.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcdoat.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcexec.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcfishlim.dll", plugin_auto_load_cb); + for_files ("./plugins", "hclua.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcmpcinfo.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcperl-512.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcperl-514.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcperl-516.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcpython.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcsasl.dll", plugin_auto_load_cb); + for_files ("./plugins", "hctcl.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcupd.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcwinamp.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcwinsys.dll", plugin_auto_load_cb); + for_files ("./plugins", "hcwmpa.dll", plugin_auto_load_cb); + for_files ("./plugins", "hextray.dll", plugin_auto_load_cb); + for_files (sub_dir, "*.dll", plugin_auto_load_cb); #else #if defined(__hpux) @@ -1620,7 +1639,7 @@ xchat_pluginpref_set_str_real (xchat_plugin *pl, const char *var, const char *va canon = g_strdup (pl->name); canonalize_key (canon); - sprintf (confname, "plugin_%s.conf", canon); + sprintf (confname, "addon_%s.conf", canon); g_free (canon); sprintf (confname_tmp, "%s.new", confname); @@ -1737,7 +1756,7 @@ xchat_pluginpref_get_str (xchat_plugin *pl, const char *var, char *dest) canon = g_strdup (pl->name); canonalize_key (canon); - sprintf (confname, "plugin_%s.conf", canon); + sprintf (confname, "addon_%s.conf", canon); g_free (canon); /* partly borrowed from palette.c */ @@ -1817,7 +1836,7 @@ xchat_pluginpref_list (xchat_plugin *pl, char* dest) token = g_strdup (pl->name); canonalize_key (token); - sprintf (confname, "plugin_%s.conf", token); + sprintf (confname, "addon_%s.conf", token); g_free (token); fpIn = xchat_fopen_file (confname, "r", 0); diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c index d17aadb7..00566533 100644 --- a/src/fe-gtk/plugingui.c +++ b/src/fe-gtk/plugingui.c @@ -147,6 +147,15 @@ plugingui_load_cb (session *sess, char *file) void plugingui_load (void) { + /* let's do it the Perl way */ + const char *xdir; + char *sub_dir; + + xdir = get_xdir_utf8 (); + sub_dir = malloc (strlen (xdir) + 8); + strcpy (sub_dir, xdir); + strcat (sub_dir, "/addons"); + gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess, #if 0 /* native file dialogs */ #ifdef WIN32 @@ -156,10 +165,12 @@ plugingui_load (void) #endif #endif /* native file dialogs */ #ifdef WIN32 - get_xdir_utf8 (), "*.dll;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS); + sub_dir, "*.dll;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS); #else - get_xdir_utf8 (), "*.so;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS); + sub_dir, "*.so;*.lua;*.pl;*.py;*.tcl", FRF_ADDFOLDER|FRF_FILTERISINITIAL|FRF_EXTENSIONS); #endif + + free (sub_dir); } static void |