mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Updated the Python scripting shim to expose EAT_HEXCHAT as an alias of EAT_ZOITECHAT, so scripts written for HexChat constants work without changes.
Added a Python hexchat.py compatibility module and ensured it is installed alongside zoitechat.py/xchat.py, enabling import hexchat scripts to run. Updated the Perl API layer to support HexChat naming by aliasing HexChat:: to ZoiteChat::, adding EAT_HEXCHAT to exported constants, and adding an explicit Perl shim module HexChat.pm. Extended Perl XS constant registration to export EAT_HEXCHAT as a compatibility alias, and wired HexChat.pm into the embedded Perl module generation list so it ships with the plugin.
This commit is contained in:
1
plugins/perl/lib/HexChat.pm
Normal file
1
plugins/perl/lib/HexChat.pm
Normal file
@@ -0,0 +1 @@
|
||||
require ZoiteChat;
|
||||
@@ -53,14 +53,16 @@ sub ZoiteChat::Internal::print;
|
||||
|
||||
#keep compatibility with Xchat scripts
|
||||
sub EAT_XCHAT ();
|
||||
sub EAT_HEXCHAT ();
|
||||
BEGIN {
|
||||
*Xchat:: = *ZoiteChat::;
|
||||
*HexChat:: = *ZoiteChat::;
|
||||
}
|
||||
|
||||
our %EXPORT_TAGS = (
|
||||
constants => [
|
||||
qw(PRI_HIGHEST PRI_HIGH PRI_NORM PRI_LOW PRI_LOWEST), # priorities
|
||||
qw(EAT_NONE EAT_ZOITECHAT EAT_XCHAT EAT_PLUGIN EAT_ALL), # callback return values
|
||||
qw(EAT_NONE EAT_ZOITECHAT EAT_XCHAT EAT_HEXCHAT EAT_PLUGIN EAT_ALL), # callback return values
|
||||
qw(FD_READ FD_WRITE FD_EXCEPTION FD_NOTSOCKET), # fd flags
|
||||
qw(KEEP REMOVE), # timers
|
||||
],
|
||||
|
||||
@@ -4,6 +4,7 @@ zoitechat_perl_module = custom_target('zoitechat-perl-header',
|
||||
input: [
|
||||
'lib/ZoiteChat.pm',
|
||||
'lib/Xchat.pm',
|
||||
'lib/HexChat.pm',
|
||||
'lib/ZoiteChat/Embed.pm',
|
||||
'lib/ZoiteChat/List/Network.pm',
|
||||
'lib/ZoiteChat/List/Network/Entry.pm',
|
||||
|
||||
@@ -1365,6 +1365,7 @@ xs_init (pTHX)
|
||||
newCONSTSUB (stash, "EAT_NONE", newSViv (ZOITECHAT_EAT_NONE));
|
||||
newCONSTSUB (stash, "EAT_ZOITECHAT", newSViv (ZOITECHAT_EAT_ZOITECHAT));
|
||||
newCONSTSUB (stash, "EAT_XCHAT", newSViv (ZOITECHAT_EAT_ZOITECHAT)); /* for compatibility */
|
||||
newCONSTSUB (stash, "EAT_HEXCHAT", newSViv (ZOITECHAT_EAT_ZOITECHAT)); /* for compatibility */
|
||||
newCONSTSUB (stash, "EAT_PLUGIN", newSViv (ZOITECHAT_EAT_PLUGIN));
|
||||
newCONSTSUB (stash, "EAT_ALL", newSViv (ZOITECHAT_EAT_ALL));
|
||||
newCONSTSUB (stash, "FD_READ", newSViv (ZOITECHAT_FD_READ));
|
||||
|
||||
@@ -5,7 +5,7 @@ from contextlib import contextmanager
|
||||
from _zoitechat_embedded import ffi, lib
|
||||
|
||||
__all__ = [
|
||||
'EAT_ALL', 'EAT_ZOITECHAT', 'EAT_NONE', 'EAT_PLUGIN', 'EAT_XCHAT',
|
||||
'EAT_ALL', 'EAT_ZOITECHAT', 'EAT_NONE', 'EAT_PLUGIN', 'EAT_XCHAT', 'EAT_HEXCHAT',
|
||||
'PRI_HIGH', 'PRI_HIGHEST', 'PRI_LOW', 'PRI_LOWEST', 'PRI_NORM',
|
||||
'__doc__', '__version__', 'command', 'del_pluginpref', 'emit_print',
|
||||
'find_context', 'get_context', 'get_info',
|
||||
@@ -22,6 +22,7 @@ __license__ = 'GPL-2.0+'
|
||||
EAT_NONE = 0
|
||||
EAT_ZOITECHAT = 1
|
||||
EAT_XCHAT = EAT_ZOITECHAT
|
||||
EAT_HEXCHAT = EAT_ZOITECHAT
|
||||
EAT_PLUGIN = 2
|
||||
EAT_ALL = EAT_ZOITECHAT | EAT_PLUGIN
|
||||
|
||||
|
||||
1
plugins/python/hexchat.py
Normal file
1
plugins/python/hexchat.py
Normal file
@@ -0,0 +1 @@
|
||||
from _zoitechat import *
|
||||
@@ -19,7 +19,7 @@ python3_source = custom_target('python-bindings',
|
||||
command: [find_program('generate_plugin.py'), '@INPUT@', '@OUTPUT@']
|
||||
)
|
||||
|
||||
install_data(['_zoitechat.py', 'zoitechat.py', 'xchat.py'],
|
||||
install_data(['_zoitechat.py', 'zoitechat.py', 'xchat.py', 'hexchat.py'],
|
||||
install_dir: join_paths(get_option('libdir'), 'zoitechat/python')
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user