From 29f7a9180caa1b8278bf3d9c6a9b49a0b59a1000 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Tue, 30 Oct 2012 09:59:58 +0100 Subject: Rebrand get_info(xchatdir) but remain compatible for Perl and Python --- plugins/fishlim/plugin_hexchat.c | 2 +- plugins/lua/lua.c | 4 ++-- plugins/mailcheck/Makefile.am | 2 +- plugins/mpcinfo/theme.c | 2 +- plugins/perl/lib/IRC.pm | 2 +- plugins/perl/lib/Xchat.pm | 2 +- plugins/perl/lib/Xchat.pod | 8 ++++---- plugins/perl/lib/Xchat/Embed.pm | 2 +- plugins/perl/lib/Xchat/List/Network.pm | 2 +- plugins/perl/perl.c | 6 ++---- plugins/python/python.c | 6 +++--- plugins/tcl/tclplugin.c | 16 ++++++++-------- plugins/xdcc/Makefile.am | 2 +- plugins/xdcc/xdcc.c | 4 ++-- 14 files changed, 29 insertions(+), 31 deletions(-) (limited to 'plugins') diff --git a/plugins/fishlim/plugin_hexchat.c b/plugins/fishlim/plugin_hexchat.c index 3be13efb..6ddb5d64 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, "xchatdirfs"), "addon_fishlim.conf", NULL); + return g_build_filename(hexchat_get_info(ph, "hexchatdirfs"), "addon_fishlim.conf", NULL); } /** diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index 6f17b50d..c887e31f 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, "xchatdirfs"); + xdir = hexchat_get_info (ph, "hexchatdirfs"); snprintf (file, PATH_MAX, "%s/addons/%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 , executes in a new lua state", NULL); - xdir = hexchat_get_info (ph, "xchatdirfs"); + xdir = hexchat_get_info (ph, "hexchatdirfs"); xsubdir = g_build_filename (xdir, "addons", NULL); lxc_autoload_from_path (xsubdir); g_free (xsubdir); diff --git a/plugins/mailcheck/Makefile.am b/plugins/mailcheck/Makefile.am index bda04229..b9281494 100644 --- a/plugins/mailcheck/Makefile.am +++ b/plugins/mailcheck/Makefile.am @@ -15,7 +15,7 @@ EXTRA_DIST = mailcheck-config.h.in # Remember to include this line in your Makefile.am include @top_srcdir@/plugins/Make.plugin -libdir = $(xchatdir)/plugins +libdir = $(hexchatdir)/plugins lib_LTLIBRARIES = mailcheck.la mailcheck_la_SOURCES = mailcheck.c diff --git a/plugins/mpcinfo/theme.c b/plugins/mpcinfo/theme.c index fc218267..b7e08d2e 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,"xchatdirfs")); + strcpy(hDir,hexchat_get_info(ph,"hexchatdirfs")); 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 5cc419d0..20498e69 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 xchatdir away network host topic); + my @ids = qw(version nick channel server hexchatdir 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 504f3c5c..fe99f37c 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(xchatdir xchatdirfs state_cursor), + qw(hexchatdir hexchatdirfs xchatdir xchatdirfs state_cursor), ); if( Xchat::set_context( $ctx ) ) { diff --git a/plugins/perl/lib/Xchat.pod b/plugins/perl/lib/Xchat.pod index 76618658..9f4b19b8 100644 --- a/plugins/perl/lib/Xchat.pod +++ b/plugins/perl/lib/Xchat.pod @@ -683,16 +683,16 @@ C<$id> - one of the following case sensitive values - xchatdir xchat config directory encoded in UTF-8
+ hexchatdir HexChat config directory encoded in UTF-8
examples:
- /home/user/.xchat2
- C:\Documents and Settings\user\Application Data\X-Chat 2 + /home/user/.config/hexchat
+ C:\Users\user\Appdata\Roaming\HexChat - xchatdirfs same as xchatdir except encoded in the locale file system encoding + hexchatdirfs same as hexchatdir except encoded in the locale file system encoding diff --git a/plugins/perl/lib/Xchat/Embed.pm b/plugins/perl/lib/Xchat/Embed.pm index f7dd70f1..d9d3e92a 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( "xchatdirfs" ) || Xchat::get_info( "xchatdir" ); + my @dirs = Xchat::get_info( "hexchatdirfs" ) || Xchat::get_info( "hexchatdir" ); 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 5755ede9..7ce1c435 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( "xchatdirfs" ) . "/servlist_.conf"; + my $server_file = Xchat::get_info( "hexchatdirfs" ) . "/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 5427c62f..0d3674b9 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -144,9 +144,7 @@ perl_auto_load (void *unused) #endif /* get the dir in local filesystem encoding (what opendir() expects!) */ - xdir = hexchat_get_info (ph, "xchatdirfs"); - if (!xdir) /* xchatdirfs is new for 2.0.9, will fail on older */ - xdir = hexchat_get_info (ph, "xchatdir"); + xdir = hexchat_get_info (ph, "hexchatdirfs"); /* don't pollute the filesystem with script files, this only causes misuse of the folders * only use ~/.config/hexchat/addons/ and %APPDATA%\HexChat\addons */ @@ -796,7 +794,7 @@ XS (XS_Xchat_get_info) if ( !strncmp ("libdirfs", SvPV_nolen (id), 8) || - !strncmp ("xchatdirfs", SvPV_nolen (id), 10) + !strncmp ("hexchatdirfs", SvPV_nolen (id), 10) ) { XSRETURN_PV (RETVAL); } else { diff --git a/plugins/python/python.c b/plugins/python/python.c index 84f2647a..97824b13 100644 --- a/plugins/python/python.c +++ b/plugins/python/python.c @@ -393,13 +393,13 @@ Util_Autoload() char *sub_dir; /* we need local filesystem encoding for chdir, opendir etc */ - xdir = hexchat_get_info(ph, "xchatdirfs"); + xdir = hexchat_get_info(ph, "hexchatdirfs"); /* 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, "xchatdirfs")); + Util_Autoload_from(hexchat_get_info(ph, "hexchatdirfs")); #endif /* auto-load from subdirectory addons */ @@ -449,7 +449,7 @@ Util_Expand(char *filename) g_free(expanded); /* Check if ~/.config/hexchat/addons/ exists. */ - expanded = g_build_filename(hexchat_get_info(ph, "xchatdir"), + expanded = g_build_filename(hexchat_get_info(ph, "hexchatdir"), "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 f0cc2429..2ef88132 100644 --- a/plugins/tcl/tclplugin.c +++ b/plugins/tcl/tclplugin.c @@ -92,7 +92,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 [xchatdir] \"/addons/*.tcl\"]]\n" + "set files [lsort [glob -nocomplain -directory [hexchatdir] \"/addons/*.tcl\"]]\n" "set init [lsearch -glob $files \"*/init.tcl\"]\n" "if { $init > 0 } {\n" "set initfile [lindex $files $init]\n" @@ -121,8 +121,8 @@ 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 ::xchatdir { args } { return [eval [join [list getinfo $args xchatdir]]] }\n" -"proc ::xchatdirfs { args } { return [eval [join [list getinfo $args xchatdirfs]]] }\n" +"proc ::hexchatdir { args } { return [eval [join [list getinfo $args hexchatdir]]] }\n" +"proc ::hexchatdirfs { args } { return [eval [join [list getinfo $args hexchatdirfs]]] }\n" "proc ::color { {arg {}} } { return \"\\003$arg\" }\n" "proc ::bold { } { return \"\\002\" }\n" @@ -2013,7 +2013,7 @@ static int Command_TCL(char *word[], char *word_eol[], void *userdata) static int Command_Source(char *word[], char *word_eol[], void *userdata) { - const char *xchatdir; + const char *hexchatdir; Tcl_DString ds; struct stat dummy; int len; @@ -2030,7 +2030,7 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata) if (len > 4 && strcasecmp(".tcl", word[2] + len - 4) == 0) { - xchatdir = hexchat_get_info(ph, "xchatdir"); + hexchatdir = hexchat_get_info(ph, "hexchatdir"); Tcl_DStringInit(&ds); @@ -2038,7 +2038,7 @@ static int Command_Source(char *word[], char *word_eol[], void *userdata) Tcl_DStringAppend(&ds, word_eol[2], strlen(word_eol[2])); } else { if (!strchr(word_eol[2], '/')) { - Tcl_DStringAppend(&ds, xchatdir, strlen(xchatdir)); + Tcl_DStringAppend(&ds, hexchatdir, strlen(hexchatdir)); Tcl_DStringAppend(&ds, "/addons/", 8); Tcl_DStringAppend(&ds, word_eol[2], strlen(word_eol[2])); } @@ -2083,7 +2083,7 @@ static int TCL_Event_Handler(void *userdata) static void Tcl_Plugin_Init() { int x; - const char *xchatdir; + const char *hexchatdir; interp = Tcl_CreateInterp(); @@ -2136,7 +2136,7 @@ static void Tcl_Plugin_Init() for (x = 0; x < XC_SIZE; x++) xc[x].hook = NULL; - xchatdir = hexchat_get_info(ph, "xchatdir"); + hexchatdir = hexchat_get_info(ph, "hexchatdir"); if (Tcl_Eval(interp, unknown) == TCL_ERROR) { hexchat_printf(ph, "Error sourcing internal 'unknown' (%s)\n", Tcl_GetStringResult(interp)); diff --git a/plugins/xdcc/Makefile.am b/plugins/xdcc/Makefile.am index 24f93f16..9e0cf713 100644 --- a/plugins/xdcc/Makefile.am +++ b/plugins/xdcc/Makefile.am @@ -1,4 +1,4 @@ -libdir = $(xchatdir)/plugins +libdir = $(hexchatdir)/plugins lib_LTLIBRARIES = xdcc.la xdcc_la_SOURCES = xdcc.c diff --git a/plugins/xdcc/xdcc.c b/plugins/xdcc/xdcc.c index ffe7dfd3..7a9fa16e 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, "xchatdir")); + snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "hexchatdir")); 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, "xchatdir")); + snprintf(buf, sizeof(buf), "%s/xdcclist.conf", hexchat_get_info(ph, "hexchatdir")); fp = fopen(buf, "r"); if(!fp) -- cgit 1.4.1