diff options
author | Berke Viktor <bviktor@hexchat.org> | 2012-11-04 23:55:36 +0100 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2012-11-04 23:55:36 +0100 |
commit | db218817fdc895aa2e3e52a71aa2f4423a534423 (patch) | |
tree | 42adbac9f667aa7a1dba5386150738fac84aeafc | |
parent | ad16ed3933b2904f3e4b206a67c4b67cc86622bc (diff) |
Use configdir instead of *xchatdir*
-rw-r--r-- | plugins/fishlim/plugin_hexchat.c | 2 | ||||
-rw-r--r-- | plugins/lua/lua.c | 4 | ||||
-rw-r--r-- | plugins/mpcinfo/theme.c | 2 | ||||
-rw-r--r-- | plugins/perl/lib/IRC.pm | 2 | ||||
-rw-r--r-- | plugins/perl/lib/Xchat.pm | 2 | ||||
-rw-r--r-- | plugins/perl/lib/Xchat.pod | 7 | ||||
-rw-r--r-- | plugins/perl/lib/Xchat/Embed.pm | 2 | ||||
-rw-r--r-- | plugins/perl/lib/Xchat/List/Network.pm | 2 | ||||
-rw-r--r-- | plugins/perl/perl.c | 5 | ||||
-rw-r--r-- | plugins/python/python.c | 6 | ||||
-rw-r--r-- | plugins/tcl/tclplugin.c | 9 | ||||
-rw-r--r-- | plugins/xdcc/xdcc.c | 4 | ||||
-rw-r--r-- | share/doc/perl.md | 23 | ||||
-rw-r--r-- | share/doc/plugins.md | 3 | ||||
-rw-r--r-- | share/doc/python.md | 2 | ||||
-rw-r--r-- | share/doc/tcl.md | 22 | ||||
-rw-r--r-- | src/common/plugin.c | 3 |
17 files changed, 45 insertions, 55 deletions
diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 3401f25d..35d05b6b 100644 --- a/plugins/fishlim/plugin_hexchat.c +++ b/plugins/fishlim/plugin_hexchat.c @@ -52,7 +52,7 @@ static hexchat_plugin *ph; * Returns the path to the key store file. */ gchar *get_config_filename() { - return g_build_filename(hexchat_get_info(ph, "hexchatdirfs"), "addon_fishlim.conf", NULL); + return g_build_filename(hexchat_get_info(ph, "configdir"), "addon_fishlim.conf", NULL); } /** diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index cd237c24..872d3081 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -524,7 +524,7 @@ static int lxc_cb_load(char *word[], char *word_eol[], void *userdata) } else { - xdir = hexchat_get_info (ph, "hexchatdirfs"); + xdir = hexchat_get_info (ph, "configdir"); snprintf (file, PATH_MAX, "%s" G_DIR_SEPARATOR_S "addons" G_DIR_SEPARATOR_S "%s", xdir, word[2]); } } @@ -678,7 +678,7 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle, hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, lxc_cb_unload, NULL, NULL); hexchat_hook_command(ph, "LUA", HEXCHAT_PRI_NORM, lxc_cb_lua, "Usage: LUA <code>, executes <code> in a new lua state", NULL); - xdir = hexchat_get_info (ph, "hexchatdirfs"); + xdir = hexchat_get_info (ph, "configdir"); xsubdir = g_build_filename (xdir, "addons", NULL); lxc_autoload_from_path (xsubdir); g_free (xsubdir); diff --git a/plugins/mpcinfo/theme.c b/plugins/mpcinfo/theme.c index b7e08d2e..0be6e376 100644 --- a/plugins/mpcinfo/theme.c +++ b/plugins/mpcinfo/theme.c @@ -87,7 +87,7 @@ void loadThemes(){ FILE *f; hexchat_print(ph,"loading themes\n"); hDir=(char*)calloc(1024,sizeof(char)); - strcpy(hDir,hexchat_get_info(ph,"hexchatdirfs")); + strcpy(hDir,hexchat_get_info(ph,"configdir")); hFile=str3cat(hDir,"\\","mpcInfo.theme.txt"); f = fopen(hFile,"r"); if(f==NULL) diff --git a/plugins/perl/lib/IRC.pm b/plugins/perl/lib/IRC.pm index 20498e69..e642fa3d 100644 --- a/plugins/perl/lib/IRC.pm +++ b/plugins/perl/lib/IRC.pm @@ -127,7 +127,7 @@ sub IRC::channel_list { sub IRC::get_info { my $id = shift; - my @ids = qw(version nick channel server hexchatdir xchatdir away network host topic); + my @ids = qw(version nick channel server configdir xchatdir away network host topic); if( $id >= 0 && $id <= 8 && $id != 5 ) { my $info = Xchat::get_info($ids[$id]); diff --git a/plugins/perl/lib/Xchat.pm b/plugins/perl/lib/Xchat.pm index fe99f37c..1ead64c3 100644 --- a/plugins/perl/lib/Xchat.pm +++ b/plugins/perl/lib/Xchat.pm @@ -471,7 +471,7 @@ sub context_info { my @fields = ( qw(away channel charset host id inputbox libdirfs modes network), qw(nick nickserv server topic version win_ptr win_status), - qw(hexchatdir hexchatdirfs xchatdir xchatdirfs state_cursor), + qw(configdir xchatdir xchatdirfs state_cursor), ); if( Xchat::set_context( $ctx ) ) { diff --git a/plugins/perl/lib/Xchat.pod b/plugins/perl/lib/Xchat.pod index 9f4b19b8..7b11e25c 100644 --- a/plugins/perl/lib/Xchat.pod +++ b/plugins/perl/lib/Xchat.pod @@ -683,18 +683,13 @@ C<$id> - one of the following case sensitive values <td></td> </tr> <tr> - <td>hexchatdir</td> <td>HexChat config directory encoded in UTF-8<br /> + <td>configdir</td> <td>HexChat config directory encoded in UTF-8<br /> examples:<br /> /home/user/.config/hexchat<br /> C:\Users\user\Appdata\Roaming\HexChat </td> <td></td> </tr> - -<tr> - <td>hexchatdirfs</td> <td>same as hexchatdir except encoded in the locale file system encoding</td> - <td></td> -</tr> </table> <p>This function is used to retrieve certain information about the current diff --git a/plugins/perl/lib/Xchat/Embed.pm b/plugins/perl/lib/Xchat/Embed.pm index d9d3e92a..6993dc6e 100644 --- a/plugins/perl/lib/Xchat/Embed.pm +++ b/plugins/perl/lib/Xchat/Embed.pm @@ -207,7 +207,7 @@ sub reload { } sub reload_all { - my @dirs = Xchat::get_info( "hexchatdirfs" ) || Xchat::get_info( "hexchatdir" ); + my @dirs = Xchat::get_info( "configdir" ); push @dirs, File::Spec->catdir( $dirs[0], "plugins" ); for my $dir ( @dirs ) { my $auto_load_glob = File::Spec->catfile( $dir, "*.pl" ); diff --git a/plugins/perl/lib/Xchat/List/Network.pm b/plugins/perl/lib/Xchat/List/Network.pm index 7ce1c435..2b112e3a 100644 --- a/plugins/perl/lib/Xchat/List/Network.pm +++ b/plugins/perl/lib/Xchat/List/Network.pm @@ -6,7 +6,7 @@ my $last_modified; my @servers; sub get { - my $server_file = Xchat::get_info( "hexchatdirfs" ) . "/servlist_.conf"; + my $server_file = Xchat::get_info( "configdir" ) . "/servlist_.conf"; # recreate the list only if the server list file has changed if( -f $server_file && diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index ba0d0a8d..2b7c073b 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -144,7 +144,7 @@ perl_auto_load (void *unused) #endif /* get the dir in local filesystem encoding (what opendir() expects!) */ - xdir = hexchat_get_info (ph, "hexchatdirfs"); + xdir = hexchat_get_info (ph, "configdir"); /* don't pollute the filesystem with script files, this only causes misuse of the folders * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ @@ -794,7 +794,8 @@ XS (XS_Xchat_get_info) if ( !strncmp ("libdirfs", SvPV_nolen (id), 8) || - !strncmp ("hexchatdirfs", SvPV_nolen (id), 10) + !strncmp ("xchatdirfs", SvPV_nolen (id), 10) || + !strncmp ("configdir", SvPV_nolen (id), 9) ) { XSRETURN_PV (RETVAL); } else { diff --git a/plugins/python/python.c b/plugins/python/python.c index efe57480..32acd522 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -394,13 +394,13 @@ Util_Autoload() char *sub_dir; /* we need local filesystem encoding for chdir, opendir etc */ - xdir = hexchat_get_info(ph, "hexchatdirfs"); + xdir = hexchat_get_info(ph, "configdir"); /* don't pollute the filesystem with script files, this only causes misuse of the folders * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ #if 0 /* auto-load from ~/.config/hexchat/ or %APPDATA%\HexChat\ */ - Util_Autoload_from(hexchat_get_info(ph, "hexchatdirfs")); + Util_Autoload_from(hexchat_get_info(ph, "configdir")); #endif /* auto-load from subdirectory addons */ @@ -450,7 +450,7 @@ Util_Expand(char *filename) g_free(expanded); /* Check if ~/.config/hexchat/addons/<filename> exists. */ - expanded = g_build_filename(hexchat_get_info(ph, "hexchatdir"), + expanded = g_build_filename(hexchat_get_info(ph, "configdir"), "addons", filename, NULL); if (g_file_test(expanded, G_FILE_TEST_EXISTS)) return expanded; diff --git a/plugins/tcl/tclplugin.c b/plugins/tcl/tclplugin.c index 6ec89137..b03e7bac 100644 --- a/plugins/tcl/tclplugin.c +++ b/plugins/tcl/tclplugin.c @@ -93,7 +93,7 @@ static char unknown[] = { /* don't pollute the filesystem with script files, this only causes misuse of the folders * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ static char sourcedirs[] = { - "set files [lsort [glob -nocomplain -directory [hexchatdir] \"/addons/*.tcl\"]]\n" + "set files [lsort [glob -nocomplain -directory [configdir] \"/addons/*.tcl\"]]\n" "set init [lsearch -glob $files \"*/init.tcl\"]\n" "if { $init > 0 } {\n" "set initfile [lindex $files $init]\n" @@ -122,8 +122,7 @@ static char inlinetcl[] = { "proc ::server { args } { return [eval [join [list getinfo $args server]]] }\n" "proc ::version { args } { return [eval [join [list getinfo $args version]]] }\n" "proc ::win_status { args } { return [eval [join [list getinfo $args win_status]]] }\n" -"proc ::hexchatdir { args } { return [eval [join [list getinfo $args hexchatdir]]] }\n" -"proc ::hexchatdirfs { args } { return [eval [join [list getinfo $args hexchatdirfs]]] }\n" +"proc ::configdir { args } { return [eval [join [list getinfo $args configdir]]] }\n" "proc ::color { {arg {}} } { return \"\\003$arg\" }\n" "proc ::bold { } { return \"\\002\" }\n" @@ -2031,7 +2030,7 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata) if (len > 4 && strcasecmp(".tcl", word[2] + len - 4) == 0) { - hexchatdir = hexchat_get_info(ph, "hexchatdir"); + hexchatdir = hexchat_get_info(ph, "configdir"); Tcl_DStringInit(&ds); @@ -2137,7 +2136,7 @@ static void Tcl_Plugin_Init() for (x = 0; x < XC_SIZE; x++) xc[x].hook = NULL; - hexchatdir = hexchat_get_info(ph, "hexchatdir"); + hexchatdir = hexchat_get_info(ph, "configdir"); if (Tcl_Eval(interp, unknown) == TCL_ERROR) { hexchat_printf(ph, "Error sourcing internal 'unknown' (%s)\n", Tcl_GetStringResult(interp)); diff --git a/plugins/xdcc/xdcc.c b/plugins/xdcc/xdcc.c index 73a3983b..85d27732 100644 --- a/plugins/xdcc/xdcc.c +++ b/plugins/xdcc/xdcc.c @@ -253,7 +253,7 @@ static void xdcc_save(void) GSList *list; fileoffer *offer; - snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "hexchatdir")); + snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "configdir")); fp = fopen(buf, "w"); if(!fp) @@ -280,7 +280,7 @@ static void xdcc_load(void) char dl[128]; FILE *fp; - snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "hexchatdir")); + snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "configdir")); fp = fopen(buf, "r"); if(!fp) diff --git a/share/doc/perl.md b/share/doc/perl.md index 683e4683..7a7aa5db 100644 --- a/share/doc/perl.md +++ b/share/doc/perl.md @@ -362,8 +362,16 @@ Returns true on success, false on failure. <td>charset</td> <td>character-set used in the current context</td> <td>CHARSET</td> - </tr> <tr> - <td>event\_text <Event Name></td> <td>text event format string for <Event name><br /> + </tr> +<tr> + <td>configdir</td> <td>HexChat config directory encoded in UTF-8. Examples:<br /> + /home/user/.config/hexchat<br /> + C:\Users\user\Appdata\Roaming\HexChat + </td> + <td></td> +</tr> +<tr> + <td>event_text <Event Name></td> <td>text event format string for <Event name><br /> Example: <div class="example synNormal"><div class='line_number'> <div>1</div> @@ -442,17 +450,6 @@ Returns true on success, false on failure. <td>similar to win_ptr except it will always be a GtkWindow *</td> <td></td> </tr> -<tr> - <td>hexchatdir</td> <td>HexChat config directory encoded in UTF-8<br /> - examples:<br /> - /home/user/.config/hexchat<br /> - C:\Users\user\Appdata\Roaming\HexChat - </td> - <td></td> -</tr><tr> - <td>hexchatdirfs</td> <td>same as hexchatdir except encoded in the locale file system encoding</td> - <td></td> -</tr> </table> This function is used to retrieve certain information about the current diff --git a/share/doc/plugins.md b/share/doc/plugins.md index a46c4177..060f2c65 100644 --- a/share/doc/plugins.md +++ b/share/doc/plugins.md @@ -808,10 +808,9 @@ Changed in 2.6.1. If _servname_ is NULL, it finds the channel (or query) by the * **away:** away reason or NULL if you are not away. * **channel:** current channel name. * **charset:** character-set used in the current context. + * **configdir:** HexChat config directory, e.g.: `/home/user/.config/hexchat`. This string is encoded in UTF-8. * **event\_text <name>:** text event format string for _name_. * **gtkwin\_ptr:** (GtkWindow \*). - * **hexchatdir:** HexChat config directory, e.g.: /home/user/.config/hexchat. This string is encoded in UTF-8, which means you **should** convert it to "locale" encoding before using functions like open() or OpenFile(). For best Unicode support on Linux, convert this string using g\_filename\_from\_utf8 and on Windows convert this string to UTF-16LE (wide) and use OpenFileW() etc. - * **hexchatdirfs:** HexChat config directory, e.g.: /home/user/.config/hexchat. This string is encoded in local file system encoding, making it ideal for direct use with functions like open() or OpenFile(). For real Unicode support on Windows, it's best not to use hexchatdirfs, but hexchatdir instead. * **host:** real hostname of the server you connected to. * **inputbox:** the input-box contents, what the user has typed. * **libdirfs:** library directory. e.g. /usr/lib/hexchat. The same directory used for auto-loading plugins. This string isn't necessarily UTF-8, but local file system encoding. diff --git a/share/doc/python.md b/share/doc/python.md index dc4ff1ec..1020d645 100644 --- a/share/doc/python.md +++ b/share/doc/python.md @@ -157,9 +157,9 @@ are available to be queried: * **away:** Away reason or None if you are not away. * **channel:** Channel name of the current context. * **charset:** Charset in current context. + * **configdir:** HexChat config directory e.g.: "~/.config/hexchat". * **event_name NAME:** Returns text event string for requested event. * **gtkwin_ptr:** Current Gtk Window. - * **hexchatdir:** HexChat config directory e.g.: "~/.config/hexchat". * **host:** Real hostname of the server you connected to. * **inputbox:** Contents of inputbox. * **network:** Current network name or None. diff --git a/share/doc/tcl.md b/share/doc/tcl.md index 506da056..7f3f6db3 100644 --- a/share/doc/tcl.md +++ b/share/doc/tcl.md @@ -95,7 +95,7 @@ before Eggdrop and is broadly considered the industry standard language for auto <tr valign=top> <td align=right><b>Example:</b></td> <td><pre>/tcl puts "Hello, XChat World!" -/tcl hexchatdir</pre></td> +/tcl configdir</pre></td> </tr> @@ -680,6 +680,10 @@ The following fields are currently defined: </td> </tr> <tr> +<td>configdir </td> +<td> HexChat config directory, e.g.: /home/user/.config/hexchat.</td> +</tr> +<tr> <td>host </td> <td> real hostname of the server you connected to. </td> @@ -709,10 +713,6 @@ The following fields are currently defined: <td> HexChat version number. </td> </tr> -<tr> -<td>hexchatdir </td> -<td> HexChat config directory, e.g.: /home/user/.config/hexchat.</td> -</tr> </table><br> </td> </tr> @@ -724,7 +724,7 @@ The following fields are currently defined: <tr valign=top> <td align=right nowrap><b>See Also:</b></td> -<td><a href='#away'>away</a>, <a href='#channel'>channel</a>, <a href='#host'>host</a>, <a href='#me'>me</a>, <a href='#network'>network</a>, <a href='#server'>server</a>, <a href='#topic'>topic</a>, <a href='#version'>version</a>, <a href='#hexchatdir'>hexchatdir</a></td> +<td><a href='#away'>away</a>, <a href='#channel'>channel</a>, <a href='#host'>host</a>, <a href='#me'>me</a>, <a href='#network'>network</a>, <a href='#server'>server</a>, <a href='#topic'>topic</a>, <a href='#version'>version</a>, <a href='#configdir'>configdir</a></td> </tr> @@ -3581,7 +3581,7 @@ print "[timers]"</pre></td> <tr valign=top> <td align=right nowrap><b>See Also:</b></td> -<td><a href='#hexchatdir'>hexchatdir</a></td> +<td><a href='#configdir'>configdir</a></td> </tr> @@ -3594,17 +3594,17 @@ print "[timers]"</pre></td> <p> -<a name='hexchatdir'> </a> +<a name='configdir'> </a> <table width=100% border=0 bgcolor=#eeeeee cellpadding=3 cellspacing=0> <tr valign=top> <td align=right width=1% ><b>Name:</b></td> -<td>hexchatdir - Returns the current HexChat config directory.</td> +<td>configdir - Returns the current HexChat config directory.</td> </tr> <tr valign=top> <td align=right><b>Synopsis:</b></td> -<td><pre>hexchatdir</pre></td> +<td><pre>configdir</pre></td> </tr> <tr valign=top> @@ -3614,7 +3614,7 @@ print "[timers]"</pre></td> <tr valign=top> <td align=right><b>Example:</b></td> -<td><pre>print "My XChat config directory is [hexchatdir]"</pre></td> +<td><pre>print "My XChat config directory is [configdir]"</pre></td> </tr> <tr valign=top> diff --git a/src/common/plugin.c b/src/common/plugin.c index a30ba575..fb677325 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -1050,9 +1050,8 @@ hexchat_get_info (hexchat_plugin *ph, const char *id) return PACKAGE_VERSION; case 0xdd9b1abd: /* xchatdir */ - case 0x9a70daba: /* hexchatdir */ case 0xe33f6c4a: /* xchatdirfs */ - case 0xc1a52107: /* hexchatdirfs */ + case 0xd00d220b: /* configdir */ return get_xdir (); } |