Merge pull request #40 from ZoiteChat/master

sync with master.
This commit is contained in:
deepend-tildeclub
2026-01-25 16:09:41 -07:00
committed by GitHub
2 changed files with 1337 additions and 1283 deletions

View File

@@ -1370,15 +1370,28 @@ static script_info *create_script(char const *file)
static script_info *get_script_by_file(char const *filename) static script_info *get_script_by_file(char const *filename)
{ {
char const *expanded = expand_path(filename);
guint i; guint i;
for(i = 0; i < scripts->len; i++) for(i = 0; i < scripts->len; i++)
{ {
script_info *script = scripts->pdata[i]; script_info *script = scripts->pdata[i];
if(!strcmp(script->filename, expanded)) if(!strcmp(script->filename, filename))
{ {
return script; return script;
} }
if(g_path_is_absolute(filename) || strchr(filename, '/'))
{
char const *expanded = expand_path(filename);
if(!strcmp(script->filename, expanded))
return script;
}
else
{
char *basename = g_path_get_basename(script->filename);
gboolean match = !strcmp(basename, filename);
g_free(basename);
if(match)
return script;
}
} }
return NULL; return NULL;
@@ -1395,11 +1408,13 @@ static int load_script(char const *file)
} }
info = create_script(file); info = create_script(file);
if (info) if (!info)
{ {
return 0;
}
g_ptr_array_add(scripts, info); g_ptr_array_add(scripts, info);
check_deferred(info); check_deferred(info);
}
return 1; return 1;
} }
@@ -1629,11 +1644,24 @@ static int command_lua(char *word[], char *word_eol[], void *userdata)
{ {
if(!strcmp(word[2], "load")) if(!strcmp(word[2], "load"))
{ {
load_script(word[3]); if(load_script(word[3]))
zoitechat_printf(ph, "Loaded Lua script '%s'", word[3]);
else
zoitechat_printf(ph, "Failed to load Lua script '%s'", word[3]);
} }
else if(!strcmp(word[2], "unload")) else if(!strcmp(word[2], "unload"))
{ {
if(!unload_script(word[3])) script_info *script = get_script_by_file(word[3]);
if(script)
{
gboolean deferred = script->status & STATUS_ACTIVE;
unload_script(word[3]);
if(deferred)
zoitechat_printf(ph, "Unload scheduled for Lua script '%s'", word[3]);
else
zoitechat_printf(ph, "Unloaded Lua script '%s'", word[3]);
}
else
zoitechat_printf(ph, "Could not find a script by the name '%s'", word[3]); zoitechat_printf(ph, "Could not find a script by the name '%s'", word[3]);
} }
else if(!strcmp(word[2], "reload")) else if(!strcmp(word[2], "reload"))
@@ -1689,7 +1717,7 @@ static int command_lua(char *word[], char *word_eol[], void *userdata)
g_free(basename); g_free(basename);
} }
if(interp) if(interp)
zoitechat_printf(ph, "%-16s %-8s", interp->name, plugin_version); zoitechat_printf(ph, "%-16s %-8s %-20s %-10s", interp->name, plugin_version, "", "");
} }
else if(!strcmp(word[2], "console")) else if(!strcmp(word[2], "console"))
{ {

View File

@@ -1,4 +1,5 @@
# ZoiteChat <div align="center">
<img src="data/icons/zoitechat.svg" height="230">
[![Debian Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/debian-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/debian-build.yml) [![Debian Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/debian-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/debian-build.yml)
[![Flatpak Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/flatpak-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/flatpak-build.yml) [![Flatpak Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/flatpak-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/flatpak-build.yml)
@@ -7,6 +8,31 @@
[![MSYS2 Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/msys-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/msys-build.yml) [![MSYS2 Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/msys-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/msys-build.yml)
[![OpenBSD Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/openbsd-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/openbsd-build.yml) [![OpenBSD Build](https://github.com/ZoiteChat/zoitechat/actions/workflows/openbsd-build.yml/badge.svg)](https://github.com/ZoiteChat/zoitechat/actions/workflows/openbsd-build.yml)
[![Version][github-version-img]][github-version-uri] [![Downloads][github-downloads-img]][github-downloads-uri] [![Size][github-size-img]][github-size-img] [![Last Commit][github-commit-img]][github-commit-img] [![Contributors][contribs-all-img]](#contributors-)
[![View Official Documentation](https://img.shields.io/badge/View_Official_Documentation-526CFE?style=for-the-badge&logo=MaterialForMkDocs&logoColor=white)](https://zoitechat.zoite.net/docs/)
</div>
<!-- Badge reference definitions -->
[github-version-img]: https://img.shields.io/github/v/release/ZoiteChat/zoitechat?display_name=tag&sort=semver
[github-version-uri]: https://github.com/ZoiteChat/zoitechat/releases/latest
[github-downloads-img]: https://img.shields.io/github/downloads/ZoiteChat/zoitechat/total
[github-downloads-uri]: https://github.com/ZoiteChat/zoitechat/releases
[github-size-img]: https://img.shields.io/github/repo-size/ZoiteChat/zoitechat
[github-size-uri]: https://github.com/ZoiteChat/zoitechat
[github-commit-img]: https://img.shields.io/github/last-commit/ZoiteChat/zoitechat
[github-commit-uri]: https://github.com/ZoiteChat/zoitechat/commits
[contribs-all-img]: https://img.shields.io/github/contributors/ZoiteChat/zoitechat
<br />
<br />
ZoiteChat is an HexChat based IRC client for Windows and UNIX-like operating systems. ZoiteChat is an HexChat based IRC client for Windows and UNIX-like operating systems.
See [IRCHelp.org](http://irchelp.org) for information about IRC in general. See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
For more information on ZoiteChat please read our [documentation](https://zoitechat.zoite.net/docs/): For more information on ZoiteChat please read our [documentation](https://zoitechat.zoite.net/docs/):