mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
new name after fork
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
* Copyright (c) 2010-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static zoitechat_plugin *ph; /* plugin handle */
|
||||
static char name[] = "Checksum";
|
||||
static char desc[] = "Calculate checksum for DCC file transfers";
|
||||
static char version[] = "4.0";
|
||||
@@ -43,7 +43,7 @@ static void
|
||||
print_sha256_result (ChecksumCallbackInfo *info, const char *checksum, const char *filename, GError *error)
|
||||
{
|
||||
// So then we get the next best available channel, since we always want to print at least somewhere, it's fine
|
||||
hexchat_context *ctx = hexchat_find_context(ph, info->servername, info->channel);
|
||||
zoitechat_context *ctx = zoitechat_find_context(ph, info->servername, info->channel);
|
||||
if (!ctx) {
|
||||
// before we print a private message to the wrong channel, we exit early
|
||||
if (info->send_message) {
|
||||
@@ -51,21 +51,21 @@ print_sha256_result (ChecksumCallbackInfo *info, const char *checksum, const cha
|
||||
}
|
||||
|
||||
// if the context isn't found the first time, we search in the server
|
||||
ctx = hexchat_find_context(ph, info->servername, NULL);
|
||||
ctx = zoitechat_find_context(ph, info->servername, NULL);
|
||||
if (!ctx) {
|
||||
// The second time we exit early, since printing in another server isn't desireable
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hexchat_set_context(ph, ctx);
|
||||
zoitechat_set_context(ph, ctx);
|
||||
|
||||
if (error) {
|
||||
hexchat_printf (ph, "Failed to create checksum for %s: %s\n", filename, error->message);
|
||||
zoitechat_printf (ph, "Failed to create checksum for %s: %s\n", filename, error->message);
|
||||
} else if (info->send_message) {
|
||||
hexchat_commandf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): %s", hexchat_get_info (ph, "channel"), filename, checksum);
|
||||
zoitechat_commandf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): %s", zoitechat_get_info (ph, "channel"), filename, checksum);
|
||||
} else {
|
||||
hexchat_printf (ph, "SHA-256 checksum for %s (local): %s\n", filename, checksum);
|
||||
zoitechat_printf (ph, "SHA-256 checksum for %s (local): %s\n", filename, checksum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,21 +126,21 @@ dccrecv_cb (char *word[], void *userdata)
|
||||
const char *dcc_completed_dir;
|
||||
char *filename;
|
||||
|
||||
if (hexchat_get_prefs (ph, "dcc_completed_dir", &dcc_completed_dir, NULL) == 1 && dcc_completed_dir[0] != '\0')
|
||||
if (zoitechat_get_prefs (ph, "dcc_completed_dir", &dcc_completed_dir, NULL) == 1 && dcc_completed_dir[0] != '\0')
|
||||
filename = g_build_filename (dcc_completed_dir, word[1], NULL);
|
||||
else
|
||||
filename = g_strdup (word[2]);
|
||||
|
||||
filename_fs = g_filename_from_utf8 (filename, -1, NULL, NULL, NULL);
|
||||
if (!filename_fs) {
|
||||
hexchat_printf (ph, "Checksum: Invalid filename (%s)\n", filename);
|
||||
zoitechat_printf (ph, "Checksum: Invalid filename (%s)\n", filename);
|
||||
g_free (filename);
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
|
||||
ChecksumCallbackInfo *callback_data = g_new (ChecksumCallbackInfo, 1);
|
||||
callback_data->servername = g_strdup(hexchat_get_info(ph, "server"));
|
||||
callback_data->channel = g_strdup(hexchat_get_info(ph, "channel"));
|
||||
callback_data->servername = g_strdup(zoitechat_get_info(ph, "server"));
|
||||
callback_data->channel = g_strdup(zoitechat_get_info(ph, "channel"));
|
||||
callback_data->send_message = FALSE;
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ dccoffer_cb (char *word[], void *userdata)
|
||||
char *filename;
|
||||
|
||||
ChecksumCallbackInfo *callback_data = g_new (ChecksumCallbackInfo, 1);
|
||||
callback_data->servername = g_strdup(hexchat_get_info(ph, "server"));
|
||||
callback_data->channel = g_strdup(hexchat_get_info(ph, "channel"));
|
||||
callback_data->servername = g_strdup(zoitechat_get_info(ph, "server"));
|
||||
callback_data->channel = g_strdup(zoitechat_get_info(ph, "channel"));
|
||||
callback_data->send_message = TRUE;
|
||||
|
||||
filename = g_strdup (word[3]);
|
||||
@@ -181,7 +181,7 @@ dccoffer_cb (char *word[], void *userdata)
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
|
||||
@@ -189,16 +189,16 @@ hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **p
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
hexchat_hook_print (ph, "DCC RECV Complete", HEXCHAT_PRI_NORM, dccrecv_cb, NULL);
|
||||
hexchat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_NORM, dccoffer_cb, NULL);
|
||||
zoitechat_hook_print (ph, "DCC RECV Complete", HEXCHAT_PRI_NORM, dccrecv_cb, NULL);
|
||||
zoitechat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_NORM, dccoffer_cb, NULL);
|
||||
|
||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
zoitechat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_printf (ph, "%s plugin unloaded\n", name);
|
||||
zoitechat_printf (ph, "%s plugin unloaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcchecksum</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>checksum.def</ModuleDefinitionFile>
|
||||
@@ -41,7 +41,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;CHECKSUM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>checksum.def</ModuleDefinitionFile>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
shared_module('checksum', 'checksum.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep],
|
||||
dependencies: [libgio_dep, zoitechat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
* Copyright (c) 2011-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -23,11 +23,11 @@
|
||||
#include <windows.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static zoitechat_plugin *ph; /* plugin handle */
|
||||
static char name[] = "Exec";
|
||||
static char desc[] = "Execute commands inside HexChat";
|
||||
static char desc[] = "Execute commands inside ZoiteChat";
|
||||
static char version[] = "1.2";
|
||||
|
||||
static int
|
||||
@@ -100,12 +100,12 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
||||
token = strtok_s (buffer, "\n", &context);
|
||||
while (token != NULL)
|
||||
{
|
||||
hexchat_commandf (ph, "SAY %s", token);
|
||||
zoitechat_commandf (ph, "SAY %s", token);
|
||||
token = strtok_s (NULL, "\n", &context);
|
||||
}
|
||||
}
|
||||
else
|
||||
hexchat_printf (ph, "%s", buffer);
|
||||
zoitechat_printf (ph, "%s", buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -118,11 +118,11 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
||||
|
||||
/* display a newline to separate things */
|
||||
if (!announce)
|
||||
hexchat_printf (ph, "\n");
|
||||
zoitechat_printf (ph, "\n");
|
||||
|
||||
if (timeElapsed >= 10)
|
||||
{
|
||||
hexchat_printf (ph, "Command took too much time to run, execution aborted.\n");
|
||||
zoitechat_printf (ph, "Command took too much time to run, execution aborted.\n");
|
||||
}
|
||||
|
||||
CloseHandle (readPipe);
|
||||
@@ -131,14 +131,14 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_command (ph, "help exec");
|
||||
zoitechat_command (ph, "help exec");
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
|
||||
@@ -146,15 +146,15 @@ hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **p
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
hexchat_hook_command (ph, "EXEC", HEXCHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside HexChat", 0);
|
||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||
zoitechat_hook_command (ph, "EXEC", HEXCHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside ZoiteChat", 0);
|
||||
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
zoitechat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_printf (ph, "%s plugin unloaded\n", name);
|
||||
zoitechat_printf (ph, "%s plugin unloaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcexec</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
shared_module('exec', 'exec.c',
|
||||
dependencies: hexchat_plugin_dep,
|
||||
dependencies: zoitechat_plugin_dep,
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
vs_module_defs: 'exec.def',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
hexchat_plugin_get_info
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
zoitechat_plugin_get_info
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcfishlim</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;HAVE_DH_SET0_PQG;HAVE_DH_GET0_KEY;HAVE_DH_SET0_KEY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>fishlim.def</ModuleDefinitionFile>
|
||||
@@ -41,7 +41,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;HAVE_DH_SET0_PQG;HAVE_DH_GET0_KEY;HAVE_DH_SET0_KEY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>fishlim.def</ModuleDefinitionFile>
|
||||
@@ -58,7 +58,7 @@
|
||||
<ClInclude Include="utils.h" />
|
||||
<ClInclude Include="irc.h" />
|
||||
<ClInclude Include="keystore.h" />
|
||||
<ClInclude Include="plugin_hexchat.h" />
|
||||
<ClInclude Include="plugin_zoitechat.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dh1080.c" />
|
||||
@@ -66,7 +66,7 @@
|
||||
<ClCompile Include="utils.c" />
|
||||
<ClCompile Include="irc.c" />
|
||||
<ClCompile Include="keystore.c" />
|
||||
<ClCompile Include="plugin_hexchat.c" />
|
||||
<ClCompile Include="plugin_zoitechat.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<ClInclude Include="keystore.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="plugin_hexchat.h">
|
||||
<ClInclude Include="plugin_zoitechat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
@@ -58,7 +58,7 @@
|
||||
<ClCompile Include="keystore.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="plugin_hexchat.c">
|
||||
<ClCompile Include="plugin_zoitechat.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
#include "irc.h"
|
||||
#include "fish.h"
|
||||
#include "keystore.h"
|
||||
#include "plugin_hexchat.h"
|
||||
#include "plugin_zoitechat.h"
|
||||
|
||||
|
||||
static char *keystore_password = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Opens the key store file: ~/.config/hexchat/addon_fishlim.conf
|
||||
* Opens the key store file: ~/.config/zoitechat/addon_fishlim.conf
|
||||
*/
|
||||
static GKeyFile *getConfigFile(void) {
|
||||
gchar *filename = get_config_filename();
|
||||
|
||||
@@ -11,11 +11,11 @@ fishlim_sources = [
|
||||
'utils.c',
|
||||
'irc.c',
|
||||
'keystore.c',
|
||||
'plugin_hexchat.c'
|
||||
'plugin_zoitechat.c'
|
||||
]
|
||||
|
||||
shared_module('fishlim', fishlim_sources,
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, libssl_dep],
|
||||
dependencies: [libgio_dep, zoitechat_plugin_dep, libssl_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
#include "fish.h"
|
||||
#include "dh1080.h"
|
||||
@@ -50,7 +50,7 @@ static const char usage_notice[] = "Usage: NOTICE+ <nick or #channel> <notice>";
|
||||
static const char usage_msg[] = "Usage: MSG+ <nick or #channel> <message>";
|
||||
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static zoitechat_plugin *ph;
|
||||
static GHashTable *pending_exchanges;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ static GHashTable *pending_exchanges;
|
||||
* Compare two nicks using the current plugin
|
||||
*/
|
||||
int irc_nick_cmp(const char *a, const char *b) {
|
||||
return hexchat_nickcmp (ph, a, b);
|
||||
return zoitechat_nickcmp (ph, a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ int irc_nick_cmp(const char *a, const char *b) {
|
||||
gchar *get_config_filename(void) {
|
||||
char *filename_fs, *filename_utf8;
|
||||
|
||||
filename_utf8 = g_build_filename(hexchat_get_info(ph, "configdir"), "addon_fishlim.conf", NULL);
|
||||
filename_utf8 = g_build_filename(zoitechat_get_info(ph, "configdir"), "addon_fishlim.conf", NULL);
|
||||
filename_fs = g_filename_from_utf8 (filename_utf8, -1, NULL, NULL, NULL);
|
||||
|
||||
g_free (filename_utf8);
|
||||
@@ -75,34 +75,34 @@ gchar *get_config_filename(void) {
|
||||
}
|
||||
|
||||
static inline gboolean irc_is_query (const char *name) {
|
||||
const char *chantypes = hexchat_list_str (ph, NULL, "chantypes");
|
||||
const char *chantypes = zoitechat_list_str (ph, NULL, "chantypes");
|
||||
|
||||
return strchr (chantypes, name[0]) == NULL;
|
||||
}
|
||||
|
||||
static hexchat_context *find_context_on_network (const char *name) {
|
||||
hexchat_list *channels;
|
||||
hexchat_context *ret = NULL;
|
||||
static zoitechat_context *find_context_on_network (const char *name) {
|
||||
zoitechat_list *channels;
|
||||
zoitechat_context *ret = NULL;
|
||||
int id;
|
||||
|
||||
if (hexchat_get_prefs(ph, "id", NULL, &id) != 2)
|
||||
if (zoitechat_get_prefs(ph, "id", NULL, &id) != 2)
|
||||
return NULL;
|
||||
|
||||
channels = hexchat_list_get(ph, "channels");
|
||||
channels = zoitechat_list_get(ph, "channels");
|
||||
if (!channels)
|
||||
return NULL;
|
||||
|
||||
while (hexchat_list_next(ph, channels)) {
|
||||
int chan_id = hexchat_list_int(ph, channels, "id");
|
||||
const char *chan_name = hexchat_list_str(ph, channels, "channel");
|
||||
while (zoitechat_list_next(ph, channels)) {
|
||||
int chan_id = zoitechat_list_int(ph, channels, "id");
|
||||
const char *chan_name = zoitechat_list_str(ph, channels, "channel");
|
||||
|
||||
if (chan_id == id && chan_name && irc_nick_cmp (chan_name, name) == 0) {
|
||||
ret = (hexchat_context*)hexchat_list_str(ph, channels, "context");
|
||||
ret = (zoitechat_context*)zoitechat_list_str(ph, channels, "context");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
hexchat_list_free(ph, channels);
|
||||
zoitechat_list_free(ph, channels);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -113,23 +113,23 @@ static hexchat_context *find_context_on_network (const char *name) {
|
||||
char *get_my_info(const char *field, gboolean find_in_other_context) {
|
||||
char *result = NULL;
|
||||
const char *own_nick;
|
||||
hexchat_list *list;
|
||||
hexchat_context *ctx_current, *ctx_channel;
|
||||
zoitechat_list *list;
|
||||
zoitechat_context *ctx_current, *ctx_channel;
|
||||
|
||||
/* Display message */
|
||||
own_nick = hexchat_get_info(ph, "nick");
|
||||
own_nick = zoitechat_get_info(ph, "nick");
|
||||
|
||||
if (!own_nick)
|
||||
return NULL;
|
||||
|
||||
/* Get field for own nick if any */
|
||||
list = hexchat_list_get(ph, "users");
|
||||
list = zoitechat_list_get(ph, "users");
|
||||
if (list) {
|
||||
while (hexchat_list_next(ph, list)) {
|
||||
if (irc_nick_cmp(own_nick, hexchat_list_str(ph, list, "nick")) == 0)
|
||||
result = g_strdup(hexchat_list_str(ph, list, field));
|
||||
while (zoitechat_list_next(ph, list)) {
|
||||
if (irc_nick_cmp(own_nick, zoitechat_list_str(ph, list, "nick")) == 0)
|
||||
result = g_strdup(zoitechat_list_str(ph, list, field));
|
||||
}
|
||||
hexchat_list_free(ph, list);
|
||||
zoitechat_list_free(ph, list);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
@@ -141,21 +141,21 @@ char *get_my_info(const char *field, gboolean find_in_other_context) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
list = hexchat_list_get(ph, "channels");
|
||||
list = zoitechat_list_get(ph, "channels");
|
||||
if (list) {
|
||||
ctx_current = hexchat_get_context(ph);
|
||||
while (hexchat_list_next(ph, list)) {
|
||||
ctx_channel = (hexchat_context *) hexchat_list_str(ph, list, "context");
|
||||
ctx_current = zoitechat_get_context(ph);
|
||||
while (zoitechat_list_next(ph, list)) {
|
||||
ctx_channel = (zoitechat_context *) zoitechat_list_str(ph, list, "context");
|
||||
|
||||
hexchat_set_context(ph, ctx_channel);
|
||||
zoitechat_set_context(ph, ctx_channel);
|
||||
result = get_my_info(field, FALSE);
|
||||
hexchat_set_context(ph, ctx_current);
|
||||
zoitechat_set_context(ph, ctx_current);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
hexchat_list_free(ph, list);
|
||||
zoitechat_list_free(ph, list);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -187,7 +187,7 @@ int get_prefix_length(void) {
|
||||
int prefix_len = 0;
|
||||
|
||||
/* ':! ' + 'nick' + 'ident@host', e.g. ':user!~name@mynet.com ' */
|
||||
prefix_len = 3 + strlen(hexchat_get_info(ph, "nick"));
|
||||
prefix_len = 3 + strlen(zoitechat_get_info(ph, "nick"));
|
||||
own_host = get_my_own_host();
|
||||
if (own_host) {
|
||||
prefix_len += strlen(own_host);
|
||||
@@ -278,11 +278,11 @@ char *decrypt_raw_message(const char *message, const char *key) {
|
||||
}
|
||||
|
||||
/*static int handle_debug(char *word[], char *word_eol[], void *userdata) {
|
||||
hexchat_printf(ph, "debug incoming: ");
|
||||
zoitechat_printf(ph, "debug incoming: ");
|
||||
for (size_t i = 1; word[i] != NULL && word[i][0] != '\0'; i++) {
|
||||
hexchat_printf(ph, ">%s< ", word[i]);
|
||||
zoitechat_printf(ph, ">%s< ", word[i]);
|
||||
}
|
||||
hexchat_printf(ph, "\n");
|
||||
zoitechat_printf(ph, "\n");
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}*/
|
||||
|
||||
@@ -296,7 +296,7 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
|
||||
GString *command;
|
||||
GSList *encrypted_list, *encrypted_item;
|
||||
|
||||
const char *channel = hexchat_get_info(ph, "channel");
|
||||
const char *channel = zoitechat_get_info(ph, "channel");
|
||||
|
||||
/* Check if we can encrypt */
|
||||
if (!fish_nick_has_key(channel)) return HEXCHAT_EAT_NONE;
|
||||
@@ -317,14 +317,14 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
|
||||
message = g_strconcat("[", fish_modes[mode], "] ", word_eol[1], NULL);
|
||||
|
||||
/* Display message */
|
||||
hexchat_emit_print(ph, "Your Message", hexchat_get_info(ph, "nick"), message, prefix, NULL);
|
||||
zoitechat_emit_print(ph, "Your Message", zoitechat_get_info(ph, "nick"), message, prefix, NULL);
|
||||
g_free(message);
|
||||
|
||||
/* Send encrypted messages */
|
||||
encrypted_item = encrypted_list;
|
||||
while (encrypted_item)
|
||||
{
|
||||
hexchat_commandf(ph, "%s%s", command->str, (char *)encrypted_item->data);
|
||||
zoitechat_commandf(ph, "%s%s", command->str, (char *)encrypted_item->data);
|
||||
|
||||
encrypted_item = encrypted_item->next;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
|
||||
/**
|
||||
* Called when a channel message or private message is received.
|
||||
*/
|
||||
static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *attrs, void *userdata) {
|
||||
static int handle_incoming(char *word[], char *word_eol[], zoitechat_event_attrs *attrs, void *userdata) {
|
||||
const char *prefix;
|
||||
const char *command;
|
||||
const char *recipient;
|
||||
@@ -392,7 +392,7 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
|
||||
/* Fake server message
|
||||
* RECV command will throw this function again, if message have multiple
|
||||
* encrypted data, we will decrypt all */
|
||||
hexchat_command(ph, message->str);
|
||||
zoitechat_command(ph, message->str);
|
||||
g_string_free (message, TRUE);
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
@@ -401,7 +401,7 @@ static int handle_incoming(char *word[], char *word_eol[], hexchat_event_attrs *
|
||||
static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
const char *dh_message = word[4];
|
||||
const char *dh_pubkey = word[5];
|
||||
hexchat_context *query_ctx;
|
||||
zoitechat_context *query_ctx;
|
||||
const char *prefix;
|
||||
char *sender, *secret_key, *priv_key = NULL;
|
||||
enum fish_mode mode = FISH_ECB_MODE;
|
||||
@@ -415,7 +415,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
sender = irc_prefix_get_nick(prefix);
|
||||
query_ctx = find_context_on_network(sender);
|
||||
if (query_ctx)
|
||||
g_assert(hexchat_set_context(ph, query_ctx) == 1);
|
||||
g_assert(zoitechat_set_context(ph, query_ctx) == 1);
|
||||
|
||||
dh_message++; /* : prefix */
|
||||
|
||||
@@ -425,12 +425,12 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
if (!strcmp(dh_message, "DH1080_INIT")) {
|
||||
char *pub_key;
|
||||
|
||||
hexchat_printf(ph, "Received public key from %s (%s), sending mine...", sender, fish_modes[mode]);
|
||||
zoitechat_printf(ph, "Received public key from %s (%s), sending mine...", sender, fish_modes[mode]);
|
||||
if (dh1080_generate_key(&priv_key, &pub_key)) {
|
||||
hexchat_commandf(ph, "quote NOTICE %s :DH1080_FINISH %s%s", sender, pub_key, (mode == FISH_CBC_MODE) ? " CBC" : "");
|
||||
zoitechat_commandf(ph, "quote NOTICE %s :DH1080_FINISH %s%s", sender, pub_key, (mode == FISH_CBC_MODE) ? " CBC" : "");
|
||||
g_free(pub_key);
|
||||
} else {
|
||||
hexchat_print(ph, "Failed to generate keys");
|
||||
zoitechat_print(ph, "Failed to generate keys");
|
||||
goto cleanup;
|
||||
}
|
||||
} else if (!strcmp (dh_message, "DH1080_FINISH")) {
|
||||
@@ -441,7 +441,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
g_free(sender_lower);
|
||||
|
||||
if (!priv_key) {
|
||||
hexchat_printf(ph, "Received a key exchange response for unknown user: %s", sender);
|
||||
zoitechat_printf(ph, "Received a key exchange response for unknown user: %s", sender);
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
@@ -452,10 +452,10 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
|
||||
if (dh1080_compute_key(priv_key, dh_pubkey, &secret_key)) {
|
||||
keystore_store_key(sender, secret_key, mode);
|
||||
hexchat_printf(ph, "Stored new key for %s (%s)", sender, fish_modes[mode]);
|
||||
zoitechat_printf(ph, "Stored new key for %s (%s)", sender, fish_modes[mode]);
|
||||
g_free(secret_key);
|
||||
} else {
|
||||
hexchat_print(ph, "Failed to create secret key!");
|
||||
zoitechat_print(ph, "Failed to create secret key!");
|
||||
}
|
||||
|
||||
cleanup:
|
||||
@@ -474,13 +474,13 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
|
||||
|
||||
/* Check syntax */
|
||||
if (*word[2] == '\0') {
|
||||
hexchat_printf(ph, "%s\n", usage_setkey);
|
||||
zoitechat_printf(ph, "%s\n", usage_setkey);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
|
||||
if (*word[3] == '\0') {
|
||||
/* /setkey password */
|
||||
nick = hexchat_get_info(ph, "channel");
|
||||
nick = zoitechat_get_info(ph, "channel");
|
||||
key = word_eol[2];
|
||||
} else {
|
||||
/* /setkey #channel password */
|
||||
@@ -498,9 +498,9 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
|
||||
|
||||
/* Set password */
|
||||
if (keystore_store_key(nick, key, mode)) {
|
||||
hexchat_printf(ph, "Stored key for %s (%s)\n", nick, fish_modes[mode]);
|
||||
zoitechat_printf(ph, "Stored key for %s (%s)\n", nick, fish_modes[mode]);
|
||||
} else {
|
||||
hexchat_printf(ph, "\00305Failed to store key in addon_fishlim.conf\n");
|
||||
zoitechat_printf(ph, "\00305Failed to store key in addon_fishlim.conf\n");
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
@@ -517,21 +517,21 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
|
||||
if (*word[2] != '\0') {
|
||||
nick = g_strstrip(g_strdup(word_eol[2]));
|
||||
} else { /* Delete key from current context */
|
||||
nick = g_strdup(hexchat_get_info(ph, "channel"));
|
||||
ctx_type = hexchat_list_int(ph, NULL, "type");
|
||||
nick = g_strdup(zoitechat_get_info(ph, "channel"));
|
||||
ctx_type = zoitechat_list_int(ph, NULL, "type");
|
||||
|
||||
/* Only allow channel or dialog */
|
||||
if (ctx_type < 2 || ctx_type > 3) {
|
||||
hexchat_printf(ph, "%s\n", usage_delkey);
|
||||
zoitechat_printf(ph, "%s\n", usage_delkey);
|
||||
return HEXCHAT_EAT_HEXCHAT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete the given nick from the key store */
|
||||
if (keystore_delete_nick(nick)) {
|
||||
hexchat_printf(ph, "Deleted key for %s\n", nick);
|
||||
zoitechat_printf(ph, "Deleted key for %s\n", nick);
|
||||
} else {
|
||||
hexchat_printf(ph, "\00305Failed to delete key in addon_fishlim.conf!\n");
|
||||
zoitechat_printf(ph, "\00305Failed to delete key in addon_fishlim.conf!\n");
|
||||
}
|
||||
g_free(nick);
|
||||
|
||||
@@ -540,36 +540,36 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
|
||||
|
||||
static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
|
||||
const char *target = word[2];
|
||||
hexchat_context *query_ctx = NULL;
|
||||
zoitechat_context *query_ctx = NULL;
|
||||
char *pub_key, *priv_key;
|
||||
int ctx_type;
|
||||
|
||||
if (*target)
|
||||
query_ctx = find_context_on_network(target);
|
||||
else {
|
||||
target = hexchat_get_info(ph, "channel");
|
||||
query_ctx = hexchat_get_context (ph);
|
||||
target = zoitechat_get_info(ph, "channel");
|
||||
query_ctx = zoitechat_get_context (ph);
|
||||
}
|
||||
|
||||
if (query_ctx) {
|
||||
g_assert(hexchat_set_context(ph, query_ctx) == 1);
|
||||
ctx_type = hexchat_list_int(ph, NULL, "type");
|
||||
g_assert(zoitechat_set_context(ph, query_ctx) == 1);
|
||||
ctx_type = zoitechat_list_int(ph, NULL, "type");
|
||||
}
|
||||
|
||||
if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) {
|
||||
hexchat_print(ph, "You can only exchange keys with individuals");
|
||||
zoitechat_print(ph, "You can only exchange keys with individuals");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (dh1080_generate_key(&priv_key, &pub_key)) {
|
||||
g_hash_table_replace (pending_exchanges, g_ascii_strdown(target, -1), priv_key);
|
||||
|
||||
hexchat_commandf(ph, "quote NOTICE %s :DH1080_INIT %s CBC", target, pub_key);
|
||||
hexchat_printf(ph, "Sent public key to %s (CBC), waiting for reply...", target);
|
||||
zoitechat_commandf(ph, "quote NOTICE %s :DH1080_INIT %s CBC", target, pub_key);
|
||||
zoitechat_printf(ph, "Sent public key to %s (CBC), waiting for reply...", target);
|
||||
|
||||
g_free(pub_key);
|
||||
} else {
|
||||
hexchat_print(ph, "Failed to generate keys");
|
||||
zoitechat_print(ph, "Failed to generate keys");
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
@@ -586,20 +586,20 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
|
||||
GSList *encrypted_list;
|
||||
|
||||
if (!*topic) {
|
||||
hexchat_print(ph, usage_topic);
|
||||
zoitechat_print(ph, usage_topic);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (hexchat_list_int(ph, NULL, "type") != 2) {
|
||||
hexchat_printf(ph, "Please change to the channel window where you want to set the topic!");
|
||||
if (zoitechat_list_int(ph, NULL, "type") != 2) {
|
||||
zoitechat_printf(ph, "Please change to the channel window where you want to set the topic!");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
target = hexchat_get_info(ph, "channel");
|
||||
target = zoitechat_get_info(ph, "channel");
|
||||
|
||||
/* Check if we can encrypt */
|
||||
if (!fish_nick_has_key(target)) {
|
||||
hexchat_printf(ph, "/topic+ error, no key found for %s", target);
|
||||
zoitechat_printf(ph, "/topic+ error, no key found for %s", target);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
@@ -609,11 +609,11 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
|
||||
encrypted_list = fish_encrypt_for_nick(target, topic, &mode, get_prefix_length() + command->len);
|
||||
if (!encrypted_list) {
|
||||
g_string_free(command, TRUE);
|
||||
hexchat_printf(ph, "/topic+ error, can't encrypt %s", target);
|
||||
zoitechat_printf(ph, "/topic+ error, can't encrypt %s", target);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
hexchat_commandf(ph, "%s%s", command->str, (char *) encrypted_list->data);
|
||||
zoitechat_commandf(ph, "%s%s", command->str, (char *) encrypted_list->data);
|
||||
|
||||
g_string_free(command, TRUE);
|
||||
g_slist_free_full(encrypted_list, g_free);
|
||||
@@ -633,13 +633,13 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
GSList *encrypted_list, *encrypted_item;
|
||||
|
||||
if (!*target || !*notice) {
|
||||
hexchat_print(ph, usage_notice);
|
||||
zoitechat_print(ph, usage_notice);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
/* Check if we can encrypt */
|
||||
if (!fish_nick_has_key(target)) {
|
||||
hexchat_printf(ph, "/notice+ error, no key found for %s.", target);
|
||||
zoitechat_printf(ph, "/notice+ error, no key found for %s.", target);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
@@ -649,17 +649,17 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
|
||||
encrypted_list = fish_encrypt_for_nick(target, notice, &mode, get_prefix_length() + command->len);
|
||||
if (!encrypted_list) {
|
||||
g_string_free(command, TRUE);
|
||||
hexchat_printf(ph, "/notice+ error, can't encrypt %s", target);
|
||||
zoitechat_printf(ph, "/notice+ error, can't encrypt %s", target);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
notice_flag = g_strconcat("[", fish_modes[mode], "] ", notice, NULL);
|
||||
hexchat_emit_print(ph, "Notice Send", target, notice_flag);
|
||||
zoitechat_emit_print(ph, "Notice Send", target, notice_flag);
|
||||
|
||||
/* Send encrypted messages */
|
||||
encrypted_item = encrypted_list;
|
||||
while (encrypted_item) {
|
||||
hexchat_commandf(ph, "%s%s", command->str, (char *) encrypted_item->data);
|
||||
zoitechat_commandf(ph, "%s%s", command->str, (char *) encrypted_item->data);
|
||||
|
||||
encrypted_item = encrypted_item->next;
|
||||
}
|
||||
@@ -679,19 +679,19 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
|
||||
const char *message = word_eol[3];
|
||||
char *message_flag;
|
||||
char *prefix;
|
||||
hexchat_context *query_ctx;
|
||||
zoitechat_context *query_ctx;
|
||||
enum fish_mode mode;
|
||||
GString *command;
|
||||
GSList *encrypted_list, *encrypted_item;
|
||||
|
||||
if (!*target || !*message) {
|
||||
hexchat_print(ph, usage_msg);
|
||||
zoitechat_print(ph, usage_msg);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
/* Check if we can encrypt */
|
||||
if (!fish_nick_has_key(target)) {
|
||||
hexchat_printf(ph, "/msg+ error, no key found for %s", target);
|
||||
zoitechat_printf(ph, "/msg+ error, no key found for %s", target);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
@@ -701,14 +701,14 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
|
||||
encrypted_list = fish_encrypt_for_nick(target, message, &mode, get_prefix_length() + command->len);
|
||||
if (!encrypted_list) {
|
||||
g_string_free(command, TRUE);
|
||||
hexchat_printf(ph, "/msg+ error, can't encrypt %s", target);
|
||||
zoitechat_printf(ph, "/msg+ error, can't encrypt %s", target);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
/* Send encrypted messages */
|
||||
encrypted_item = encrypted_list;
|
||||
while (encrypted_item) {
|
||||
hexchat_commandf(ph, "%s%s", command->str, (char *) encrypted_item->data);
|
||||
zoitechat_commandf(ph, "%s%s", command->str, (char *) encrypted_item->data);
|
||||
|
||||
encrypted_item = encrypted_item->next;
|
||||
}
|
||||
@@ -718,24 +718,24 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
|
||||
|
||||
query_ctx = find_context_on_network(target);
|
||||
if (query_ctx) {
|
||||
g_assert(hexchat_set_context(ph, query_ctx) == 1);
|
||||
g_assert(zoitechat_set_context(ph, query_ctx) == 1);
|
||||
|
||||
prefix = get_my_own_prefix();
|
||||
|
||||
/* Add encrypted flag */
|
||||
message_flag = g_strconcat("[", fish_modes[mode], "] ", message, NULL);
|
||||
hexchat_emit_print(ph, "Your Message", hexchat_get_info(ph, "nick"), message_flag, prefix, NULL);
|
||||
zoitechat_emit_print(ph, "Your Message", zoitechat_get_info(ph, "nick"), message_flag, prefix, NULL);
|
||||
g_free(prefix);
|
||||
g_free(message_flag);
|
||||
} else {
|
||||
hexchat_emit_print(ph, "Message Send", target, message);
|
||||
zoitechat_emit_print(ph, "Message Send", target, message);
|
||||
}
|
||||
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
||||
const char *channel = hexchat_get_info(ph, "channel");
|
||||
const char *channel = zoitechat_get_info(ph, "channel");
|
||||
enum fish_mode mode;
|
||||
GString *command;
|
||||
GSList *encrypted_list, *encrypted_item;
|
||||
@@ -752,16 +752,16 @@ static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
||||
encrypted_list = fish_encrypt_for_nick(channel, word_eol[2], &mode, get_prefix_length() + command->len + 2);
|
||||
if (!encrypted_list) {
|
||||
g_string_free(command, TRUE);
|
||||
hexchat_printf(ph, "/me error, can't encrypt %s", channel);
|
||||
zoitechat_printf(ph, "/me error, can't encrypt %s", channel);
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
hexchat_emit_print(ph, "Your Action", hexchat_get_info(ph, "nick"), word_eol[2], NULL);
|
||||
zoitechat_emit_print(ph, "Your Action", zoitechat_get_info(ph, "nick"), word_eol[2], NULL);
|
||||
|
||||
/* Send encrypted messages */
|
||||
encrypted_item = encrypted_list;
|
||||
while (encrypted_item) {
|
||||
hexchat_commandf(ph, "%s%s \001", command->str, (char *) encrypted_item->data);
|
||||
zoitechat_commandf(ph, "%s%s \001", command->str, (char *) encrypted_item->data);
|
||||
|
||||
encrypted_item = encrypted_item->next;
|
||||
}
|
||||
@@ -775,7 +775,7 @@ static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
||||
/**
|
||||
* Returns the plugin name version information.
|
||||
*/
|
||||
void hexchat_plugin_get_info(const char **name, const char **desc,
|
||||
void zoitechat_plugin_get_info(const char **name, const char **desc,
|
||||
const char **version, void **reserved) {
|
||||
*name = plugin_name;
|
||||
*desc = plugin_desc;
|
||||
@@ -785,35 +785,35 @@ void hexchat_plugin_get_info(const char **name, const char **desc,
|
||||
/**
|
||||
* Plugin entry point.
|
||||
*/
|
||||
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
||||
const char **name,
|
||||
const char **desc,
|
||||
const char **version,
|
||||
char *arg) {
|
||||
ph = plugin_handle;
|
||||
|
||||
/* Send our info to HexChat */
|
||||
/* Send our info to ZoiteChat */
|
||||
*name = plugin_name;
|
||||
*desc = plugin_desc;
|
||||
*version = plugin_version;
|
||||
|
||||
/* Register commands */
|
||||
hexchat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
|
||||
hexchat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
|
||||
hexchat_hook_command(ph, "KEYX", HEXCHAT_PRI_NORM, handle_keyx, usage_keyx, NULL);
|
||||
hexchat_hook_command(ph, "TOPIC+", HEXCHAT_PRI_NORM, handle_crypt_topic, usage_topic, NULL);
|
||||
hexchat_hook_command(ph, "NOTICE+", HEXCHAT_PRI_NORM, handle_crypt_notice, usage_notice, NULL);
|
||||
hexchat_hook_command(ph, "MSG+", HEXCHAT_PRI_NORM, handle_crypt_msg, usage_msg, NULL);
|
||||
hexchat_hook_command(ph, "ME", HEXCHAT_PRI_NORM, handle_crypt_me, NULL, NULL);
|
||||
zoitechat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
|
||||
zoitechat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
|
||||
zoitechat_hook_command(ph, "KEYX", HEXCHAT_PRI_NORM, handle_keyx, usage_keyx, NULL);
|
||||
zoitechat_hook_command(ph, "TOPIC+", HEXCHAT_PRI_NORM, handle_crypt_topic, usage_topic, NULL);
|
||||
zoitechat_hook_command(ph, "NOTICE+", HEXCHAT_PRI_NORM, handle_crypt_notice, usage_notice, NULL);
|
||||
zoitechat_hook_command(ph, "MSG+", HEXCHAT_PRI_NORM, handle_crypt_msg, usage_msg, NULL);
|
||||
zoitechat_hook_command(ph, "ME", HEXCHAT_PRI_NORM, handle_crypt_me, NULL, NULL);
|
||||
|
||||
/* Add handlers */
|
||||
hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
|
||||
hexchat_hook_server(ph, "NOTICE", HEXCHAT_PRI_HIGHEST, handle_keyx_notice, NULL);
|
||||
hexchat_hook_server_attrs(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
hexchat_hook_server_attrs(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
/* hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); */
|
||||
hexchat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
hexchat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
zoitechat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
|
||||
zoitechat_hook_server(ph, "NOTICE", HEXCHAT_PRI_HIGHEST, handle_keyx_notice, NULL);
|
||||
zoitechat_hook_server_attrs(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
zoitechat_hook_server_attrs(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
/* zoitechat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); */
|
||||
zoitechat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
zoitechat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
||||
|
||||
if (!fish_init())
|
||||
return 0;
|
||||
@@ -823,17 +823,17 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
|
||||
pending_exchanges = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
hexchat_printf(ph, "%s plugin loaded\n", plugin_name);
|
||||
zoitechat_printf(ph, "%s plugin loaded\n", plugin_name);
|
||||
/* Return success */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int hexchat_plugin_deinit(void) {
|
||||
int zoitechat_plugin_deinit(void) {
|
||||
g_clear_pointer(&pending_exchanges, g_hash_table_destroy);
|
||||
dh1080_deinit();
|
||||
fish_deinit();
|
||||
|
||||
hexchat_printf(ph, "%s plugin unloaded\n", plugin_name);
|
||||
zoitechat_printf(ph, "%s plugin unloaded\n", plugin_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ fishlim_test_sources = [
|
||||
]
|
||||
|
||||
fishlim_tests = executable('fishlim_tests', fishlim_test_sources,
|
||||
dependencies: [libgio_dep, libssl_dep, hexchat_plugin_dep],
|
||||
dependencies: [libgio_dep, libssl_dep, zoitechat_plugin_dep],
|
||||
include_directories: include_directories('..'),
|
||||
)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,15 +22,15 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>$(LuaOutput)</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(LuaInclude);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(LuaInclude);..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>"$(LuaLib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -40,7 +40,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(LuaInclude);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(LuaInclude);..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>"$(LuaLib).lib";$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@ else
|
||||
endif
|
||||
|
||||
shared_module('lua', 'lua.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, lua_dep],
|
||||
dependencies: [libgio_dep, zoitechat_plugin_dep, lua_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
plugindir = join_paths(get_option('libdir'), 'hexchat/plugins')
|
||||
plugindir = join_paths(get_option('libdir'), 'zoitechat/plugins')
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
if get_option('with-exec')
|
||||
|
||||
@@ -25,13 +25,13 @@ sub toc {
|
||||
}
|
||||
|
||||
for my $files (
|
||||
[ "hexchat.pm.h", # output file
|
||||
"lib/HexChat.pm", # input files
|
||||
[ "zoitechat.pm.h", # output file
|
||||
"lib/ZoiteChat.pm", # input files
|
||||
"lib/Xchat.pm",
|
||||
"lib/HexChat/Embed.pm",
|
||||
"lib/HexChat/List/Network.pm",
|
||||
"lib/HexChat/List/Network/Entry.pm",
|
||||
"lib/HexChat/List/Network/AutoJoin.pm",
|
||||
"lib/ZoiteChat/Embed.pm",
|
||||
"lib/ZoiteChat/List/Network.pm",
|
||||
"lib/ZoiteChat/List/Network/Entry.pm",
|
||||
"lib/ZoiteChat/List/Network/AutoJoin.pm",
|
||||
],
|
||||
[ "irc.pm.h", # output file
|
||||
"lib/IRC.pm" # input file
|
||||
|
||||
@@ -1 +1 @@
|
||||
require HexChat;
|
||||
require ZoiteChat;
|
||||
|
||||
@@ -8,8 +8,8 @@ $SIG{__WARN__} = sub {
|
||||
print STDERR $message;
|
||||
} else {
|
||||
|
||||
if( defined &HexChat::Internal::print ) {
|
||||
HexChat::print( $message );
|
||||
if( defined &ZoiteChat::Internal::print ) {
|
||||
ZoiteChat::print( $message );
|
||||
} else {
|
||||
warn $message;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ use Symbol();
|
||||
use Time::HiRes ();
|
||||
use Carp ();
|
||||
|
||||
package HexChat;
|
||||
package ZoiteChat;
|
||||
use base qw(Exporter);
|
||||
use strict;
|
||||
use warnings;
|
||||
@@ -48,13 +48,13 @@ sub FD_EXCEPTION ();
|
||||
sub FD_NOTSOCKET ();
|
||||
|
||||
sub get_context;
|
||||
sub HexChat::Internal::context_info;
|
||||
sub HexChat::Internal::print;
|
||||
sub ZoiteChat::Internal::context_info;
|
||||
sub ZoiteChat::Internal::print;
|
||||
|
||||
#keep compatibility with Xchat scripts
|
||||
sub EAT_XCHAT ();
|
||||
BEGIN {
|
||||
*Xchat:: = *HexChat::;
|
||||
*Xchat:: = *ZoiteChat::;
|
||||
}
|
||||
|
||||
our %EXPORT_TAGS = (
|
||||
@@ -81,20 +81,20 @@ our @EXPORT = @{$EXPORT_TAGS{constants}};
|
||||
our @EXPORT_OK = @{$EXPORT_TAGS{all}};
|
||||
|
||||
sub register {
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $filename = $pkg_info->{filename};
|
||||
my ($name, $version, $description, $callback) = @_;
|
||||
|
||||
if( defined $pkg_info->{gui_entry} ) {
|
||||
HexChat::print( "HexChat::register called more than once in "
|
||||
ZoiteChat::print( "ZoiteChat::register called more than once in "
|
||||
. $pkg_info->{filename} );
|
||||
return ();
|
||||
}
|
||||
|
||||
$description = "" unless defined $description;
|
||||
if( $callback ) {
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ sub register {
|
||||
$version = "NaN";
|
||||
}
|
||||
$pkg_info->{gui_entry} =
|
||||
HexChat::Internal::register( $name, $version, $description, $filename );
|
||||
ZoiteChat::Internal::register( $name, $version, $description, $filename );
|
||||
# keep with old behavior
|
||||
return ();
|
||||
}
|
||||
@@ -136,21 +136,21 @@ sub hook_server {
|
||||
my $message = shift;
|
||||
my $callback = shift;
|
||||
my $options = shift;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($priority, $data) = ( HexChat::PRI_NORM, undef );
|
||||
my ($priority, $data) = ( ZoiteChat::PRI_NORM, undef );
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(priority data)],
|
||||
[\($priority, $data)],
|
||||
);
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_server(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_server(
|
||||
$message, $priority, $callback, $data, $package
|
||||
);
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
@@ -162,21 +162,21 @@ sub hook_command {
|
||||
my $command = shift;
|
||||
my $callback = shift;
|
||||
my $options = shift;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($priority, $help_text, $data) = ( HexChat::PRI_NORM, undef, undef );
|
||||
my ($priority, $help_text, $data) = ( ZoiteChat::PRI_NORM, undef, undef );
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(priority help_text data)],
|
||||
[\($priority, $help_text, $data)],
|
||||
);
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_command(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_command(
|
||||
$command, $priority, $callback, $help_text, $data, $package
|
||||
);
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
@@ -188,13 +188,13 @@ sub hook_print {
|
||||
my $event = shift;
|
||||
my $callback = shift;
|
||||
my $options = shift;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($priority, $run_after, $filter, $data) = ( HexChat::PRI_NORM, 0, 0, undef );
|
||||
my ($priority, $run_after, $filter, $data) = ( ZoiteChat::PRI_NORM, 0, 0, undef );
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(priority run_after_event filter data)],
|
||||
@@ -202,7 +202,7 @@ sub hook_print {
|
||||
);
|
||||
|
||||
if( $run_after and $filter ) {
|
||||
Carp::carp( "HexChat::hook_print's run_after_event and filter options are mutually exclusive, you can only use of them at a time per hook" );
|
||||
Carp::carp( "ZoiteChat::hook_print's run_after_event and filter options are mutually exclusive, you can only use of them at a time per hook" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -254,8 +254,8 @@ sub hook_print {
|
||||
|
||||
}
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_print(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_print(
|
||||
$event, $priority, $callback, $data, $package
|
||||
);
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
@@ -265,9 +265,9 @@ sub hook_print {
|
||||
sub hook_timer {
|
||||
return undef unless @_ >= 2;
|
||||
my ($timeout, $callback, $data) = @_;
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
@@ -278,8 +278,8 @@ sub hook_timer {
|
||||
$data = $data->{data};
|
||||
}
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_timer( $timeout, $callback, $data, $package );
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_timer( $timeout, $callback, $data, $package );
|
||||
push @{$pkg_info->{hooks}}, $hook if defined $hook;
|
||||
return $hook;
|
||||
}
|
||||
@@ -292,12 +292,12 @@ sub hook_fd {
|
||||
my $fileno = fileno $fd;
|
||||
return undef unless defined $fileno; # no underlying fd for this handle
|
||||
|
||||
my ($package, $calling_package) = HexChat::Embed::find_pkg();
|
||||
$callback = HexChat::Embed::fix_callback(
|
||||
my ($package, $calling_package) = ZoiteChat::Embed::find_pkg();
|
||||
$callback = ZoiteChat::Embed::fix_callback(
|
||||
$package, $calling_package, $callback
|
||||
);
|
||||
|
||||
my ($flags, $data) = (HexChat::FD_READ, undef);
|
||||
my ($flags, $data) = (ZoiteChat::FD_READ, undef);
|
||||
_process_hook_options(
|
||||
$options,
|
||||
[qw(flags data)],
|
||||
@@ -311,8 +311,8 @@ sub hook_fd {
|
||||
);
|
||||
};
|
||||
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $hook = HexChat::Internal::hook_fd(
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
my $hook = ZoiteChat::Internal::hook_fd(
|
||||
$fileno, $cb, $flags, {
|
||||
DATA => $data, FD => $fd, CB => $callback, FLAGS => $flags,
|
||||
},
|
||||
@@ -326,13 +326,13 @@ sub unhook {
|
||||
my $hook = shift @_;
|
||||
my $package = shift @_;
|
||||
($package) = caller unless $package;
|
||||
my $pkg_info = HexChat::Embed::pkg_info( $package );
|
||||
my $pkg_info = ZoiteChat::Embed::pkg_info( $package );
|
||||
|
||||
if( defined( $hook )
|
||||
&& $hook =~ /^\d+$/
|
||||
&& grep { $_ == $hook } @{$pkg_info->{hooks}} ) {
|
||||
$pkg_info->{hooks} = [grep { $_ != $hook } @{$pkg_info->{hooks}}];
|
||||
return HexChat::Internal::unhook( $hook );
|
||||
return ZoiteChat::Internal::unhook( $hook );
|
||||
}
|
||||
return ();
|
||||
}
|
||||
@@ -362,16 +362,16 @@ sub _do_for_each {
|
||||
}
|
||||
|
||||
my $num_done = 0;
|
||||
my $old_ctx = HexChat::get_context();
|
||||
my $old_ctx = ZoiteChat::get_context();
|
||||
for my $server ( @$servers ) {
|
||||
for my $channel ( @$channels ) {
|
||||
if( HexChat::set_context( $channel, $server ) ) {
|
||||
if( ZoiteChat::set_context( $channel, $server ) ) {
|
||||
$cb->();
|
||||
$num_done++
|
||||
}
|
||||
}
|
||||
}
|
||||
HexChat::set_context( $old_ctx );
|
||||
ZoiteChat::set_context( $old_ctx );
|
||||
return $num_done;
|
||||
}
|
||||
|
||||
@@ -387,24 +387,24 @@ sub print {
|
||||
}
|
||||
|
||||
return _do_for_each(
|
||||
sub { HexChat::Internal::print( $text ); },
|
||||
sub { ZoiteChat::Internal::print( $text ); },
|
||||
@_
|
||||
);
|
||||
}
|
||||
|
||||
sub printf {
|
||||
my $format = shift;
|
||||
HexChat::print( sprintf( $format, @_ ) );
|
||||
ZoiteChat::print( sprintf( $format, @_ ) );
|
||||
}
|
||||
|
||||
# make HexChat::prnt() and HexChat::prntf() as aliases for HexChat::print() and
|
||||
# HexChat::printf(), mainly useful when these functions are exported
|
||||
# make ZoiteChat::prnt() and ZoiteChat::prntf() as aliases for ZoiteChat::print() and
|
||||
# ZoiteChat::printf(), mainly useful when these functions are exported
|
||||
sub prnt {
|
||||
goto &HexChat::print;
|
||||
goto &ZoiteChat::print;
|
||||
}
|
||||
|
||||
sub prntf {
|
||||
goto &HexChat::printf;
|
||||
goto &ZoiteChat::printf;
|
||||
}
|
||||
|
||||
sub command {
|
||||
@@ -419,37 +419,37 @@ sub command {
|
||||
}
|
||||
|
||||
return _do_for_each(
|
||||
sub { HexChat::Internal::command( $_ ) foreach @commands },
|
||||
sub { ZoiteChat::Internal::command( $_ ) foreach @commands },
|
||||
@_
|
||||
);
|
||||
}
|
||||
|
||||
sub commandf {
|
||||
my $format = shift;
|
||||
HexChat::command( sprintf( $format, @_ ) );
|
||||
ZoiteChat::command( sprintf( $format, @_ ) );
|
||||
}
|
||||
|
||||
sub plugin_pref_set {
|
||||
my $setting = shift // return 0;
|
||||
my $value = shift // return 0;
|
||||
|
||||
return HexChat::Internal::plugin_pref_set($setting, $value);
|
||||
return ZoiteChat::Internal::plugin_pref_set($setting, $value);
|
||||
}
|
||||
|
||||
sub plugin_pref_get {
|
||||
my $setting = shift // return 0;
|
||||
|
||||
return HexChat::Internal::plugin_pref_get($setting);
|
||||
return ZoiteChat::Internal::plugin_pref_get($setting);
|
||||
}
|
||||
|
||||
sub plugin_pref_delete {
|
||||
my $setting = shift // return 0;
|
||||
|
||||
return HexChat::Internal::plugin_pref_delete($setting);
|
||||
return ZoiteChat::Internal::plugin_pref_delete($setting);
|
||||
}
|
||||
|
||||
sub plugin_pref_list {
|
||||
my %list = HexChat::Internal::plugin_pref_list();
|
||||
my %list = ZoiteChat::Internal::plugin_pref_list();
|
||||
|
||||
return \%list;
|
||||
}
|
||||
@@ -458,17 +458,17 @@ sub set_context {
|
||||
my $context;
|
||||
if( @_ == 2 ) {
|
||||
my ($channel, $server) = @_;
|
||||
$context = HexChat::find_context( $channel, $server );
|
||||
$context = ZoiteChat::find_context( $channel, $server );
|
||||
} elsif( @_ == 1 ) {
|
||||
if( defined $_[0] && $_[0] =~ /^\d+$/ ) {
|
||||
$context = $_[0];
|
||||
} else {
|
||||
$context = HexChat::find_context( $_[0] );
|
||||
$context = ZoiteChat::find_context( $_[0] );
|
||||
}
|
||||
} elsif( @_ == 0 ) {
|
||||
$context = HexChat::find_context();
|
||||
$context = ZoiteChat::find_context();
|
||||
}
|
||||
return $context ? HexChat::Internal::set_context( $context ) : 0;
|
||||
return $context ? ZoiteChat::Internal::set_context( $context ) : 0;
|
||||
}
|
||||
|
||||
sub get_info {
|
||||
@@ -477,19 +477,19 @@ sub get_info {
|
||||
|
||||
if( defined( $id ) ) {
|
||||
if( grep { $id eq $_ } qw(state_cursor id) ) {
|
||||
$info = HexChat::get_prefs( $id );
|
||||
$info = ZoiteChat::get_prefs( $id );
|
||||
} else {
|
||||
$info = HexChat::Internal::get_info( $id );
|
||||
$info = ZoiteChat::Internal::get_info( $id );
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
sub user_info {
|
||||
my $nick = HexChat::strip_code(shift @_ || HexChat::get_info( "nick" ));
|
||||
my $nick = ZoiteChat::strip_code(shift @_ || ZoiteChat::get_info( "nick" ));
|
||||
my $user;
|
||||
for (HexChat::get_list( "users" ) ) {
|
||||
if ( HexChat::nickcmp( $_->{nick}, $nick ) == 0 ) {
|
||||
for (ZoiteChat::get_list( "users" ) ) {
|
||||
if ( ZoiteChat::nickcmp( $_->{nick}, $nick ) == 0 ) {
|
||||
$user = $_;
|
||||
last;
|
||||
}
|
||||
@@ -498,24 +498,24 @@ sub user_info {
|
||||
}
|
||||
|
||||
sub context_info {
|
||||
my $ctx = shift @_ || HexChat::get_context;
|
||||
my $old_ctx = HexChat::get_context;
|
||||
my $ctx = shift @_ || ZoiteChat::get_context;
|
||||
my $old_ctx = ZoiteChat::get_context;
|
||||
my @fields = (
|
||||
qw(away channel charset host id inputbox libdirfs modes network),
|
||||
qw(nick nickserv server topic version win_ptr win_status),
|
||||
qw(configdir xchatdir xchatdirfs state_cursor),
|
||||
);
|
||||
|
||||
if( HexChat::set_context( $ctx ) ) {
|
||||
if( ZoiteChat::set_context( $ctx ) ) {
|
||||
my %info;
|
||||
for my $field ( @fields ) {
|
||||
$info{$field} = HexChat::get_info( $field );
|
||||
$info{$field} = ZoiteChat::get_info( $field );
|
||||
}
|
||||
|
||||
my $ctx_info = HexChat::Internal::context_info;
|
||||
my $ctx_info = ZoiteChat::Internal::context_info;
|
||||
@info{keys %$ctx_info} = values %$ctx_info;
|
||||
|
||||
HexChat::set_context( $old_ctx );
|
||||
ZoiteChat::set_context( $old_ctx );
|
||||
return \%info;
|
||||
} else {
|
||||
return undef;
|
||||
@@ -527,9 +527,9 @@ sub get_list {
|
||||
Carp::carp( "'$_[0]' does not appear to be a valid list name" );
|
||||
}
|
||||
if( $_[0] eq 'networks' ) {
|
||||
return HexChat::List::Network->get();
|
||||
return ZoiteChat::List::Network->get();
|
||||
} else {
|
||||
return HexChat::Internal::get_list( $_[0] );
|
||||
return ZoiteChat::Internal::get_list( $_[0] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::Embed;
|
||||
package ZoiteChat::Embed;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
@@ -9,7 +9,7 @@ use Data::Dumper;
|
||||
# filename
|
||||
# The full path to the script.
|
||||
# gui_entry
|
||||
# This is hexchat_plugin pointer that is used to remove the script from
|
||||
# This is zoitechat_plugin pointer that is used to remove the script from
|
||||
# Plugins and Scripts window when a script is unloaded. This has also
|
||||
# been converted with the PTR2IV() macro.
|
||||
# hooks
|
||||
@@ -43,11 +43,11 @@ sub load {
|
||||
if( exists $scripts{$package} ) {
|
||||
my $pkg_info = pkg_info( $package );
|
||||
my $filename = File::Basename::basename( $pkg_info->{filename} );
|
||||
HexChat::printf(
|
||||
ZoiteChat::printf(
|
||||
qq{'%s' already loaded from '%s'.\n},
|
||||
$filename, $pkg_info->{filename}
|
||||
);
|
||||
HexChat::print(
|
||||
ZoiteChat::print(
|
||||
'If this is a different script then it rename and try '.
|
||||
'loading it again.'
|
||||
);
|
||||
@@ -61,7 +61,7 @@ sub load {
|
||||
$source =~ s/^__END__.*//ms;
|
||||
|
||||
# this must come before the eval or the filename will not be found in
|
||||
# HexChat::register
|
||||
# ZoiteChat::register
|
||||
$scripts{$package}{filename} = $file;
|
||||
$scripts{$package}{loaded_at} = Time::HiRes::time();
|
||||
|
||||
@@ -94,7 +94,7 @@ sub load {
|
||||
$error_message .= " $conflict_package already defined in " .
|
||||
pkg_info($owner_package{ $conflict_package })->{filename}."\n";
|
||||
}
|
||||
HexChat::print( $error_message );
|
||||
ZoiteChat::print( $error_message );
|
||||
|
||||
return 2;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ sub load {
|
||||
|
||||
unless( exists $scripts{$package}{gui_entry} ) {
|
||||
$scripts{$package}{gui_entry} =
|
||||
HexChat::Internal::register(
|
||||
ZoiteChat::Internal::register(
|
||||
"", "unknown", "", $file
|
||||
);
|
||||
}
|
||||
@@ -123,13 +123,13 @@ sub load {
|
||||
if( $@ ) {
|
||||
# something went wrong
|
||||
$@ =~ s/\(eval \d+\)/$file/g;
|
||||
HexChat::print( "Error loading '$file':\n$@\n" );
|
||||
ZoiteChat::print( "Error loading '$file':\n$@\n" );
|
||||
# make sure the script list doesn't contain false information
|
||||
unload( $scripts{$package}{filename} );
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
HexChat::print( "Error opening '$file': $!\n" );
|
||||
ZoiteChat::print( "Error opening '$file': $!\n" );
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ sub unload {
|
||||
|
||||
if( exists $pkg_info->{hooks} ) {
|
||||
for my $hook ( @{$pkg_info->{hooks}} ) {
|
||||
HexChat::unhook( $hook, $package );
|
||||
ZoiteChat::unhook( $hook, $package );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,10 +177,10 @@ sub unload {
|
||||
}
|
||||
Symbol::delete_package( $package );
|
||||
delete $scripts{$package};
|
||||
return HexChat::EAT_ALL;
|
||||
return ZoiteChat::EAT_ALL;
|
||||
} else {
|
||||
HexChat::print( qq{"$file" is not loaded.\n} );
|
||||
return HexChat::EAT_NONE;
|
||||
ZoiteChat::print( qq{"$file" is not loaded.\n} );
|
||||
return ZoiteChat::EAT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ sub unload_all {
|
||||
unload( $scripts{$package}->{filename} );
|
||||
}
|
||||
|
||||
return HexChat::EAT_ALL;
|
||||
return ZoiteChat::EAT_ALL;
|
||||
}
|
||||
|
||||
sub reload {
|
||||
@@ -204,11 +204,11 @@ sub reload {
|
||||
}
|
||||
|
||||
load( $fullpath );
|
||||
return HexChat::EAT_ALL;
|
||||
return ZoiteChat::EAT_ALL;
|
||||
}
|
||||
|
||||
sub reload_all {
|
||||
my @dirs = HexChat::get_info( "configdir" );
|
||||
my @dirs = ZoiteChat::get_info( "configdir" );
|
||||
push @dirs, File::Spec->catdir( $dirs[0], "plugins" );
|
||||
for my $dir ( @dirs ) {
|
||||
my $auto_load_glob = File::Spec->catfile( $dir, "*.pl" );
|
||||
@@ -232,22 +232,22 @@ sub evaluate {
|
||||
my ($code) = @_;
|
||||
|
||||
my @results = eval $code;
|
||||
HexChat::print $@ if $@; #print warnings
|
||||
ZoiteChat::print $@ if $@; #print warnings
|
||||
|
||||
local $Data::Dumper::Sortkeys = 1;
|
||||
local $Data::Dumper::Terse = 1;
|
||||
|
||||
if (@results > 1) {
|
||||
HexChat::print Dumper \@results;
|
||||
ZoiteChat::print Dumper \@results;
|
||||
}
|
||||
elsif (ref $results[0] || !$results[0]) {
|
||||
HexChat::print Dumper $results[0];
|
||||
ZoiteChat::print Dumper $results[0];
|
||||
}
|
||||
else {
|
||||
HexChat::print $results[0];
|
||||
ZoiteChat::print $results[0];
|
||||
}
|
||||
|
||||
return HexChat::EAT_HEXCHAT;
|
||||
return ZoiteChat::EAT_HEXCHAT;
|
||||
};
|
||||
|
||||
sub expand_homedir {
|
||||
@@ -267,7 +267,7 @@ sub file2pkg {
|
||||
my $string = File::Basename::basename( shift @_ );
|
||||
$string =~ s/\.pl$//i;
|
||||
$string =~ s|([^A-Za-z0-9/])|'_'.unpack("H*",$1)|eg;
|
||||
return "HexChat::Script::" . $string;
|
||||
return "ZoiteChat::Script::" . $string;
|
||||
}
|
||||
|
||||
sub pkg_info {
|
||||
@@ -279,7 +279,7 @@ sub find_external_pkg {
|
||||
my $level = 1;
|
||||
|
||||
while( my @frame = caller( $level ) ) {
|
||||
return @frame if $frame[0] !~ /(?:^IRC$|^HexChat)/;
|
||||
return @frame if $frame[0] !~ /(?:^IRC$|^ZoiteChat)/;
|
||||
$level++;
|
||||
}
|
||||
return;
|
||||
@@ -289,7 +289,7 @@ sub find_pkg {
|
||||
my $level = 1;
|
||||
|
||||
while( my ($package, $file, $line) = caller( $level ) ) {
|
||||
return $package if $package =~ /^HexChat::Script::/;
|
||||
return $package if $package =~ /^ZoiteChat::Script::/;
|
||||
$level++;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::List::Network;
|
||||
package ZoiteChat::List::Network;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Storable qw(dclone);
|
||||
@@ -6,7 +6,7 @@ my $last_modified;
|
||||
my @servers;
|
||||
|
||||
sub get {
|
||||
my $server_file = HexChat::get_info( "configdir" ) . "/servlist.conf";
|
||||
my $server_file = ZoiteChat::get_info( "configdir" ) . "/servlist.conf";
|
||||
|
||||
# recreate the list only if the server list file has changed
|
||||
if( -f $server_file &&
|
||||
@@ -19,7 +19,7 @@ sub get {
|
||||
while( my $record = <$fh> ) {
|
||||
chomp $record;
|
||||
next if $record =~ /^v=/; # skip the version line
|
||||
push @servers, HexChat::List::Network::Entry::parse( $record );
|
||||
push @servers, ZoiteChat::List::Network::Entry::parse( $record );
|
||||
}
|
||||
} else {
|
||||
warn "Unable to open '$server_file': $!";
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::List::Network::AutoJoin;
|
||||
package ZoiteChat::List::Network::AutoJoin;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package HexChat::List::Network::Entry;
|
||||
package ZoiteChat::List::Network::Entry;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@@ -26,7 +26,7 @@ sub parse {
|
||||
|
||||
# the order of the channels need to be maintained
|
||||
# list of { channel => .., key => ... }
|
||||
autojoins => HexChat::List::Network::AutoJoin->new( '' ),
|
||||
autojoins => ZoiteChat::List::Network::AutoJoin->new( '' ),
|
||||
connect_commands => [],
|
||||
flags => {},
|
||||
selected => undef,
|
||||
@@ -39,7 +39,7 @@ sub parse {
|
||||
my @fields = split /\n/, $data;
|
||||
chomp @fields;
|
||||
|
||||
$entry->{ autojoins } = HexChat::List::Network::AutoJoin->new();
|
||||
$entry->{ autojoins } = ZoiteChat::List::Network::AutoJoin->new();
|
||||
|
||||
for my $field ( @fields ) {
|
||||
SWITCH: for ( $field ) {
|
||||
@@ -1,15 +1,15 @@
|
||||
generate_perl_header = find_program('generate_header.py')
|
||||
|
||||
hexchat_perl_module = custom_target('hexchat-perl-header',
|
||||
zoitechat_perl_module = custom_target('zoitechat-perl-header',
|
||||
input: [
|
||||
'lib/HexChat.pm',
|
||||
'lib/ZoiteChat.pm',
|
||||
'lib/Xchat.pm',
|
||||
'lib/HexChat/Embed.pm',
|
||||
'lib/HexChat/List/Network.pm',
|
||||
'lib/HexChat/List/Network/Entry.pm',
|
||||
'lib/HexChat/List/Network/AutoJoin.pm',
|
||||
'lib/ZoiteChat/Embed.pm',
|
||||
'lib/ZoiteChat/List/Network.pm',
|
||||
'lib/ZoiteChat/List/Network/Entry.pm',
|
||||
'lib/ZoiteChat/List/Network/AutoJoin.pm',
|
||||
],
|
||||
output: 'hexchat.pm.h',
|
||||
output: 'zoitechat.pm.h',
|
||||
command: [generate_perl_header, '@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
|
||||
@@ -82,8 +82,8 @@ perl_dep = declare_dependency(
|
||||
)
|
||||
|
||||
shared_module('perl',
|
||||
sources: ['perl.c', hexchat_perl_module, irc_perl_module],
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep, perl_dep],
|
||||
sources: ['perl.c', zoitechat_perl_module, irc_perl_module],
|
||||
dependencies: [libgio_dep, zoitechat_plugin_dep, perl_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
install_rpath: perl_rpath,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
hexchat_plugin_get_info
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
zoitechat_plugin_get_info
|
||||
@@ -22,15 +22,15 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcperl</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PERL520_EXPORTS;HAS_BOOL;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);..\..\src\common;$(HexChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(IntDir);..\..\src\common;$(ZoiteChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(IntDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
@@ -44,13 +44,13 @@ move $(PerlLib).def "$(IntDir)"
|
||||
lib /nologo /machine:x86 "/def:$(IntDir)$(PerlLib).def" "/out:$(IntDir)\$(PerlLib).lib"
|
||||
"$(PerlPath)\bin\perl.exe" generate_header
|
||||
move irc.pm.h "$(IntDir)"
|
||||
move hexchat.pm.h "$(IntDir)"</Command>
|
||||
move zoitechat.pm.h "$(IntDir)"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PERL520_EXPORTS;HAS_BOOL;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);..\..\src\common;$(HexChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(IntDir);..\..\src\common;$(ZoiteChatLib);$(PerlPath)\lib\CORE;$(Glib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(IntDir);$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
@@ -64,7 +64,7 @@ move $(PerlLib).def "$(IntDir)"
|
||||
lib /nologo /machine:x64 "/def:$(IntDir)$(PerlLib).def" "/out:$(IntDir)\$(PerlLib).lib"
|
||||
"$(PerlPath)\bin\perl.exe" generate_header
|
||||
move irc.pm.h "$(IntDir)"
|
||||
move hexchat.pm.h "$(IntDir)"</Command>
|
||||
move zoitechat.pm.h "$(IntDir)"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@ import inspect
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
|
||||
from _hexchat_embedded import ffi, lib
|
||||
from _zoitechat_embedded import ffi, lib
|
||||
|
||||
__all__ = [
|
||||
'EAT_ALL', 'EAT_HEXCHAT', 'EAT_NONE', 'EAT_PLUGIN', 'EAT_XCHAT',
|
||||
@@ -15,7 +15,7 @@ __all__ = [
|
||||
'set_pluginpref', 'strip', 'unhook',
|
||||
]
|
||||
|
||||
__doc__ = 'HexChat Scripting Interface'
|
||||
__doc__ = 'ZoiteChat Scripting Interface'
|
||||
__version__ = (2, 0)
|
||||
__license__ = 'GPL-2.0+'
|
||||
|
||||
@@ -57,7 +57,7 @@ else:
|
||||
|
||||
# ------------ API ------------
|
||||
def prnt(string):
|
||||
lib.hexchat_print(lib.ph, string.encode())
|
||||
lib.zoitechat_print(lib.ph, string.encode())
|
||||
|
||||
|
||||
def emit_print(event_name, *args, **kwargs):
|
||||
@@ -69,33 +69,33 @@ def emit_print(event_name, *args, **kwargs):
|
||||
cargs.append(cstring)
|
||||
|
||||
if time == 0:
|
||||
return lib.hexchat_emit_print(lib.ph, event_name.encode(), *cargs)
|
||||
return lib.zoitechat_emit_print(lib.ph, event_name.encode(), *cargs)
|
||||
|
||||
attrs = lib.hexchat_event_attrs_create(lib.ph)
|
||||
attrs = lib.zoitechat_event_attrs_create(lib.ph)
|
||||
attrs.server_time_utc = time
|
||||
ret = lib.hexchat_emit_print_attrs(lib.ph, attrs, event_name.encode(), *cargs)
|
||||
lib.hexchat_event_attrs_free(lib.ph, attrs)
|
||||
ret = lib.zoitechat_emit_print_attrs(lib.ph, attrs, event_name.encode(), *cargs)
|
||||
lib.zoitechat_event_attrs_free(lib.ph, attrs)
|
||||
return ret
|
||||
|
||||
|
||||
# TODO: this shadows itself. command should be changed to cmd
|
||||
def command(command):
|
||||
lib.hexchat_command(lib.ph, command.encode())
|
||||
lib.zoitechat_command(lib.ph, command.encode())
|
||||
|
||||
|
||||
def nickcmp(string1, string2):
|
||||
return lib.hexchat_nickcmp(lib.ph, string1.encode(), string2.encode())
|
||||
return lib.zoitechat_nickcmp(lib.ph, string1.encode(), string2.encode())
|
||||
|
||||
|
||||
def strip(text, length=-1, flags=3):
|
||||
stripped = lib.hexchat_strip(lib.ph, text.encode(), length, flags)
|
||||
stripped = lib.zoitechat_strip(lib.ph, text.encode(), length, flags)
|
||||
ret = __decode(ffi.string(stripped))
|
||||
lib.hexchat_free(lib.ph, stripped)
|
||||
lib.zoitechat_free(lib.ph, stripped)
|
||||
return ret
|
||||
|
||||
|
||||
def get_info(name):
|
||||
ret = lib.hexchat_get_info(lib.ph, name.encode())
|
||||
ret = lib.zoitechat_get_info(lib.ph, name.encode())
|
||||
if ret == ffi.NULL:
|
||||
return None
|
||||
if name in ('gtkwin_ptr', 'win_ptr'):
|
||||
@@ -109,7 +109,7 @@ def get_info(name):
|
||||
def get_prefs(name):
|
||||
string_out = ffi.new('char**')
|
||||
int_out = ffi.new('int*')
|
||||
_type = lib.hexchat_get_prefs(lib.ph, name.encode(), string_out, int_out)
|
||||
_type = lib.zoitechat_get_prefs(lib.ph, name.encode(), string_out, int_out)
|
||||
if _type == 0:
|
||||
return None
|
||||
|
||||
@@ -136,7 +136,7 @@ __FIELD_CACHE = {}
|
||||
|
||||
|
||||
def __get_fields(name):
|
||||
return __FIELD_CACHE.setdefault(name, __cstrarray_to_list(lib.hexchat_list_fields(lib.ph, name)))
|
||||
return __FIELD_CACHE.setdefault(name, __cstrarray_to_list(lib.zoitechat_list_fields(lib.ph, name)))
|
||||
|
||||
|
||||
__FIELD_PROPERTY_CACHE = {}
|
||||
@@ -177,7 +177,7 @@ def get_list(name):
|
||||
if name not in __get_fields(b'lists'):
|
||||
raise KeyError('list not available')
|
||||
|
||||
list_ = lib.hexchat_list_get(lib.ph, name)
|
||||
list_ = lib.zoitechat_list_get(lib.ph, name)
|
||||
if list_ == ffi.NULL:
|
||||
return None
|
||||
|
||||
@@ -185,7 +185,7 @@ def get_list(name):
|
||||
fields = __get_fields(name)
|
||||
|
||||
def string_getter(field):
|
||||
string = lib.hexchat_list_str(lib.ph, list_, field)
|
||||
string = lib.zoitechat_list_str(lib.ph, list_, field)
|
||||
if string != ffi.NULL:
|
||||
return __decode(ffi.string(string))
|
||||
|
||||
@@ -193,20 +193,20 @@ def get_list(name):
|
||||
|
||||
def ptr_getter(field):
|
||||
if field == b'context':
|
||||
ptr = lib.hexchat_list_str(lib.ph, list_, field)
|
||||
ctx = ffi.cast('hexchat_context*', ptr)
|
||||
ptr = lib.zoitechat_list_str(lib.ph, list_, field)
|
||||
ctx = ffi.cast('zoitechat_context*', ptr)
|
||||
return Context(ctx)
|
||||
|
||||
return None
|
||||
|
||||
getters = {
|
||||
ord('s'): string_getter,
|
||||
ord('i'): lambda field: lib.hexchat_list_int(lib.ph, list_, field),
|
||||
ord('t'): lambda field: lib.hexchat_list_time(lib.ph, list_, field),
|
||||
ord('i'): lambda field: lib.zoitechat_list_int(lib.ph, list_, field),
|
||||
ord('t'): lambda field: lib.zoitechat_list_time(lib.ph, list_, field),
|
||||
ord('p'): ptr_getter,
|
||||
}
|
||||
|
||||
while lib.hexchat_list_next(lib.ph, list_) == 1:
|
||||
while lib.zoitechat_list_next(lib.ph, list_) == 1:
|
||||
item = ListItem(orig_name)
|
||||
for _field in fields:
|
||||
getter = getters.get(get_getter(_field))
|
||||
@@ -216,7 +216,7 @@ def get_list(name):
|
||||
|
||||
ret.append(item)
|
||||
|
||||
lib.hexchat_list_free(lib.ph, list_)
|
||||
lib.zoitechat_list_free(lib.ph, list_)
|
||||
return ret
|
||||
|
||||
|
||||
@@ -224,50 +224,50 @@ def get_list(name):
|
||||
def hook_command(command, callback, userdata=None, priority=PRI_NORM, help=None):
|
||||
plugin = __get_current_plugin()
|
||||
hook = plugin.add_hook(callback, userdata)
|
||||
handle = lib.hexchat_hook_command(lib.ph, command.encode(), priority, lib._on_command_hook,
|
||||
handle = lib.zoitechat_hook_command(lib.ph, command.encode(), priority, lib._on_command_hook,
|
||||
help.encode() if help is not None else ffi.NULL, hook.handle)
|
||||
|
||||
hook.hexchat_hook = handle
|
||||
hook.zoitechat_hook = handle
|
||||
return id(hook)
|
||||
|
||||
|
||||
def hook_print(name, callback, userdata=None, priority=PRI_NORM):
|
||||
plugin = __get_current_plugin()
|
||||
hook = plugin.add_hook(callback, userdata)
|
||||
handle = lib.hexchat_hook_print(lib.ph, name.encode(), priority, lib._on_print_hook, hook.handle)
|
||||
hook.hexchat_hook = handle
|
||||
handle = lib.zoitechat_hook_print(lib.ph, name.encode(), priority, lib._on_print_hook, hook.handle)
|
||||
hook.zoitechat_hook = handle
|
||||
return id(hook)
|
||||
|
||||
|
||||
def hook_print_attrs(name, callback, userdata=None, priority=PRI_NORM):
|
||||
plugin = __get_current_plugin()
|
||||
hook = plugin.add_hook(callback, userdata)
|
||||
handle = lib.hexchat_hook_print_attrs(lib.ph, name.encode(), priority, lib._on_print_attrs_hook, hook.handle)
|
||||
hook.hexchat_hook = handle
|
||||
handle = lib.zoitechat_hook_print_attrs(lib.ph, name.encode(), priority, lib._on_print_attrs_hook, hook.handle)
|
||||
hook.zoitechat_hook = handle
|
||||
return id(hook)
|
||||
|
||||
|
||||
def hook_server(name, callback, userdata=None, priority=PRI_NORM):
|
||||
plugin = __get_current_plugin()
|
||||
hook = plugin.add_hook(callback, userdata)
|
||||
handle = lib.hexchat_hook_server(lib.ph, name.encode(), priority, lib._on_server_hook, hook.handle)
|
||||
hook.hexchat_hook = handle
|
||||
handle = lib.zoitechat_hook_server(lib.ph, name.encode(), priority, lib._on_server_hook, hook.handle)
|
||||
hook.zoitechat_hook = handle
|
||||
return id(hook)
|
||||
|
||||
|
||||
def hook_server_attrs(name, callback, userdata=None, priority=PRI_NORM):
|
||||
plugin = __get_current_plugin()
|
||||
hook = plugin.add_hook(callback, userdata)
|
||||
handle = lib.hexchat_hook_server_attrs(lib.ph, name.encode(), priority, lib._on_server_attrs_hook, hook.handle)
|
||||
hook.hexchat_hook = handle
|
||||
handle = lib.zoitechat_hook_server_attrs(lib.ph, name.encode(), priority, lib._on_server_attrs_hook, hook.handle)
|
||||
hook.zoitechat_hook = handle
|
||||
return id(hook)
|
||||
|
||||
|
||||
def hook_timer(timeout, callback, userdata=None):
|
||||
plugin = __get_current_plugin()
|
||||
hook = plugin.add_hook(callback, userdata)
|
||||
handle = lib.hexchat_hook_timer(lib.ph, timeout, lib._on_timer_hook, hook.handle)
|
||||
hook.hexchat_hook = handle
|
||||
handle = lib.zoitechat_hook_timer(lib.ph, timeout, lib._on_timer_hook, hook.handle)
|
||||
hook.zoitechat_hook = handle
|
||||
return id(hook)
|
||||
|
||||
|
||||
@@ -284,10 +284,10 @@ def unhook(handle):
|
||||
|
||||
def set_pluginpref(name, value):
|
||||
if isinstance(value, str):
|
||||
return bool(lib.hexchat_pluginpref_set_str(lib.ph, name.encode(), value.encode()))
|
||||
return bool(lib.zoitechat_pluginpref_set_str(lib.ph, name.encode(), value.encode()))
|
||||
|
||||
if isinstance(value, int):
|
||||
return bool(lib.hexchat_pluginpref_set_int(lib.ph, name.encode(), value))
|
||||
return bool(lib.zoitechat_pluginpref_set_int(lib.ph, name.encode(), value))
|
||||
|
||||
# XXX: This should probably raise but this keeps API
|
||||
return False
|
||||
@@ -296,7 +296,7 @@ def set_pluginpref(name, value):
|
||||
def get_pluginpref(name):
|
||||
name = name.encode()
|
||||
string_out = ffi.new('char[512]')
|
||||
if lib.hexchat_pluginpref_get_str(lib.ph, name, string_out) != 1:
|
||||
if lib.zoitechat_pluginpref_get_str(lib.ph, name, string_out) != 1:
|
||||
return None
|
||||
|
||||
string = ffi.string(string_out)
|
||||
@@ -305,7 +305,7 @@ def get_pluginpref(name):
|
||||
if len(string) > 12: # Can't be a number
|
||||
return __decode(string)
|
||||
|
||||
number = lib.hexchat_pluginpref_get_int(lib.ph, name)
|
||||
number = lib.zoitechat_pluginpref_get_int(lib.ph, name)
|
||||
if number == -1 and string != b'-1':
|
||||
return __decode(string)
|
||||
|
||||
@@ -313,12 +313,12 @@ def get_pluginpref(name):
|
||||
|
||||
|
||||
def del_pluginpref(name):
|
||||
return bool(lib.hexchat_pluginpref_delete(lib.ph, name.encode()))
|
||||
return bool(lib.zoitechat_pluginpref_delete(lib.ph, name.encode()))
|
||||
|
||||
|
||||
def list_pluginpref():
|
||||
prefs_str = ffi.new('char[4096]')
|
||||
if lib.hexchat_pluginpref_list(lib.ph, prefs_str) == 1:
|
||||
if lib.zoitechat_pluginpref_list(lib.ph, prefs_str) == 1:
|
||||
return __decode(ffi.string(prefs_str)).split(',')
|
||||
|
||||
return []
|
||||
@@ -336,18 +336,18 @@ class Context:
|
||||
|
||||
@contextmanager
|
||||
def __change_context(self):
|
||||
old_ctx = lib.hexchat_get_context(lib.ph)
|
||||
old_ctx = lib.zoitechat_get_context(lib.ph)
|
||||
if not self.set():
|
||||
# XXX: Behavior change, previously used wrong context
|
||||
lib.hexchat_print(lib.ph, b'Context object refers to closed context, ignoring call')
|
||||
lib.zoitechat_print(lib.ph, b'Context object refers to closed context, ignoring call')
|
||||
return
|
||||
|
||||
yield
|
||||
lib.hexchat_set_context(lib.ph, old_ctx)
|
||||
lib.zoitechat_set_context(lib.ph, old_ctx)
|
||||
|
||||
def set(self):
|
||||
# XXX: API addition, C plugin silently ignored failure
|
||||
return bool(lib.hexchat_set_context(lib.ph, self._ctx))
|
||||
return bool(lib.zoitechat_set_context(lib.ph, self._ctx))
|
||||
|
||||
def prnt(self, string):
|
||||
with self.__change_context():
|
||||
@@ -372,14 +372,14 @@ class Context:
|
||||
|
||||
|
||||
def get_context():
|
||||
ctx = lib.hexchat_get_context(lib.ph)
|
||||
ctx = lib.zoitechat_get_context(lib.ph)
|
||||
return Context(ctx)
|
||||
|
||||
|
||||
def find_context(server=None, channel=None):
|
||||
server = server.encode() if server is not None else ffi.NULL
|
||||
channel = channel.encode() if channel is not None else ffi.NULL
|
||||
ctx = lib.hexchat_find_context(lib.ph, server, channel)
|
||||
ctx = lib.zoitechat_find_context(lib.ph, server, channel)
|
||||
if ctx == ffi.NULL:
|
||||
return None
|
||||
|
||||
@@ -5,11 +5,11 @@ import cffi
|
||||
|
||||
builder = cffi.FFI()
|
||||
|
||||
# hexchat-plugin.h
|
||||
# zoitechat-plugin.h
|
||||
with open(sys.argv[1]) as f:
|
||||
output = []
|
||||
eat_until_endif = 0
|
||||
# This is very specific to hexchat-plugin.h, it is not a cpp
|
||||
# This is very specific to zoitechat-plugin.h, it is not a cpp
|
||||
for line in f:
|
||||
if line.startswith('#define'):
|
||||
continue
|
||||
@@ -21,7 +21,7 @@ with open(sys.argv[1]) as f:
|
||||
eat_until_endif += 1
|
||||
elif line.startswith('#endif'):
|
||||
eat_until_endif -= 1
|
||||
elif eat_until_endif and '_hexchat_context' not in line:
|
||||
elif eat_until_endif and '_zoitechat_context' not in line:
|
||||
continue
|
||||
else:
|
||||
output.append(line)
|
||||
@@ -36,30 +36,30 @@ extern "Python" int _on_say_command(char **, char **, void *);
|
||||
|
||||
extern "Python" int _on_command_hook(char **, char **, void *);
|
||||
extern "Python" int _on_print_hook(char **, void *);
|
||||
extern "Python" int _on_print_attrs_hook(char **, hexchat_event_attrs *, void *);
|
||||
extern "Python" int _on_print_attrs_hook(char **, zoitechat_event_attrs *, void *);
|
||||
extern "Python" int _on_server_hook(char **, char **, void *);
|
||||
extern "Python" int _on_server_attrs_hook(char **, char **, hexchat_event_attrs *, void *);
|
||||
extern "Python" int _on_server_attrs_hook(char **, char **, zoitechat_event_attrs *, void *);
|
||||
extern "Python" int _on_timer_hook(void *);
|
||||
|
||||
extern "Python" int _on_plugin_init(char **, char **, char **, char *, char *);
|
||||
extern "Python" int _on_plugin_deinit(void);
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static zoitechat_plugin *ph;
|
||||
''')
|
||||
|
||||
builder.set_source('_hexchat_embedded', '''
|
||||
builder.set_source('_zoitechat_embedded', '''
|
||||
/* Python's header defines these.. */
|
||||
#undef HAVE_MEMRCHR
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static zoitechat_plugin *ph;
|
||||
CFFI_DLLEXPORT int _on_plugin_init(char **, char **, char **, char *, char *);
|
||||
CFFI_DLLEXPORT int _on_plugin_deinit(void);
|
||||
|
||||
int hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
||||
char **name_out, char **description_out,
|
||||
char **version_out, char *arg)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ int hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
return _on_plugin_init(name_out, description_out, version_out, arg, HEXCHATLIBDIR);
|
||||
}
|
||||
|
||||
int hexchat_plugin_deinit(void)
|
||||
int zoitechat_plugin_deinit(void)
|
||||
{
|
||||
int ret = _on_plugin_deinit();
|
||||
ph = NULL;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from _hexchat import *
|
||||
@@ -14,17 +14,17 @@ else
|
||||
endif
|
||||
|
||||
python3_source = custom_target('python-bindings',
|
||||
input: ['../../src/common/hexchat-plugin.h', 'python.py'],
|
||||
input: ['../../src/common/zoitechat-plugin.h', 'python.py'],
|
||||
output: 'python.c',
|
||||
command: [find_program('generate_plugin.py'), '@INPUT@', '@OUTPUT@']
|
||||
)
|
||||
|
||||
install_data(['_hexchat.py', 'hexchat.py', 'xchat.py'],
|
||||
install_dir: join_paths(get_option('libdir'), 'hexchat/python')
|
||||
install_data(['_zoitechat.py', 'zoitechat.py', 'xchat.py'],
|
||||
install_dir: join_paths(get_option('libdir'), 'zoitechat/python')
|
||||
)
|
||||
|
||||
shared_module('python', python3_source,
|
||||
dependencies: [hexchat_plugin_dep, python_dep],
|
||||
dependencies: [zoitechat_plugin_dep, python_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
|
||||
@@ -9,7 +9,7 @@ import traceback
|
||||
import weakref
|
||||
from contextlib import contextmanager
|
||||
|
||||
from _hexchat_embedded import ffi, lib
|
||||
from _zoitechat_embedded import ffi, lib
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from io import BytesIO as HelpEater
|
||||
@@ -17,17 +17,17 @@ else:
|
||||
from io import StringIO as HelpEater
|
||||
|
||||
if not hasattr(sys, 'argv'):
|
||||
sys.argv = ['<hexchat>']
|
||||
sys.argv = ['<zoitechat>']
|
||||
|
||||
VERSION = b'2.0' # Sync with hexchat.__version__
|
||||
VERSION = b'2.0' # Sync with zoitechat.__version__
|
||||
PLUGIN_NAME = ffi.new('char[]', b'Python')
|
||||
PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1]))
|
||||
PLUGIN_VERSION = ffi.new('char[]', VERSION)
|
||||
|
||||
# TODO: Constants should be screaming snake case
|
||||
hexchat = None
|
||||
zoitechat = None
|
||||
local_interp = None
|
||||
hexchat_stdout = None
|
||||
zoitechat_stdout = None
|
||||
plugins = set()
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ def redirected_stdout():
|
||||
sys.stdout = sys.__stdout__
|
||||
sys.stderr = sys.__stderr__
|
||||
yield
|
||||
sys.stdout = hexchat_stdout
|
||||
sys.stderr = hexchat_stdout
|
||||
sys.stdout = zoitechat_stdout
|
||||
sys.stderr = zoitechat_stdout
|
||||
|
||||
|
||||
if os.getenv('HEXCHAT_LOG_PYTHON'):
|
||||
@@ -59,13 +59,13 @@ class Stdout:
|
||||
idx = string.rfind(b'\n')
|
||||
if idx != -1:
|
||||
self.buffer += string[:idx]
|
||||
lib.hexchat_print(lib.ph, bytes(self.buffer))
|
||||
lib.zoitechat_print(lib.ph, bytes(self.buffer))
|
||||
self.buffer = bytearray(string[idx + 1:])
|
||||
else:
|
||||
self.buffer += string
|
||||
|
||||
def flush(self):
|
||||
lib.hexchat_print(lib.ph, bytes(self.buffer))
|
||||
lib.zoitechat_print(lib.ph, bytes(self.buffer))
|
||||
self.buffer = bytearray()
|
||||
|
||||
def isatty(self):
|
||||
@@ -86,14 +86,14 @@ class Hook:
|
||||
self.plugin = weakref.proxy(plugin)
|
||||
self.callback = callback
|
||||
self.userdata = userdata
|
||||
self.hexchat_hook = None
|
||||
self.zoitechat_hook = None
|
||||
self.handle = ffi.new_handle(weakref.proxy(self))
|
||||
|
||||
def __del__(self):
|
||||
log('Removing hook', id(self))
|
||||
if self.is_unload is False:
|
||||
assert self.hexchat_hook is not None
|
||||
lib.hexchat_unhook(lib.ph, self.hexchat_hook)
|
||||
assert self.zoitechat_hook is not None
|
||||
lib.zoitechat_unhook(lib.ph, self.zoitechat_hook)
|
||||
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
@@ -159,17 +159,17 @@ class Plugin:
|
||||
self.name = self.globals['__module_name__']
|
||||
|
||||
except KeyError:
|
||||
lib.hexchat_print(lib.ph, b'Failed to load module: __module_name__ must be set')
|
||||
lib.zoitechat_print(lib.ph, b'Failed to load module: __module_name__ must be set')
|
||||
|
||||
return False
|
||||
|
||||
self.version = self.globals.get('__module_version__', '')
|
||||
self.description = self.globals.get('__module_description__', '')
|
||||
self.ph = lib.hexchat_plugingui_add(lib.ph, filename.encode(), self.name.encode(),
|
||||
self.ph = lib.zoitechat_plugingui_add(lib.ph, filename.encode(), self.name.encode(),
|
||||
self.description.encode(), self.version.encode(), ffi.NULL)
|
||||
|
||||
except Exception as e:
|
||||
lib.hexchat_print(lib.ph, 'Failed to load module: {}'.format(e).encode())
|
||||
lib.zoitechat_print(lib.ph, 'Failed to load module: {}'.format(e).encode())
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
@@ -188,7 +188,7 @@ class Plugin:
|
||||
|
||||
del self.hooks
|
||||
if self.ph is not None:
|
||||
lib.hexchat_plugingui_remove(lib.ph, self.ph)
|
||||
lib.zoitechat_plugingui_remove(lib.ph, self.ph)
|
||||
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
@@ -292,7 +292,7 @@ def _on_timer_hook(userdata):
|
||||
return 1
|
||||
|
||||
try:
|
||||
# Avoid calling hexchat_unhook twice if unnecessary
|
||||
# Avoid calling zoitechat_unhook twice if unnecessary
|
||||
hook.is_unload = True
|
||||
except ReferenceError:
|
||||
# hook is a weak reference, it might have been destroyed by the callback
|
||||
@@ -310,10 +310,10 @@ def _on_timer_hook(userdata):
|
||||
|
||||
@ffi.def_extern(error=3)
|
||||
def _on_say_command(word, word_eol, userdata):
|
||||
channel = ffi.string(lib.hexchat_get_info(lib.ph, b'channel'))
|
||||
channel = ffi.string(lib.zoitechat_get_info(lib.ph, b'channel'))
|
||||
if channel == b'>>python<<':
|
||||
python = ffi.string(word_eol[1])
|
||||
lib.hexchat_print(lib.ph, b'>>> ' + python)
|
||||
lib.zoitechat_print(lib.ph, b'>>> ' + python)
|
||||
exec_in_interp(__decode(python))
|
||||
return 1
|
||||
|
||||
@@ -323,7 +323,7 @@ def _on_say_command(word, word_eol, userdata):
|
||||
def load_filename(filename):
|
||||
filename = os.path.expanduser(filename)
|
||||
if not os.path.isabs(filename):
|
||||
configdir = __decode(ffi.string(lib.hexchat_get_info(lib.ph, b'configdir')))
|
||||
configdir = __decode(ffi.string(lib.zoitechat_get_info(lib.ph, b'configdir')))
|
||||
|
||||
filename = os.path.join(configdir, 'addons', filename)
|
||||
|
||||
@@ -366,7 +366,7 @@ def change_cwd(path):
|
||||
|
||||
|
||||
def autoload():
|
||||
configdir = __decode(ffi.string(lib.hexchat_get_info(lib.ph, b'configdir')))
|
||||
configdir = __decode(ffi.string(lib.zoitechat_get_info(lib.ph, b'configdir')))
|
||||
addondir = os.path.join(configdir, 'addons')
|
||||
try:
|
||||
with change_cwd(addondir): # Maintaining old behavior
|
||||
@@ -382,7 +382,7 @@ def autoload():
|
||||
|
||||
def list_plugins():
|
||||
if not plugins:
|
||||
lib.hexchat_print(lib.ph, b'No python modules loaded')
|
||||
lib.zoitechat_print(lib.ph, b'No python modules loaded')
|
||||
return
|
||||
|
||||
tbl_headers = [b'Name', b'Version', b'Filename', b'Description']
|
||||
@@ -404,9 +404,9 @@ def list_plugins():
|
||||
]
|
||||
|
||||
for row in tbl:
|
||||
lib.hexchat_print(lib.ph, b' '.join(item.ljust(column_sizes[i])
|
||||
lib.zoitechat_print(lib.ph, b' '.join(item.ljust(column_sizes[i])
|
||||
for i, item in enumerate(row)))
|
||||
lib.hexchat_print(lib.ph, b'')
|
||||
lib.zoitechat_print(lib.ph, b'')
|
||||
|
||||
|
||||
def exec_in_interp(python):
|
||||
@@ -418,16 +418,16 @@ def exec_in_interp(python):
|
||||
if local_interp is None:
|
||||
local_interp = Plugin()
|
||||
local_interp.locals = {}
|
||||
local_interp.globals['hexchat'] = hexchat
|
||||
local_interp.globals['zoitechat'] = zoitechat
|
||||
|
||||
code = compile_line(python)
|
||||
try:
|
||||
ret = eval(code, local_interp.globals, local_interp.locals)
|
||||
if ret is not None:
|
||||
lib.hexchat_print(lib.ph, '{}'.format(ret).encode())
|
||||
lib.zoitechat_print(lib.ph, '{}'.format(ret).encode())
|
||||
|
||||
except Exception as e:
|
||||
traceback.print_exc(file=hexchat_stdout)
|
||||
traceback.print_exc(file=zoitechat_stdout)
|
||||
|
||||
|
||||
@ffi.def_extern()
|
||||
@@ -475,32 +475,32 @@ def _on_py_command(word, word_eol, userdata):
|
||||
elif subcmd == 'unload':
|
||||
name = __decode(ffi.string(word[3]))
|
||||
if not unload_name(name):
|
||||
lib.hexchat_print(lib.ph, b'Can\'t find a python plugin with that name')
|
||||
lib.zoitechat_print(lib.ph, b'Can\'t find a python plugin with that name')
|
||||
|
||||
elif subcmd == 'reload':
|
||||
name = __decode(ffi.string(word[3]))
|
||||
if not reload_name(name):
|
||||
lib.hexchat_print(lib.ph, b'Can\'t find a python plugin with that name')
|
||||
lib.zoitechat_print(lib.ph, b'Can\'t find a python plugin with that name')
|
||||
|
||||
elif subcmd == 'console':
|
||||
lib.hexchat_command(lib.ph, b'QUERY >>python<<')
|
||||
lib.zoitechat_command(lib.ph, b'QUERY >>python<<')
|
||||
|
||||
elif subcmd == 'list':
|
||||
list_plugins()
|
||||
|
||||
elif subcmd == 'about':
|
||||
lib.hexchat_print(lib.ph, b'HexChat Python interface version ' + VERSION)
|
||||
lib.zoitechat_print(lib.ph, b'ZoiteChat Python interface version ' + VERSION)
|
||||
|
||||
else:
|
||||
lib.hexchat_command(lib.ph, b'HELP PY')
|
||||
lib.zoitechat_command(lib.ph, b'HELP PY')
|
||||
|
||||
return 3
|
||||
|
||||
|
||||
@ffi.def_extern()
|
||||
def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir):
|
||||
global hexchat
|
||||
global hexchat_stdout
|
||||
global zoitechat
|
||||
global zoitechat_stdout
|
||||
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
|
||||
@@ -512,23 +512,23 @@ def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir):
|
||||
libdir = __decode(ffi.string(libdir))
|
||||
modpath = os.path.join(libdir, '..', 'python')
|
||||
sys.path.append(os.path.abspath(modpath))
|
||||
hexchat = importlib.import_module('hexchat')
|
||||
zoitechat = importlib.import_module('zoitechat')
|
||||
|
||||
except (UnicodeDecodeError, ImportError) as e:
|
||||
lib.hexchat_print(lib.ph, b'Failed to import module: ' + repr(e).encode())
|
||||
lib.zoitechat_print(lib.ph, b'Failed to import module: ' + repr(e).encode())
|
||||
|
||||
return 0
|
||||
|
||||
hexchat_stdout = Stdout()
|
||||
sys.stdout = hexchat_stdout
|
||||
sys.stderr = hexchat_stdout
|
||||
zoitechat_stdout = Stdout()
|
||||
sys.stdout = zoitechat_stdout
|
||||
sys.stderr = zoitechat_stdout
|
||||
pydoc.help = pydoc.Helper(HelpEater(), HelpEater())
|
||||
|
||||
lib.hexchat_hook_command(lib.ph, b'', 0, lib._on_say_command, ffi.NULL, ffi.NULL)
|
||||
lib.hexchat_hook_command(lib.ph, b'LOAD', 0, lib._on_load_command, ffi.NULL, ffi.NULL)
|
||||
lib.hexchat_hook_command(lib.ph, b'UNLOAD', 0, lib._on_unload_command, ffi.NULL, ffi.NULL)
|
||||
lib.hexchat_hook_command(lib.ph, b'RELOAD', 0, lib._on_reload_command, ffi.NULL, ffi.NULL)
|
||||
lib.hexchat_hook_command(lib.ph, b'PY', 0, lib._on_py_command, b'''Usage: /PY LOAD <filename>
|
||||
lib.zoitechat_hook_command(lib.ph, b'', 0, lib._on_say_command, ffi.NULL, ffi.NULL)
|
||||
lib.zoitechat_hook_command(lib.ph, b'LOAD', 0, lib._on_load_command, ffi.NULL, ffi.NULL)
|
||||
lib.zoitechat_hook_command(lib.ph, b'UNLOAD', 0, lib._on_unload_command, ffi.NULL, ffi.NULL)
|
||||
lib.zoitechat_hook_command(lib.ph, b'RELOAD', 0, lib._on_reload_command, ffi.NULL, ffi.NULL)
|
||||
lib.zoitechat_hook_command(lib.ph, b'PY', 0, lib._on_py_command, b'''Usage: /PY LOAD <filename>
|
||||
UNLOAD <filename|name>
|
||||
RELOAD <filename|name>
|
||||
LIST
|
||||
@@ -536,7 +536,7 @@ def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir):
|
||||
CONSOLE
|
||||
ABOUT''', ffi.NULL)
|
||||
|
||||
lib.hexchat_print(lib.ph, b'Python interface loaded')
|
||||
lib.zoitechat_print(lib.ph, b'Python interface loaded')
|
||||
autoload()
|
||||
return 1
|
||||
|
||||
@@ -544,19 +544,19 @@ def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir):
|
||||
@ffi.def_extern()
|
||||
def _on_plugin_deinit():
|
||||
global local_interp
|
||||
global hexchat
|
||||
global hexchat_stdout
|
||||
global zoitechat
|
||||
global zoitechat_stdout
|
||||
global plugins
|
||||
|
||||
plugins = set()
|
||||
local_interp = None
|
||||
hexchat = None
|
||||
hexchat_stdout = None
|
||||
zoitechat = None
|
||||
zoitechat_stdout = None
|
||||
sys.stdout = sys.__stdout__
|
||||
sys.stderr = sys.__stderr__
|
||||
pydoc.help = pydoc.Helper()
|
||||
|
||||
for mod in ('_hexchat', 'hexchat', 'xchat', '_hexchat_embedded'):
|
||||
for mod in ('_zoitechat', 'zoitechat', 'xchat', '_zoitechat_embedded'):
|
||||
try:
|
||||
del sys.modules[mod]
|
||||
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>$(Python3Output)</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>python.def</ModuleDefinitionFile>
|
||||
@@ -38,13 +38,13 @@
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(Python3Path)\python.exe" generate_plugin.py ..\..\src\common\hexchat-plugin.h python.py "$(IntDir)python.c"</Command>
|
||||
<Command>"$(Python3Path)\python.exe" generate_plugin.py ..\..\src\common\zoitechat-plugin.h python.py "$(IntDir)python.c"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;PYTHON_EXPORTS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(Glib);$(Python3Path)\include;..\..\src\common;$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>python.def</ModuleDefinitionFile>
|
||||
@@ -52,16 +52,16 @@
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;$(Python3Path)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>"$(Python3Path)\python.exe" generate_plugin.py ..\..\src\common\hexchat-plugin.h python.py "$(IntDir)python.c"</Command>
|
||||
<Command>"$(Python3Path)\python.exe" generate_plugin.py ..\..\src\common\zoitechat-plugin.h python.py "$(IntDir)python.c"</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="generate_plugin.py" />
|
||||
<None Include="hexchat.py" />
|
||||
<None Include="zoitechat.py" />
|
||||
<None Include="python.def" />
|
||||
<None Include="python.py" />
|
||||
<None Include="xchat.py" />
|
||||
<None Include="_hexchat.py" />
|
||||
<None Include="_zoitechat.py" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(IntDir)python.c" />
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
<None Include="python.def">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="_hexchat.py">
|
||||
<None Include="_zoitechat.py">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="generate_plugin.py">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="hexchat.py">
|
||||
<None Include="zoitechat.py">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="python.py">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# HexChat Python Module Style Guide
|
||||
# ZoiteChat Python Module Style Guide
|
||||
|
||||
(This is a work in progress).
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
from _hexchat import *
|
||||
from _zoitechat import *
|
||||
|
||||
1
plugins/python/zoitechat.py
Normal file
1
plugins/python/zoitechat.py
Normal file
@@ -0,0 +1 @@
|
||||
from _zoitechat import *
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -5,7 +5,7 @@ sysinfo_sources = [
|
||||
|
||||
sysinfo_deps = [
|
||||
libgio_dep,
|
||||
hexchat_plugin_dep,
|
||||
zoitechat_plugin_dep,
|
||||
common_sysinfo_deps,
|
||||
]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2012 Berke Viktor.
|
||||
*
|
||||
* xsys.c - main functions for X-Sys 2
|
||||
@@ -29,14 +29,14 @@
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
#include "sysinfo-backend.h"
|
||||
#include "sysinfo.h"
|
||||
|
||||
#define _(x) hexchat_gettext(ph,x)
|
||||
#define _(x) zoitechat_gettext(ph,x)
|
||||
#define DEFAULT_ANNOUNCE TRUE
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static zoitechat_plugin *ph;
|
||||
|
||||
static char name[] = "Sysinfo";
|
||||
static char desc[] = "Display info about your hardware and OS";
|
||||
@@ -54,7 +54,7 @@ typedef struct
|
||||
static char *
|
||||
get_client (void)
|
||||
{
|
||||
return g_strdup_printf ("HexChat %s", hexchat_get_info(ph, "version"));
|
||||
return g_strdup_printf ("ZoiteChat %s", zoitechat_get_info(ph, "version"));
|
||||
}
|
||||
|
||||
static hwinfo hwinfos[] = {
|
||||
@@ -102,7 +102,7 @@ print_summary (gboolean announce)
|
||||
}
|
||||
|
||||
output = g_strjoinv (" \002\342\200\242\002 ", strings);
|
||||
hexchat_commandf (ph, "%s %s", announce ? "SAY" : "ECHO", output);
|
||||
zoitechat_commandf (ph, "%s %s", announce ? "SAY" : "ECHO", output);
|
||||
|
||||
g_strfreev (strings);
|
||||
g_free (output);
|
||||
@@ -120,23 +120,23 @@ print_info (char *info, gboolean announce)
|
||||
char *str = hwinfos[i].callback();
|
||||
if (str)
|
||||
{
|
||||
hexchat_commandf (ph, "%s \002%s\002: %s", announce ? "SAY" : "ECHO",
|
||||
zoitechat_commandf (ph, "%s \002%s\002: %s", announce ? "SAY" : "ECHO",
|
||||
hwinfos[i].title, str);
|
||||
g_free (str);
|
||||
}
|
||||
else
|
||||
hexchat_print (ph, _("Sysinfo: Failed to get info. Either not supported or error."));
|
||||
zoitechat_print (ph, _("Sysinfo: Failed to get info. Either not supported or error."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hexchat_print (ph, _("Sysinfo: No info by that name\n"));
|
||||
zoitechat_print (ph, _("Sysinfo: No info by that name\n"));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sysinfo_get_bool_pref (const char *pref, gboolean def)
|
||||
{
|
||||
int value = hexchat_pluginpref_get_int (ph, pref);
|
||||
int value = zoitechat_pluginpref_get_int (ph, pref);
|
||||
|
||||
if (value != -1)
|
||||
return value;
|
||||
@@ -150,12 +150,12 @@ sysinfo_set_pref_real (const char *pref, char *value, gboolean def)
|
||||
if (value && value[0])
|
||||
{
|
||||
guint64 i = g_ascii_strtoull (value, NULL, 0);
|
||||
hexchat_pluginpref_set_int (ph, pref, i != 0);
|
||||
hexchat_printf (ph, _("Sysinfo: %s is set to: %d\n"), pref, i != 0);
|
||||
zoitechat_pluginpref_set_int (ph, pref, i != 0);
|
||||
zoitechat_printf (ph, _("Sysinfo: %s is set to: %d\n"), pref, i != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_printf (ph, _("Sysinfo: %s is set to: %d\n"), pref,
|
||||
zoitechat_printf (ph, _("Sysinfo: %s is set to: %d\n"), pref,
|
||||
sysinfo_get_bool_pref(pref, def));
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ sysinfo_set_pref (char *key, char *value)
|
||||
{
|
||||
if (!key || !key[0])
|
||||
{
|
||||
hexchat_print (ph, _("Sysinfo: Valid settings are: announce and hide_* for each piece of information. e.g. hide_os. Without a value it will show current (or default) setting.\n"));
|
||||
zoitechat_print (ph, _("Sysinfo: Valid settings are: announce and hide_* for each piece of information. e.g. hide_os. Without a value it will show current (or default) setting.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ sysinfo_set_pref (char *key, char *value)
|
||||
}
|
||||
}
|
||||
|
||||
hexchat_print (ph, _("Sysinfo: Invalid variable name\n"));
|
||||
zoitechat_print (ph, _("Sysinfo: Invalid variable name\n"));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -210,7 +210,7 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
||||
}
|
||||
|
||||
/* Cannot send to server tab */
|
||||
channel_type = hexchat_list_int (ph, NULL, "type");
|
||||
channel_type = zoitechat_list_int (ph, NULL, "type");
|
||||
if (channel_type != 2 /* SESS_CHANNEL */ && channel_type != 3 /* SESS_DIALOG */)
|
||||
announce = FALSE;
|
||||
|
||||
@@ -226,24 +226,24 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
*plugin_name = name;
|
||||
*plugin_desc = desc;
|
||||
*plugin_version = version;
|
||||
|
||||
hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
||||
zoitechat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
||||
|
||||
hexchat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||
hexchat_printf (ph, _("%s plugin loaded\n"), name);
|
||||
zoitechat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||
zoitechat_printf (ph, _("%s plugin loaded\n"), name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
zoitechat_plugin_deinit (void)
|
||||
{
|
||||
hexchat_command (ph, "MENU DEL \"Window/Display System Info\"");
|
||||
hexchat_printf (ph, _("%s plugin unloaded\n"), name);
|
||||
zoitechat_command (ph, "MENU DEL \"Window/Display System Info\"");
|
||||
zoitechat_printf (ph, _("%s plugin unloaded\n"), name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -23,20 +23,20 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcsysinfo</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(HexChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(ZoiteChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
@@ -44,12 +44,12 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;SYSINFO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\src\common;$(DepsRoot)\include;$(Glib);$(ZoiteChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>$(HexChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(ZoiteChatLib)common.lib;wbemuuid.lib;comsupp.lib;$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>comsupp.lib</IgnoreSpecificDefaultLibraries>
|
||||
<ModuleDefinitionFile>sysinfo.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SysInfo - sysinfo plugin for HexChat
|
||||
* SysInfo - sysinfo plugin for ZoiteChat
|
||||
* Copyright (c) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
* Copyright (c) 2011-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
winsparkle_dep = cc.find_library('WinSparkle')
|
||||
|
||||
shared_module('upd', 'upd.c',
|
||||
dependencies: [winsparkle_dep, hexchat_plugin_dep],
|
||||
dependencies: [winsparkle_dep, zoitechat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
* Copyright (c) 2010-2012 Berke Viktor.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -22,15 +22,15 @@
|
||||
|
||||
#include <winsparkle.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
#define APPCAST_URL "https://hexchat.github.io/appcast.xml"
|
||||
#define APPCAST_URL "https://zoitechat.github.io/appcast.xml"
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static zoitechat_plugin *ph; /* plugin handle */
|
||||
static char name[] = "Update Checker";
|
||||
static char desc[] = "Check for HexChat updates automatically";
|
||||
static char desc[] = "Check for ZoiteChat updates automatically";
|
||||
static char version[] = "5.0";
|
||||
static const char upd_help[] = "Update Checker Usage:\n /UPDCHK, check for HexChat updates\n";
|
||||
static const char upd_help[] = "Update Checker Usage:\n /UPDCHK, check for ZoiteChat updates\n";
|
||||
|
||||
static int
|
||||
check_cmd (char *word[], char *word_eol[], void *userdata)
|
||||
@@ -41,7 +41,7 @@ check_cmd (char *word[], char *word_eol[], void *userdata)
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
|
||||
@@ -52,19 +52,19 @@ hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **p
|
||||
win_sparkle_set_appcast_url (APPCAST_URL);
|
||||
win_sparkle_init ();
|
||||
|
||||
hexchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, check_cmd, upd_help, NULL);
|
||||
hexchat_command (ph, "MENU -ishare\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
|
||||
hexchat_printf (ph, "%s plugin loaded\n", name);
|
||||
zoitechat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, check_cmd, upd_help, NULL);
|
||||
zoitechat_command (ph, "MENU -ishare\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
|
||||
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit (void)
|
||||
zoitechat_plugin_deinit (void)
|
||||
{
|
||||
win_sparkle_cleanup ();
|
||||
|
||||
hexchat_command (ph, "MENU DEL \"Help/Check for updates\"");
|
||||
hexchat_printf (ph, "%s plugin unloaded\n", name);
|
||||
zoitechat_command (ph, "MENU DEL \"Help/Check for updates\"");
|
||||
zoitechat_printf (ph, "%s plugin unloaded\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcupd</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
shared_module('winamp', 'winamp.c',
|
||||
dependencies: [libgio_dep, hexchat_plugin_dep],
|
||||
dependencies: [libgio_dep, zoitechat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "hexchat-plugin.h"
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
#define PLAYING 1
|
||||
#define PAUSED 3
|
||||
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static zoitechat_plugin *ph; /* plugin handle */
|
||||
|
||||
static int
|
||||
winamp(char *word[], char *word_eol[], void *userdata)
|
||||
@@ -36,35 +36,35 @@ winamp(char *word[], char *word_eol[], void *userdata)
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
|
||||
|
||||
if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
|
||||
hexchat_printf(ph, "Winamp: playing");
|
||||
zoitechat_printf(ph, "Winamp: playing");
|
||||
else
|
||||
hexchat_printf(ph, "Winamp: paused");
|
||||
zoitechat_printf(ph, "Winamp: paused");
|
||||
}
|
||||
}
|
||||
else if (!stricmp("STOP", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
|
||||
hexchat_printf(ph, "Winamp: stopped");
|
||||
zoitechat_printf(ph, "Winamp: stopped");
|
||||
}
|
||||
else if (!stricmp("PLAY", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
|
||||
hexchat_printf(ph, "Winamp: playing");
|
||||
zoitechat_printf(ph, "Winamp: playing");
|
||||
}
|
||||
else if (!stricmp("NEXT", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
|
||||
hexchat_printf(ph, "Winamp: next playlist entry");
|
||||
zoitechat_printf(ph, "Winamp: next playlist entry");
|
||||
}
|
||||
else if (!stricmp("PREV", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
|
||||
hexchat_printf(ph, "Winamp: previous playlist entry");
|
||||
zoitechat_printf(ph, "Winamp: previous playlist entry");
|
||||
}
|
||||
else if (!stricmp("START", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
|
||||
hexchat_printf(ph, "Winamp: playlist start");
|
||||
zoitechat_printf(ph, "Winamp: playlist start");
|
||||
}
|
||||
else if (!word_eol[2][0])
|
||||
{
|
||||
@@ -75,7 +75,7 @@ winamp(char *word[], char *word_eol[], void *userdata)
|
||||
current_play = g_utf16_to_utf8 (wcurrent_play, len, NULL, NULL, NULL);
|
||||
if (!current_play)
|
||||
{
|
||||
hexchat_print (ph, "Winamp: Error getting song information.");
|
||||
zoitechat_print (ph, "Winamp: Error getting song information.");
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
@@ -105,50 +105,50 @@ winamp(char *word[], char *word_eol[], void *userdata)
|
||||
p = current_play;
|
||||
|
||||
if (*p != '\0')
|
||||
hexchat_commandf (ph, "me is now playing: %s", p);
|
||||
zoitechat_commandf (ph, "me is now playing: %s", p);
|
||||
else
|
||||
hexchat_print (ph, "Winamp: No song information found.");
|
||||
zoitechat_print (ph, "Winamp: No song information found.");
|
||||
g_free (current_play);
|
||||
}
|
||||
else
|
||||
hexchat_print(ph, "Winamp: Nothing being played.");
|
||||
zoitechat_print(ph, "Winamp: Nothing being played.");
|
||||
}
|
||||
else
|
||||
hexchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
|
||||
zoitechat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
hexchat_print(ph, "Winamp not found.\n");
|
||||
zoitechat_print(ph, "Winamp not found.\n");
|
||||
}
|
||||
return HEXCHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_init(hexchat_plugin *plugin_handle,
|
||||
zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
||||
char **plugin_name,
|
||||
char **plugin_desc,
|
||||
char **plugin_version,
|
||||
char *arg)
|
||||
{
|
||||
/* we need to save this for use with any hexchat_* functions */
|
||||
/* we need to save this for use with any zoitechat_* functions */
|
||||
ph = plugin_handle;
|
||||
|
||||
*plugin_name = "Winamp";
|
||||
*plugin_desc = "Winamp plugin for HexChat";
|
||||
*plugin_desc = "Winamp plugin for ZoiteChat";
|
||||
*plugin_version = "0.6";
|
||||
|
||||
hexchat_hook_command (ph, "WINAMP", HEXCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
|
||||
hexchat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
|
||||
zoitechat_hook_command (ph, "WINAMP", HEXCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
|
||||
zoitechat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
|
||||
|
||||
hexchat_print (ph, "Winamp plugin loaded\n");
|
||||
zoitechat_print (ph, "Winamp plugin loaded\n");
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
}
|
||||
|
||||
int
|
||||
hexchat_plugin_deinit(void)
|
||||
zoitechat_plugin_deinit(void)
|
||||
{
|
||||
hexchat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
|
||||
hexchat_print (ph, "Winamp plugin unloaded\n");
|
||||
zoitechat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
|
||||
zoitechat_print (ph, "Winamp plugin unloaded\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
EXPORTS
|
||||
hexchat_plugin_init
|
||||
hexchat_plugin_deinit
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\hexchat.props" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcwinamp</TargetName>
|
||||
<OutDir>$(HexChatRel)plugins\</OutDir>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
|
||||
Reference in New Issue
Block a user