mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
Use configdir instead of *xchatdir*
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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 ) ) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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" );
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user