mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-18 11:40:18 +00:00
Compare commits
49 Commits
zoitechat-
...
zoitechat-
| Author | SHA1 | Date | |
|---|---|---|---|
| 303d5cc581 | |||
|
|
cf2e44f3d5 | ||
|
|
049d3c19af | ||
|
|
7be145b94a | ||
|
|
e365266b4a | ||
|
|
4ad5df0370 | ||
|
|
887d891541 | ||
| 041288cdad | |||
| c8ee118f00 | |||
| d4134c94b3 | |||
| 5ca3e835a7 | |||
| 6c85c796d3 | |||
| 992215ee91 | |||
|
|
4cf1b52982 | ||
| bc1d2e5f7a | |||
| a0f0c48bc5 | |||
| 4d6c77704c | |||
| 2b98ebc544 | |||
|
|
4ed7032fd5 | ||
|
|
4e01192979 | ||
|
|
2127820ae0 | ||
|
|
a40f53a1f3 | ||
|
|
0e661dec95 | ||
|
|
e503bec31a | ||
|
|
628bb2e157 | ||
|
|
afeae7380d | ||
|
|
3530a5c191 | ||
|
|
92b9577a19 | ||
|
|
56dc9b1b4a | ||
| 8c3986ffe0 | |||
|
|
c2b67e647d | ||
| 6137fdbd91 | |||
| 35ecc2c643 | |||
| cb8b8bd4cc | |||
| 7279e3592f | |||
| 8d275ddb31 | |||
| cf41615cb3 | |||
| c1f855c2ab | |||
| 4ac836fc66 | |||
| 5986e6a78b | |||
| 0601be026c | |||
| 24b0a3d75f | |||
| 2ac5234803 | |||
| 30e309853c | |||
| 944ce69906 | |||
| 4bf5316cfa | |||
| 136e63a6cd | |||
| 5ea424d0e8 | |||
|
|
d0e7e45a41 |
2
.github/workflows/appimage-build.yml
vendored
2
.github/workflows/appimage-build.yml
vendored
@@ -42,6 +42,8 @@ jobs:
|
|||||||
meson setup build \
|
meson setup build \
|
||||||
--prefix=/usr \
|
--prefix=/usr \
|
||||||
-Dtext-frontend=true \
|
-Dtext-frontend=true \
|
||||||
|
-Dwith-perl=perl \
|
||||||
|
-Dwith-python=python3 \
|
||||||
-Dauto_features=enabled
|
-Dauto_features=enabled
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|||||||
2
.mailmap
2
.mailmap
@@ -1,5 +1,5 @@
|
|||||||
Berke Viktor <github.bviktor@outlook.com> <berkeviktor@aol.com>
|
Berke Viktor <github.bviktor@outlook.com> <berkeviktor@aol.com>
|
||||||
Berke Viktor <github.bviktor@outlook.com> <bviktor@zoitechat.org>
|
Berke Viktor <github.bviktor@outlook.com> <bviktor@hexchat.org>
|
||||||
Berke Viktor <github.bviktor@outlook.com> <bviktor@outlook.com>
|
Berke Viktor <github.bviktor@outlook.com> <bviktor@outlook.com>
|
||||||
Berke Viktor <github.bviktor@outlook.com> berkeviktor@aol.com
|
Berke Viktor <github.bviktor@outlook.com> berkeviktor@aol.com
|
||||||
Patrick Griffis <tingping@tingping.se> TingPing <tingping@fedoraproject.org>
|
Patrick Griffis <tingping@tingping.se> TingPing <tingping@fedoraproject.org>
|
||||||
|
|||||||
43
Makefile
Normal file
43
Makefile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
PREFIX ?= /usr/local
|
||||||
|
BUILD_DIR ?= build
|
||||||
|
MESON ?= meson
|
||||||
|
NINJA ?= ninja
|
||||||
|
MESON_SETUP_ARGS ?=
|
||||||
|
MESON_COMPILE_ARGS ?=
|
||||||
|
MESON_INSTALL_ARGS ?=
|
||||||
|
|
||||||
|
CONFIG_STAMP := $(BUILD_DIR)/build.ninja
|
||||||
|
|
||||||
|
.PHONY: all configure build reconfigure install uninstall clean distclean
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
# Only run initial meson setup if we don't have a configured build dir yet.
|
||||||
|
$(CONFIG_STAMP):
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
@env NINJA=$(NINJA) $(MESON) setup $(BUILD_DIR) --prefix=$(PREFIX) $(MESON_SETUP_ARGS)
|
||||||
|
|
||||||
|
configure: $(CONFIG_STAMP)
|
||||||
|
|
||||||
|
build: configure
|
||||||
|
@env NINJA=$(NINJA) $(MESON) compile -C $(BUILD_DIR) $(MESON_COMPILE_ARGS)
|
||||||
|
|
||||||
|
reconfigure:
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
||||||
|
@env NINJA=$(NINJA) $(MESON) setup --reconfigure $(BUILD_DIR) --prefix=$(PREFIX) $(MESON_SETUP_ARGS)
|
||||||
|
|
||||||
|
install: build
|
||||||
|
@env NINJA=$(NINJA) $(MESON) install -C $(BUILD_DIR) $(MESON_INSTALL_ARGS)
|
||||||
|
|
||||||
|
uninstall: configure
|
||||||
|
@$(NINJA) -C $(BUILD_DIR) uninstall
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@if [ -f "$(CONFIG_STAMP)" ]; then \
|
||||||
|
env NINJA=$(NINJA) $(MESON) compile -C $(BUILD_DIR) --clean; \
|
||||||
|
else \
|
||||||
|
echo "Nothing to clean (no $(CONFIG_STAMP))."; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
distclean:
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
1113
changelog.rst
Normal file
1113
changelog.rst
Normal file
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,16 @@
|
|||||||
<id>zoitechat.desktop</id>
|
<id>zoitechat.desktop</id>
|
||||||
</provides>
|
</provides>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release date="2026-02-03" version="2.17.4">
|
||||||
|
<description>
|
||||||
|
<p>Fixes and minor features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>STS handling now persists server policies, enforces upgrades more consistently, and falls back to current ports when needed.</li>
|
||||||
|
<li>Windows build workflow updated (MSYS2 setup changes) and OpenSSL trust store handling tightened for safer TLS connections.</li>
|
||||||
|
<li>Reduced GLib coupling in multiple Windows subsystems (spellcheck, history, sysinfo) plus small stability fixes.</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release date="2026-01-17" version="2.17.3">
|
<release date="2026-01-17" version="2.17.3">
|
||||||
<description>
|
<description>
|
||||||
<p>Fixes and minor features:</p>
|
<p>Fixes and minor features:</p>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
project('zoitechat', 'c',
|
project('zoitechat', 'c',
|
||||||
version: '2.17.3',
|
version: '2.17.4',
|
||||||
meson_version: '>= 0.47.0',
|
meson_version: '>= 0.47.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=gnu89',
|
'c_std=gnu89',
|
||||||
@@ -54,7 +54,7 @@ config_h.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_36')
|
|||||||
config_h.set('HAVE_MEMRCHR', cc.has_function('memrchr'))
|
config_h.set('HAVE_MEMRCHR', cc.has_function('memrchr'))
|
||||||
config_h.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
|
config_h.set('HAVE_STRINGS_H', cc.has_header('strings.h'))
|
||||||
|
|
||||||
config_h.set_quoted('HEXCHATLIBDIR',
|
config_h.set_quoted('ZOITECHATLIBDIR',
|
||||||
join_paths(get_option('prefix'), get_option('libdir'), 'zoitechat/plugins')
|
join_paths(get_option('prefix'), get_option('libdir'), 'zoitechat/plugins')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export PANGO_SYSCONFDIR="$bundle_etc"
|
|||||||
|
|
||||||
export OPENSSL_CONF="/System/Library/OpenSSL/openssl.cnf"
|
export OPENSSL_CONF="/System/Library/OpenSSL/openssl.cnf"
|
||||||
|
|
||||||
export HEXCHAT_LIBDIR="$bundle_lib/zoitechat/plugins"
|
export ZOITECHAT_LIBDIR="$bundle_lib/zoitechat/plugins"
|
||||||
|
|
||||||
APP=name
|
APP=name
|
||||||
I18NDIR="$bundle_data/locale"
|
I18NDIR="$bundle_data/locale"
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ dccrecv_cb (char *word[], void *userdata)
|
|||||||
if (!filename_fs) {
|
if (!filename_fs) {
|
||||||
zoitechat_printf (ph, "Checksum: Invalid filename (%s)\n", filename);
|
zoitechat_printf (ph, "Checksum: Invalid filename (%s)\n", filename);
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChecksumCallbackInfo *callback_data = g_new (ChecksumCallbackInfo, 1);
|
ChecksumCallbackInfo *callback_data = g_new (ChecksumCallbackInfo, 1);
|
||||||
@@ -153,7 +153,7 @@ dccrecv_cb (char *word[], void *userdata)
|
|||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -177,7 +177,7 @@ dccoffer_cb (char *word[], void *userdata)
|
|||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -189,8 +189,8 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
|
|||||||
*plugin_desc = desc;
|
*plugin_desc = desc;
|
||||||
*plugin_version = version;
|
*plugin_version = version;
|
||||||
|
|
||||||
zoitechat_hook_print (ph, "DCC RECV Complete", HEXCHAT_PRI_NORM, dccrecv_cb, NULL);
|
zoitechat_hook_print (ph, "DCC RECV Complete", ZOITECHAT_PRI_NORM, dccrecv_cb, NULL);
|
||||||
zoitechat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_NORM, dccoffer_cb, NULL);
|
zoitechat_hook_print (ph, "DCC Offer", ZOITECHAT_PRI_NORM, dccoffer_cb, NULL);
|
||||||
|
|
||||||
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
|||||||
zoitechat_command (ph, "help exec");
|
zoitechat_command (ph, "help exec");
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -146,7 +146,7 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
|
|||||||
*plugin_desc = desc;
|
*plugin_desc = desc;
|
||||||
*plugin_version = version;
|
*plugin_version = version;
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "EXEC", HEXCHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside ZoiteChat", 0);
|
zoitechat_hook_command (ph, "EXEC", ZOITECHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside ZoiteChat", 0);
|
||||||
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
||||||
|
|
||||||
return 1; /* return 1 for success */
|
return 1; /* return 1 for success */
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ char *decrypt_raw_message(const char *message, const char *key) {
|
|||||||
zoitechat_printf(ph, ">%s< ", word[i]);
|
zoitechat_printf(ph, ">%s< ", word[i]);
|
||||||
}
|
}
|
||||||
zoitechat_printf(ph, "\n");
|
zoitechat_printf(ph, "\n");
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -299,7 +299,7 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
|
|||||||
const char *channel = zoitechat_get_info(ph, "channel");
|
const char *channel = zoitechat_get_info(ph, "channel");
|
||||||
|
|
||||||
/* Check if we can encrypt */
|
/* Check if we can encrypt */
|
||||||
if (!fish_nick_has_key(channel)) return HEXCHAT_EAT_NONE;
|
if (!fish_nick_has_key(channel)) return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
command = g_string_new("");
|
command = g_string_new("");
|
||||||
g_string_printf(command, "PRIVMSG %s :+OK ", channel);
|
g_string_printf(command, "PRIVMSG %s :+OK ", channel);
|
||||||
@@ -307,7 +307,7 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
|
|||||||
encrypted_list = fish_encrypt_for_nick(channel, word_eol[1], &mode, get_prefix_length() + command->len);
|
encrypted_list = fish_encrypt_for_nick(channel, word_eol[1], &mode, get_prefix_length() + command->len);
|
||||||
if (!encrypted_list) {
|
if (!encrypted_list) {
|
||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get prefix for own nick if any */
|
/* Get prefix for own nick if any */
|
||||||
@@ -333,7 +333,7 @@ static int handle_outgoing(char *word[], char *word_eol[], void *userdata) {
|
|||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
g_slist_free_full(encrypted_list, g_free);
|
g_slist_free_full(encrypted_list, g_free);
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,7 +350,7 @@ static int handle_incoming(char *word[], char *word_eol[], zoitechat_event_attrs
|
|||||||
GString *message;
|
GString *message;
|
||||||
|
|
||||||
if (!irc_parse_message((const char **)word, &prefix, &command, ¶meters_offset))
|
if (!irc_parse_message((const char **)word, &prefix, &command, ¶meters_offset))
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
/* Topic (command 332) has an extra parameter */
|
/* Topic (command 332) has an extra parameter */
|
||||||
if (!strcmp(command, "332"))
|
if (!strcmp(command, "332"))
|
||||||
@@ -367,7 +367,7 @@ static int handle_incoming(char *word[], char *word_eol[], zoitechat_event_attrs
|
|||||||
|
|
||||||
/* Nothing to decrypt */
|
/* Nothing to decrypt */
|
||||||
if (decrypted == NULL)
|
if (decrypted == NULL)
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
/* Build decrypted message */
|
/* Build decrypted message */
|
||||||
|
|
||||||
@@ -395,7 +395,7 @@ static int handle_incoming(char *word[], char *word_eol[], zoitechat_event_attrs
|
|||||||
zoitechat_command(ph, message->str);
|
zoitechat_command(ph, message->str);
|
||||||
g_string_free (message, TRUE);
|
g_string_free (message, TRUE);
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
||||||
@@ -407,10 +407,10 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
|||||||
enum fish_mode mode = FISH_ECB_MODE;
|
enum fish_mode mode = FISH_ECB_MODE;
|
||||||
|
|
||||||
if (!*dh_message || !*dh_pubkey || strlen(dh_pubkey) != 181)
|
if (!*dh_message || !*dh_pubkey || strlen(dh_pubkey) != 181)
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
if (!irc_parse_message((const char**)word, &prefix, NULL, NULL) || !prefix)
|
if (!irc_parse_message((const char**)word, &prefix, NULL, NULL) || !prefix)
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
sender = irc_prefix_get_nick(prefix);
|
sender = irc_prefix_get_nick(prefix);
|
||||||
query_ctx = find_context_on_network(sender);
|
query_ctx = find_context_on_network(sender);
|
||||||
@@ -447,7 +447,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
|||||||
} else {
|
} else {
|
||||||
/* Regular notice */
|
/* Regular notice */
|
||||||
g_free(sender);
|
g_free(sender);
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dh1080_compute_key(priv_key, dh_pubkey, &secret_key)) {
|
if (dh1080_compute_key(priv_key, dh_pubkey, &secret_key)) {
|
||||||
@@ -461,7 +461,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
|
|||||||
cleanup:
|
cleanup:
|
||||||
g_free(sender);
|
g_free(sender);
|
||||||
g_free(priv_key);
|
g_free(priv_key);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -475,7 +475,7 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
|
|||||||
/* Check syntax */
|
/* Check syntax */
|
||||||
if (*word[2] == '\0') {
|
if (*word[2] == '\0') {
|
||||||
zoitechat_printf(ph, "%s\n", usage_setkey);
|
zoitechat_printf(ph, "%s\n", usage_setkey);
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*word[3] == '\0') {
|
if (*word[3] == '\0') {
|
||||||
@@ -503,7 +503,7 @@ static int handle_setkey(char *word[], char *word_eol[], void *userdata) {
|
|||||||
zoitechat_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;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -523,7 +523,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
|
|||||||
/* Only allow channel or dialog */
|
/* Only allow channel or dialog */
|
||||||
if (ctx_type < 2 || ctx_type > 3) {
|
if (ctx_type < 2 || ctx_type > 3) {
|
||||||
zoitechat_printf(ph, "%s\n", usage_delkey);
|
zoitechat_printf(ph, "%s\n", usage_delkey);
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,7 +535,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) {
|
|||||||
}
|
}
|
||||||
g_free(nick);
|
g_free(nick);
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
|
static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
|
||||||
@@ -558,7 +558,7 @@ static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
|
|||||||
|
|
||||||
if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) {
|
if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) {
|
||||||
zoitechat_print(ph, "You can only exchange keys with individuals");
|
zoitechat_print(ph, "You can only exchange keys with individuals");
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dh1080_generate_key(&priv_key, &pub_key)) {
|
if (dh1080_generate_key(&priv_key, &pub_key)) {
|
||||||
@@ -572,7 +572,7 @@ static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
|
|||||||
zoitechat_print(ph, "Failed to generate keys");
|
zoitechat_print(ph, "Failed to generate keys");
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -587,12 +587,12 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
|
|||||||
|
|
||||||
if (!*topic) {
|
if (!*topic) {
|
||||||
zoitechat_print(ph, usage_topic);
|
zoitechat_print(ph, usage_topic);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zoitechat_list_int(ph, NULL, "type") != 2) {
|
if (zoitechat_list_int(ph, NULL, "type") != 2) {
|
||||||
zoitechat_printf(ph, "Please change to the channel window where you want to set the topic!");
|
zoitechat_printf(ph, "Please change to the channel window where you want to set the topic!");
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = zoitechat_get_info(ph, "channel");
|
target = zoitechat_get_info(ph, "channel");
|
||||||
@@ -600,7 +600,7 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
|
|||||||
/* Check if we can encrypt */
|
/* Check if we can encrypt */
|
||||||
if (!fish_nick_has_key(target)) {
|
if (!fish_nick_has_key(target)) {
|
||||||
zoitechat_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;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command = g_string_new("");
|
command = g_string_new("");
|
||||||
@@ -610,7 +610,7 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
|
|||||||
if (!encrypted_list) {
|
if (!encrypted_list) {
|
||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
zoitechat_printf(ph, "/topic+ error, can't encrypt %s", target);
|
zoitechat_printf(ph, "/topic+ error, can't encrypt %s", target);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoitechat_commandf(ph, "%s%s", command->str, (char *) encrypted_list->data);
|
zoitechat_commandf(ph, "%s%s", command->str, (char *) encrypted_list->data);
|
||||||
@@ -618,7 +618,7 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
|
|||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
g_slist_free_full(encrypted_list, g_free);
|
g_slist_free_full(encrypted_list, g_free);
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -634,13 +634,13 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
|
|||||||
|
|
||||||
if (!*target || !*notice) {
|
if (!*target || !*notice) {
|
||||||
zoitechat_print(ph, usage_notice);
|
zoitechat_print(ph, usage_notice);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we can encrypt */
|
/* Check if we can encrypt */
|
||||||
if (!fish_nick_has_key(target)) {
|
if (!fish_nick_has_key(target)) {
|
||||||
zoitechat_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;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command = g_string_new("");
|
command = g_string_new("");
|
||||||
@@ -650,7 +650,7 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
|
|||||||
if (!encrypted_list) {
|
if (!encrypted_list) {
|
||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
zoitechat_printf(ph, "/notice+ error, can't encrypt %s", target);
|
zoitechat_printf(ph, "/notice+ error, can't encrypt %s", target);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
notice_flag = g_strconcat("[", fish_modes[mode], "] ", notice, NULL);
|
notice_flag = g_strconcat("[", fish_modes[mode], "] ", notice, NULL);
|
||||||
@@ -668,7 +668,7 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
|
|||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
g_slist_free_full(encrypted_list, g_free);
|
g_slist_free_full(encrypted_list, g_free);
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -686,13 +686,13 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
|
|||||||
|
|
||||||
if (!*target || !*message) {
|
if (!*target || !*message) {
|
||||||
zoitechat_print(ph, usage_msg);
|
zoitechat_print(ph, usage_msg);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we can encrypt */
|
/* Check if we can encrypt */
|
||||||
if (!fish_nick_has_key(target)) {
|
if (!fish_nick_has_key(target)) {
|
||||||
zoitechat_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;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command = g_string_new("");
|
command = g_string_new("");
|
||||||
@@ -702,7 +702,7 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
|
|||||||
if (!encrypted_list) {
|
if (!encrypted_list) {
|
||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
zoitechat_printf(ph, "/msg+ error, can't encrypt %s", target);
|
zoitechat_printf(ph, "/msg+ error, can't encrypt %s", target);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send encrypted messages */
|
/* Send encrypted messages */
|
||||||
@@ -731,7 +731,7 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
|
|||||||
zoitechat_emit_print(ph, "Message Send", target, message);
|
zoitechat_emit_print(ph, "Message Send", target, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
||||||
@@ -742,7 +742,7 @@ static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
|||||||
|
|
||||||
/* Check if we can encrypt */
|
/* Check if we can encrypt */
|
||||||
if (!fish_nick_has_key(channel)) {
|
if (!fish_nick_has_key(channel)) {
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
command = g_string_new("");
|
command = g_string_new("");
|
||||||
@@ -753,7 +753,7 @@ static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
|||||||
if (!encrypted_list) {
|
if (!encrypted_list) {
|
||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
zoitechat_printf(ph, "/me error, can't encrypt %s", channel);
|
zoitechat_printf(ph, "/me error, can't encrypt %s", channel);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zoitechat_emit_print(ph, "Your Action", zoitechat_get_info(ph, "nick"), word_eol[2], NULL);
|
zoitechat_emit_print(ph, "Your Action", zoitechat_get_info(ph, "nick"), word_eol[2], NULL);
|
||||||
@@ -769,7 +769,7 @@ static int handle_crypt_me(char *word[], char *word_eol[], void *userdata) {
|
|||||||
g_string_free(command, TRUE);
|
g_string_free(command, TRUE);
|
||||||
g_slist_free_full(encrypted_list, g_free);
|
g_slist_free_full(encrypted_list, g_free);
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -798,22 +798,22 @@ int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
|||||||
*version = plugin_version;
|
*version = plugin_version;
|
||||||
|
|
||||||
/* Register commands */
|
/* Register commands */
|
||||||
zoitechat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
|
zoitechat_hook_command(ph, "SETKEY", ZOITECHAT_PRI_NORM, handle_setkey, usage_setkey, NULL);
|
||||||
zoitechat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
|
zoitechat_hook_command(ph, "DELKEY", ZOITECHAT_PRI_NORM, handle_delkey, usage_delkey, NULL);
|
||||||
zoitechat_hook_command(ph, "KEYX", HEXCHAT_PRI_NORM, handle_keyx, usage_keyx, NULL);
|
zoitechat_hook_command(ph, "KEYX", ZOITECHAT_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, "TOPIC+", ZOITECHAT_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, "NOTICE+", ZOITECHAT_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, "MSG+", ZOITECHAT_PRI_NORM, handle_crypt_msg, usage_msg, NULL);
|
||||||
zoitechat_hook_command(ph, "ME", HEXCHAT_PRI_NORM, handle_crypt_me, NULL, NULL);
|
zoitechat_hook_command(ph, "ME", ZOITECHAT_PRI_NORM, handle_crypt_me, NULL, NULL);
|
||||||
|
|
||||||
/* Add handlers */
|
/* Add handlers */
|
||||||
zoitechat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL);
|
zoitechat_hook_command(ph, "", ZOITECHAT_PRI_NORM, handle_outgoing, NULL, NULL);
|
||||||
zoitechat_hook_server(ph, "NOTICE", HEXCHAT_PRI_HIGHEST, handle_keyx_notice, NULL);
|
zoitechat_hook_server(ph, "NOTICE", ZOITECHAT_PRI_HIGHEST, handle_keyx_notice, NULL);
|
||||||
zoitechat_hook_server_attrs(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
zoitechat_hook_server_attrs(ph, "NOTICE", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
|
||||||
zoitechat_hook_server_attrs(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
zoitechat_hook_server_attrs(ph, "PRIVMSG", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
|
||||||
/* zoitechat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); */
|
/* zoitechat_hook_server(ph, "RAW LINE", ZOITECHAT_PRI_NORM, handle_debug, NULL); */
|
||||||
zoitechat_hook_server_attrs(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
zoitechat_hook_server_attrs(ph, "TOPIC", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
|
||||||
zoitechat_hook_server_attrs(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL);
|
zoitechat_hook_server_attrs(ph, "332", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
|
||||||
|
|
||||||
if (!fish_init())
|
if (!fish_init())
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PLUGIN_HEXCHAT_H
|
#ifndef PLUGIN_ZOITECHAT_H
|
||||||
#define PLUGIN_HEXCHAT_H
|
#define PLUGIN_ZOITECHAT_H
|
||||||
|
|
||||||
gchar *get_config_filename(void);
|
gchar *get_config_filename(void);
|
||||||
int irc_nick_cmp (const char *, const char *);
|
int irc_nick_cmp (const char *, const char *);
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PLUGIN_HEXCHAT_FISHLIM_UTILS_H
|
#ifndef PLUGIN_ZOITECHAT_FISHLIM_UTILS_H
|
||||||
#define PLUGIN_HEXCHAT_FISHLIM_UTILS_H
|
#define PLUGIN_ZOITECHAT_FISHLIM_UTILS_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "fish.h"
|
#include "fish.h"
|
||||||
|
|||||||
2590
plugins/lua/lua.c
2590
plugins/lua/lua.c
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@ sub PRI_LOW ();
|
|||||||
sub PRI_LOWEST ();
|
sub PRI_LOWEST ();
|
||||||
|
|
||||||
sub EAT_NONE ();
|
sub EAT_NONE ();
|
||||||
sub EAT_HEXCHAT ();
|
sub EAT_ZOITECHAT ();
|
||||||
sub EAT_PLUGIN ();
|
sub EAT_PLUGIN ();
|
||||||
sub EAT_ALL ();
|
sub EAT_ALL ();
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ BEGIN {
|
|||||||
our %EXPORT_TAGS = (
|
our %EXPORT_TAGS = (
|
||||||
constants => [
|
constants => [
|
||||||
qw(PRI_HIGHEST PRI_HIGH PRI_NORM PRI_LOW PRI_LOWEST), # priorities
|
qw(PRI_HIGHEST PRI_HIGH PRI_NORM PRI_LOW PRI_LOWEST), # priorities
|
||||||
qw(EAT_NONE EAT_HEXCHAT EAT_XCHAT EAT_PLUGIN EAT_ALL), # callback return values
|
qw(EAT_NONE EAT_ZOITECHAT EAT_XCHAT EAT_PLUGIN EAT_ALL), # callback return values
|
||||||
qw(FD_READ FD_WRITE FD_EXCEPTION FD_NOTSOCKET), # fd flags
|
qw(FD_READ FD_WRITE FD_EXCEPTION FD_NOTSOCKET), # fd flags
|
||||||
qw(KEEP REMOVE), # timers
|
qw(KEEP REMOVE), # timers
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ sub evaluate {
|
|||||||
ZoiteChat::print $results[0];
|
ZoiteChat::print $results[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZoiteChat::EAT_HEXCHAT;
|
return ZoiteChat::EAT_ZOITECHAT;
|
||||||
};
|
};
|
||||||
|
|
||||||
sub expand_homedir {
|
sub expand_homedir {
|
||||||
|
|||||||
@@ -337,11 +337,11 @@ fd_cb (int fd, int flags, void *userdata)
|
|||||||
if (SvTRUE (ERRSV)) {
|
if (SvTRUE (ERRSV)) {
|
||||||
zoitechat_printf (ph, "Error in fd callback %s", SvPV_nolen (ERRSV));
|
zoitechat_printf (ph, "Error in fd callback %s", SvPV_nolen (ERRSV));
|
||||||
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
||||||
retVal = HEXCHAT_EAT_ALL;
|
retVal = ZOITECHAT_EAT_ALL;
|
||||||
} else {
|
} else {
|
||||||
if (count != 1) {
|
if (count != 1) {
|
||||||
zoitechat_print (ph, "Fd handler should only return 1 value.");
|
zoitechat_print (ph, "Fd handler should only return 1 value.");
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
retVal = POPi;
|
retVal = POPi;
|
||||||
if (retVal == 0) {
|
if (retVal == 0) {
|
||||||
@@ -398,11 +398,11 @@ timer_cb (void *userdata)
|
|||||||
if (SvTRUE (ERRSV)) {
|
if (SvTRUE (ERRSV)) {
|
||||||
zoitechat_printf (ph, "Error in timer callback %s", SvPV_nolen (ERRSV));
|
zoitechat_printf (ph, "Error in timer callback %s", SvPV_nolen (ERRSV));
|
||||||
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
||||||
retVal = HEXCHAT_EAT_ALL;
|
retVal = ZOITECHAT_EAT_ALL;
|
||||||
} else {
|
} else {
|
||||||
if (count != 1) {
|
if (count != 1) {
|
||||||
zoitechat_print (ph, "Timer handler should only return 1 value.");
|
zoitechat_print (ph, "Timer handler should only return 1 value.");
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
retVal = POPi;
|
retVal = POPi;
|
||||||
if (retVal == 0) {
|
if (retVal == 0) {
|
||||||
@@ -438,7 +438,7 @@ server_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
SAVETMPS;
|
SAVETMPS;
|
||||||
|
|
||||||
if (data->depth)
|
if (data->depth)
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
/* zoitechat_printf (ph, */
|
/* zoitechat_printf (ph, */
|
||||||
/* "Received %d words in server callback", av_len (wd)); */
|
/* "Received %d words in server callback", av_len (wd)); */
|
||||||
@@ -457,11 +457,11 @@ server_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (SvTRUE (ERRSV)) {
|
if (SvTRUE (ERRSV)) {
|
||||||
zoitechat_printf (ph, "Error in server callback %s", SvPV_nolen (ERRSV));
|
zoitechat_printf (ph, "Error in server callback %s", SvPV_nolen (ERRSV));
|
||||||
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
if (count != 1) {
|
if (count != 1) {
|
||||||
zoitechat_print (ph, "Server handler should only return 1 value.");
|
zoitechat_print (ph, "Server handler should only return 1 value.");
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
retVal = POPi;
|
retVal = POPi;
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ command_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
SAVETMPS;
|
SAVETMPS;
|
||||||
|
|
||||||
if (data->depth)
|
if (data->depth)
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
/* zoitechat_printf (ph, "Received %d words in command callback", */
|
/* zoitechat_printf (ph, "Received %d words in command callback", */
|
||||||
/* av_len (wd)); */
|
/* av_len (wd)); */
|
||||||
@@ -506,11 +506,11 @@ command_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (SvTRUE (ERRSV)) {
|
if (SvTRUE (ERRSV)) {
|
||||||
zoitechat_printf (ph, "Error in command callback %s", SvPV_nolen (ERRSV));
|
zoitechat_printf (ph, "Error in command callback %s", SvPV_nolen (ERRSV));
|
||||||
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
||||||
retVal = HEXCHAT_EAT_HEXCHAT;
|
retVal = ZOITECHAT_EAT_ZOITECHAT;
|
||||||
} else {
|
} else {
|
||||||
if (count != 1) {
|
if (count != 1) {
|
||||||
zoitechat_print (ph, "Command handler should only return 1 value.");
|
zoitechat_print (ph, "Command handler should only return 1 value.");
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
retVal = POPi;
|
retVal = POPi;
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ print_cb (char *word[], void *userdata)
|
|||||||
SAVETMPS;
|
SAVETMPS;
|
||||||
|
|
||||||
if (data->depth)
|
if (data->depth)
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
|
|
||||||
wd = newAV ();
|
wd = newAV ();
|
||||||
sv_2mortal ((SV *) wd);
|
sv_2mortal ((SV *) wd);
|
||||||
@@ -582,11 +582,11 @@ print_cb (char *word[], void *userdata)
|
|||||||
if (SvTRUE (ERRSV)) {
|
if (SvTRUE (ERRSV)) {
|
||||||
zoitechat_printf (ph, "Error in print callback %s", SvPV_nolen (ERRSV));
|
zoitechat_printf (ph, "Error in print callback %s", SvPV_nolen (ERRSV));
|
||||||
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
if (!SvOK (POPs)) {} /* remove undef from the top of the stack */
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
if (count != 1) {
|
if (count != 1) {
|
||||||
zoitechat_print (ph, "Print handler should only return 1 value.");
|
zoitechat_print (ph, "Print handler should only return 1 value.");
|
||||||
retVal = HEXCHAT_EAT_NONE;
|
retVal = ZOITECHAT_EAT_NONE;
|
||||||
} else {
|
} else {
|
||||||
retVal = POPi;
|
retVal = POPi;
|
||||||
}
|
}
|
||||||
@@ -1022,7 +1022,7 @@ XS (XS_ZoiteChat_hook_fd)
|
|||||||
data = NULL;
|
data = NULL;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if ((flags & HEXCHAT_FD_NOTSOCKET) == 0) {
|
if ((flags & ZOITECHAT_FD_NOTSOCKET) == 0) {
|
||||||
/* this _get_osfhandle if from win32iop.h in the perl distribution,
|
/* this _get_osfhandle if from win32iop.h in the perl distribution,
|
||||||
* not the one provided by Windows
|
* not the one provided by Windows
|
||||||
*/
|
*/
|
||||||
@@ -1356,21 +1356,21 @@ xs_init (pTHX)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
newCONSTSUB (stash, "PRI_HIGHEST", newSViv (HEXCHAT_PRI_HIGHEST));
|
newCONSTSUB (stash, "PRI_HIGHEST", newSViv (ZOITECHAT_PRI_HIGHEST));
|
||||||
newCONSTSUB (stash, "PRI_HIGH", newSViv (HEXCHAT_PRI_HIGH));
|
newCONSTSUB (stash, "PRI_HIGH", newSViv (ZOITECHAT_PRI_HIGH));
|
||||||
newCONSTSUB (stash, "PRI_NORM", newSViv (HEXCHAT_PRI_NORM));
|
newCONSTSUB (stash, "PRI_NORM", newSViv (ZOITECHAT_PRI_NORM));
|
||||||
newCONSTSUB (stash, "PRI_LOW", newSViv (HEXCHAT_PRI_LOW));
|
newCONSTSUB (stash, "PRI_LOW", newSViv (ZOITECHAT_PRI_LOW));
|
||||||
newCONSTSUB (stash, "PRI_LOWEST", newSViv (HEXCHAT_PRI_LOWEST));
|
newCONSTSUB (stash, "PRI_LOWEST", newSViv (ZOITECHAT_PRI_LOWEST));
|
||||||
|
|
||||||
newCONSTSUB (stash, "EAT_NONE", newSViv (HEXCHAT_EAT_NONE));
|
newCONSTSUB (stash, "EAT_NONE", newSViv (ZOITECHAT_EAT_NONE));
|
||||||
newCONSTSUB (stash, "EAT_HEXCHAT", newSViv (HEXCHAT_EAT_HEXCHAT));
|
newCONSTSUB (stash, "EAT_ZOITECHAT", newSViv (ZOITECHAT_EAT_ZOITECHAT));
|
||||||
newCONSTSUB (stash, "EAT_XCHAT", newSViv (HEXCHAT_EAT_HEXCHAT)); /* for compatibility */
|
newCONSTSUB (stash, "EAT_XCHAT", newSViv (ZOITECHAT_EAT_ZOITECHAT)); /* for compatibility */
|
||||||
newCONSTSUB (stash, "EAT_PLUGIN", newSViv (HEXCHAT_EAT_PLUGIN));
|
newCONSTSUB (stash, "EAT_PLUGIN", newSViv (ZOITECHAT_EAT_PLUGIN));
|
||||||
newCONSTSUB (stash, "EAT_ALL", newSViv (HEXCHAT_EAT_ALL));
|
newCONSTSUB (stash, "EAT_ALL", newSViv (ZOITECHAT_EAT_ALL));
|
||||||
newCONSTSUB (stash, "FD_READ", newSViv (HEXCHAT_FD_READ));
|
newCONSTSUB (stash, "FD_READ", newSViv (ZOITECHAT_FD_READ));
|
||||||
newCONSTSUB (stash, "FD_WRITE", newSViv (HEXCHAT_FD_WRITE));
|
newCONSTSUB (stash, "FD_WRITE", newSViv (ZOITECHAT_FD_WRITE));
|
||||||
newCONSTSUB (stash, "FD_EXCEPTION", newSViv (HEXCHAT_FD_EXCEPTION));
|
newCONSTSUB (stash, "FD_EXCEPTION", newSViv (ZOITECHAT_FD_EXCEPTION));
|
||||||
newCONSTSUB (stash, "FD_NOTSOCKET", newSViv (HEXCHAT_FD_NOTSOCKET));
|
newCONSTSUB (stash, "FD_NOTSOCKET", newSViv (ZOITECHAT_FD_NOTSOCKET));
|
||||||
newCONSTSUB (stash, "KEEP", newSViv (1));
|
newCONSTSUB (stash, "KEEP", newSViv (1));
|
||||||
newCONSTSUB (stash, "REMOVE", newSViv (0));
|
newCONSTSUB (stash, "REMOVE", newSViv (0));
|
||||||
|
|
||||||
@@ -1509,10 +1509,10 @@ perl_command_unloadall (char *word[], char *word_eol[], void *userdata)
|
|||||||
{
|
{
|
||||||
if (my_perl != NULL) {
|
if (my_perl != NULL) {
|
||||||
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::unload_all", 0)), "");
|
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::unload_all", 0)), "");
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1521,11 +1521,11 @@ perl_command_reloadall (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (my_perl != NULL) {
|
if (my_perl != NULL) {
|
||||||
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::reload_all", 0)), "");
|
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::reload_all", 0)), "");
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
} else {
|
} else {
|
||||||
perl_auto_load( NULL );
|
perl_auto_load( NULL );
|
||||||
}
|
}
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1536,10 +1536,10 @@ perl_command_load (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (file != NULL )
|
if (file != NULL )
|
||||||
{
|
{
|
||||||
perl_load_file (file);
|
perl_load_file (file);
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1549,10 +1549,10 @@ perl_command_unload (char *word[], char *word_eol[], void *userdata)
|
|||||||
|
|
||||||
if (my_perl != NULL && file != NULL) {
|
if (my_perl != NULL && file != NULL) {
|
||||||
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::unload", 0)), file);
|
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::unload", 0)), file);
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1562,13 +1562,13 @@ perl_command_reload (char *word[], char *word_eol[], void *eat)
|
|||||||
|
|
||||||
if (my_perl != NULL && file != NULL) {
|
if (my_perl != NULL && file != NULL) {
|
||||||
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::reload", 0)), file);
|
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::reload", 0)), file);
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eat)
|
if (eat)
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
else
|
else
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1577,7 +1577,7 @@ perl_command_eval (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (my_perl != NULL)
|
if (my_perl != NULL)
|
||||||
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::evaluate", 0)), word_eol[2]);
|
execute_perl (sv_2mortal (newSVpv ("ZoiteChat::Embed::evaluate", 0)), word_eol[2]);
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1612,19 +1612,19 @@ zoitechat_plugin_init (zoitechat_plugin * plugin_handle, char **plugin_name,
|
|||||||
*plugin_desc = "Perl scripting interface";
|
*plugin_desc = "Perl scripting interface";
|
||||||
*plugin_version = PACKAGE_VERSION;
|
*plugin_version = PACKAGE_VERSION;
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "load", HEXCHAT_PRI_NORM, perl_command_load, 0, 0);
|
zoitechat_hook_command (ph, "load", ZOITECHAT_PRI_NORM, perl_command_load, 0, 0);
|
||||||
zoitechat_hook_command (ph, "unload", HEXCHAT_PRI_NORM, perl_command_unload, 0,
|
zoitechat_hook_command (ph, "unload", ZOITECHAT_PRI_NORM, perl_command_unload, 0,
|
||||||
0);
|
0);
|
||||||
zoitechat_hook_command (ph, "reload", HEXCHAT_PRI_NORM, perl_command_reload, 0,
|
zoitechat_hook_command (ph, "reload", ZOITECHAT_PRI_NORM, perl_command_reload, 0,
|
||||||
0);
|
0);
|
||||||
zoitechat_hook_command (ph, "pl_reload", HEXCHAT_PRI_NORM, perl_command_reload,
|
zoitechat_hook_command (ph, "pl_reload", ZOITECHAT_PRI_NORM, perl_command_reload,
|
||||||
"Reloads a Perl script. Syntax: /pl_reload <filename.pl>", (int*)1);
|
"Reloads a Perl script. Syntax: /pl_reload <filename.pl>", (int*)1);
|
||||||
zoitechat_hook_command (ph, "unloadall", HEXCHAT_PRI_NORM,
|
zoitechat_hook_command (ph, "unloadall", ZOITECHAT_PRI_NORM,
|
||||||
perl_command_unloadall, "Unloads all loaded Perl scripts.", 0);
|
perl_command_unloadall, "Unloads all loaded Perl scripts.", 0);
|
||||||
zoitechat_hook_command (ph, "reloadall", HEXCHAT_PRI_NORM,
|
zoitechat_hook_command (ph, "reloadall", ZOITECHAT_PRI_NORM,
|
||||||
perl_command_reloadall, "Realoads all loaded Perl scripts.", 0);
|
perl_command_reloadall, "Realoads all loaded Perl scripts.", 0);
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "pl", HEXCHAT_PRI_NORM,
|
zoitechat_hook_command (ph, "pl", ZOITECHAT_PRI_NORM,
|
||||||
perl_command_eval, "Evaluates Perl code. Syntax: /pl <perl code>", 0);
|
perl_command_eval, "Evaluates Perl code. Syntax: /pl <perl code>", 0);
|
||||||
|
|
||||||
/*perl_init (); */
|
/*perl_init (); */
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from contextlib import contextmanager
|
|||||||
from _zoitechat_embedded import ffi, lib
|
from _zoitechat_embedded import ffi, lib
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'EAT_ALL', 'EAT_HEXCHAT', 'EAT_NONE', 'EAT_PLUGIN', 'EAT_XCHAT',
|
'EAT_ALL', 'EAT_ZOITECHAT', 'EAT_NONE', 'EAT_PLUGIN', 'EAT_XCHAT',
|
||||||
'PRI_HIGH', 'PRI_HIGHEST', 'PRI_LOW', 'PRI_LOWEST', 'PRI_NORM',
|
'PRI_HIGH', 'PRI_HIGHEST', 'PRI_LOW', 'PRI_LOWEST', 'PRI_NORM',
|
||||||
'__doc__', '__version__', 'command', 'del_pluginpref', 'emit_print',
|
'__doc__', '__version__', 'command', 'del_pluginpref', 'emit_print',
|
||||||
'find_context', 'get_context', 'get_info',
|
'find_context', 'get_context', 'get_info',
|
||||||
@@ -20,10 +20,10 @@ __version__ = (2, 0)
|
|||||||
__license__ = 'GPL-2.0+'
|
__license__ = 'GPL-2.0+'
|
||||||
|
|
||||||
EAT_NONE = 0
|
EAT_NONE = 0
|
||||||
EAT_HEXCHAT = 1
|
EAT_ZOITECHAT = 1
|
||||||
EAT_XCHAT = EAT_HEXCHAT
|
EAT_XCHAT = EAT_ZOITECHAT
|
||||||
EAT_PLUGIN = 2
|
EAT_PLUGIN = 2
|
||||||
EAT_ALL = EAT_HEXCHAT | EAT_PLUGIN
|
EAT_ALL = EAT_ZOITECHAT | EAT_PLUGIN
|
||||||
|
|
||||||
PRI_LOWEST = -128
|
PRI_LOWEST = -128
|
||||||
PRI_LOW = -64
|
PRI_LOW = -64
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ with open(sys.argv[1]) as f:
|
|||||||
for line in f:
|
for line in f:
|
||||||
if line.startswith('#define'):
|
if line.startswith('#define'):
|
||||||
continue
|
continue
|
||||||
elif line.endswith('HEXCHAT_PLUGIN_H\n'):
|
elif line.endswith('ZOITECHAT_PLUGIN_H\n'):
|
||||||
continue
|
continue
|
||||||
elif 'time.h' in line:
|
elif 'time.h' in line:
|
||||||
output.append('typedef int... time_t;')
|
output.append('typedef int... time_t;')
|
||||||
@@ -70,7 +70,7 @@ int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ph = plugin_handle;
|
ph = plugin_handle;
|
||||||
return _on_plugin_init(name_out, description_out, version_out, arg, HEXCHATLIBDIR);
|
return _on_plugin_init(name_out, description_out, version_out, arg, ZOITECHATLIBDIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zoitechat_plugin_deinit(void)
|
int zoitechat_plugin_deinit(void)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ def redirected_stdout():
|
|||||||
sys.stderr = zoitechat_stdout
|
sys.stderr = zoitechat_stdout
|
||||||
|
|
||||||
|
|
||||||
if os.getenv('HEXCHAT_LOG_PYTHON'):
|
if os.getenv('ZOITECHAT_LOG_PYTHON'):
|
||||||
def log(*args):
|
def log(*args):
|
||||||
with redirected_stdout():
|
with redirected_stdout():
|
||||||
print(*args)
|
print(*args)
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
else
|
else
|
||||||
print_info (cmd, announce);
|
print_info (cmd, announce);
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -233,7 +233,7 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
|
|||||||
*plugin_desc = desc;
|
*plugin_desc = desc;
|
||||||
*plugin_version = version;
|
*plugin_version = version;
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
zoitechat_hook_command (ph, "SYSINFO", ZOITECHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
|
||||||
|
|
||||||
zoitechat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
zoitechat_command (ph, "MENU ADD \"Window/Send System Info\" \"SYSINFO\"");
|
||||||
zoitechat_printf (ph, _("%s plugin loaded\n"), name);
|
zoitechat_printf (ph, _("%s plugin loaded\n"), name);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ check_cmd (char *word[], char *word_eol[], void *userdata)
|
|||||||
{
|
{
|
||||||
win_sparkle_check_update_with_ui ();
|
win_sparkle_check_update_with_ui ();
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -52,7 +52,7 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
|
|||||||
win_sparkle_set_appcast_url (APPCAST_URL);
|
win_sparkle_set_appcast_url (APPCAST_URL);
|
||||||
win_sparkle_init ();
|
win_sparkle_init ();
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, check_cmd, upd_help, NULL);
|
zoitechat_hook_command (ph, "UPDCHK", ZOITECHAT_PRI_NORM, check_cmd, upd_help, NULL);
|
||||||
zoitechat_command (ph, "MENU -ishare\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
|
zoitechat_command (ph, "MENU -ishare\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\"");
|
||||||
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
zoitechat_printf (ph, "%s plugin loaded\n", name);
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ winamp(char *word[], char *word_eol[], void *userdata)
|
|||||||
if (!current_play)
|
if (!current_play)
|
||||||
{
|
{
|
||||||
zoitechat_print (ph, "Winamp: Error getting song information.");
|
zoitechat_print (ph, "Winamp: Error getting song information.");
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr(current_play, '-'))
|
if (strchr(current_play, '-'))
|
||||||
@@ -120,7 +120,7 @@ winamp(char *word[], char *word_eol[], void *userdata)
|
|||||||
{
|
{
|
||||||
zoitechat_print(ph, "Winamp not found.\n");
|
zoitechat_print(ph, "Winamp not found.\n");
|
||||||
}
|
}
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -137,7 +137,7 @@ zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
|||||||
*plugin_desc = "Winamp plugin for ZoiteChat";
|
*plugin_desc = "Winamp plugin for ZoiteChat";
|
||||||
*plugin_version = "0.6";
|
*plugin_version = "0.6";
|
||||||
|
|
||||||
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_hook_command (ph, "WINAMP", ZOITECHAT_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\"");
|
zoitechat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
|
||||||
|
|
||||||
zoitechat_print (ph, "Winamp plugin loaded\n");
|
zoitechat_print (ph, "Winamp plugin loaded\n");
|
||||||
|
|||||||
32
readme.md
32
readme.md
@@ -1,5 +1,6 @@
|
|||||||
# ZoiteChat
|
<div align="center">
|
||||||
|
<img src="data/icons/zoitechat.svg" height="230">
|
||||||
|
|
||||||
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/debian-build.yml)
|
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/debian-build.yml)
|
||||||
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/flatpak-build.yml)
|
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/flatpak-build.yml)
|
||||||
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/appimage-build.yml)
|
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/appimage-build.yml)
|
||||||
@@ -7,9 +8,34 @@
|
|||||||
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/msys-build.yml)
|
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/msys-build.yml)
|
||||||
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/openbsd-build.yml)
|
[](https://github.com/ZoiteChat/zoitechat/actions/workflows/openbsd-build.yml)
|
||||||
|
|
||||||
|
[![Version][github-version-img]][github-version-uri] [![Downloads][github-downloads-img]][github-downloads-uri] [![Size][github-size-img]][github-size-img] [![Last Commit][github-commit-img]][github-commit-img] [![Contributors][contribs-all-img]](#contributors-)
|
||||||
|
|
||||||
|
[](https://docs.zoitechat.zoite.net)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Badge reference definitions -->
|
||||||
|
[github-version-img]: https://img.shields.io/github/v/release/ZoiteChat/zoitechat?display_name=tag&sort=semver
|
||||||
|
[github-version-uri]: https://github.com/ZoiteChat/zoitechat/releases/latest
|
||||||
|
|
||||||
|
[github-downloads-img]: https://img.shields.io/github/downloads/ZoiteChat/zoitechat/total
|
||||||
|
[github-downloads-uri]: https://github.com/ZoiteChat/zoitechat/releases
|
||||||
|
|
||||||
|
[github-size-img]: https://img.shields.io/github/repo-size/ZoiteChat/zoitechat
|
||||||
|
[github-size-uri]: https://github.com/ZoiteChat/zoitechat
|
||||||
|
|
||||||
|
[github-commit-img]: https://img.shields.io/github/last-commit/ZoiteChat/zoitechat
|
||||||
|
[github-commit-uri]: https://github.com/ZoiteChat/zoitechat/commits
|
||||||
|
|
||||||
|
[contribs-all-img]: https://img.shields.io/github/contributors/ZoiteChat/zoitechat
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
|
||||||
ZoiteChat is an HexChat based IRC client for Windows and UNIX-like operating systems.
|
ZoiteChat is an HexChat based IRC client for Windows and UNIX-like operating systems.
|
||||||
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
|
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
|
||||||
For more information on ZoiteChat please read our [documentation](https://zoitechat.zoite.net/docs/):
|
For more information on ZoiteChat please read our [documentation](https://docs.zoitechat.zoite.net/):
|
||||||
- [Downloads](https://zoitechat.zoite.net/download)
|
- [Downloads](https://zoitechat.zoite.net/download)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#define HEXCHAT_DIR "zoitechat"
|
#define ZOITECHAT_DIR "zoitechat"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEF_FONT "Monospace 9"
|
#define DEF_FONT "Monospace 9"
|
||||||
@@ -305,7 +305,7 @@ get_xdir (void)
|
|||||||
if (!xdir)
|
if (!xdir)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
xdir = g_build_filename (g_get_user_config_dir (), HEXCHAT_DIR, NULL);
|
xdir = g_build_filename (g_get_user_config_dir (), ZOITECHAT_DIR, NULL);
|
||||||
#else
|
#else
|
||||||
wchar_t* roaming_path_wide;
|
wchar_t* roaming_path_wide;
|
||||||
gchar* roaming_path;
|
gchar* roaming_path;
|
||||||
@@ -437,7 +437,7 @@ const struct prefs vars[] =
|
|||||||
{"gui_tab_dialogs", P_OFFINT (hex_gui_tab_dialogs), TYPE_BOOL},
|
{"gui_tab_dialogs", P_OFFINT (hex_gui_tab_dialogs), TYPE_BOOL},
|
||||||
{"gui_tab_dots", P_OFFINT (hex_gui_tab_dots), TYPE_BOOL},
|
{"gui_tab_dots", P_OFFINT (hex_gui_tab_dots), TYPE_BOOL},
|
||||||
{"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL},
|
{"gui_tab_icons", P_OFFINT (hex_gui_tab_icons), TYPE_BOOL},
|
||||||
{"gui_dark_mode", P_OFFINT (hex_gui_dark_mode), TYPE_BOOL},
|
{"gui_dark_mode", P_OFFINT (hex_gui_dark_mode), TYPE_INT},
|
||||||
{"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT},
|
{"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT},
|
||||||
{"gui_tab_middleclose", P_OFFINT (hex_gui_tab_middleclose), TYPE_BOOL},
|
{"gui_tab_middleclose", P_OFFINT (hex_gui_tab_middleclose), TYPE_BOOL},
|
||||||
{"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT},
|
{"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT},
|
||||||
@@ -936,7 +936,7 @@ make_config_dirs (void)
|
|||||||
}
|
}
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
|
|
||||||
buf = g_build_filename (get_xdir (), HEXCHAT_SOUND_DIR, NULL);
|
buf = g_build_filename (get_xdir (), ZOITECHAT_SOUND_DIR, NULL);
|
||||||
if (g_mkdir (buf, 0700) != 0)
|
if (g_mkdir (buf, 0700) != 0)
|
||||||
{
|
{
|
||||||
g_free (buf);
|
g_free (buf);
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
/* cfgfiles.h */
|
/* cfgfiles.h */
|
||||||
|
|
||||||
#ifndef HEXCHAT_CFGFILES_H
|
#ifndef ZOITECHAT_CFGFILES_H
|
||||||
#define HEXCHAT_CFGFILES_H
|
#define ZOITECHAT_CFGFILES_H
|
||||||
|
|
||||||
#include "zoitechat.h"
|
#include "zoitechat.h"
|
||||||
|
|
||||||
@@ -82,6 +82,6 @@ struct prefs
|
|||||||
#define TYPE_INT 1
|
#define TYPE_INT 1
|
||||||
#define TYPE_BOOL 2
|
#define TYPE_BOOL 2
|
||||||
|
|
||||||
#define HEXCHAT_SOUND_DIR "sounds"
|
#define ZOITECHAT_SOUND_DIR "sounds"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_CHANOPT_H
|
#ifndef ZOITECHAT_CHANOPT_H
|
||||||
#define HEXCHAT_CHANOPT_H
|
#define ZOITECHAT_CHANOPT_H
|
||||||
|
|
||||||
int chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[]);
|
int chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[]);
|
||||||
gboolean chanopt_is_set (unsigned int global, guint8 per_chan_setting);
|
gboolean chanopt_is_set (unsigned int global, guint8 per_chan_setting);
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
<ClCompile Include="servlist.c" />
|
<ClCompile Include="servlist.c" />
|
||||||
<ClCompile Include="ssl.c" />
|
<ClCompile Include="ssl.c" />
|
||||||
<ClCompile Include="scram.c" />
|
<ClCompile Include="scram.c" />
|
||||||
|
<ClCompile Include="sts.c" />
|
||||||
<ClCompile Include="sysinfo\win32\backend.c" />
|
<ClCompile Include="sysinfo\win32\backend.c" />
|
||||||
<ClCompile Include="text.c" />
|
<ClCompile Include="text.c" />
|
||||||
<ClCompile Include="tree.c" />
|
<ClCompile Include="tree.c" />
|
||||||
|
|||||||
@@ -172,6 +172,9 @@
|
|||||||
<ClCompile Include="ssl.c">
|
<ClCompile Include="ssl.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="sts.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="text.c">
|
<ClCompile Include="text.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_CTCP_H
|
#ifndef ZOITECHAT_CTCP_H
|
||||||
#define HEXCHAT_CTCP_H
|
#define ZOITECHAT_CTCP_H
|
||||||
|
|
||||||
void ctcp_handle (session *sess, char *to, char *nick, char *ip, char *msg,
|
void ctcp_handle (session *sess, char *to, char *nick, char *ip, char *msg,
|
||||||
char *word[], char *word_eol[], int id,
|
char *word[], char *word_eol[], int id,
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ open_context_cb (char *word[],
|
|||||||
info->context = zoitechat_get_context (ph);
|
info->context = zoitechat_get_context (ph);
|
||||||
contexts = g_list_prepend (contexts, info);
|
contexts = g_list_prepend (contexts, info);
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1020,7 +1020,7 @@ close_context_cb (char *word[],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -1044,10 +1044,10 @@ unload_plugin_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
g_signal_emit (obj,
|
g_signal_emit (obj,
|
||||||
signals[UNLOAD_SIGNAL],
|
signals[UNLOAD_SIGNAL],
|
||||||
0);
|
0);
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_NONE;
|
return ZOITECHAT_EAT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1071,17 +1071,17 @@ dbus_plugin_init (zoitechat_plugin *plugin_handle,
|
|||||||
g_object_unref);
|
g_object_unref);
|
||||||
|
|
||||||
zoitechat_hook_print (ph, "Open Context",
|
zoitechat_hook_print (ph, "Open Context",
|
||||||
HEXCHAT_PRI_NORM,
|
ZOITECHAT_PRI_NORM,
|
||||||
open_context_cb,
|
open_context_cb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
zoitechat_hook_print (ph, "Close Context",
|
zoitechat_hook_print (ph, "Close Context",
|
||||||
HEXCHAT_PRI_NORM,
|
ZOITECHAT_PRI_NORM,
|
||||||
close_context_cb,
|
close_context_cb,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "unload",
|
zoitechat_hook_command (ph, "unload",
|
||||||
HEXCHAT_PRI_HIGHEST,
|
ZOITECHAT_PRI_HIGHEST,
|
||||||
unload_plugin_cb, NULL, NULL);
|
unload_plugin_cb, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
* xclaesse@gmail.com
|
* xclaesse@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_DBUS_PLUGIN_H
|
#ifndef ZOITECHAT_DBUS_PLUGIN_H
|
||||||
#define HEXCHAT_DBUS_PLUGIN_H
|
#define ZOITECHAT_DBUS_PLUGIN_H
|
||||||
|
|
||||||
int dbus_plugin_init (zoitechat_plugin *plugin_handle,
|
int dbus_plugin_init (zoitechat_plugin *plugin_handle,
|
||||||
char **plugin_name,
|
char **plugin_name,
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
#include <time.h> /* for time_t */
|
#include <time.h> /* for time_t */
|
||||||
#include "proto-irc.h"
|
#include "proto-irc.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_DCC_H
|
#ifndef ZOITECHAT_DCC_H
|
||||||
#define HEXCHAT_DCC_H
|
#define ZOITECHAT_DCC_H
|
||||||
|
|
||||||
enum dcc_state {
|
enum dcc_state {
|
||||||
STAT_QUEUED = 0,
|
STAT_QUEUED = 0,
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include "userlist.h"
|
#include "userlist.h"
|
||||||
#include "dcc.h"
|
#include "dcc.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_FE_H
|
#ifndef ZOITECHAT_FE_H
|
||||||
#define HEXCHAT_FE_H
|
#define ZOITECHAT_FE_H
|
||||||
|
|
||||||
/* for storage of /menu entries */
|
/* for storage of /menu entries */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
@@ -18,14 +18,13 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <glib.h>
|
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
history_add (struct history *his, char *text)
|
history_add (struct history *his, char *text)
|
||||||
{
|
{
|
||||||
g_free (his->lines[his->realpos]);
|
free (his->lines[his->realpos]);
|
||||||
his->lines[his->realpos] = g_strdup (text);
|
his->lines[his->realpos] = strdup (text);
|
||||||
his->realpos++;
|
his->realpos++;
|
||||||
if (his->realpos == HISTORY_SIZE)
|
if (his->realpos == HISTORY_SIZE)
|
||||||
his->realpos = 0;
|
his->realpos = 0;
|
||||||
@@ -40,7 +39,7 @@ history_free (struct history *his)
|
|||||||
{
|
{
|
||||||
if (his->lines[i])
|
if (his->lines[i])
|
||||||
{
|
{
|
||||||
g_free (his->lines[i]);
|
free (his->lines[i]);
|
||||||
his->lines[i] = 0;
|
his->lines[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_HISTORY_H
|
#ifndef ZOITECHAT_HISTORY_H
|
||||||
#define HEXCHAT_HISTORY_H
|
#define ZOITECHAT_HISTORY_H
|
||||||
|
|
||||||
#define HISTORY_SIZE 100
|
#define HISTORY_SIZE 100
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_IGNORE_H
|
#ifndef ZOITECHAT_IGNORE_H
|
||||||
#define HEXCHAT_IGNORE_H
|
#define ZOITECHAT_IGNORE_H
|
||||||
|
|
||||||
extern GSList *ignore_list;
|
extern GSList *ignore_list;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
#include "inbound.h"
|
#include "inbound.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "servlist.h"
|
#include "servlist.h"
|
||||||
|
#include "sts.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "ctcp.h"
|
#include "ctcp.h"
|
||||||
#include "zoitechatc.h"
|
#include "zoitechatc.h"
|
||||||
@@ -1722,6 +1723,25 @@ void
|
|||||||
inbound_cap_del (server *serv, char *nick, char *extensions,
|
inbound_cap_del (server *serv, char *nick, char *extensions,
|
||||||
const message_tags_data *tags_data)
|
const message_tags_data *tags_data)
|
||||||
{
|
{
|
||||||
|
if (extensions)
|
||||||
|
{
|
||||||
|
char **tokens = g_strsplit (extensions, " ", 0);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; tokens[i]; i++)
|
||||||
|
{
|
||||||
|
if (!g_strcmp0 (tokens[i], "sts") ||
|
||||||
|
g_str_has_prefix (tokens[i], "sts="))
|
||||||
|
{
|
||||||
|
/* STS cannot be disabled via CAP DEL. */
|
||||||
|
g_strfreev (tokens);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (tokens);
|
||||||
|
}
|
||||||
|
|
||||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPDEL, serv->server_session, nick, extensions,
|
EMIT_SIGNAL_TIMESTAMP (XP_TE_CAPDEL, serv->server_session, nick, extensions,
|
||||||
NULL, NULL, 0, tags_data->timestamp);
|
NULL, NULL, 0, tags_data->timestamp);
|
||||||
|
|
||||||
@@ -1745,6 +1765,7 @@ static const char * const supported_caps[] = {
|
|||||||
"invite-notify",
|
"invite-notify",
|
||||||
"account-tag",
|
"account-tag",
|
||||||
"extended-monitor",
|
"extended-monitor",
|
||||||
|
"standard-replies",
|
||||||
|
|
||||||
/* ZNC */
|
/* ZNC */
|
||||||
"znc.in/server-time-iso",
|
"znc.in/server-time-iso",
|
||||||
@@ -1818,6 +1839,7 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
|||||||
{
|
{
|
||||||
char buffer[500]; /* buffer for requesting capabilities and emitting the signal */
|
char buffer[500]; /* buffer for requesting capabilities and emitting the signal */
|
||||||
gboolean want_cap = FALSE; /* format the CAP REQ string based on previous capabilities being requested or not */
|
gboolean want_cap = FALSE; /* format the CAP REQ string based on previous capabilities being requested or not */
|
||||||
|
gboolean sts_upgrade_triggered = FALSE;
|
||||||
char **extensions;
|
char **extensions;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1852,6 +1874,15 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
|||||||
value++;
|
value++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!g_strcmp0 (extension, "sts"))
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
sts_upgrade_triggered |= sts_handle_capability (serv, value);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* if the SASL password is set AND auth mode is set to SASL, request SASL auth */
|
/* if the SASL password is set AND auth mode is set to SASL, request SASL auth */
|
||||||
if (!g_strcmp0 (extension, "sasl") &&
|
if (!g_strcmp0 (extension, "sasl") &&
|
||||||
(((serv->loginmethod == LOGIN_SASL
|
(((serv->loginmethod == LOGIN_SASL
|
||||||
@@ -1887,6 +1918,11 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
|
|||||||
|
|
||||||
g_strfreev (extensions);
|
g_strfreev (extensions);
|
||||||
|
|
||||||
|
if (sts_upgrade_triggered)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (want_cap)
|
if (want_cap)
|
||||||
{
|
{
|
||||||
/* buffer + 9 = emit buffer without "CAP REQ :" */
|
/* buffer + 9 = emit buffer without "CAP REQ :" */
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
#include "proto-irc.h"
|
#include "proto-irc.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_INBOUND_H
|
#ifndef ZOITECHAT_INBOUND_H
|
||||||
#define HEXCHAT_INBOUND_H
|
#define ZOITECHAT_INBOUND_H
|
||||||
|
|
||||||
void inbound_next_nick (session *sess, char *nick, int error,
|
void inbound_next_nick (session *sess, char *nick, int error,
|
||||||
const message_tags_data *tags_data);
|
const message_tags_data *tags_data);
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
/* include stuff for internet */
|
/* include stuff for internet */
|
||||||
|
|
||||||
#ifndef HEXCHAT_INET_H
|
#ifndef ZOITECHAT_INET_H
|
||||||
#define HEXCHAT_INET_H
|
#define ZOITECHAT_INET_H
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ common_sources = [
|
|||||||
'scram.c',
|
'scram.c',
|
||||||
'server.c',
|
'server.c',
|
||||||
'servlist.c',
|
'servlist.c',
|
||||||
|
'sts.c',
|
||||||
'text.c',
|
'text.c',
|
||||||
'tree.c',
|
'tree.c',
|
||||||
'url.c',
|
'url.c',
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
#include "proto-irc.h"
|
#include "proto-irc.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_MODES_H
|
#ifndef ZOITECHAT_MODES_H
|
||||||
#define HEXCHAT_MODES_H
|
#define ZOITECHAT_MODES_H
|
||||||
|
|
||||||
int is_channel (server *serv, char *chan);
|
int is_channel (server *serv, char *chan);
|
||||||
char get_nick_prefix (server *serv, unsigned int access);
|
char get_nick_prefix (server *serv, unsigned int access);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <glib.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -54,7 +54,7 @@ net_set_socket_options (int sok)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
net_ip (guint32 addr)
|
net_ip (uint32_t addr)
|
||||||
{
|
{
|
||||||
struct in_addr ia;
|
struct in_addr ia;
|
||||||
|
|
||||||
@@ -67,13 +67,13 @@ net_store_destroy (netstore * ns)
|
|||||||
{
|
{
|
||||||
if (ns->ip6_hostent)
|
if (ns->ip6_hostent)
|
||||||
freeaddrinfo (ns->ip6_hostent);
|
freeaddrinfo (ns->ip6_hostent);
|
||||||
g_free (ns);
|
free (ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
netstore *
|
netstore *
|
||||||
net_store_new (void)
|
net_store_new (void)
|
||||||
{
|
{
|
||||||
return g_new0 (netstore, 1);
|
return calloc (1, sizeof (netstore));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =================== IPV6 ================== */
|
/* =================== IPV6 ================== */
|
||||||
@@ -121,11 +121,11 @@ net_resolve (netstore * ns, char *hostname, int port, char **real_host)
|
|||||||
ipstring, sizeof (ipstring), NULL, 0, NI_NUMERICHOST);
|
ipstring, sizeof (ipstring), NULL, 0, NI_NUMERICHOST);
|
||||||
|
|
||||||
if (ns->ip6_hostent->ai_canonname)
|
if (ns->ip6_hostent->ai_canonname)
|
||||||
*real_host = g_strdup (ns->ip6_hostent->ai_canonname);
|
*real_host = strdup (ns->ip6_hostent->ai_canonname);
|
||||||
else
|
else
|
||||||
*real_host = g_strdup (hostname);
|
*real_host = strdup (hostname);
|
||||||
|
|
||||||
return g_strdup (ipstring);
|
return strdup (ipstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the only thing making this interface unclean, this shitty sok4, sok6 business */
|
/* the only thing making this interface unclean, this shitty sok4, sok6 business */
|
||||||
|
|||||||
@@ -17,8 +17,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_NETWORK_H
|
#ifndef ZOITECHAT_NETWORK_H
|
||||||
#define HEXCHAT_NETWORK_H
|
#define ZOITECHAT_NETWORK_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct netstore_
|
typedef struct netstore_
|
||||||
{
|
{
|
||||||
@@ -36,7 +38,7 @@ void net_store_destroy (netstore *ns);
|
|||||||
int net_connect (netstore *ns, int sok4, int sok6, int *sok_return);
|
int net_connect (netstore *ns, int sok4, int sok6, int *sok_return);
|
||||||
char *net_resolve (netstore *ns, char *hostname, int port, char **real_host);
|
char *net_resolve (netstore *ns, char *hostname, int port, char **real_host);
|
||||||
void net_bind (netstore *tobindto, int sok4, int sok6);
|
void net_bind (netstore *tobindto, int sok4, int sok6);
|
||||||
char *net_ip (guint32 addr);
|
char *net_ip (uint32_t addr);
|
||||||
void net_sockets (int *sok4, int *sok6);
|
void net_sockets (int *sok4, int *sok6);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -478,7 +478,7 @@ notify_markonline (server *serv, char *word[], const message_tags_data *tags_dat
|
|||||||
about 27 people */
|
about 27 people */
|
||||||
if (i > PDIWORDS - 5)
|
if (i > PDIWORDS - 5)
|
||||||
{
|
{
|
||||||
/*fprintf (stderr, _("*** HEXCHAT WARNING: notify list too large.\n"));*/
|
/*fprintf (stderr, _("*** ZOITECHAT WARNING: notify list too large.\n"));*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,7 +515,7 @@ notify_checklist_for_server (server *serv)
|
|||||||
/* LAME: we can't send more than 512 bytes to the server, but *
|
/* LAME: we can't send more than 512 bytes to the server, but *
|
||||||
* if we split it in two packets, our offline detection wouldn't *
|
* if we split it in two packets, our offline detection wouldn't *
|
||||||
work */
|
work */
|
||||||
/*fprintf (stderr, _("*** HEXCHAT WARNING: notify list too large.\n"));*/
|
/*fprintf (stderr, _("*** ZOITECHAT WARNING: notify list too large.\n"));*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@
|
|||||||
|
|
||||||
#include "proto-irc.h"
|
#include "proto-irc.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_NOTIFY_H
|
#ifndef ZOITECHAT_NOTIFY_H
|
||||||
#define HEXCHAT_NOTIFY_H
|
#define ZOITECHAT_NOTIFY_H
|
||||||
|
|
||||||
struct notify
|
struct notify
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_OUTBOUND_H
|
#ifndef ZOITECHAT_OUTBOUND_H
|
||||||
#define HEXCHAT_OUTBOUND_H
|
#define ZOITECHAT_OUTBOUND_H
|
||||||
|
|
||||||
#include "zoitechat.h"
|
#include "zoitechat.h"
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ identd_cleanup_response_cb (gpointer userdata)
|
|||||||
static int
|
static int
|
||||||
identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (responses != NULL, HEXCHAT_EAT_ALL);
|
g_return_val_if_fail (responses != NULL, ZOITECHAT_EAT_ALL);
|
||||||
|
|
||||||
if (!g_strcmp0 (word[2], "reload"))
|
if (!g_strcmp0 (word[2], "reload"))
|
||||||
{
|
{
|
||||||
@@ -86,11 +86,11 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
identd_start_server ();
|
identd_start_server ();
|
||||||
|
|
||||||
if (service)
|
if (service)
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service == NULL) /* If we are not running plugins can handle it */
|
if (service == NULL) /* If we are not running plugins can handle it */
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
|
|
||||||
if (word[2] && *word[2] && word[3] && *word[3])
|
if (word[2] && *word[2] && word[3] && *word[3])
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,7 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
zoitechat_command (ph, "HELP IDENTD");
|
zoitechat_command (ph, "HELP IDENTD");
|
||||||
}
|
}
|
||||||
|
|
||||||
return HEXCHAT_EAT_ALL;
|
return ZOITECHAT_EAT_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -258,7 +258,7 @@ identd_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
|||||||
|
|
||||||
|
|
||||||
responses = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
responses = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
||||||
zoitechat_hook_command (ph, "IDENTD", HEXCHAT_PRI_NORM, identd_command_cb,
|
zoitechat_hook_command (ph, "IDENTD", ZOITECHAT_PRI_NORM, identd_command_cb,
|
||||||
_("IDENTD <port> <username>"), NULL);
|
_("IDENTD <port> <username>"), NULL);
|
||||||
|
|
||||||
identd_start_server ();
|
identd_start_server ();
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_PLUGIN_IDENTD_H
|
#ifndef ZOITECHAT_PLUGIN_IDENTD_H
|
||||||
#define HEXCHAT_PLUGIN_IDENTD_H
|
#define ZOITECHAT_PLUGIN_IDENTD_H
|
||||||
|
|
||||||
int identd_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
int identd_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
||||||
char **plugin_desc, char **plugin_version, char *arg);
|
char **plugin_desc, char **plugin_version, char *arg);
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (!word[2][0])
|
if (!word[2][0])
|
||||||
{
|
{
|
||||||
timer_showlist ();
|
timer_showlist ();
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_ascii_strcasecmp (word[2], "-quiet") == 0)
|
if (g_ascii_strcasecmp (word[2], "-quiet") == 0)
|
||||||
@@ -183,7 +183,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
if (g_ascii_strcasecmp (word[2 + offset], "-delete") == 0)
|
if (g_ascii_strcasecmp (word[2 + offset], "-delete") == 0)
|
||||||
{
|
{
|
||||||
timer_del_ref (atoi (word[3 + offset]), quiet);
|
timer_del_ref (atoi (word[3 + offset]), quiet);
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_ascii_strcasecmp (word[2 + offset], "-refnum") == 0)
|
if (g_ascii_strcasecmp (word[2 + offset], "-refnum") == 0)
|
||||||
@@ -206,7 +206,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata)
|
|||||||
else
|
else
|
||||||
timer_add (ref, (int) timeout * 1000, repeat, command);
|
timer_add (ref, (int) timeout * 1000, repeat, command);
|
||||||
|
|
||||||
return HEXCHAT_EAT_HEXCHAT;
|
return ZOITECHAT_EAT_ZOITECHAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -225,7 +225,7 @@ zoitechat_plugin_init
|
|||||||
*plugin_desc = "IrcII style /TIMER command";
|
*plugin_desc = "IrcII style /TIMER command";
|
||||||
*plugin_version = "";
|
*plugin_version = "";
|
||||||
|
|
||||||
zoitechat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, _(HELP), 0);
|
zoitechat_hook_command (ph, "TIMER", ZOITECHAT_PRI_NORM, timer_cb, _(HELP), 0);
|
||||||
|
|
||||||
return 1; /* return 1 for success */
|
return 1; /* return 1 for success */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_PLUGIN_TIMER_H
|
#ifndef ZOITECHAT_PLUGIN_TIMER_H
|
||||||
#define HEXCHAT_PLUGIN_TIMER_H
|
#define ZOITECHAT_PLUGIN_TIMER_H
|
||||||
|
|
||||||
int timer_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
int timer_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name,
|
||||||
char **plugin_desc, char **plugin_version, char *arg);
|
char **plugin_desc, char **plugin_version, char *arg);
|
||||||
|
|||||||
@@ -466,11 +466,11 @@ plugin_get_libdir (void)
|
|||||||
{
|
{
|
||||||
const char *libdir;
|
const char *libdir;
|
||||||
|
|
||||||
libdir = g_getenv ("HEXCHAT_LIBDIR");
|
libdir = g_getenv ("ZOITECHAT_LIBDIR");
|
||||||
if (libdir && *libdir)
|
if (libdir && *libdir)
|
||||||
return libdir;
|
return libdir;
|
||||||
else
|
else
|
||||||
return HEXCHATLIBDIR;
|
return ZOITECHATLIBDIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -608,14 +608,14 @@ plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[],
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret & HEXCHAT_EAT_HEXCHAT) && (ret & HEXCHAT_EAT_PLUGIN))
|
if ((ret & ZOITECHAT_EAT_ZOITECHAT) && (ret & ZOITECHAT_EAT_PLUGIN))
|
||||||
{
|
{
|
||||||
eat = 1;
|
eat = 1;
|
||||||
goto xit;
|
goto xit;
|
||||||
}
|
}
|
||||||
if (ret & HEXCHAT_EAT_PLUGIN)
|
if (ret & ZOITECHAT_EAT_PLUGIN)
|
||||||
goto xit; /* stop running plugins */
|
goto xit; /* stop running plugins */
|
||||||
if (ret & HEXCHAT_EAT_HEXCHAT)
|
if (ret & ZOITECHAT_EAT_ZOITECHAT)
|
||||||
eat = 1; /* eventually we'll return 1, but continue running plugins */
|
eat = 1; /* eventually we'll return 1, but continue running plugins */
|
||||||
|
|
||||||
list = next;
|
list = next;
|
||||||
@@ -801,11 +801,11 @@ plugin_fd_cb (GIOChannel *source, GIOCondition condition, zoitechat_hook *hook)
|
|||||||
typedef int (zoitechat_fd_cb2) (int fd, int flags, void *user_data, GIOChannel *);
|
typedef int (zoitechat_fd_cb2) (int fd, int flags, void *user_data, GIOChannel *);
|
||||||
|
|
||||||
if (condition & G_IO_IN)
|
if (condition & G_IO_IN)
|
||||||
flags |= HEXCHAT_FD_READ;
|
flags |= ZOITECHAT_FD_READ;
|
||||||
if (condition & G_IO_OUT)
|
if (condition & G_IO_OUT)
|
||||||
flags |= HEXCHAT_FD_WRITE;
|
flags |= ZOITECHAT_FD_WRITE;
|
||||||
if (condition & G_IO_PRI)
|
if (condition & G_IO_PRI)
|
||||||
flags |= HEXCHAT_FD_EXCEPTION;
|
flags |= ZOITECHAT_FD_EXCEPTION;
|
||||||
|
|
||||||
ret = ((zoitechat_fd_cb2 *)hook->callback) (hook->pri, flags, hook->userdata, source);
|
ret = ((zoitechat_fd_cb2 *)hook->callback) (hook->pri, flags, hook->userdata, source);
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_COMMONPLUGIN_H
|
#ifndef ZOITECHAT_COMMONPLUGIN_H
|
||||||
#define HEXCHAT_COMMONPLUGIN_H
|
#define ZOITECHAT_COMMONPLUGIN_H
|
||||||
|
|
||||||
#ifdef PLUGIN_C
|
#ifdef PLUGIN_C
|
||||||
struct _zoitechat_plugin
|
struct _zoitechat_plugin
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "zoitechat.h"
|
#include "zoitechat.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_PROTO_H
|
#ifndef ZOITECHAT_PROTO_H
|
||||||
#define HEXCHAT_PROTO_H
|
#define ZOITECHAT_PROTO_H
|
||||||
|
|
||||||
#define MESSAGE_TAGS_DATA_INIT \
|
#define MESSAGE_TAGS_DATA_INIT \
|
||||||
{ \
|
{ \
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
#ifndef HEXCHAT_SCRAM_H
|
#ifndef ZOITECHAT_SCRAM_H
|
||||||
#define HEXCHAT_SCRAM_H
|
#define ZOITECHAT_SCRAM_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include "proto-irc.h"
|
#include "proto-irc.h"
|
||||||
#include "servlist.h"
|
#include "servlist.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
#include "sts.h"
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
#include <openssl/ssl.h> /* SSL_() */
|
#include <openssl/ssl.h> /* SSL_() */
|
||||||
@@ -396,7 +397,7 @@ server_read (GIOChannel *source, GIOCondition condition, server *serv)
|
|||||||
serv->linebuf[serv->pos] = lbuf[i];
|
serv->linebuf[serv->pos] = lbuf[i];
|
||||||
if (serv->pos >= (sizeof (serv->linebuf) - 1))
|
if (serv->pos >= (sizeof (serv->linebuf) - 1))
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"*** HEXCHAT WARNING: Buffer overflow - non-compliant server!\n");
|
"*** ZOITECHAT WARNING: Buffer overflow - non-compliant server!\n");
|
||||||
else
|
else
|
||||||
serv->pos++;
|
serv->pos++;
|
||||||
}
|
}
|
||||||
@@ -1034,6 +1035,8 @@ server_disconnect (session * sess, int sendquit, int err)
|
|||||||
server_sendquit (sess);
|
server_sendquit (sess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sts_reschedule_on_disconnect (serv);
|
||||||
|
|
||||||
fe_server_event (serv, FE_SE_DISCONNECT, 0);
|
fe_server_event (serv, FE_SE_DISCONNECT, 0);
|
||||||
|
|
||||||
/* close all sockets & io tags */
|
/* close all sockets & io tags */
|
||||||
@@ -1588,6 +1591,15 @@ server_connect (server *serv, char *hostname, int port, int no_login)
|
|||||||
int pid, read_des[2];
|
int pid, read_des[2];
|
||||||
session *sess = serv->server_session;
|
session *sess = serv->server_session;
|
||||||
|
|
||||||
|
if (!hostname[0])
|
||||||
|
return;
|
||||||
|
|
||||||
|
safe_strcpy (serv->sts_host, hostname, sizeof (serv->sts_host));
|
||||||
|
if (!sts_apply_policy_for_connection (serv, hostname, &port))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
if (!serv->ctx && serv->use_ssl)
|
if (!serv->ctx && serv->use_ssl)
|
||||||
{
|
{
|
||||||
@@ -1599,9 +1611,6 @@ server_connect (server *serv, char *hostname, int port, int no_login)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!hostname[0])
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (port < 1 || port > 65535)
|
if (port < 1 || port > 65535)
|
||||||
{
|
{
|
||||||
/* use default port for this server type */
|
/* use default port for this server type */
|
||||||
@@ -1842,6 +1851,8 @@ server_set_defaults (server *serv)
|
|||||||
serv->have_sasl = FALSE;
|
serv->have_sasl = FALSE;
|
||||||
serv->have_except = FALSE;
|
serv->have_except = FALSE;
|
||||||
serv->have_invite = FALSE;
|
serv->have_invite = FALSE;
|
||||||
|
serv->sts_duration_seen = FALSE;
|
||||||
|
serv->sts_upgrade_in_progress = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_SERVER_H
|
#ifndef ZOITECHAT_SERVER_H
|
||||||
#define HEXCHAT_SERVER_H
|
#define ZOITECHAT_SERVER_H
|
||||||
|
|
||||||
extern GSList *serv_list;
|
extern GSList *serv_list;
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_SERVLIST_H
|
#ifndef ZOITECHAT_SERVLIST_H
|
||||||
#define HEXCHAT_SERVLIST_H
|
#define ZOITECHAT_SERVLIST_H
|
||||||
|
|
||||||
typedef struct ircserver
|
typedef struct ircserver
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_SSL_H
|
#ifndef ZOITECHAT_SSL_H
|
||||||
#define HEXCHAT_SSL_H
|
#define ZOITECHAT_SSL_H
|
||||||
|
|
||||||
struct cert_info {
|
struct cert_info {
|
||||||
char subject[256];
|
char subject[256];
|
||||||
|
|||||||
641
src/common/sts.c
Normal file
641
src/common/sts.c
Normal file
@@ -0,0 +1,641 @@
|
|||||||
|
/* ZoiteChat
|
||||||
|
* Copyright (C) 2024
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "zoitechat.h"
|
||||||
|
#include "cfgfiles.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "text.h"
|
||||||
|
#include "sts.h"
|
||||||
|
|
||||||
|
static GHashTable *sts_profiles = NULL;
|
||||||
|
static gboolean sts_loaded = FALSE;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
sts_parse_bool (const char *value)
|
||||||
|
{
|
||||||
|
if (!value || !*value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_ascii_strcasecmp (value, "1") == 0 ||
|
||||||
|
g_ascii_strcasecmp (value, "true") == 0 ||
|
||||||
|
g_ascii_strcasecmp (value, "yes") == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profile *
|
||||||
|
sts_profile_new (const char *host, guint16 port, time_t expires_at, guint64 duration, gboolean preload)
|
||||||
|
{
|
||||||
|
sts_profile *profile = g_new0 (sts_profile, 1);
|
||||||
|
|
||||||
|
profile->host = g_strdup (host);
|
||||||
|
profile->port = port;
|
||||||
|
profile->expires_at = expires_at;
|
||||||
|
profile->duration = duration;
|
||||||
|
profile->preload = preload;
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sts_profile_free (sts_profile *profile)
|
||||||
|
{
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (profile->host);
|
||||||
|
g_free (profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
sts_profile_serialize (const sts_profile *profile)
|
||||||
|
{
|
||||||
|
GString *serialized;
|
||||||
|
char *escaped_host;
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
if (!profile || !profile->host || !*profile->host)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
escaped_host = g_strdup (profile->host);
|
||||||
|
serialized = g_string_new (escaped_host);
|
||||||
|
g_free (escaped_host);
|
||||||
|
|
||||||
|
g_string_append_printf (serialized, " %u %" G_GINT64_FORMAT,
|
||||||
|
profile->port, (gint64) profile->expires_at);
|
||||||
|
|
||||||
|
if (profile->duration > 0)
|
||||||
|
{
|
||||||
|
g_string_append_printf (serialized, " %" G_GUINT64_FORMAT, profile->duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile->preload)
|
||||||
|
{
|
||||||
|
g_string_append (serialized, " 1");
|
||||||
|
}
|
||||||
|
|
||||||
|
result = g_string_free (serialized, FALSE);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profile *
|
||||||
|
sts_profile_deserialize (const char *serialized)
|
||||||
|
{
|
||||||
|
char *host = NULL;
|
||||||
|
guint16 port = 0;
|
||||||
|
gint64 expires_at = -1;
|
||||||
|
guint64 duration = 0;
|
||||||
|
gboolean preload = FALSE;
|
||||||
|
gboolean duration_seen = FALSE;
|
||||||
|
gchar **pairs = NULL;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
if (!serialized || !*serialized)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pairs = g_strsplit_set (serialized, " \t", -1);
|
||||||
|
{
|
||||||
|
const char *fields[5] = {0};
|
||||||
|
int field_count = 0;
|
||||||
|
|
||||||
|
for (i = 0; pairs[i]; i++)
|
||||||
|
{
|
||||||
|
if (!pairs[i][0])
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_count < 5)
|
||||||
|
{
|
||||||
|
fields[field_count++] = pairs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_count >= 3)
|
||||||
|
{
|
||||||
|
host = g_strdup (fields[0]);
|
||||||
|
|
||||||
|
gint64 port_value = g_ascii_strtoll (fields[1], NULL, 10);
|
||||||
|
if (port_value > 0 && port_value <= G_MAXUINT16)
|
||||||
|
{
|
||||||
|
port = (guint16) port_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
expires_at = g_ascii_strtoll (fields[2], NULL, 10);
|
||||||
|
|
||||||
|
if (field_count >= 4)
|
||||||
|
{
|
||||||
|
if (field_count == 4 && sts_parse_bool (fields[3]))
|
||||||
|
{
|
||||||
|
preload = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
duration = g_ascii_strtoull (fields[3], NULL, 10);
|
||||||
|
duration_seen = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (field_count >= 5)
|
||||||
|
{
|
||||||
|
duration_seen = TRUE;
|
||||||
|
preload = sts_parse_bool (fields[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!host || !*host || expires_at < 0)
|
||||||
|
{
|
||||||
|
g_free (host);
|
||||||
|
g_strfreev (pairs);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!duration_seen && duration == 0 && expires_at > 0)
|
||||||
|
{
|
||||||
|
time_t now = time (NULL);
|
||||||
|
if (expires_at > now)
|
||||||
|
{
|
||||||
|
duration = (guint64) (expires_at - now);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profile *profile = sts_profile_new (host, port, (time_t) expires_at, duration, preload);
|
||||||
|
g_free (host);
|
||||||
|
g_strfreev (pairs);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
sts_normalize_host (const char *host)
|
||||||
|
{
|
||||||
|
char *normalized;
|
||||||
|
gsize len;
|
||||||
|
|
||||||
|
if (!host || !*host)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
normalized = g_ascii_strdown (host, -1);
|
||||||
|
g_strstrip (normalized);
|
||||||
|
len = strlen (normalized);
|
||||||
|
|
||||||
|
if (len > 2 && normalized[0] == '[' && normalized[len - 1] == ']')
|
||||||
|
{
|
||||||
|
char *trimmed = g_strndup (normalized + 1, len - 2);
|
||||||
|
g_free (normalized);
|
||||||
|
normalized = trimmed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sts_profiles_ensure (void)
|
||||||
|
{
|
||||||
|
if (!sts_profiles)
|
||||||
|
{
|
||||||
|
sts_profiles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
||||||
|
(GDestroyNotify) sts_profile_free);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sts_profile_store (sts_profile *profile)
|
||||||
|
{
|
||||||
|
char *normalized;
|
||||||
|
|
||||||
|
if (!profile || !profile->host)
|
||||||
|
{
|
||||||
|
sts_profile_free (profile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profiles_ensure ();
|
||||||
|
normalized = sts_normalize_host (profile->host);
|
||||||
|
if (!normalized)
|
||||||
|
{
|
||||||
|
sts_profile_free (profile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_replace (sts_profiles, normalized, profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sts_profile_remove (const char *host)
|
||||||
|
{
|
||||||
|
char *normalized;
|
||||||
|
|
||||||
|
if (!host)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profiles_ensure ();
|
||||||
|
normalized = sts_normalize_host (host);
|
||||||
|
if (!normalized)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_remove (sts_profiles, normalized);
|
||||||
|
g_free (normalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
static sts_profile *
|
||||||
|
sts_profile_lookup (const char *host, time_t now)
|
||||||
|
{
|
||||||
|
char *normalized;
|
||||||
|
sts_profile *profile = NULL;
|
||||||
|
|
||||||
|
sts_profiles_ensure ();
|
||||||
|
normalized = sts_normalize_host (host);
|
||||||
|
if (!normalized)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile = g_hash_table_lookup (sts_profiles, normalized);
|
||||||
|
if (profile && profile->expires_at > 0 && profile->expires_at <= now)
|
||||||
|
{
|
||||||
|
g_hash_table_remove (sts_profiles, normalized);
|
||||||
|
profile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (normalized);
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
sts_parse_value (const char *value, guint16 *port, guint64 *duration, gboolean *preload,
|
||||||
|
gboolean *has_port, gboolean *has_duration, gboolean *has_preload)
|
||||||
|
{
|
||||||
|
char **tokens;
|
||||||
|
gsize i;
|
||||||
|
|
||||||
|
if (!value || !*value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*has_port = FALSE;
|
||||||
|
*has_duration = FALSE;
|
||||||
|
*has_preload = FALSE;
|
||||||
|
|
||||||
|
tokens = g_strsplit (value, ",", -1);
|
||||||
|
for (i = 0; tokens[i]; i++)
|
||||||
|
{
|
||||||
|
char *token = g_strstrip (tokens[i]);
|
||||||
|
char *equals = strchr (token, '=');
|
||||||
|
char *key = token;
|
||||||
|
char *val = NULL;
|
||||||
|
|
||||||
|
if (!*token)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (equals)
|
||||||
|
{
|
||||||
|
*equals = '\0';
|
||||||
|
val = equals + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!g_ascii_strcasecmp (key, "port"))
|
||||||
|
{
|
||||||
|
gint64 port_value;
|
||||||
|
|
||||||
|
if (*has_port || !val)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
port_value = g_ascii_strtoll (val, NULL, 10);
|
||||||
|
if (port_value > 0 && port_value <= G_MAXUINT16)
|
||||||
|
{
|
||||||
|
*port = (guint16) port_value;
|
||||||
|
*has_port = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!g_ascii_strcasecmp (key, "duration"))
|
||||||
|
{
|
||||||
|
guint64 duration_value;
|
||||||
|
|
||||||
|
if (*has_duration || !val)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
duration_value = g_ascii_strtoull (val, NULL, 10);
|
||||||
|
*duration = duration_value;
|
||||||
|
*has_duration = TRUE;
|
||||||
|
}
|
||||||
|
else if (!g_ascii_strcasecmp (key, "preload"))
|
||||||
|
{
|
||||||
|
if (*has_preload)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
*preload = TRUE;
|
||||||
|
*has_preload = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_strfreev (tokens);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sts_init (void)
|
||||||
|
{
|
||||||
|
sts_profiles_ensure ();
|
||||||
|
if (sts_loaded)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_loaded = TRUE;
|
||||||
|
{
|
||||||
|
int fh;
|
||||||
|
char buf[512];
|
||||||
|
|
||||||
|
fh = zoitechat_open_file ("sts.conf", O_RDONLY, 0, 0);
|
||||||
|
if (fh != -1)
|
||||||
|
{
|
||||||
|
while (waitline (fh, buf, sizeof buf, FALSE) != -1)
|
||||||
|
{
|
||||||
|
if (buf[0] == '#' || buf[0] == '\0')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profile *profile = sts_profile_deserialize (buf);
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile->expires_at <= time (NULL))
|
||||||
|
{
|
||||||
|
sts_profile_free (profile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile->duration == 0)
|
||||||
|
{
|
||||||
|
sts_profile_free (profile);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_profile_store (profile);
|
||||||
|
}
|
||||||
|
close (fh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sts_save (void)
|
||||||
|
{
|
||||||
|
GHashTableIter iter;
|
||||||
|
gpointer key;
|
||||||
|
gpointer value;
|
||||||
|
int fh;
|
||||||
|
|
||||||
|
sts_profiles_ensure ();
|
||||||
|
fh = zoitechat_open_file ("sts.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
|
||||||
|
if (fh == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_hash_table_iter_init (&iter, sts_profiles);
|
||||||
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||||
|
{
|
||||||
|
sts_profile *profile = value;
|
||||||
|
char *serialized;
|
||||||
|
|
||||||
|
if (!profile || profile->expires_at <= time (NULL) || profile->duration == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
serialized = sts_profile_serialize (profile);
|
||||||
|
if (serialized)
|
||||||
|
{
|
||||||
|
write (fh, serialized, strlen (serialized));
|
||||||
|
write (fh, "\n", 1);
|
||||||
|
g_free (serialized);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close (fh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sts_cleanup (void)
|
||||||
|
{
|
||||||
|
if (!sts_profiles)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_save ();
|
||||||
|
g_hash_table_destroy (sts_profiles);
|
||||||
|
sts_profiles = NULL;
|
||||||
|
sts_loaded = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sts_apply_policy_for_connection (struct server *serv, const char *hostname, int *port)
|
||||||
|
{
|
||||||
|
sts_profile *profile;
|
||||||
|
time_t now;
|
||||||
|
|
||||||
|
if (!hostname || !*hostname || !port)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_init ();
|
||||||
|
sts_profiles_ensure ();
|
||||||
|
now = time (NULL);
|
||||||
|
profile = sts_profile_lookup (hostname, now);
|
||||||
|
if (!profile)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile->port == 0)
|
||||||
|
{
|
||||||
|
sts_profile_remove (hostname);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_OPENSSL
|
||||||
|
serv->use_ssl = TRUE;
|
||||||
|
if (profile->port > 0)
|
||||||
|
{
|
||||||
|
*port = profile->port;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
#else
|
||||||
|
PrintTextf (serv->server_session,
|
||||||
|
_("STS policy requires TLS for %s, but TLS is not available.\n"),
|
||||||
|
hostname);
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sts_handle_capability (struct server *serv, const char *value)
|
||||||
|
{
|
||||||
|
guint16 port = 0;
|
||||||
|
guint64 duration = 0;
|
||||||
|
gboolean preload = FALSE;
|
||||||
|
gboolean has_port = FALSE;
|
||||||
|
gboolean has_duration = FALSE;
|
||||||
|
gboolean has_preload = FALSE;
|
||||||
|
const char *hostname;
|
||||||
|
|
||||||
|
if (!serv || !value)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_init ();
|
||||||
|
if (!sts_parse_value (value, &port, &duration, &preload,
|
||||||
|
&has_port, &has_duration, &has_preload))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hostname = serv->sts_host[0] ? serv->sts_host : serv->servername;
|
||||||
|
if (!hostname || !*hostname)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!serv->use_ssl)
|
||||||
|
{
|
||||||
|
if (!has_port)
|
||||||
|
{
|
||||||
|
if (serv->port > 0)
|
||||||
|
{
|
||||||
|
port = (guint16) serv->port;
|
||||||
|
has_port = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef USE_OPENSSL
|
||||||
|
if (serv->sts_upgrade_in_progress)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
serv->sts_upgrade_in_progress = TRUE;
|
||||||
|
serv->use_ssl = TRUE;
|
||||||
|
{
|
||||||
|
char host_copy[128];
|
||||||
|
|
||||||
|
safe_strcpy (host_copy, hostname, sizeof (host_copy));
|
||||||
|
serv->disconnect (serv->server_session, FALSE, -1);
|
||||||
|
serv->connect (serv, host_copy, (int) port, serv->no_login);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
PrintTextf (serv->server_session,
|
||||||
|
_("STS upgrade requested for %s, but TLS is not available.\n"),
|
||||||
|
hostname);
|
||||||
|
#endif
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!has_duration)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (duration == 0)
|
||||||
|
{
|
||||||
|
sts_profile_remove (hostname);
|
||||||
|
serv->sts_duration_seen = FALSE;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time_t now = time (NULL);
|
||||||
|
time_t expires_at = now + (time_t) duration;
|
||||||
|
guint16 effective_port = serv->port > 0 ? (guint16) serv->port : port;
|
||||||
|
sts_profile *profile;
|
||||||
|
|
||||||
|
if (effective_port == 0)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile = sts_profile_new (hostname, effective_port, expires_at, duration,
|
||||||
|
has_preload ? preload : FALSE);
|
||||||
|
sts_profile_store (profile);
|
||||||
|
serv->sts_duration_seen = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sts_reschedule_on_disconnect (struct server *serv)
|
||||||
|
{
|
||||||
|
sts_profile *profile;
|
||||||
|
time_t now;
|
||||||
|
|
||||||
|
if (!serv || !serv->sts_duration_seen)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sts_init ();
|
||||||
|
now = time (NULL);
|
||||||
|
profile = sts_profile_lookup (serv->sts_host[0] ? serv->sts_host : serv->servername, now);
|
||||||
|
if (!profile || profile->duration == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile->expires_at = now + (time_t) profile->duration;
|
||||||
|
}
|
||||||
53
src/common/sts.h
Normal file
53
src/common/sts.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* ZoiteChat
|
||||||
|
* Copyright (C) 2024
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HEXCHAT_STS_H
|
||||||
|
#define HEXCHAT_STS_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
struct server;
|
||||||
|
|
||||||
|
typedef struct sts_profile
|
||||||
|
{
|
||||||
|
char *host;
|
||||||
|
guint16 port;
|
||||||
|
time_t expires_at;
|
||||||
|
guint64 duration;
|
||||||
|
gboolean preload;
|
||||||
|
} sts_profile;
|
||||||
|
|
||||||
|
sts_profile *sts_profile_new (const char *host, guint16 port, time_t expires_at, guint64 duration, gboolean preload);
|
||||||
|
void sts_profile_free (sts_profile *profile);
|
||||||
|
|
||||||
|
char *sts_profile_serialize (const sts_profile *profile);
|
||||||
|
sts_profile *sts_profile_deserialize (const char *serialized);
|
||||||
|
|
||||||
|
void sts_init (void);
|
||||||
|
void sts_save (void);
|
||||||
|
void sts_cleanup (void);
|
||||||
|
gboolean sts_apply_policy_for_connection (struct server *serv, const char *hostname, int *port);
|
||||||
|
gboolean sts_handle_capability (struct server *serv, const char *value);
|
||||||
|
void sts_reschedule_on_disconnect (struct server *serv);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
#ifndef HEXCHAT_SYSINFO_H
|
#ifndef ZOITECHAT_SYSINFO_H
|
||||||
#define HEXCHAT_SYSINFO_H
|
#define ZOITECHAT_SYSINFO_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
int sysinfo_get_cpu_arch (void);
|
int sysinfo_get_cpu_arch (void);
|
||||||
int sysinfo_get_build_arch (void);
|
int sysinfo_get_build_arch (void);
|
||||||
char *sysinfo_get_cpu (void);
|
char *sysinfo_get_cpu (void);
|
||||||
char *sysinfo_get_os (void);
|
char *sysinfo_get_os (void);
|
||||||
void sysinfo_get_hdd_info (guint64 *hdd_capacity_out, guint64 *hdd_free_space_out);
|
void sysinfo_get_hdd_info (uint64_t *hdd_capacity_out, uint64_t *hdd_free_space_out);
|
||||||
char *sysinfo_get_gpu (void);
|
char *sysinfo_get_gpu (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,7 +20,14 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wbemidl.h>
|
#include <wbemidl.h>
|
||||||
@@ -47,12 +54,26 @@ static char *read_os_name (IWbemClassObject *object);
|
|||||||
static char *read_cpu_info (IWbemClassObject *object);
|
static char *read_cpu_info (IWbemClassObject *object);
|
||||||
static char *read_vga_name (IWbemClassObject *object);
|
static char *read_vga_name (IWbemClassObject *object);
|
||||||
|
|
||||||
static guint64 hdd_capacity;
|
static uint64_t hdd_capacity;
|
||||||
static guint64 hdd_free_space;
|
static uint64_t hdd_free_space;
|
||||||
static char *read_hdd_info (IWbemClassObject *object);
|
static char *read_hdd_info (IWbemClassObject *object);
|
||||||
|
|
||||||
static char *bstr_to_utf8 (BSTR bstr);
|
static char *bstr_to_utf8 (BSTR bstr);
|
||||||
static guint64 variant_to_uint64 (VARIANT *variant);
|
static uint64_t variant_to_uint64 (VARIANT *variant);
|
||||||
|
static char *zoitechat_strdup (const char *value);
|
||||||
|
static char *zoitechat_strdup_printf (const char *format, ...);
|
||||||
|
static char *zoitechat_strchomp (char *value);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char *data;
|
||||||
|
size_t len;
|
||||||
|
size_t cap;
|
||||||
|
} StringBuilder;
|
||||||
|
|
||||||
|
static bool string_builder_init (StringBuilder *builder);
|
||||||
|
static void string_builder_free (StringBuilder *builder);
|
||||||
|
static bool string_builder_append (StringBuilder *builder, const char *text);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sysinfo_get_cpu (void)
|
sysinfo_get_cpu (void)
|
||||||
@@ -60,7 +81,7 @@ sysinfo_get_cpu (void)
|
|||||||
if (cpu_info == NULL)
|
if (cpu_info == NULL)
|
||||||
cpu_info = query_wmi (QUERY_WMI_CPU);
|
cpu_info = query_wmi (QUERY_WMI_CPU);
|
||||||
|
|
||||||
return g_strdup (cpu_info);
|
return zoitechat_strdup (cpu_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -69,7 +90,12 @@ sysinfo_get_os (void)
|
|||||||
if (os_name == NULL)
|
if (os_name == NULL)
|
||||||
os_name = query_wmi (QUERY_WMI_OS);
|
os_name = query_wmi (QUERY_WMI_OS);
|
||||||
|
|
||||||
return g_strdup_printf ("%s (x%d)", os_name, sysinfo_get_cpu_arch ());
|
if (os_name == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return zoitechat_strdup_printf ("%s (x%d)", os_name, sysinfo_get_cpu_arch ());
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -124,11 +150,11 @@ sysinfo_get_gpu (void)
|
|||||||
if (vga_name == NULL)
|
if (vga_name == NULL)
|
||||||
vga_name = query_wmi (QUERY_WMI_VGA);
|
vga_name = query_wmi (QUERY_WMI_VGA);
|
||||||
|
|
||||||
return g_strdup (vga_name);
|
return zoitechat_strdup (vga_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sysinfo_get_hdd_info (guint64 *hdd_capacity_out, guint64 *hdd_free_space_out)
|
sysinfo_get_hdd_info (uint64_t *hdd_capacity_out, uint64_t *hdd_free_space_out)
|
||||||
{
|
{
|
||||||
char *hdd_info;
|
char *hdd_info;
|
||||||
|
|
||||||
@@ -149,7 +175,8 @@ sysinfo_get_hdd_info (guint64 *hdd_capacity_out, guint64 *hdd_free_space_out)
|
|||||||
/* https://msdn.microsoft.com/en-us/library/aa390423 */
|
/* https://msdn.microsoft.com/en-us/library/aa390423 */
|
||||||
static char *query_wmi (QueryWmiType type)
|
static char *query_wmi (QueryWmiType type)
|
||||||
{
|
{
|
||||||
GString *result = NULL;
|
StringBuilder result;
|
||||||
|
bool result_initialized = false;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
IWbemLocator *locator = NULL;
|
IWbemLocator *locator = NULL;
|
||||||
@@ -160,7 +187,7 @@ static char *query_wmi (QueryWmiType type)
|
|||||||
IUnknown *namespaceUnknown = NULL;
|
IUnknown *namespaceUnknown = NULL;
|
||||||
IEnumWbemClassObject *enumerator = NULL;
|
IEnumWbemClassObject *enumerator = NULL;
|
||||||
int i;
|
int i;
|
||||||
gboolean atleast_one_appended = FALSE;
|
bool atleast_one_appended = false;
|
||||||
|
|
||||||
hr = CoCreateInstance (&CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (LPVOID *) &locator);
|
hr = CoCreateInstance (&CLSID_WbemLocator, 0, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (LPVOID *) &locator);
|
||||||
if (FAILED (hr))
|
if (FAILED (hr))
|
||||||
@@ -214,7 +241,11 @@ static char *query_wmi (QueryWmiType type)
|
|||||||
goto release_query;
|
goto release_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = g_string_new ("");
|
if (!string_builder_init (&result))
|
||||||
|
{
|
||||||
|
goto release_query;
|
||||||
|
}
|
||||||
|
result_initialized = true;
|
||||||
|
|
||||||
for (i = 0;; i++)
|
for (i = 0;; i++)
|
||||||
{
|
{
|
||||||
@@ -256,14 +287,22 @@ static char *query_wmi (QueryWmiType type)
|
|||||||
{
|
{
|
||||||
if (atleast_one_appended)
|
if (atleast_one_appended)
|
||||||
{
|
{
|
||||||
g_string_append (result, ", ");
|
if (!string_builder_append (&result, ", "))
|
||||||
|
{
|
||||||
|
free (line);
|
||||||
|
goto release_query;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_string_append (result, line);
|
if (!string_builder_append (&result, line))
|
||||||
|
{
|
||||||
|
free (line);
|
||||||
|
goto release_query;
|
||||||
|
}
|
||||||
|
|
||||||
g_free (line);
|
free (line);
|
||||||
|
|
||||||
atleast_one_appended = TRUE;
|
atleast_one_appended = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,12 +325,12 @@ release_locator:
|
|||||||
SysFreeString (namespaceName);
|
SysFreeString (namespaceName);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (result == NULL)
|
if (!result_initialized || result.data == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_string_free (result, FALSE);
|
return result.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *read_os_name (IWbemClassObject *object)
|
static char *read_os_name (IWbemClassObject *object)
|
||||||
@@ -315,7 +354,7 @@ static char *read_os_name (IWbemClassObject *object)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_strchomp (caption_utf8);
|
zoitechat_strchomp (caption_utf8);
|
||||||
|
|
||||||
return caption_utf8;
|
return caption_utf8;
|
||||||
}
|
}
|
||||||
@@ -326,7 +365,7 @@ static char *read_cpu_info (IWbemClassObject *object)
|
|||||||
VARIANT name_variant;
|
VARIANT name_variant;
|
||||||
char *name_utf8;
|
char *name_utf8;
|
||||||
VARIANT max_clock_speed_variant;
|
VARIANT max_clock_speed_variant;
|
||||||
guint cpu_freq_mhz;
|
uint32_t cpu_freq_mhz;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
||||||
@@ -347,7 +386,7 @@ static char *read_cpu_info (IWbemClassObject *object)
|
|||||||
hr = object->lpVtbl->Get (object, L"MaxClockSpeed", 0, &max_clock_speed_variant, NULL, NULL);
|
hr = object->lpVtbl->Get (object, L"MaxClockSpeed", 0, &max_clock_speed_variant, NULL, NULL);
|
||||||
if (FAILED (hr))
|
if (FAILED (hr))
|
||||||
{
|
{
|
||||||
g_free (name_utf8);
|
free (name_utf8);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -356,18 +395,18 @@ static char *read_cpu_info (IWbemClassObject *object)
|
|||||||
|
|
||||||
VariantClear (&max_clock_speed_variant);
|
VariantClear (&max_clock_speed_variant);
|
||||||
|
|
||||||
g_strchomp (name_utf8);
|
zoitechat_strchomp (name_utf8);
|
||||||
|
|
||||||
if (cpu_freq_mhz > 1000)
|
if (cpu_freq_mhz > 1000)
|
||||||
{
|
{
|
||||||
result = g_strdup_printf ("%s (%.2fGHz)", name_utf8, cpu_freq_mhz / 1000.f);
|
result = zoitechat_strdup_printf ("%s (%.2fGHz)", name_utf8, cpu_freq_mhz / 1000.f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = g_strdup_printf ("%s (%" G_GUINT32_FORMAT "MHz)", name_utf8, cpu_freq_mhz);
|
result = zoitechat_strdup_printf ("%s (%" PRIu32 "MHz)", name_utf8, cpu_freq_mhz);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (name_utf8);
|
free (name_utf8);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -393,7 +432,7 @@ static char *read_vga_name (IWbemClassObject *object)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_strchomp (name_utf8);
|
return zoitechat_strchomp (name_utf8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *read_hdd_info (IWbemClassObject *object)
|
static char *read_hdd_info (IWbemClassObject *object)
|
||||||
@@ -401,11 +440,11 @@ static char *read_hdd_info (IWbemClassObject *object)
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
VARIANT name_variant;
|
VARIANT name_variant;
|
||||||
BSTR name_bstr;
|
BSTR name_bstr;
|
||||||
gsize name_len;
|
size_t name_len;
|
||||||
VARIANT capacity_variant;
|
VARIANT capacity_variant;
|
||||||
guint64 capacity;
|
uint64_t capacity;
|
||||||
VARIANT free_space_variant;
|
VARIANT free_space_variant;
|
||||||
guint64 free_space;
|
uint64_t free_space;
|
||||||
|
|
||||||
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
hr = object->lpVtbl->Get (object, L"Name", 0, &name_variant, NULL, NULL);
|
||||||
if (FAILED (hr))
|
if (FAILED (hr))
|
||||||
@@ -464,10 +503,38 @@ static char *read_hdd_info (IWbemClassObject *object)
|
|||||||
|
|
||||||
static char *bstr_to_utf8 (BSTR bstr)
|
static char *bstr_to_utf8 (BSTR bstr)
|
||||||
{
|
{
|
||||||
return g_utf16_to_utf8 (bstr, SysStringLen (bstr), NULL, NULL, NULL);
|
int utf8_len;
|
||||||
|
char *utf8;
|
||||||
|
|
||||||
|
if (bstr == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
utf8_len = WideCharToMultiByte (CP_UTF8, 0, bstr, SysStringLen (bstr), NULL, 0, NULL, NULL);
|
||||||
|
if (utf8_len <= 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
utf8 = malloc ((size_t) utf8_len + 1);
|
||||||
|
if (utf8 == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WideCharToMultiByte (CP_UTF8, 0, bstr, SysStringLen (bstr), utf8, utf8_len, NULL, NULL) <= 0)
|
||||||
|
{
|
||||||
|
free (utf8);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
utf8[utf8_len] = '\0';
|
||||||
|
|
||||||
|
return utf8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint64 variant_to_uint64 (VARIANT *variant)
|
static uint64_t variant_to_uint64 (VARIANT *variant)
|
||||||
{
|
{
|
||||||
switch (V_VT (variant))
|
switch (V_VT (variant))
|
||||||
{
|
{
|
||||||
@@ -481,3 +548,139 @@ static guint64 variant_to_uint64 (VARIANT *variant)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *zoitechat_strdup (const char *value)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
char *copy;
|
||||||
|
|
||||||
|
if (value == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = strlen (value);
|
||||||
|
copy = malloc (len + 1);
|
||||||
|
if (copy == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy (copy, value, len + 1);
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *zoitechat_strdup_printf (const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_list args_copy;
|
||||||
|
int length;
|
||||||
|
char *buffer;
|
||||||
|
|
||||||
|
va_start (args, format);
|
||||||
|
va_copy (args_copy, args);
|
||||||
|
length = vsnprintf (NULL, 0, format, args_copy);
|
||||||
|
va_end (args_copy);
|
||||||
|
|
||||||
|
if (length < 0)
|
||||||
|
{
|
||||||
|
va_end (args);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = malloc ((size_t) length + 1);
|
||||||
|
if (buffer == NULL)
|
||||||
|
{
|
||||||
|
va_end (args);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
vsnprintf (buffer, (size_t) length + 1, format, args);
|
||||||
|
va_end (args);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *zoitechat_strchomp (char *value)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (value == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = strlen (value);
|
||||||
|
while (len > 0 && isspace ((unsigned char) value[len - 1]) != 0)
|
||||||
|
{
|
||||||
|
value[len - 1] = '\0';
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool string_builder_init (StringBuilder *builder)
|
||||||
|
{
|
||||||
|
builder->cap = 64;
|
||||||
|
builder->len = 0;
|
||||||
|
builder->data = malloc (builder->cap);
|
||||||
|
if (builder->data == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
builder->data[0] = '\0';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void string_builder_free (StringBuilder *builder)
|
||||||
|
{
|
||||||
|
if (builder->data != NULL)
|
||||||
|
{
|
||||||
|
free (builder->data);
|
||||||
|
builder->data = NULL;
|
||||||
|
}
|
||||||
|
builder->len = 0;
|
||||||
|
builder->cap = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool string_builder_append (StringBuilder *builder, const char *text)
|
||||||
|
{
|
||||||
|
size_t add_len;
|
||||||
|
size_t needed;
|
||||||
|
size_t new_cap;
|
||||||
|
char *new_data;
|
||||||
|
|
||||||
|
if (text == NULL)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_len = strlen (text);
|
||||||
|
needed = builder->len + add_len + 1;
|
||||||
|
if (needed > builder->cap)
|
||||||
|
{
|
||||||
|
new_cap = builder->cap;
|
||||||
|
while (new_cap < needed)
|
||||||
|
{
|
||||||
|
new_cap *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
new_data = realloc (builder->data, new_cap);
|
||||||
|
if (new_data == NULL)
|
||||||
|
{
|
||||||
|
string_builder_free (builder);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
builder->data = new_data;
|
||||||
|
builder->cap = new_cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy (builder->data + builder->len, text, add_len);
|
||||||
|
builder->len += add_len;
|
||||||
|
builder->data[builder->len] = '\0';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2237,7 +2237,7 @@ sound_play (const char *file, gboolean quiet)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wavfile = g_build_filename (get_xdir (), HEXCHAT_SOUND_DIR, file, NULL);
|
wavfile = g_build_filename (get_xdir (), ZOITECHAT_SOUND_DIR, file, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_access (wavfile, R_OK) == 0)
|
if (g_access (wavfile, R_OK) == 0)
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "textenums.h"
|
#include "textenums.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_TEXT_H
|
#ifndef ZOITECHAT_TEXT_H
|
||||||
#define HEXCHAT_TEXT_H
|
#define ZOITECHAT_TEXT_H
|
||||||
|
|
||||||
/* timestamp is non-zero if we are using server-time */
|
/* timestamp is non-zero if we are using server-time */
|
||||||
#define EMIT_SIGNAL_TIMESTAMP(i, sess, a, b, c, d, e, timestamp) \
|
#define EMIT_SIGNAL_TIMESTAMP(i, sess, a, b, c, d, e, timestamp) \
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_TREE_H
|
#ifndef ZOITECHAT_TREE_H
|
||||||
#define HEXCHAT_TREE_H
|
#define ZOITECHAT_TREE_H
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_TYPEDEF_H
|
#ifndef ZOITECHAT_TYPEDEF_H
|
||||||
#define HEXCHAT_TYPEDEF_H
|
#define ZOITECHAT_TYPEDEF_H
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_URL_H
|
#ifndef ZOITECHAT_URL_H
|
||||||
#define HEXCHAT_URL_H
|
#define ZOITECHAT_URL_H
|
||||||
|
|
||||||
extern void *url_tree;
|
extern void *url_tree;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "proto-irc.h"
|
#include "proto-irc.h"
|
||||||
|
|
||||||
#ifndef HEXCHAT_USERLIST_H
|
#ifndef ZOITECHAT_USERLIST_H
|
||||||
#define HEXCHAT_USERLIST_H
|
#define ZOITECHAT_USERLIST_H
|
||||||
|
|
||||||
struct User
|
struct User
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -214,11 +214,13 @@ waitline2 (GIOChannel *source, char *buf, int bufsize)
|
|||||||
gsize len;
|
gsize len;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (g_io_channel_get_buffered (source))
|
||||||
|
{
|
||||||
|
g_io_channel_set_encoding (source, NULL, &error);
|
||||||
|
g_io_channel_set_buffered (source, FALSE);
|
||||||
|
}
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
g_io_channel_set_buffered (source, FALSE);
|
|
||||||
g_io_channel_set_encoding (source, NULL, &error);
|
|
||||||
|
|
||||||
if (g_io_channel_read_chars (source, &buf[i], 1, &len, &error) != G_IO_STATUS_NORMAL)
|
if (g_io_channel_read_chars (source, &buf[i], 1, &len, &error) != G_IO_STATUS_NORMAL)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
* --+ Dagmar d'Surreal
|
* --+ Dagmar d'Surreal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_UTIL_H
|
#ifndef ZOITECHAT_UTIL_H
|
||||||
#define HEXCHAT_UTIL_H
|
#define ZOITECHAT_UTIL_H
|
||||||
|
|
||||||
#define rfc_tolower(c) (rfc_tolowertab[(unsigned char)(c)])
|
#define rfc_tolower(c) (rfc_tolowertab[(unsigned char)(c)])
|
||||||
|
|
||||||
|
|||||||
@@ -18,26 +18,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* You can distribute this header with your plugins for easy compilation */
|
/* You can distribute this header with your plugins for easy compilation */
|
||||||
#ifndef HEXCHAT_PLUGIN_H
|
#ifndef ZOITECHAT_PLUGIN_H
|
||||||
#define HEXCHAT_PLUGIN_H
|
#define ZOITECHAT_PLUGIN_H
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define HEXCHAT_PRI_HIGHEST 127
|
#define ZOITECHAT_PRI_HIGHEST 127
|
||||||
#define HEXCHAT_PRI_HIGH 64
|
#define ZOITECHAT_PRI_HIGH 64
|
||||||
#define HEXCHAT_PRI_NORM 0
|
#define ZOITECHAT_PRI_NORM 0
|
||||||
#define HEXCHAT_PRI_LOW (-64)
|
#define ZOITECHAT_PRI_LOW (-64)
|
||||||
#define HEXCHAT_PRI_LOWEST (-128)
|
#define ZOITECHAT_PRI_LOWEST (-128)
|
||||||
|
|
||||||
#define HEXCHAT_FD_READ 1
|
#define ZOITECHAT_FD_READ 1
|
||||||
#define HEXCHAT_FD_WRITE 2
|
#define ZOITECHAT_FD_WRITE 2
|
||||||
#define HEXCHAT_FD_EXCEPTION 4
|
#define ZOITECHAT_FD_EXCEPTION 4
|
||||||
#define HEXCHAT_FD_NOTSOCKET 8
|
#define ZOITECHAT_FD_NOTSOCKET 8
|
||||||
|
|
||||||
#define HEXCHAT_EAT_NONE 0 /* pass it on through! */
|
#define ZOITECHAT_EAT_NONE 0 /* pass it on through! */
|
||||||
#define HEXCHAT_EAT_HEXCHAT 1 /* don't let ZoiteChat see this event */
|
#define ZOITECHAT_EAT_ZOITECHAT 1 /* don't let ZoiteChat see this event */
|
||||||
#define HEXCHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */
|
#define ZOITECHAT_EAT_PLUGIN 2 /* don't let other plugins see this event */
|
||||||
#define HEXCHAT_EAT_ALL (HEXCHAT_EAT_HEXCHAT|HEXCHAT_EAT_PLUGIN) /* don't let anything see this event */
|
#define ZOITECHAT_EAT_ALL (ZOITECHAT_EAT_ZOITECHAT|ZOITECHAT_EAT_PLUGIN) /* don't let anything see this event */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -407,50 +407,50 @@ zoitechat_pluginpref_list (zoitechat_plugin *ph,
|
|||||||
char *dest);
|
char *dest);
|
||||||
|
|
||||||
#if !defined(PLUGIN_C) && (defined(WIN32) || defined(__CYGWIN__))
|
#if !defined(PLUGIN_C) && (defined(WIN32) || defined(__CYGWIN__))
|
||||||
#ifndef HEXCHAT_PLUGIN_HANDLE
|
#ifndef ZOITECHAT_PLUGIN_HANDLE
|
||||||
#define HEXCHAT_PLUGIN_HANDLE (ph)
|
#define ZOITECHAT_PLUGIN_HANDLE (ph)
|
||||||
#endif
|
#endif
|
||||||
#define zoitechat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_command)
|
#define zoitechat_hook_command ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_command)
|
||||||
#define zoitechat_event_attrs_create ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_event_attrs_create)
|
#define zoitechat_event_attrs_create ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_event_attrs_create)
|
||||||
#define zoitechat_event_attrs_free ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_event_attrs_free)
|
#define zoitechat_event_attrs_free ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_event_attrs_free)
|
||||||
#define zoitechat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_server)
|
#define zoitechat_hook_server ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_server)
|
||||||
#define zoitechat_hook_server_attrs ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_server_attrs)
|
#define zoitechat_hook_server_attrs ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_server_attrs)
|
||||||
#define zoitechat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_print)
|
#define zoitechat_hook_print ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_print)
|
||||||
#define zoitechat_hook_print_attrs ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_print_attrs)
|
#define zoitechat_hook_print_attrs ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_print_attrs)
|
||||||
#define zoitechat_hook_timer ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_timer)
|
#define zoitechat_hook_timer ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_timer)
|
||||||
#define zoitechat_hook_fd ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_hook_fd)
|
#define zoitechat_hook_fd ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_hook_fd)
|
||||||
#define zoitechat_unhook ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_unhook)
|
#define zoitechat_unhook ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_unhook)
|
||||||
#define zoitechat_print ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_print)
|
#define zoitechat_print ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_print)
|
||||||
#define zoitechat_printf ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_printf)
|
#define zoitechat_printf ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_printf)
|
||||||
#define zoitechat_command ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_command)
|
#define zoitechat_command ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_command)
|
||||||
#define zoitechat_commandf ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_commandf)
|
#define zoitechat_commandf ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_commandf)
|
||||||
#define zoitechat_nickcmp ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_nickcmp)
|
#define zoitechat_nickcmp ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_nickcmp)
|
||||||
#define zoitechat_set_context ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_set_context)
|
#define zoitechat_set_context ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_set_context)
|
||||||
#define zoitechat_find_context ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_find_context)
|
#define zoitechat_find_context ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_find_context)
|
||||||
#define zoitechat_get_context ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_get_context)
|
#define zoitechat_get_context ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_get_context)
|
||||||
#define zoitechat_get_info ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_get_info)
|
#define zoitechat_get_info ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_get_info)
|
||||||
#define zoitechat_get_prefs ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_get_prefs)
|
#define zoitechat_get_prefs ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_get_prefs)
|
||||||
#define zoitechat_list_get ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_get)
|
#define zoitechat_list_get ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_get)
|
||||||
#define zoitechat_list_free ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_free)
|
#define zoitechat_list_free ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_free)
|
||||||
#define zoitechat_list_fields ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_fields)
|
#define zoitechat_list_fields ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_fields)
|
||||||
#define zoitechat_list_next ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_next)
|
#define zoitechat_list_next ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_next)
|
||||||
#define zoitechat_list_str ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_str)
|
#define zoitechat_list_str ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_str)
|
||||||
#define zoitechat_list_int ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_int)
|
#define zoitechat_list_int ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_int)
|
||||||
#define zoitechat_plugingui_add ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_plugingui_add)
|
#define zoitechat_plugingui_add ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_plugingui_add)
|
||||||
#define zoitechat_plugingui_remove ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_plugingui_remove)
|
#define zoitechat_plugingui_remove ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_plugingui_remove)
|
||||||
#define zoitechat_emit_print ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_emit_print)
|
#define zoitechat_emit_print ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_emit_print)
|
||||||
#define zoitechat_emit_print_attrs ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_emit_print_attrs)
|
#define zoitechat_emit_print_attrs ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_emit_print_attrs)
|
||||||
#define zoitechat_list_time ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_list_time)
|
#define zoitechat_list_time ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_list_time)
|
||||||
#define zoitechat_gettext ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_gettext)
|
#define zoitechat_gettext ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_gettext)
|
||||||
#define zoitechat_send_modes ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_send_modes)
|
#define zoitechat_send_modes ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_send_modes)
|
||||||
#define zoitechat_strip ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_strip)
|
#define zoitechat_strip ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_strip)
|
||||||
#define zoitechat_free ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_free)
|
#define zoitechat_free ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_free)
|
||||||
#define zoitechat_pluginpref_set_str ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_set_str)
|
#define zoitechat_pluginpref_set_str ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_set_str)
|
||||||
#define zoitechat_pluginpref_get_str ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_get_str)
|
#define zoitechat_pluginpref_get_str ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_get_str)
|
||||||
#define zoitechat_pluginpref_set_int ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_set_int)
|
#define zoitechat_pluginpref_set_int ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_set_int)
|
||||||
#define zoitechat_pluginpref_get_int ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_get_int)
|
#define zoitechat_pluginpref_get_int ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_get_int)
|
||||||
#define zoitechat_pluginpref_delete ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_delete)
|
#define zoitechat_pluginpref_delete ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_delete)
|
||||||
#define zoitechat_pluginpref_list ((HEXCHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_list)
|
#define zoitechat_pluginpref_list ((ZOITECHAT_PLUGIN_HANDLE)->zoitechat_pluginpref_list)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "servlist.h"
|
#include "servlist.h"
|
||||||
|
#include "sts.h"
|
||||||
#include "outbound.h"
|
#include "outbound.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
@@ -1200,6 +1201,7 @@ xchat_init (void)
|
|||||||
sound_load ();
|
sound_load ();
|
||||||
notify_load ();
|
notify_load ();
|
||||||
ignore_load ();
|
ignore_load ();
|
||||||
|
sts_init ();
|
||||||
|
|
||||||
g_snprintf (buf, sizeof (buf),
|
g_snprintf (buf, sizeof (buf),
|
||||||
"NAME %s~%s~\n" "CMD query %%s\n\n"\
|
"NAME %s~%s~\n" "CMD query %%s\n\n"\
|
||||||
@@ -1352,6 +1354,7 @@ zoitechat_exit (void)
|
|||||||
sound_save ();
|
sound_save ();
|
||||||
notify_save ();
|
notify_save ();
|
||||||
ignore_save ();
|
ignore_save ();
|
||||||
|
sts_cleanup ();
|
||||||
free_sessions ();
|
free_sessions ();
|
||||||
chanopt_save_all (TRUE);
|
chanopt_save_all (TRUE);
|
||||||
servlist_cleanup ();
|
servlist_cleanup ();
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
#include <time.h> /* need time_t */
|
#include <time.h> /* need time_t */
|
||||||
|
|
||||||
#ifndef HEXCHAT_H
|
#ifndef ZOITECHAT_H
|
||||||
#define HEXCHAT_H
|
#define ZOITECHAT_H
|
||||||
|
|
||||||
gboolean zoitechat_theme_path_from_arg (const char *arg, char **path_out);
|
gboolean zoitechat_theme_path_from_arg (const char *arg, char **path_out);
|
||||||
gboolean zoitechat_import_theme (const char *path, GError **error);
|
gboolean zoitechat_import_theme (const char *path, GError **error);
|
||||||
@@ -83,6 +83,10 @@ gboolean zoitechat_import_theme (const char *path, GError **error);
|
|||||||
#define USERNAMELEN 10
|
#define USERNAMELEN 10
|
||||||
#define HIDDEN_CHAR 8 /* invisible character for xtext */
|
#define HIDDEN_CHAR 8 /* invisible character for xtext */
|
||||||
|
|
||||||
|
#define ZOITECHAT_DARK_MODE_AUTO 0
|
||||||
|
#define ZOITECHAT_DARK_MODE_DARK 1
|
||||||
|
#define ZOITECHAT_DARK_MODE_LIGHT 2
|
||||||
|
|
||||||
struct nbexec
|
struct nbexec
|
||||||
{
|
{
|
||||||
int myfd;
|
int myfd;
|
||||||
@@ -510,6 +514,7 @@ typedef struct server
|
|||||||
int joindelay_tag; /* waiting before we send JOIN */
|
int joindelay_tag; /* waiting before we send JOIN */
|
||||||
char hostname[128]; /* real ip number */
|
char hostname[128]; /* real ip number */
|
||||||
char servername[128]; /* what the server says is its name */
|
char servername[128]; /* what the server says is its name */
|
||||||
|
char sts_host[128];
|
||||||
char password[1024];
|
char password[1024];
|
||||||
char nick[NICKLEN];
|
char nick[NICKLEN];
|
||||||
char linebuf[8704]; /* RFC says 512 chars including \r\n, IRCv3 message tags add 8191, plus the NUL byte */
|
char linebuf[8704]; /* RFC says 512 chars including \r\n, IRCv3 message tags add 8191, plus the NUL byte */
|
||||||
@@ -584,6 +589,8 @@ typedef struct server
|
|||||||
unsigned int have_sasl:1; /* SASL capability */
|
unsigned int have_sasl:1; /* SASL capability */
|
||||||
unsigned int have_except:1; /* ban exemptions +e */
|
unsigned int have_except:1; /* ban exemptions +e */
|
||||||
unsigned int have_invite:1; /* invite exemptions +I */
|
unsigned int have_invite:1; /* invite exemptions +I */
|
||||||
|
unsigned int sts_duration_seen:1;
|
||||||
|
unsigned int sts_upgrade_in_progress:1;
|
||||||
unsigned int have_cert:1; /* have loaded a cert */
|
unsigned int have_cert:1; /* have loaded a cert */
|
||||||
unsigned int use_who:1; /* whether to use WHO command to get dcc_ip */
|
unsigned int use_who:1; /* whether to use WHO command to get dcc_ip */
|
||||||
unsigned int sasl_mech; /* mechanism for sasl auth */
|
unsigned int sasl_mech; /* mechanism for sasl auth */
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_C_H
|
#ifndef ZOITECHAT_C_H
|
||||||
#define HEXCHAT_C_H
|
#define ZOITECHAT_C_H
|
||||||
|
|
||||||
extern struct zoitechatprefs prefs;
|
extern struct zoitechatprefs prefs;
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_ASCII_H
|
#ifndef ZOITECHAT_ASCII_H
|
||||||
#define HEXCHAT_ASCII_H
|
#define ZOITECHAT_ASCII_H
|
||||||
|
|
||||||
void ascii_open (void);
|
void ascii_open (void);
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_BANLIST_H
|
#ifndef ZOITECHAT_BANLIST_H
|
||||||
#define HEXCHAT_BANLIST_H
|
#define ZOITECHAT_BANLIST_H
|
||||||
|
|
||||||
#include "../common/zoitechat.h"
|
#include "../common/zoitechat.h"
|
||||||
void banlist_opengui (session *sess);
|
void banlist_opengui (session *sess);
|
||||||
@@ -72,4 +72,4 @@ typedef struct mode_info_s {
|
|||||||
void (*tester)(banlist_info *, int); /* Function returns true to set bit into checkable */
|
void (*tester)(banlist_info *, int); /* Function returns true to set bit into checkable */
|
||||||
} mode_info;
|
} mode_info;
|
||||||
|
|
||||||
#endif /* HEXCHAT_BANLIST_H */
|
#endif /* ZOITECHAT_BANLIST_H */
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_CHANLIST_H
|
#ifndef ZOITECHAT_CHANLIST_H
|
||||||
#define HEXCHAT_CHANLIST_H
|
#define ZOITECHAT_CHANLIST_H
|
||||||
|
|
||||||
void chanlist_opengui (server *serv, int do_refresh);
|
void chanlist_opengui (server *serv, int do_refresh);
|
||||||
|
|
||||||
|
|||||||
@@ -98,11 +98,11 @@ cv_tree_init (chanview *cv)
|
|||||||
int wid1, wid2;
|
int wid1, wid2;
|
||||||
static const GtkTargetEntry dnd_src_target[] =
|
static const GtkTargetEntry dnd_src_target[] =
|
||||||
{
|
{
|
||||||
{"HEXCHAT_CHANVIEW", GTK_TARGET_SAME_APP, 75 }
|
{"ZOITECHAT_CHANVIEW", GTK_TARGET_SAME_APP, 75 }
|
||||||
};
|
};
|
||||||
static const GtkTargetEntry dnd_dest_target[] =
|
static const GtkTargetEntry dnd_dest_target[] =
|
||||||
{
|
{
|
||||||
{"HEXCHAT_USERLIST", GTK_TARGET_SAME_APP, 75 }
|
{"ZOITECHAT_USERLIST", GTK_TARGET_SAME_APP, 75 }
|
||||||
};
|
};
|
||||||
|
|
||||||
win = gtk_scrolled_window_new (0, 0);
|
win = gtk_scrolled_window_new (0, 0);
|
||||||
@@ -117,7 +117,11 @@ cv_tree_init (chanview *cv)
|
|||||||
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (cv->store));
|
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (cv->store));
|
||||||
gtk_widget_set_name (view, "zoitechat-tree");
|
gtk_widget_set_name (view, "zoitechat-tree");
|
||||||
if (cv->style)
|
if (cv->style)
|
||||||
gtk_widget_set_style (view, cv->style);
|
{
|
||||||
|
gtk_widget_modify_base (view, GTK_STATE_NORMAL, &cv->style->base[GTK_STATE_NORMAL]);
|
||||||
|
gtk_widget_modify_text (view, GTK_STATE_NORMAL, &cv->style->text[GTK_STATE_NORMAL]);
|
||||||
|
gtk_widget_modify_font (view, cv->style->font_desc);
|
||||||
|
}
|
||||||
/*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/
|
/*gtk_widget_modify_base (view, GTK_STATE_NORMAL, &colors[COL_BG]);*/
|
||||||
gtk_widget_set_can_focus (view, FALSE);
|
gtk_widget_set_can_focus (view, FALSE);
|
||||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ chanview_apply_theme (chanview *cv)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
w = GTK_WIDGET (tv->tree);
|
w = GTK_WIDGET (tv->tree);
|
||||||
if (prefs.hex_gui_dark_mode)
|
if (fe_dark_mode_is_enabled () || prefs.hex_gui_dark_mode == ZOITECHAT_DARK_MODE_LIGHT)
|
||||||
{
|
{
|
||||||
gtk_widget_modify_base (w, GTK_STATE_NORMAL, &colors[COL_BG]);
|
gtk_widget_modify_base (w, GTK_STATE_NORMAL, &colors[COL_BG]);
|
||||||
gtk_widget_modify_text (w, GTK_STATE_NORMAL, &colors[COL_FG]);
|
gtk_widget_modify_text (w, GTK_STATE_NORMAL, &colors[COL_FG]);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_CHANVIEW_H
|
#ifndef ZOITECHAT_CHANVIEW_H
|
||||||
#define HEXCHAT_CHANVIEW_H
|
#define ZOITECHAT_CHANVIEW_H
|
||||||
|
|
||||||
typedef struct _chanview chanview;
|
typedef struct _chanview chanview;
|
||||||
typedef struct _chan chan;
|
typedef struct _chan chan;
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_CUSTOM_LIST_H
|
#ifndef ZOITECHAT_CUSTOM_LIST_H
|
||||||
#define HEXCHAT_CUSTOM_LIST_H
|
#define ZOITECHAT_CUSTOM_LIST_H
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
@@ -103,4 +103,4 @@ void custom_list_append (CustomList *, chanlistrow *);
|
|||||||
void custom_list_resort (CustomList *);
|
void custom_list_resort (CustomList *);
|
||||||
void custom_list_clear (CustomList *);
|
void custom_list_clear (CustomList *);
|
||||||
|
|
||||||
#endif /* HEXCHAT_CUSTOM_LIST_H */
|
#endif /* ZOITECHAT_CUSTOM_LIST_H */
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_EDITLIST_H
|
#ifndef ZOITECHAT_EDITLIST_H
|
||||||
#define HEXCHAT_EDITLIST_H
|
#define ZOITECHAT_EDITLIST_H
|
||||||
|
|
||||||
void editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass, char *file, char *help);
|
void editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass, char *file, char *help);
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
#include <canberra.h>
|
#include <canberra.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GdkPixmap *channelwin_pix;
|
cairo_surface_t *channelwin_pix;
|
||||||
|
|
||||||
#ifdef USE_LIBCANBERRA
|
#ifdef USE_LIBCANBERRA
|
||||||
static ca_context *ca_con;
|
static ca_context *ca_con;
|
||||||
@@ -270,6 +270,130 @@ static const char adwaita_workaround_rc[] =
|
|||||||
"}"
|
"}"
|
||||||
"widget \"*.zoitechat-inputbox\" style \"zoitechat-input-workaround\"";
|
"widget \"*.zoitechat-inputbox\" style \"zoitechat-input-workaround\"";
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
fe_system_prefers_dark (void)
|
||||||
|
{
|
||||||
|
GtkSettings *settings = gtk_settings_get_default ();
|
||||||
|
gboolean prefer_dark = FALSE;
|
||||||
|
char *theme_name = NULL;
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
gboolean have_win_pref = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!settings)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
{
|
||||||
|
DWORD value = 1;
|
||||||
|
DWORD value_size = sizeof (value);
|
||||||
|
LSTATUS status;
|
||||||
|
|
||||||
|
status = RegGetValueW (HKEY_CURRENT_USER,
|
||||||
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||||
|
L"AppsUseLightTheme",
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
NULL,
|
||||||
|
&value,
|
||||||
|
&value_size);
|
||||||
|
if (status != ERROR_SUCCESS)
|
||||||
|
status = RegGetValueW (HKEY_CURRENT_USER,
|
||||||
|
L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||||
|
L"SystemUsesLightTheme",
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
NULL,
|
||||||
|
&value,
|
||||||
|
&value_size);
|
||||||
|
|
||||||
|
if (status == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
prefer_dark = (value == 0);
|
||||||
|
have_win_pref = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
if (!have_win_pref)
|
||||||
|
#endif
|
||||||
|
if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings),
|
||||||
|
"gtk-application-prefer-dark-theme"))
|
||||||
|
{
|
||||||
|
g_object_get (settings, "gtk-application-prefer-dark-theme", &prefer_dark, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prefer_dark)
|
||||||
|
{
|
||||||
|
g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
|
||||||
|
if (theme_name)
|
||||||
|
{
|
||||||
|
char *lower = g_ascii_strdown (theme_name, -1);
|
||||||
|
if (g_str_has_suffix (lower, "-dark") || g_strrstr (lower, "dark"))
|
||||||
|
prefer_dark = TRUE;
|
||||||
|
g_free (lower);
|
||||||
|
g_free (theme_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefer_dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean auto_dark_mode_enabled = FALSE;
|
||||||
|
|
||||||
|
static void
|
||||||
|
fe_auto_dark_mode_changed (GtkSettings *settings, GParamSpec *pspec, gpointer data)
|
||||||
|
{
|
||||||
|
gboolean enabled;
|
||||||
|
|
||||||
|
(void) settings;
|
||||||
|
(void) pspec;
|
||||||
|
(void) data;
|
||||||
|
|
||||||
|
if (prefs.hex_gui_dark_mode != ZOITECHAT_DARK_MODE_AUTO)
|
||||||
|
return;
|
||||||
|
|
||||||
|
enabled = fe_system_prefers_dark ();
|
||||||
|
if (enabled == auto_dark_mode_enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto_dark_mode_enabled = enabled;
|
||||||
|
palette_apply_dark_mode (enabled);
|
||||||
|
setup_apply_real (0, TRUE, FALSE, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fe_set_auto_dark_mode_state (gboolean enabled)
|
||||||
|
{
|
||||||
|
auto_dark_mode_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
fe_refresh_auto_dark_mode (void)
|
||||||
|
{
|
||||||
|
fe_auto_dark_mode_changed (NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
fe_dark_mode_is_enabled_for (unsigned int mode)
|
||||||
|
{
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case ZOITECHAT_DARK_MODE_DARK:
|
||||||
|
return TRUE;
|
||||||
|
case ZOITECHAT_DARK_MODE_LIGHT:
|
||||||
|
return FALSE;
|
||||||
|
case ZOITECHAT_DARK_MODE_AUTO:
|
||||||
|
default:
|
||||||
|
return fe_system_prefers_dark ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
fe_dark_mode_is_enabled (void)
|
||||||
|
{
|
||||||
|
return fe_dark_mode_is_enabled_for (prefs.hex_gui_dark_mode);
|
||||||
|
}
|
||||||
|
|
||||||
GtkStyle *
|
GtkStyle *
|
||||||
create_input_style (GtkStyle *style)
|
create_input_style (GtkStyle *style)
|
||||||
{
|
{
|
||||||
@@ -316,8 +440,10 @@ create_input_style (GtkStyle *style)
|
|||||||
void
|
void
|
||||||
fe_init (void)
|
fe_init (void)
|
||||||
{
|
{
|
||||||
|
GtkSettings *settings;
|
||||||
|
|
||||||
palette_load ();
|
palette_load ();
|
||||||
palette_apply_dark_mode (prefs.hex_gui_dark_mode);
|
palette_apply_dark_mode (fe_dark_mode_is_enabled ());
|
||||||
key_init ();
|
key_init ();
|
||||||
pixmaps_init ();
|
pixmaps_init ();
|
||||||
|
|
||||||
@@ -326,6 +452,16 @@ fe_init (void)
|
|||||||
#endif
|
#endif
|
||||||
channelwin_pix = pixmap_load_from_file (prefs.hex_text_background);
|
channelwin_pix = pixmap_load_from_file (prefs.hex_text_background);
|
||||||
input_style = create_input_style (gtk_style_new ());
|
input_style = create_input_style (gtk_style_new ());
|
||||||
|
|
||||||
|
settings = gtk_settings_get_default ();
|
||||||
|
if (settings)
|
||||||
|
{
|
||||||
|
auto_dark_mode_enabled = fe_system_prefers_dark ();
|
||||||
|
g_signal_connect (settings, "notify::gtk-application-prefer-dark-theme",
|
||||||
|
G_CALLBACK (fe_auto_dark_mode_changed), NULL);
|
||||||
|
g_signal_connect (settings, "notify::gtk-theme-name",
|
||||||
|
G_CALLBACK (fe_auto_dark_mode_changed), NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_GTK_MAC
|
#ifdef HAVE_GTK_MAC
|
||||||
@@ -394,7 +530,7 @@ log_handler (const gchar *log_domain,
|
|||||||
{
|
{
|
||||||
session *sess;
|
session *sess;
|
||||||
|
|
||||||
/* if (getenv ("HEXCHAT_WARNING_IGNORE")) this gets ignored sometimes, so simply just disable all warnings */
|
/* if (getenv ("ZOITECHAT_WARNING_IGNORE")) this gets ignored sometimes, so simply just disable all warnings */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sess = find_dialog (serv_list->data, "(warnings)");
|
sess = find_dialog (serv_list->data, "(warnings)");
|
||||||
@@ -402,7 +538,7 @@ log_handler (const gchar *log_domain,
|
|||||||
sess = new_ircwindow (serv_list->data, "(warnings)", SESS_DIALOG, 0);
|
sess = new_ircwindow (serv_list->data, "(warnings)", SESS_DIALOG, 0);
|
||||||
|
|
||||||
PrintTextf (sess, "%s\t%s\n", log_domain, message);
|
PrintTextf (sess, "%s\t%s\n", log_domain, message);
|
||||||
if (getenv ("HEXCHAT_WARNING_ABORT"))
|
if (getenv ("ZOITECHAT_WARNING_ABORT"))
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_FE_GTK_H
|
#ifndef ZOITECHAT_FE_GTK_H
|
||||||
#define HEXCHAT_FE_GTK_H
|
#define ZOITECHAT_FE_GTK_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
#ifdef HAVE_GTK_MAC
|
#ifdef HAVE_GTK_MAC
|
||||||
#include <gtkosxapplication.h>
|
#include <gtkosxapplication.h>
|
||||||
@@ -178,8 +179,13 @@ typedef struct session_gui
|
|||||||
|
|
||||||
} session_gui;
|
} session_gui;
|
||||||
|
|
||||||
extern GdkPixmap *channelwin_pix;
|
extern cairo_surface_t *channelwin_pix;
|
||||||
extern GdkPixmap *dialogwin_pix;
|
extern cairo_surface_t *dialogwin_pix;
|
||||||
|
|
||||||
|
gboolean fe_dark_mode_is_enabled (void);
|
||||||
|
gboolean fe_dark_mode_is_enabled_for (unsigned int mode);
|
||||||
|
void fe_set_auto_dark_mode_state (gboolean enabled);
|
||||||
|
void fe_refresh_auto_dark_mode (void);
|
||||||
|
|
||||||
#define SPELL_ENTRY_GET_TEXT(e) ((char *)(gtk_entry_get_text (GTK_ENTRY(e))))
|
#define SPELL_ENTRY_GET_TEXT(e) ((char *)(gtk_entry_get_text (GTK_ENTRY(e))))
|
||||||
#define SPELL_ENTRY_SET_TEXT(e,txt) gtk_entry_set_text(GTK_ENTRY(e),txt)
|
#define SPELL_ENTRY_SET_TEXT(e,txt) gtk_entry_set_text(GTK_ENTRY(e),txt)
|
||||||
|
|||||||
@@ -803,6 +803,7 @@ key_dialog_show ()
|
|||||||
GtkWidget *vbox, *box;
|
GtkWidget *vbox, *box;
|
||||||
GtkWidget *view, *xtext;
|
GtkWidget *view, *xtext;
|
||||||
GtkListStore *store;
|
GtkListStore *store;
|
||||||
|
XTextColor xtext_palette[XTEXT_COLS];
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
if (key_dialog)
|
if (key_dialog)
|
||||||
@@ -816,7 +817,8 @@ key_dialog_show ()
|
|||||||
NULL, 600, 360, &vbox, 0);
|
NULL, 600, 360, &vbox, 0);
|
||||||
|
|
||||||
view = key_dialog_treeview_new (vbox);
|
view = key_dialog_treeview_new (vbox);
|
||||||
xtext = gtk_xtext_new (colors, 0);
|
palette_get_xtext_colors (xtext_palette, XTEXT_COLS);
|
||||||
|
xtext = gtk_xtext_new (xtext_palette, 0);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), xtext, FALSE, TRUE, 2);
|
gtk_box_pack_start (GTK_BOX (vbox), xtext, FALSE, TRUE, 2);
|
||||||
gtk_xtext_set_font (GTK_XTEXT (xtext), prefs.hex_text_font);
|
gtk_xtext_set_font (GTK_XTEXT (xtext), prefs.hex_text_font);
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_FKEYS_H
|
#ifndef ZOITECHAT_FKEYS_H
|
||||||
#define HEXCHAT_FKEYS_H
|
#define ZOITECHAT_FKEYS_H
|
||||||
|
|
||||||
/* These are cp'ed from history.c --AGL */
|
/* These are cp'ed from history.c --AGL */
|
||||||
#define STATE_SHIFT GDK_SHIFT_MASK
|
#define STATE_SHIFT GDK_SHIFT_MASK
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ gtkutil_check_file (char *filename, struct file_req *freq)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GFileInfo *fi = g_file_query_info (file, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
GFileInfo *fi = g_file_query_info (file, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "," G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
|
||||||
|
|
||||||
if (fi != NULL)
|
if (fi != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_GTKUTIL_H
|
#ifndef ZOITECHAT_GTKUTIL_H
|
||||||
#define HEXCHAT_GTKUTIL_H
|
#define ZOITECHAT_GTKUTIL_H
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "../common/fe.h"
|
#include "../common/fe.h"
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_JOIND_H
|
#ifndef ZOITECHAT_JOIND_H
|
||||||
#define HEXCHAT_JOIND_H
|
#define ZOITECHAT_JOIND_H
|
||||||
|
|
||||||
void joind_open (server *serv);
|
void joind_open (server *serv);
|
||||||
void joind_close (server *serv);
|
void joind_close (server *serv);
|
||||||
|
|||||||
@@ -21,7 +21,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#include <gdk/gdk.h>
|
||||||
#include <gdk/gdkkeysyms.h>
|
#include <gdk/gdkkeysyms.h>
|
||||||
|
#include <gdk/gdkcairo.h>
|
||||||
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "../common/zoitechat.h"
|
#include "../common/zoitechat.h"
|
||||||
#include "../common/fe.h"
|
#include "../common/fe.h"
|
||||||
@@ -82,6 +85,136 @@ static void mg_emoji_button_cb (GtkWidget *widget, session_gui *gui);
|
|||||||
static GtkWidget *mg_create_emoji_menu (session_gui *gui);
|
static GtkWidget *mg_create_emoji_menu (session_gui *gui);
|
||||||
static void mg_emoji_insert_cb (GtkMenuItem *item, session_gui *gui);
|
static void mg_emoji_insert_cb (GtkMenuItem *item, session_gui *gui);
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
mg_set_source_color (cairo_t *cr, const XTextColor *color)
|
||||||
|
{
|
||||||
|
cairo_set_source_rgba (cr, color->red, color->green, color->blue, color->alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline guint16
|
||||||
|
mg_color_component_to_pango (double value)
|
||||||
|
{
|
||||||
|
if (value < 0.0)
|
||||||
|
value = 0.0;
|
||||||
|
if (value > 1.0)
|
||||||
|
value = 1.0;
|
||||||
|
|
||||||
|
return (guint16)(value * 65535.0 + 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mg_pixbuf_destroy (guchar *pixels, gpointer data)
|
||||||
|
{
|
||||||
|
g_free (pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GdkPixbuf *
|
||||||
|
mg_pixbuf_from_surface (cairo_surface_t *surface, int width, int height)
|
||||||
|
{
|
||||||
|
const unsigned char *src;
|
||||||
|
int src_stride;
|
||||||
|
int rowstride;
|
||||||
|
guchar *pixels;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
if (!surface || width <= 0 || height <= 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
src = cairo_image_surface_get_data (surface);
|
||||||
|
src_stride = cairo_image_surface_get_stride (surface);
|
||||||
|
rowstride = width * 4;
|
||||||
|
pixels = g_malloc ((gsize)rowstride * height);
|
||||||
|
|
||||||
|
for (y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
const unsigned char *src_row = src + (y * src_stride);
|
||||||
|
guchar *dest_row = pixels + (y * rowstride);
|
||||||
|
|
||||||
|
for (x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
guint8 a;
|
||||||
|
guint8 r;
|
||||||
|
guint8 g;
|
||||||
|
guint8 b;
|
||||||
|
const unsigned char *src_px = src_row + (x * 4);
|
||||||
|
guchar *dest_px = dest_row + (x * 4);
|
||||||
|
|
||||||
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
|
b = src_px[0];
|
||||||
|
g = src_px[1];
|
||||||
|
r = src_px[2];
|
||||||
|
a = src_px[3];
|
||||||
|
#else
|
||||||
|
a = src_px[0];
|
||||||
|
r = src_px[1];
|
||||||
|
g = src_px[2];
|
||||||
|
b = src_px[3];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (a)
|
||||||
|
{
|
||||||
|
r = (guint8)((r * 255 + (a / 2)) / a);
|
||||||
|
g = (guint8)((g * 255 + (a / 2)) / a);
|
||||||
|
b = (guint8)((b * 255 + (a / 2)) / a);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r = g = b = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dest_px[0] = r;
|
||||||
|
dest_px[1] = g;
|
||||||
|
dest_px[2] = b;
|
||||||
|
dest_px[3] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
|
||||||
|
width, height, rowstride, mg_pixbuf_destroy, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GdkPixbuf *
|
||||||
|
mg_pixbuf_from_window (GdkWindow *window, int width, int height)
|
||||||
|
{
|
||||||
|
int src_width;
|
||||||
|
int src_height;
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
cairo_t *cr;
|
||||||
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
if (!window)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
src_width = gdk_window_get_width (window);
|
||||||
|
src_height = gdk_window_get_height (window);
|
||||||
|
if (width <= 0 || height <= 0)
|
||||||
|
{
|
||||||
|
width = src_width;
|
||||||
|
height = src_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (width <= 0 || height <= 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||||
|
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cr = cairo_create (surface);
|
||||||
|
gdk_cairo_set_source_window (cr, window, 0.0, 0.0);
|
||||||
|
cairo_paint (cr);
|
||||||
|
cairo_destroy (cr);
|
||||||
|
|
||||||
|
pixbuf = mg_pixbuf_from_surface (surface, width, height);
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
|
return pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
static void mg_create_entry (session *sess, GtkWidget *box);
|
static void mg_create_entry (session *sess, GtkWidget *box);
|
||||||
static void mg_create_search (session *sess, GtkWidget *box);
|
static void mg_create_search (session *sess, GtkWidget *box);
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
@@ -106,7 +239,7 @@ static PangoAttrList *newmsg_list;
|
|||||||
static PangoAttrList *plain_list = NULL;
|
static PangoAttrList *plain_list = NULL;
|
||||||
|
|
||||||
static PangoAttrList *
|
static PangoAttrList *
|
||||||
mg_attr_list_create (GdkColor *col, int size)
|
mg_attr_list_create (const XTextColor *col, int size)
|
||||||
{
|
{
|
||||||
PangoAttribute *attr;
|
PangoAttribute *attr;
|
||||||
PangoAttrList *list;
|
PangoAttrList *list;
|
||||||
@@ -115,7 +248,10 @@ mg_attr_list_create (GdkColor *col, int size)
|
|||||||
|
|
||||||
if (col)
|
if (col)
|
||||||
{
|
{
|
||||||
attr = pango_attr_foreground_new (col->red, col->green, col->blue);
|
attr = pango_attr_foreground_new (
|
||||||
|
mg_color_component_to_pango (col->red),
|
||||||
|
mg_color_component_to_pango (col->green),
|
||||||
|
mg_color_component_to_pango (col->blue));
|
||||||
attr->start_index = 0;
|
attr->start_index = 0;
|
||||||
attr->end_index = 0xffff;
|
attr->end_index = 0xffff;
|
||||||
pango_attr_list_insert (list, attr);
|
pango_attr_list_insert (list, attr);
|
||||||
@@ -135,6 +271,8 @@ mg_attr_list_create (GdkColor *col, int size)
|
|||||||
static void
|
static void
|
||||||
mg_create_tab_colors (void)
|
mg_create_tab_colors (void)
|
||||||
{
|
{
|
||||||
|
XTextColor gui_palette[MAX_COL + 1];
|
||||||
|
|
||||||
if (plain_list)
|
if (plain_list)
|
||||||
{
|
{
|
||||||
pango_attr_list_unref (plain_list);
|
pango_attr_list_unref (plain_list);
|
||||||
@@ -144,11 +282,12 @@ mg_create_tab_colors (void)
|
|||||||
pango_attr_list_unref (away_list);
|
pango_attr_list_unref (away_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
palette_get_xtext_colors (gui_palette, G_N_ELEMENTS (gui_palette));
|
||||||
plain_list = mg_attr_list_create (NULL, prefs.hex_gui_tab_small);
|
plain_list = mg_attr_list_create (NULL, prefs.hex_gui_tab_small);
|
||||||
newdata_list = mg_attr_list_create (&colors[COL_NEW_DATA], prefs.hex_gui_tab_small);
|
newdata_list = mg_attr_list_create (&gui_palette[COL_NEW_DATA], prefs.hex_gui_tab_small);
|
||||||
nickseen_list = mg_attr_list_create (&colors[COL_HILIGHT], prefs.hex_gui_tab_small);
|
nickseen_list = mg_attr_list_create (&gui_palette[COL_HILIGHT], prefs.hex_gui_tab_small);
|
||||||
newmsg_list = mg_attr_list_create (&colors[COL_NEW_MSG], prefs.hex_gui_tab_small);
|
newmsg_list = mg_attr_list_create (&gui_palette[COL_NEW_MSG], prefs.hex_gui_tab_small);
|
||||||
away_list = mg_attr_list_create (&colors[COL_AWAY], FALSE);
|
away_list = mg_attr_list_create (&gui_palette[COL_AWAY], FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2314,8 +2453,10 @@ mg_update_xtext (GtkWidget *wid)
|
|||||||
{
|
{
|
||||||
GtkXText *xtext = GTK_XTEXT (wid);
|
GtkXText *xtext = GTK_XTEXT (wid);
|
||||||
const gchar *font_name;
|
const gchar *font_name;
|
||||||
|
XTextColor xtext_palette[XTEXT_COLS];
|
||||||
|
|
||||||
gtk_xtext_set_palette (xtext, colors);
|
palette_get_xtext_colors (xtext_palette, XTEXT_COLS);
|
||||||
|
gtk_xtext_set_palette (xtext, xtext_palette);
|
||||||
gtk_xtext_set_max_lines (xtext, prefs.hex_text_max_lines);
|
gtk_xtext_set_max_lines (xtext, prefs.hex_text_max_lines);
|
||||||
gtk_xtext_set_background (xtext, channelwin_pix);
|
gtk_xtext_set_background (xtext, channelwin_pix);
|
||||||
gtk_xtext_set_wordwrap (xtext, prefs.hex_text_wordwrap);
|
gtk_xtext_set_wordwrap (xtext, prefs.hex_text_wordwrap);
|
||||||
@@ -2340,6 +2481,7 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
|||||||
{
|
{
|
||||||
GtkWidget *inbox, *vbox, *frame;
|
GtkWidget *inbox, *vbox, *frame;
|
||||||
GtkXText *xtext;
|
GtkXText *xtext;
|
||||||
|
XTextColor xtext_palette[XTEXT_COLS];
|
||||||
session_gui *gui = sess->gui;
|
session_gui *gui = sess->gui;
|
||||||
static const GtkTargetEntry dnd_targets[] =
|
static const GtkTargetEntry dnd_targets[] =
|
||||||
{
|
{
|
||||||
@@ -2347,8 +2489,8 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
|||||||
};
|
};
|
||||||
static const GtkTargetEntry dnd_dest_targets[] =
|
static const GtkTargetEntry dnd_dest_targets[] =
|
||||||
{
|
{
|
||||||
{"HEXCHAT_CHANVIEW", GTK_TARGET_SAME_APP, 75 },
|
{"ZOITECHAT_CHANVIEW", GTK_TARGET_SAME_APP, 75 },
|
||||||
{"HEXCHAT_USERLIST", GTK_TARGET_SAME_APP, 75 }
|
{"ZOITECHAT_USERLIST", GTK_TARGET_SAME_APP, 75 }
|
||||||
};
|
};
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 0);
|
vbox = gtk_vbox_new (FALSE, 0);
|
||||||
@@ -2360,7 +2502,8 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
|||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||||
gtk_container_add (GTK_CONTAINER (inbox), frame);
|
gtk_container_add (GTK_CONTAINER (inbox), frame);
|
||||||
|
|
||||||
gui->xtext = gtk_xtext_new (colors, TRUE);
|
palette_get_xtext_colors (xtext_palette, XTEXT_COLS);
|
||||||
|
gui->xtext = gtk_xtext_new (xtext_palette, TRUE);
|
||||||
xtext = GTK_XTEXT (gui->xtext);
|
xtext = GTK_XTEXT (gui->xtext);
|
||||||
gtk_xtext_set_max_indent (xtext, prefs.hex_text_max_indent);
|
gtk_xtext_set_max_indent (xtext, prefs.hex_text_max_indent);
|
||||||
gtk_xtext_set_thin_separator (xtext, prefs.hex_text_thin_sep);
|
gtk_xtext_set_thin_separator (xtext, prefs.hex_text_thin_sep);
|
||||||
@@ -2496,7 +2639,7 @@ mg_create_userlist (session_gui *gui, GtkWidget *box)
|
|||||||
|
|
||||||
if (prefs.hex_gui_ulist_style)
|
if (prefs.hex_gui_ulist_style)
|
||||||
{
|
{
|
||||||
gtk_widget_set_style (ulist, input_style);
|
gtk_widget_modify_font (ulist, input_style->font_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2507,7 +2650,7 @@ mg_create_userlist (session_gui *gui, GtkWidget *box)
|
|||||||
* - When "Dark mode" is enabled, we also force the user list to use the
|
* - When "Dark mode" is enabled, we also force the user list to use the
|
||||||
* palette colors so it doesn't stay blindingly white on GTK2 themes.
|
* palette colors so it doesn't stay blindingly white on GTK2 themes.
|
||||||
*/
|
*/
|
||||||
if (prefs.hex_gui_ulist_style || prefs.hex_gui_dark_mode)
|
if (prefs.hex_gui_ulist_style || fe_dark_mode_is_enabled ())
|
||||||
{
|
{
|
||||||
gtk_widget_modify_base (ulist, GTK_STATE_NORMAL, &colors[COL_BG]);
|
gtk_widget_modify_base (ulist, GTK_STATE_NORMAL, &colors[COL_BG]);
|
||||||
gtk_widget_modify_text (ulist, GTK_STATE_NORMAL, &colors[COL_FG]);
|
gtk_widget_modify_text (ulist, GTK_STATE_NORMAL, &colors[COL_FG]);
|
||||||
@@ -3491,6 +3634,12 @@ mg_win32_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
|
|||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (msg->message == WM_SETTINGCHANGE || msg->message == WM_THEMECHANGED)
|
||||||
|
{
|
||||||
|
fe_refresh_auto_dark_mode ();
|
||||||
|
return GDK_FILTER_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg->message == WM_COPYDATA)
|
if (msg->message == WM_COPYDATA)
|
||||||
{
|
{
|
||||||
COPYDATASTRUCT *copy_data = (COPYDATASTRUCT *)msg->lParam;
|
COPYDATASTRUCT *copy_data = (COPYDATASTRUCT *)msg->lParam;
|
||||||
@@ -4034,7 +4183,7 @@ mg_is_gui_target (GdkDragContext *context)
|
|||||||
target_name = gdk_atom_name (gdk_drag_context_list_targets (context)->data);
|
target_name = gdk_atom_name (gdk_drag_context_list_targets (context)->data);
|
||||||
if (target_name)
|
if (target_name)
|
||||||
{
|
{
|
||||||
/* if it's not HEXCHAT_CHANVIEW or HEXCHAT_USERLIST */
|
/* if it's not ZOITECHAT_CHANVIEW or ZOITECHAT_USERLIST */
|
||||||
/* we should ignore it. */
|
/* we should ignore it. */
|
||||||
if (target_name[0] != 'H')
|
if (target_name[0] != 'H')
|
||||||
{
|
{
|
||||||
@@ -4053,18 +4202,20 @@ gboolean
|
|||||||
mg_drag_begin_cb (GtkWidget *widget, GdkDragContext *context, gpointer userdata)
|
mg_drag_begin_cb (GtkWidget *widget, GdkDragContext *context, gpointer userdata)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
GdkColormap *cmap;
|
|
||||||
GdkPixbuf *pix, *pix2;
|
GdkPixbuf *pix, *pix2;
|
||||||
|
GdkWindow *window;
|
||||||
|
|
||||||
/* ignore file drops */
|
/* ignore file drops */
|
||||||
if (!mg_is_gui_target (context))
|
if (!mg_is_gui_target (context))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
cmap = gtk_widget_get_colormap (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
width = gdk_window_get_width (window);
|
||||||
height = gdk_window_get_height (gtk_widget_get_window (widget));
|
height = gdk_window_get_height (window);
|
||||||
|
|
||||||
pix = gdk_pixbuf_get_from_drawable (NULL, gtk_widget_get_window (widget), cmap, 0, 0, 0, 0, width, height);
|
pix = mg_pixbuf_from_window (window, width, height);
|
||||||
|
if (!pix)
|
||||||
|
return FALSE;
|
||||||
pix2 = gdk_pixbuf_scale_simple (pix, width * 4 / 5, height / 2, GDK_INTERP_HYPER);
|
pix2 = gdk_pixbuf_scale_simple (pix, width * 4 / 5, height / 2, GDK_INTERP_HYPER);
|
||||||
g_object_unref (pix);
|
g_object_unref (pix);
|
||||||
|
|
||||||
@@ -4115,12 +4266,11 @@ mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
|
|||||||
gboolean
|
gboolean
|
||||||
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer scbar)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
XTextColor col;
|
||||||
GdkColor col;
|
cairo_t *cr;
|
||||||
GdkGCValues val;
|
|
||||||
int half, width, height;
|
int half, width, height;
|
||||||
int ox, oy;
|
int ox, oy;
|
||||||
GdkDrawable *draw;
|
GdkWindow *window;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
|
||||||
/* ignore file drops */
|
/* ignore file drops */
|
||||||
@@ -4134,55 +4284,57 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
|
|||||||
oy = allocation.y;
|
oy = allocation.y;
|
||||||
width = allocation.width;
|
width = allocation.width;
|
||||||
height = allocation.height;
|
height = allocation.height;
|
||||||
draw = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ox = oy = 0;
|
ox = oy = 0;
|
||||||
width = gdk_window_get_width (gtk_widget_get_window (widget));
|
window = gtk_widget_get_window (widget);
|
||||||
height = gdk_window_get_height (gtk_widget_get_window (widget));
|
width = gdk_window_get_width (window);
|
||||||
draw = gtk_widget_get_window (widget);
|
height = gdk_window_get_height (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
val.subwindow_mode = GDK_INCLUDE_INFERIORS;
|
col.red = (double)rand () / (double)RAND_MAX;
|
||||||
val.graphics_exposures = 0;
|
col.green = (double)rand () / (double)RAND_MAX;
|
||||||
val.function = GDK_XOR;
|
col.blue = (double)rand () / (double)RAND_MAX;
|
||||||
|
col.alpha = 1.0;
|
||||||
gc = gdk_gc_new_with_values (gtk_widget_get_window (widget), &val, GDK_GC_EXPOSURES | GDK_GC_SUBWINDOW | GDK_GC_FUNCTION);
|
cr = gdk_cairo_create (window);
|
||||||
col.red = rand() % 0xffff;
|
cairo_set_operator (cr, CAIRO_OPERATOR_XOR);
|
||||||
col.green = rand() % 0xffff;
|
mg_set_source_color (cr, &col);
|
||||||
col.blue = rand() % 0xffff;
|
cairo_set_line_width (cr, 1.0);
|
||||||
gdk_colormap_alloc_color (gtk_widget_get_colormap (widget), &col, FALSE, TRUE);
|
|
||||||
gdk_gc_set_foreground (gc, &col);
|
|
||||||
|
|
||||||
half = height / 2;
|
half = height / 2;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* are both tree/userlist on the same side? */
|
/* are both tree/userlist on the same side? */
|
||||||
|
GtkPaned *paned;
|
||||||
paned = (GtkPaned *)widget->parent->parent;
|
paned = (GtkPaned *)widget->parent->parent;
|
||||||
if (paned->child1 != NULL && paned->child2 != NULL)
|
if (paned->child1 != NULL && paned->child2 != NULL)
|
||||||
{
|
{
|
||||||
gdk_draw_rectangle (draw, gc, 0, 1, 2, width - 3, height - 4);
|
cairo_rectangle (cr, 1 + ox, 2 + oy, width - 3, height - 4);
|
||||||
gdk_draw_rectangle (draw, gc, 0, 0, 1, width - 1, height - 2);
|
cairo_rectangle (cr, 0 + ox, 1 + oy, width - 1, height - 2);
|
||||||
g_object_unref (gc);
|
cairo_stroke (cr);
|
||||||
|
cairo_destroy (cr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (y < half)
|
if (y < half)
|
||||||
{
|
{
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 1 + ox, 2 + oy, width - 3, half - 4);
|
cairo_rectangle (cr, 1 + ox, 2 + oy, width - 3, half - 4);
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 0 + ox, 1 + oy, width - 1, half - 2);
|
cairo_rectangle (cr, 0 + ox, 1 + oy, width - 1, half - 2);
|
||||||
|
cairo_stroke (cr);
|
||||||
gtk_widget_queue_draw_area (widget, ox, half + oy, width, height - half);
|
gtk_widget_queue_draw_area (widget, ox, half + oy, width, height - half);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 0 + ox, half + 1 + oy, width - 1, half - 2);
|
cairo_rectangle (cr, 0 + ox, half + 1 + oy, width - 1, half - 2);
|
||||||
gdk_draw_rectangle (draw, gc, FALSE, 1 + ox, half + 2 + oy, width - 3, half - 4);
|
cairo_rectangle (cr, 1 + ox, half + 2 + oy, width - 3, half - 4);
|
||||||
|
cairo_stroke (cr);
|
||||||
gtk_widget_queue_draw_area (widget, ox, oy, width, half);
|
gtk_widget_queue_draw_area (widget, ox, oy, width, half);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (gc);
|
cairo_destroy (cr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_MAINGUI_H
|
#ifndef ZOITECHAT_MAINGUI_H
|
||||||
#define HEXCHAT_MAINGUI_H
|
#define ZOITECHAT_MAINGUI_H
|
||||||
|
|
||||||
extern GtkStyle *input_style;
|
extern GtkStyle *input_style;
|
||||||
extern GtkWidget *parent_window;
|
extern GtkWidget *parent_window;
|
||||||
|
|||||||
@@ -1772,7 +1772,7 @@ menu_about (GtkWidget *wid, gpointer sess)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct mymenu mymenu[] = {
|
static struct mymenu mymenu[] = {
|
||||||
{N_("_ZoiteChat"), 0, 0, M_NEWMENU, MENU_ID_HEXCHAT, 0, 1},
|
{N_("_ZoiteChat"), 0, 0, M_NEWMENU, MENU_ID_ZOITECHAT, 0, 1},
|
||||||
{N_("Network Li_st"), menu_open_server_list, (char *)&pix_book, M_MENUPIX, 0, 0, 1, GDK_KEY_s},
|
{N_("Network Li_st"), menu_open_server_list, (char *)&pix_book, M_MENUPIX, 0, 0, 1, GDK_KEY_s},
|
||||||
{0, 0, 0, M_SEP, 0, 0, 0},
|
{0, 0, 0, M_SEP, 0, 0, 0},
|
||||||
|
|
||||||
@@ -2396,7 +2396,7 @@ menu_create_main (void *accel_group, int bar, int away, int toplevel,
|
|||||||
/* record the English name for /menu */
|
/* record the English name for /menu */
|
||||||
g_object_set_data (G_OBJECT (menu_item), "name", mymenu[i].text);
|
g_object_set_data (G_OBJECT (menu_item), "name", mymenu[i].text);
|
||||||
#ifdef HAVE_GTK_MAC /* Added to app menu, see below */
|
#ifdef HAVE_GTK_MAC /* Added to app menu, see below */
|
||||||
if (!bar || mymenu[i].id != MENU_ID_HEXCHAT)
|
if (!bar || mymenu[i].id != MENU_ID_ZOITECHAT)
|
||||||
#endif
|
#endif
|
||||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menu_item);
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menu_item);
|
||||||
gtk_widget_show (menu_item);
|
gtk_widget_show (menu_item);
|
||||||
@@ -2502,7 +2502,7 @@ togitem:
|
|||||||
|
|
||||||
#ifdef HAVE_GTK_MAC
|
#ifdef HAVE_GTK_MAC
|
||||||
/* We want ZoiteChat to be the app menu, not including Quit or ZoiteChat itself */
|
/* We want ZoiteChat to be the app menu, not including Quit or ZoiteChat itself */
|
||||||
if (bar && item && i <= CLOSE_OFFSET + 1 && mymenu[i].id != MENU_ID_HEXCHAT)
|
if (bar && item && i <= CLOSE_OFFSET + 1 && mymenu[i].id != MENU_ID_ZOITECHAT)
|
||||||
{
|
{
|
||||||
if (!submenu || mymenu[i].type == M_MENUSUB)
|
if (!submenu || mymenu[i].type == M_MENUSUB)
|
||||||
gtkosx_application_insert_app_menu_item (osx_app, item, appmenu_offset++);
|
gtkosx_application_insert_app_menu_item (osx_app, item, appmenu_offset++);
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_MENU_H
|
#ifndef ZOITECHAT_MENU_H
|
||||||
#define HEXCHAT_MENU_H
|
#define ZOITECHAT_MENU_H
|
||||||
|
|
||||||
GtkWidget *menu_create_main (void *accel_group, int bar, int away, int toplevel, GtkWidget **menu_widgets);
|
GtkWidget *menu_create_main (void *accel_group, int bar, int away, int toplevel, GtkWidget **menu_widgets);
|
||||||
void menu_urlmenu (GdkEventButton * event, char *url);
|
void menu_urlmenu (GdkEventButton * event, char *url);
|
||||||
@@ -62,9 +62,9 @@ void menu_set_fullscreen (session_gui *gui, int fullscreen);
|
|||||||
#define MENU_ID_JOIN 11
|
#define MENU_ID_JOIN 11
|
||||||
#define MENU_ID_USERMENU 12
|
#define MENU_ID_USERMENU 12
|
||||||
#define MENU_ID_FULLSCREEN 13
|
#define MENU_ID_FULLSCREEN 13
|
||||||
#define MENU_ID_HEXCHAT 14
|
#define MENU_ID_ZOITECHAT 14
|
||||||
|
|
||||||
#if (MENU_ID_NUM < MENU_ID_HEXCHAT)
|
#if (MENU_ID_NUM < MENU_ID_ZOITECHAT)
|
||||||
#error MENU_ID_NUM is set wrong
|
#error MENU_ID_NUM is set wrong
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_PLUGIN_NOTIFICATION_BACKEND_H
|
#ifndef ZOITECHAT_PLUGIN_NOTIFICATION_BACKEND_H
|
||||||
#define HEXCHAT_PLUGIN_NOTIFICATION_BACKEND_H
|
#define ZOITECHAT_PLUGIN_NOTIFICATION_BACKEND_H
|
||||||
|
|
||||||
int notification_backend_supported (void);
|
int notification_backend_supported (void);
|
||||||
void notification_backend_show (const char *title, const char *text);
|
void notification_backend_show (const char *title, const char *text);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ notification_backend_init (const char **error)
|
|||||||
/* Temporarily suppress the "DLL could not be loaded" dialog box before trying to load hcnotifications-winrt.dll */
|
/* Temporarily suppress the "DLL could not be loaded" dialog box before trying to load hcnotifications-winrt.dll */
|
||||||
original_error_mode = GetErrorMode ();
|
original_error_mode = GetErrorMode ();
|
||||||
SetErrorMode(SEM_FAILCRITICALERRORS);
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||||
module = module_load (HEXCHATLIBDIR "\\hcnotifications-winrt.dll");
|
module = module_load (ZOITECHATLIBDIR "\\hcnotifications-winrt.dll");
|
||||||
SetErrorMode (original_error_mode);
|
SetErrorMode (original_error_mode);
|
||||||
|
|
||||||
if (module == NULL)
|
if (module == NULL)
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_NOTIFYGUI_H
|
#ifndef ZOITECHAT_NOTIFYGUI_H
|
||||||
#define HEXCHAT_NOTIFYGUI_H
|
#define ZOITECHAT_NOTIFYGUI_H
|
||||||
|
|
||||||
void notify_gui_update (void);
|
void notify_gui_update (void);
|
||||||
void notify_opengui (void);
|
void notify_opengui (void);
|
||||||
|
|||||||
@@ -38,6 +38,18 @@
|
|||||||
#include "../common/cfgfiles.h"
|
#include "../common/cfgfiles.h"
|
||||||
#include "../common/typedef.h"
|
#include "../common/typedef.h"
|
||||||
|
|
||||||
|
static XTextColor
|
||||||
|
palette_color_from_gdk (const GdkColor *color)
|
||||||
|
{
|
||||||
|
XTextColor result;
|
||||||
|
|
||||||
|
result.red = color->red / 65535.0;
|
||||||
|
result.green = color->green / 65535.0;
|
||||||
|
result.blue = color->blue / 65535.0;
|
||||||
|
result.alpha = 1.0;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
GdkColor colors[] = {
|
GdkColor colors[] = {
|
||||||
/* colors for xtext */
|
/* colors for xtext */
|
||||||
@@ -143,6 +155,18 @@ static const GdkColor dark_colors[MAX_COL + 1] = {
|
|||||||
{0, 0xf4f4, 0x4747, 0x4747}, /* 41 COL_SPELL (spellcheck underline) */
|
{0, 0xf4f4, 0x4747, 0x4747}, /* 41 COL_SPELL (spellcheck underline) */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
palette_get_xtext_colors (XTextColor *palette, size_t palette_len)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
size_t count = palette_len < G_N_ELEMENTS (colors) ? palette_len : G_N_ELEMENTS (colors);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
palette[i] = palette_color_from_gdk (&colors[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
palette_user_set_color (int idx, const GdkColor *col)
|
palette_user_set_color (int idx, const GdkColor *col)
|
||||||
{
|
{
|
||||||
@@ -287,20 +311,21 @@ palette_save (void)
|
|||||||
char prefname[256];
|
char prefname[256];
|
||||||
const GdkColor *lightpal = colors;
|
const GdkColor *lightpal = colors;
|
||||||
const GdkColor *darkpal = NULL;
|
const GdkColor *darkpal = NULL;
|
||||||
|
gboolean dark_mode_active = fe_dark_mode_is_enabled ();
|
||||||
|
|
||||||
/* If we're currently in dark mode, keep colors.conf's legacy keys as the user's light palette. */
|
/* If we're currently in dark mode, keep colors.conf's legacy keys as the user's light palette. */
|
||||||
if (prefs.hex_gui_dark_mode && user_colors_valid)
|
if (dark_mode_active && user_colors_valid)
|
||||||
lightpal = user_colors;
|
lightpal = user_colors;
|
||||||
|
|
||||||
/* If we're currently in light mode, ensure the snapshot stays in sync. */
|
/* If we're currently in light mode, ensure the snapshot stays in sync. */
|
||||||
if (!prefs.hex_gui_dark_mode)
|
if (!dark_mode_active)
|
||||||
{
|
{
|
||||||
memcpy (user_colors, colors, sizeof (user_colors));
|
memcpy (user_colors, colors, sizeof (user_colors));
|
||||||
user_colors_valid = TRUE;
|
user_colors_valid = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If dark mode is enabled but we haven't snapshotted a custom dark palette yet, capture it now. */
|
/* If dark mode is enabled but we haven't snapshotted a custom dark palette yet, capture it now. */
|
||||||
if (prefs.hex_gui_dark_mode && !dark_user_colors_valid)
|
if (dark_mode_active && !dark_user_colors_valid)
|
||||||
{
|
{
|
||||||
memcpy (dark_user_colors, colors, sizeof (dark_user_colors));
|
memcpy (dark_user_colors, colors, sizeof (dark_user_colors));
|
||||||
dark_user_colors_valid = TRUE;
|
dark_user_colors_valid = TRUE;
|
||||||
@@ -308,7 +333,7 @@ palette_save (void)
|
|||||||
|
|
||||||
if (dark_user_colors_valid)
|
if (dark_user_colors_valid)
|
||||||
darkpal = dark_user_colors;
|
darkpal = dark_user_colors;
|
||||||
else if (prefs.hex_gui_dark_mode)
|
else if (dark_mode_active)
|
||||||
darkpal = colors; /* current dark palette (likely defaults) */
|
darkpal = colors; /* current dark palette (likely defaults) */
|
||||||
|
|
||||||
fh = zoitechat_open_file ("colors.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
|
fh = zoitechat_open_file ("colors.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
|
||||||
@@ -399,4 +424,3 @@ palette_apply_dark_mode (gboolean enable)
|
|||||||
|
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,12 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_PALETTE_H
|
#ifndef ZOITECHAT_PALETTE_H
|
||||||
#define HEXCHAT_PALETTE_H
|
#define ZOITECHAT_PALETTE_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "xtext-color.h"
|
||||||
|
|
||||||
extern GdkColor colors[];
|
extern GdkColor colors[];
|
||||||
|
|
||||||
@@ -59,4 +63,6 @@ void palette_dark_set_color (int idx, const GdkColor *col);
|
|||||||
*/
|
*/
|
||||||
gboolean palette_apply_dark_mode (gboolean enable);
|
gboolean palette_apply_dark_mode (gboolean enable);
|
||||||
|
|
||||||
|
void palette_get_xtext_colors (XTextColor *palette, size_t palette_len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
GdkPixbuf *pix_ulist_voice;
|
GdkPixbuf *pix_ulist_voice;
|
||||||
GdkPixbuf *pix_ulist_halfop;
|
GdkPixbuf *pix_ulist_halfop;
|
||||||
@@ -49,26 +50,89 @@ GdkPixbuf *pix_tree_util;
|
|||||||
GdkPixbuf *pix_book;
|
GdkPixbuf *pix_book;
|
||||||
GdkPixbuf *pix_zoitechat;
|
GdkPixbuf *pix_zoitechat;
|
||||||
|
|
||||||
static GdkPixmap *
|
static cairo_surface_t *
|
||||||
|
pixbuf_to_cairo_surface (GdkPixbuf *pixbuf)
|
||||||
|
{
|
||||||
|
cairo_surface_t *surface;
|
||||||
|
gboolean has_alpha;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
int src_stride;
|
||||||
|
int dest_stride;
|
||||||
|
int n_channels;
|
||||||
|
const guchar *src_pixels;
|
||||||
|
unsigned char *dest_pixels;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
||||||
|
|
||||||
|
width = gdk_pixbuf_get_width (pixbuf);
|
||||||
|
height = gdk_pixbuf_get_height (pixbuf);
|
||||||
|
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
||||||
|
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
||||||
|
|
||||||
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||||
|
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
cairo_surface_destroy (surface);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
src_stride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||||
|
src_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||||
|
dest_stride = cairo_image_surface_get_stride (surface);
|
||||||
|
dest_pixels = cairo_image_surface_get_data (surface);
|
||||||
|
|
||||||
|
for (y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
const guchar *src_row = src_pixels + (y * src_stride);
|
||||||
|
guint32 *dest_row = (guint32 *)(dest_pixels + (y * dest_stride));
|
||||||
|
|
||||||
|
for (x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
const guchar *src = src_row + (x * n_channels);
|
||||||
|
guchar alpha = has_alpha ? src[3] : 0xff;
|
||||||
|
guchar red = src[0];
|
||||||
|
guchar green = src[1];
|
||||||
|
guchar blue = src[2];
|
||||||
|
guchar premul_red = (guchar)((red * alpha + 127) / 255);
|
||||||
|
guchar premul_green = (guchar)((green * alpha + 127) / 255);
|
||||||
|
guchar premul_blue = (guchar)((blue * alpha + 127) / 255);
|
||||||
|
|
||||||
|
dest_row[x] = ((guint32)alpha << 24) |
|
||||||
|
((guint32)premul_red << 16) |
|
||||||
|
((guint32)premul_green << 8) |
|
||||||
|
((guint32)premul_blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_surface_mark_dirty (surface);
|
||||||
|
|
||||||
|
return surface;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cairo_surface_t *
|
||||||
pixmap_load_from_file_real (char *file)
|
pixmap_load_from_file_real (char *file)
|
||||||
{
|
{
|
||||||
GdkPixbuf *img;
|
GdkPixbuf *img;
|
||||||
GdkPixmap *pixmap;
|
cairo_surface_t *surface;
|
||||||
|
|
||||||
img = gdk_pixbuf_new_from_file (file, 0);
|
img = gdk_pixbuf_new_from_file (file, 0);
|
||||||
if (!img)
|
if (!img)
|
||||||
return NULL;
|
return NULL;
|
||||||
gdk_pixbuf_render_pixmap_and_mask (img, &pixmap, NULL, 128);
|
|
||||||
|
surface = pixbuf_to_cairo_surface (img);
|
||||||
g_object_unref (img);
|
g_object_unref (img);
|
||||||
|
|
||||||
return pixmap;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkPixmap *
|
cairo_surface_t *
|
||||||
pixmap_load_from_file (char *filename)
|
pixmap_load_from_file (char *filename)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
GdkPixmap *pix;
|
cairo_surface_t *pix;
|
||||||
|
|
||||||
if (filename[0] == '\0')
|
if (filename[0] == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -17,8 +17,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HEXCHAT_PIXMAPS_H
|
#ifndef ZOITECHAT_PIXMAPS_H
|
||||||
#define HEXCHAT_PIXMAPS_H
|
#define ZOITECHAT_PIXMAPS_H
|
||||||
|
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
extern GdkPixbuf *pix_ulist_voice;
|
extern GdkPixbuf *pix_ulist_voice;
|
||||||
extern GdkPixbuf *pix_ulist_halfop;
|
extern GdkPixbuf *pix_ulist_halfop;
|
||||||
@@ -40,7 +42,7 @@ extern GdkPixbuf *pix_tree_util;
|
|||||||
extern GdkPixbuf *pix_book;
|
extern GdkPixbuf *pix_book;
|
||||||
extern GdkPixbuf *pix_zoitechat;
|
extern GdkPixbuf *pix_zoitechat;
|
||||||
|
|
||||||
extern GdkPixmap *pixmap_load_from_file (char *file);
|
extern cairo_surface_t *pixmap_load_from_file (char *file);
|
||||||
extern void pixmaps_init (void);
|
extern void pixmaps_init (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user