Merge pull request #90 from ZoiteChat/code-cleanup

Code cleanup
This commit is contained in:
deepend-tildeclub
2026-02-25 18:16:54 -07:00
committed by GitHub
48 changed files with 73 additions and 335 deletions

View File

@@ -62,17 +62,8 @@ jobs:
sh -lc ' sh -lc '
set -euo pipefail set -euo pipefail
eopkg update-repo -y eopkg update-repo -y
# Do not remove openssl-11 here: it can trigger a very large # Keep file-conflict handling on: some base images still carry
# dependency cascade (including python3/eopkg itself), which # openssl-11 leftovers, and Meson tooling is not always preinstalled.
# breaks the build environment before package build starts.
# Some Solus base images still contain openssl-11 files that
# conflict with openssl 3.x when the package set is refreshed.
# Allowing file-conflict resolution keeps the CI image usable
# long enough to install ypkg and complete the package build.
# The base image does not guarantee Meson toolchain packages,
# while our package.yml setup phase calls meson directly.
# Install the essential build tools up front to avoid
# `/tmp/ypkg-setup*: meson: command not found` failures.
eopkg install -y --ignore-file-conflicts \ eopkg install -y --ignore-file-conflicts \
ypkg git meson ninja pkgconf gcc gettext ypkg git meson ninja pkgconf gcc gettext
ypkg build "$PACKAGE_YML" ypkg build "$PACKAGE_YML"

View File

@@ -54,11 +54,9 @@ jobs:
Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/perl-5.20.0-${{ matrix.arch }}.7z -OutFile deps\perl-${{ matrix.arch }}.7z Invoke-WebRequest https://github.com/zoitechat/gvsbuild/releases/download/zoitechat-2.17.0/perl-5.20.0-${{ matrix.arch }}.7z -OutFile deps\perl-${{ matrix.arch }}.7z
& 7z.exe x deps\perl-${{ matrix.arch }}.7z -oC:\gtk-build\perl-5.20\${{ matrix.platform }} & 7z.exe x deps\perl-${{ matrix.arch }}.7z -oC:\gtk-build\perl-5.20\${{ matrix.platform }}
# Resolve python root from setup-python
$pyRoot = $env:pythonLocation $pyRoot = $env:pythonLocation
if (-not $pyRoot) { $pyRoot = & python -c "import sys; print(sys.prefix)" } if (-not $pyRoot) { $pyRoot = & python -c "import sys; print(sys.prefix)" }
# Create BOTH paths because the .vcxproj hard-codes python-3.14\...
foreach ($pyDir in @("C:\gtk-build\python-3.14.2", "C:\gtk-build\python-3.14")) { foreach ($pyDir in @("C:\gtk-build\python-3.14.2", "C:\gtk-build\python-3.14")) {
New-Item -Path $pyDir -ItemType Directory -Force | Out-Null New-Item -Path $pyDir -ItemType Directory -Force | Out-Null
$target = Join-Path $pyDir "${{ matrix.platform }}" $target = Join-Path $pyDir "${{ matrix.platform }}"

View File

@@ -14,7 +14,6 @@ CONFIG_STAMP := $(BUILD_DIR)/build.ninja
all: build all: build
# Only run initial meson setup if we don't have a configured build dir yet.
$(CONFIG_STAMP): $(CONFIG_STAMP):
@mkdir -p $(BUILD_DIR) @mkdir -p $(BUILD_DIR)
@env NINJA=$(NINJA) $(MESON) setup $(BUILD_DIR) --prefix=$(PREFIX) $(MESON_SETUP_ARGS) @env NINJA=$(NINJA) $(MESON) setup $(BUILD_DIR) --prefix=$(PREFIX) $(MESON_SETUP_ARGS)

View File

@@ -6,6 +6,4 @@ rm -f *.app.zip
python $HOME/.local/bin/gtk-mac-bundler zoitechat.bundle python $HOME/.local/bin/gtk-mac-bundler zoitechat.bundle
echo "Compressing bundle" echo "Compressing bundle"
#hdiutil create -format UDBZ -srcdir ZoiteChat.app -quiet ZoiteChat-2.9.6.1-$(git rev-parse --short master).dmg
zip -9rXq ./ZoiteChat-$(git describe --tags).app.zip ./ZoiteChat.app zip -9rXq ./ZoiteChat-$(git describe --tags).app.zip ./ZoiteChat.app

View File

@@ -26,7 +26,7 @@
#include "zoitechat-plugin.h" #include "zoitechat-plugin.h"
static zoitechat_plugin *ph; /* plugin handle */ static zoitechat_plugin *ph;
static char name[] = "Checksum"; static char name[] = "Checksum";
static char desc[] = "Calculate checksum for DCC file transfers"; static char desc[] = "Calculate checksum for DCC file transfers";
static char version[] = "4.0"; static char version[] = "4.0";
@@ -42,18 +42,14 @@ typedef struct {
static void static void
print_sha256_result (ChecksumCallbackInfo *info, const char *checksum, const char *filename, GError *error) print_sha256_result (ChecksumCallbackInfo *info, const char *checksum, const char *filename, GError *error)
{ {
// So then we get the next best available channel, since we always want to print at least somewhere, it's fine
zoitechat_context *ctx = zoitechat_find_context(ph, info->servername, info->channel); zoitechat_context *ctx = zoitechat_find_context(ph, info->servername, info->channel);
if (!ctx) { if (!ctx) {
// before we print a private message to the wrong channel, we exit early
if (info->send_message) { if (info->send_message) {
return; return;
} }
// if the context isn't found the first time, we search in the server
ctx = zoitechat_find_context(ph, info->servername, NULL); ctx = zoitechat_find_context(ph, info->servername, NULL);
if (!ctx) { if (!ctx) {
// The second time we exit early, since printing in another server isn't desireable
return; return;
} }
} }

View File

@@ -25,7 +25,7 @@
#include "zoitechat-plugin.h" #include "zoitechat-plugin.h"
static zoitechat_plugin *ph; /* plugin handle */ static zoitechat_plugin *ph;
static char name[] = "Exec"; static char name[] = "Exec";
static char desc[] = "Execute commands inside ZoiteChat"; static char desc[] = "Execute commands inside ZoiteChat";
static char version[] = "1.2"; static char version[] = "1.2";
@@ -71,7 +71,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
strcat (commandLine, word_eol[2]); strcat (commandLine, word_eol[2]);
} }
CreatePipe (&readPipe, &writePipe, &secattr, 0); /* might be replaced with MyCreatePipeEx */ CreatePipe (&readPipe, &writePipe, &secattr, 0);
ZeroMemory (&sInfo, sizeof (sInfo)); ZeroMemory (&sInfo, sizeof (sInfo));
ZeroMemory (&pInfo, sizeof (pInfo)); ZeroMemory (&pInfo, sizeof (pInfo));
@@ -91,12 +91,10 @@ run_command (char *word[], char *word_eol[], void *userdata)
{ {
if (ReadFile (readPipe, buffer, sizeof (buffer) - 1, &dwRead, NULL) && dwRead != 0 ) if (ReadFile (readPipe, buffer, sizeof (buffer) - 1, &dwRead, NULL) && dwRead != 0 )
{ {
/* avoid garbage */
buffer[dwRead] = '\0'; buffer[dwRead] = '\0';
if (announce) if (announce)
{ {
/* Say each line seperately, TODO: improve... */
token = strtok_s (buffer, "\n", &context); token = strtok_s (buffer, "\n", &context);
while (token != NULL) while (token != NULL)
{ {
@@ -110,13 +108,11 @@ run_command (char *word[], char *word_eol[], void *userdata)
} }
else else
{ {
/* this way we'll more likely get full lines */
SleepEx (100, TRUE); SleepEx (100, TRUE);
} }
timeElapsed = difftime (time (0), start); timeElapsed = difftime (time (0), start);
} }
/* display a newline to separate things */
if (!announce) if (!announce)
zoitechat_printf (ph, "\n"); zoitechat_printf (ph, "\n");
@@ -149,7 +145,7 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
zoitechat_hook_command (ph, "EXEC", ZOITECHAT_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;
} }
int int

View File

@@ -39,13 +39,11 @@ gboolean irc_parse_message(const char *words[],
if (prefix) *prefix = NULL; if (prefix) *prefix = NULL;
if (command) *command = NULL; if (command) *command = NULL;
/* See if the message starts with a prefix (sender user) */
if (words[w][0] == ':') { if (words[w][0] == ':') {
if (prefix) *prefix = &words[w][1]; if (prefix) *prefix = &words[w][1];
w++; w++;
} }
/* Check command */
if (words[w][0] == '\0') return FALSE; if (words[w][0] == '\0') return FALSE;
if (command) *command = words[w]; if (command) *command = words[w];
w++; w++;
@@ -72,11 +70,9 @@ char *irc_prefix_get_nick(const char *prefix) {
if (!prefix) return NULL; if (!prefix) return NULL;
/* Find end of nick */
end = prefix; end = prefix;
while (*end != '\0' && *end != '!' && *end != '@') end++; while (*end != '\0' && *end != '!' && *end != '@') end++;
/* Allocate string */
length = end - prefix; length = end - prefix;
return g_strndup (prefix, length); return g_strndup (prefix, length);
} }

View File

@@ -277,15 +277,6 @@ char *decrypt_raw_message(const char *message, const char *key) {
return NULL; return NULL;
} }
/*static int handle_debug(char *word[], char *word_eol[], void *userdata) {
zoitechat_printf(ph, "debug incoming: ");
for (size_t i = 1; word[i] != NULL && word[i][0] != '\0'; i++) {
zoitechat_printf(ph, ">%s< ", word[i]);
}
zoitechat_printf(ph, "\n");
return ZOITECHAT_EAT_NONE;
}*/
/** /**
* Called when a message is to be sent. * Called when a message is to be sent.
*/ */
@@ -811,7 +802,6 @@ int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
zoitechat_hook_server(ph, "NOTICE", ZOITECHAT_PRI_HIGHEST, handle_keyx_notice, NULL); zoitechat_hook_server(ph, "NOTICE", ZOITECHAT_PRI_HIGHEST, handle_keyx_notice, NULL);
zoitechat_hook_server_attrs(ph, "NOTICE", ZOITECHAT_PRI_NORM, handle_incoming, NULL); zoitechat_hook_server_attrs(ph, "NOTICE", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
zoitechat_hook_server_attrs(ph, "PRIVMSG", ZOITECHAT_PRI_NORM, handle_incoming, NULL); zoitechat_hook_server_attrs(ph, "PRIVMSG", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
/* zoitechat_hook_server(ph, "RAW LINE", ZOITECHAT_PRI_NORM, handle_debug, NULL); */
zoitechat_hook_server_attrs(ph, "TOPIC", ZOITECHAT_PRI_NORM, handle_incoming, NULL); zoitechat_hook_server_attrs(ph, "TOPIC", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
zoitechat_hook_server_attrs(ph, "332", ZOITECHAT_PRI_NORM, handle_incoming, NULL); zoitechat_hook_server_attrs(ph, "332", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
@@ -836,4 +826,3 @@ int zoitechat_plugin_deinit(void) {
zoitechat_printf(ph, "%s plugin unloaded\n", plugin_name); zoitechat_printf(ph, "%s plugin unloaded\n", plugin_name);
return 1; return 1;
} }

View File

@@ -440,8 +440,6 @@ server_cb (char *word[], char *word_eol[], void *userdata)
if (data->depth) if (data->depth)
return ZOITECHAT_EAT_NONE; return ZOITECHAT_EAT_NONE;
/* zoitechat_printf (ph, */
/* "Received %d words in server callback", av_len (wd)); */
PUSHMARK (SP); PUSHMARK (SP);
XPUSHs (newRV_noinc ((SV *) array2av (word))); XPUSHs (newRV_noinc ((SV *) array2av (word)));
XPUSHs (newRV_noinc ((SV *) array2av (word_eol))); XPUSHs (newRV_noinc ((SV *) array2av (word_eol)));
@@ -489,8 +487,6 @@ command_cb (char *word[], char *word_eol[], void *userdata)
if (data->depth) if (data->depth)
return ZOITECHAT_EAT_NONE; return ZOITECHAT_EAT_NONE;
/* zoitechat_printf (ph, "Received %d words in command callback", */
/* av_len (wd)); */
PUSHMARK (SP); PUSHMARK (SP);
XPUSHs (newRV_noinc ((SV *) array2av (word))); XPUSHs (newRV_noinc ((SV *) array2av (word)));
XPUSHs (newRV_noinc ((SV *) array2av (word_eol))); XPUSHs (newRV_noinc ((SV *) array2av (word_eol)));
@@ -567,7 +563,6 @@ print_cb (char *word[], void *userdata)
} }
} }
/*zoitechat_printf (ph, "Received %d words in print callback", av_len (wd)+1); */
PUSHMARK (SP); PUSHMARK (SP);
XPUSHs (newRV_noinc ((SV *) wd)); XPUSHs (newRV_noinc ((SV *) wd));
XPUSHs (data->userdata); XPUSHs (data->userdata);

View File

@@ -79,7 +79,6 @@ def emit_print(event_name, *args, **kwargs):
return ret return ret
# TODO: this shadows itself. command should be changed to cmd
def command(command): def command(command):
lib.zoitechat_command(lib.ph, command.encode()) lib.zoitechat_command(lib.ph, command.encode())
@@ -221,7 +220,6 @@ def get_list(name):
return ret return ret
# TODO: 'command' here shadows command above, and should be renamed to cmd
def hook_command(command, callback, userdata=None, priority=PRI_NORM, help=None): def hook_command(command, callback, userdata=None, priority=PRI_NORM, help=None):
plugin = __get_current_plugin() plugin = __get_current_plugin()
hook = plugin.add_hook(callback, userdata) hook = plugin.add_hook(callback, userdata)

View File

@@ -5,11 +5,9 @@ import cffi
builder = cffi.FFI() builder = cffi.FFI()
# zoitechat-plugin.h
with open(sys.argv[1]) as f: with open(sys.argv[1]) as f:
output = [] output = []
eat_until_endif = 0 eat_until_endif = 0
# This is very specific to zoitechat-plugin.h, it is not a cpp
for line in f: for line in f:
if line.startswith('#define'): if line.startswith('#define'):
continue continue
@@ -81,9 +79,7 @@ int zoitechat_plugin_deinit(void)
} }
''') ''')
# python.py
with open(sys.argv[2]) as f: with open(sys.argv[2]) as f:
builder.embedding_init_code(f.read()) builder.embedding_init_code(f.read())
# python.c
builder.emit_c_code(sys.argv[3]) builder.emit_c_code(sys.argv[3])

View File

@@ -19,12 +19,11 @@ else:
if not hasattr(sys, 'argv'): if not hasattr(sys, 'argv'):
sys.argv = ['<zoitechat>'] sys.argv = ['<zoitechat>']
VERSION = b'2.18.0~pre2' # Sync with zoitechat.__version__ VERSION = b'2.18.0~pre2'
PLUGIN_NAME = ffi.new('char[]', b'Python') PLUGIN_NAME = ffi.new('char[]', b'Python')
PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1])) PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1]))
PLUGIN_VERSION = ffi.new('char[]', VERSION) PLUGIN_VERSION = ffi.new('char[]', VERSION)
# TODO: Constants should be screaming snake case
zoitechat = None zoitechat = None
local_interp = None local_interp = None
zoitechat_stdout = None zoitechat_stdout = None
@@ -106,8 +105,6 @@ if sys.version_info[0] == 2:
return compile(string, '<string>', 'eval', dont_inherit=True) return compile(string, '<string>', 'eval', dont_inherit=True)
except SyntaxError: except SyntaxError:
# For some reason `print` is invalid for eval
# This will hide any return value though
return compile(string, '<string>', 'exec', dont_inherit=True) return compile(string, '<string>', 'exec', dont_inherit=True)
else: else:
def compile_file(data, filename): def compile_file(data, filename):
@@ -115,7 +112,6 @@ else:
def compile_line(string): def compile_line(string):
# newline appended to solve unexpected EOF issues
return compile(string + '\n', '<string>', 'single', optimize=2, dont_inherit=True) return compile(string + '\n', '<string>', 'single', optimize=2, dont_inherit=True)
@@ -200,8 +196,6 @@ else:
return string.decode() return string.decode()
# There can be empty entries between non-empty ones so find the actual last value
def _cstr(ptr): def _cstr(ptr):
"""Safely convert a C char* (possibly NULL) to bytes.""" """Safely convert a C char* (possibly NULL) to bytes."""
if ptr == ffi.NULL: if ptr == ffi.NULL:
@@ -212,7 +206,6 @@ def _cstr(ptr):
return b'' return b''
def wordlist_len(words): def wordlist_len(words):
# ZoiteChat passes a fixed-size array (typically 32) where unused entries may be NULL.
for i in range(31, 0, -1): for i in range(31, 0, -1):
if _cstr(words[i]): if _cstr(words[i]):
return i return i
@@ -299,12 +292,8 @@ def _on_timer_hook(userdata):
return 1 return 1
try: try:
# Avoid calling zoitechat_unhook twice if unnecessary
hook.is_unload = True hook.is_unload = True
except ReferenceError: except ReferenceError:
# hook is a weak reference, it might have been destroyed by the callback
# in which case it has already been removed from hook.plugin.hooks and
# we wouldn't be able to test it with h == hook anyway.
return 0 return 0
for h in hook.plugin.hooks: for h in hook.plugin.hooks:
@@ -338,11 +327,9 @@ def _on_say_command(word, word_eol, userdata):
if not python: if not python:
return 1 return 1
# Dont let exceptions here swallow core commands or wedge the UI.
try: try:
exec_in_interp(python) exec_in_interp(python)
except Exception: except Exception:
# Best effort: surface the traceback in the python tab.
exc = traceback.format_exc().encode('utf-8', errors='replace') exc = traceback.format_exc().encode('utf-8', errors='replace')
lib.zoitechat_print(lib.ph, exc) lib.zoitechat_print(lib.ph, exc)
return 1 return 1
@@ -397,11 +384,10 @@ def autoload():
configdir = __decode(_cstr(lib.zoitechat_get_info(lib.ph, b'configdir'))) configdir = __decode(_cstr(lib.zoitechat_get_info(lib.ph, b'configdir')))
addondir = os.path.join(configdir, 'addons') addondir = os.path.join(configdir, 'addons')
try: try:
with change_cwd(addondir): # Maintaining old behavior with change_cwd(addondir):
for f in os.listdir(addondir): for f in os.listdir(addondir):
if f.endswith('.py'): if f.endswith('.py'):
log('Autoloading', f) log('Autoloading', f)
# TODO: Set cwd
load_filename(os.path.join(addondir, f)) load_filename(os.path.join(addondir, f))
except FileNotFoundError as e: except FileNotFoundError as e:

View File

@@ -208,7 +208,6 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
int offset = 0, channel_type; int offset = 0, channel_type;
char *cmd; char *cmd;
/* Allow overriding global announce setting */
if (!strcmp ("-e", word[2])) if (!strcmp ("-e", word[2]))
{ {
announce = FALSE; announce = FALSE;
@@ -220,7 +219,6 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata)
offset++; offset++;
} }
/* Cannot send to server tab */
channel_type = zoitechat_list_int (ph, NULL, "type"); channel_type = zoitechat_list_int (ph, NULL, "type");
if (channel_type != 2 /* SESS_CHANNEL */ && channel_type != 3 /* SESS_DIALOG */) if (channel_type != 2 /* SESS_CHANNEL */ && channel_type != 3 /* SESS_DIALOG */)
announce = FALSE; announce = FALSE;
@@ -246,7 +244,6 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
zoitechat_hook_command (ph, "SYSINFO", ZOITECHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL); zoitechat_hook_command (ph, "SYSINFO", ZOITECHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL);
/* Match the classic label from HexChat so people can actually find it. */
zoitechat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\""); zoitechat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\"");
zoitechat_printf (ph, _("%s plugin loaded\n"), name); zoitechat_printf (ph, _("%s plugin loaded\n"), name);
return 1; return 1;
@@ -255,7 +252,6 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char
int int
zoitechat_plugin_deinit (void) zoitechat_plugin_deinit (void)
{ {
/* Keep both in case older builds used a different label. */
zoitechat_command (ph, "MENU DEL \"Window/Send System Info\""); zoitechat_command (ph, "MENU DEL \"Window/Send System Info\"");
zoitechat_command (ph, "MENU DEL \"Window/Display System Info\""); zoitechat_command (ph, "MENU DEL \"Window/Display System Info\"");
zoitechat_printf (ph, _("%s plugin unloaded\n"), name); zoitechat_printf (ph, _("%s plugin unloaded\n"), name);

View File

@@ -132,7 +132,6 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
if(fp == NULL) if(fp == NULL)
{ {
g_snprintf(fullname, bsize, "%s:%s", vendor, device); g_snprintf(fullname, bsize, "%s:%s", vendor, device);
//sysinfo_print_error ("pci.ids file not found! You might want to adjust your pciids setting with /SYSINFO SET pciids (you can query its current value with /SYSINFO LIST).\n");
return; return;
} }

View File

@@ -26,7 +26,7 @@
#define APPCAST_URL "https://zoitechat.zoite.net/appcast.xml" #define APPCAST_URL "https://zoitechat.zoite.net/appcast.xml"
static zoitechat_plugin *ph; /* plugin handle */ static zoitechat_plugin *ph;
static char name[] = "Update Checker"; static char name[] = "Update Checker";
static char desc[] = "Check for ZoiteChat updates automatically"; static char desc[] = "Check for ZoiteChat updates automatically";
static char version[] = "5.0"; static char version[] = "5.0";

View File

@@ -20,7 +20,7 @@
#define PLAYING 1 #define PLAYING 1
#define PAUSED 3 #define PAUSED 3
static zoitechat_plugin *ph; /* plugin handle */ static zoitechat_plugin *ph;
static int static int
winamp(char *word[], char *word_eol[], void *userdata) winamp(char *word[], char *word_eol[], void *userdata)
@@ -130,7 +130,6 @@ zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
char **plugin_version, char **plugin_version,
char *arg) char *arg)
{ {
/* we need to save this for use with any zoitechat_* functions */
ph = plugin_handle; ph = plugin_handle;
*plugin_name = "Winamp"; *plugin_name = "Winamp";
@@ -142,7 +141,7 @@ zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
zoitechat_print (ph, "Winamp plugin loaded\n"); zoitechat_print (ph, "Winamp plugin loaded\n");
return 1; /* return 1 for success */ return 1;
} }
int int

View File

@@ -764,7 +764,6 @@ load_default_config(void)
prefs.hex_gui_input_style = 1; prefs.hex_gui_input_style = 1;
prefs.hex_gui_join_dialog = 1; prefs.hex_gui_join_dialog = 1;
prefs.hex_gui_quit_dialog = 1; prefs.hex_gui_quit_dialog = 1;
/* prefs.hex_gui_slist_skip = 1; */
prefs.hex_gui_tab_chans = 1; prefs.hex_gui_tab_chans = 1;
prefs.hex_gui_tab_dialogs = 1; prefs.hex_gui_tab_dialogs = 1;
prefs.hex_gui_tab_icons = 1; prefs.hex_gui_tab_icons = 1;
@@ -788,7 +787,7 @@ load_default_config(void)
prefs.hex_irc_reconnect_rejoin = 1; prefs.hex_irc_reconnect_rejoin = 1;
prefs.hex_irc_cap_server_time = 1; prefs.hex_irc_cap_server_time = 1;
prefs.hex_irc_logging = 1; prefs.hex_irc_logging = 1;
prefs.hex_irc_who_join = 1; /* Can kick with inordinate amount of channels, required for some of our features though, TODO: add cap like away check? */ prefs.hex_irc_who_join = 1;
prefs.hex_irc_whois_front = 1; prefs.hex_irc_whois_front = 1;
prefs.hex_net_auto_reconnect = 1; prefs.hex_net_auto_reconnect = 1;
prefs.hex_net_throttle = 1; prefs.hex_net_throttle = 1;
@@ -819,7 +818,7 @@ load_default_config(void)
prefs.hex_flood_ctcp_num = 5; prefs.hex_flood_ctcp_num = 5;
prefs.hex_flood_ctcp_time = 30; prefs.hex_flood_ctcp_time = 30;
prefs.hex_flood_msg_num = 5; prefs.hex_flood_msg_num = 5;
/*FIXME*/ prefs.hex_flood_msg_time = 30; prefs.hex_flood_msg_time = 30;
prefs.hex_gui_chanlist_maxusers = 9999; prefs.hex_gui_chanlist_maxusers = 9999;
prefs.hex_gui_chanlist_minusers = 5; prefs.hex_gui_chanlist_minusers = 5;
prefs.hex_gui_dialog_height = 256; prefs.hex_gui_dialog_height = 256;

View File

@@ -99,8 +99,6 @@ str_to_chanopt (const char *str)
return SET_DEFAULT; return SET_DEFAULT;
} }
/* handle the /CHANOPT command */
int int
chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[]) chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[])
{ {
@@ -135,13 +133,13 @@ chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[])
{ {
if (find[0] == 0 || match (find, chanopt[i].name) || (chanopt[i].alias && match (find, chanopt[i].alias))) if (find[0] == 0 || match (find, chanopt[i].name) || (chanopt[i].alias && match (find, chanopt[i].alias)))
{ {
if (newval != -1) /* set new value */ if (newval != -1)
{ {
*(guint8 *)G_STRUCT_MEMBER_P(sess, chanopt[i].offset) = newval; *(guint8 *)G_STRUCT_MEMBER_P(sess, chanopt[i].offset) = newval;
chanopt_changed = TRUE; chanopt_changed = TRUE;
} }
if (!quiet) /* print value */ if (!quiet)
{ {
strcpy (tbuf, chanopt[i].name); strcpy (tbuf, chanopt[i].name);
p = strlen (tbuf); p = strlen (tbuf);
@@ -177,18 +175,13 @@ chanopt_is_set (unsigned int global, guint8 per_chan_setting)
return global; return global;
} }
/* === below is LOADING/SAVING stuff only === */
typedef struct typedef struct
{ {
/* Per-Channel Alerts */
/* use a byte, because we need a pointer to each element */
guint8 alert_balloon; guint8 alert_balloon;
guint8 alert_beep; guint8 alert_beep;
guint8 alert_taskbar; guint8 alert_taskbar;
guint8 alert_tray; guint8 alert_tray;
/* Per-Channel Settings */
guint8 text_hidejoinpart; guint8 text_hidejoinpart;
guint8 text_logging; guint8 text_logging;
guint8 text_scrollback; guint8 text_scrollback;
@@ -218,12 +211,10 @@ chanopt_find (char *network, char *channel, gboolean add_new)
if (!add_new) if (!add_new)
return NULL; return NULL;
/* allocate a new one */
co = g_new0 (chanopt_in_memory, 1); co = g_new0 (chanopt_in_memory, 1);
co->channel = g_strdup (channel); co->channel = g_strdup (channel);
co->network = g_strdup (network); co->network = g_strdup (network);
/* set all values to SET_DEFAULT */
i = 0; i = 0;
while (i < sizeof (chanopt) / sizeof (channel_options)) while (i < sizeof (chanopt) / sizeof (channel_options))
{ {
@@ -254,8 +245,6 @@ chanopt_add_opt (chanopt_in_memory *co, char *var, int new_value)
} }
} }
/* load chanopt.conf from disk into our chanopt_list GSList */
static void static void
chanopt_load_all (void) chanopt_load_all (void)
{ {
@@ -265,7 +254,6 @@ chanopt_load_all (void)
char *network = NULL; char *network = NULL;
chanopt_in_memory *current = NULL; chanopt_in_memory *current = NULL;
/* 1. load the old file into our GSList */
fh = zoitechat_open_file ("chanopt.conf", O_RDONLY, 0, 0); fh = zoitechat_open_file ("chanopt.conf", O_RDONLY, 0, 0);
if (fh != -1) if (fh != -1)
{ {
@@ -326,7 +314,6 @@ chanopt_load (session *sess)
if (!co) if (!co)
return; return;
/* fill in all the sess->xxxxx fields */
i = 0; i = 0;
while (i < sizeof (chanopt) / sizeof (channel_options)) while (i < sizeof (chanopt) / sizeof (channel_options))
{ {
@@ -352,8 +339,6 @@ chanopt_save (session *sess)
if (!network) if (!network)
return; return;
/* 2. reconcile sess with what we loaded from disk */
co = chanopt_find (network, sess->session_name, TRUE); co = chanopt_find (network, sess->session_name, TRUE);
i = 0; i = 0;

View File

@@ -743,9 +743,6 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
EMIT_SIGNAL (XP_TE_DCCRECVERR, dcc->serv->front_session, dcc->file, EMIT_SIGNAL (XP_TE_DCCRECVERR, dcc->serv->front_session, dcc->file,
dcc->destfile, dcc->nick, dcc->destfile, dcc->nick,
errorstring ((n < 0) ? sock_error () : 0), 0); errorstring ((n < 0) ? sock_error () : 0), 0);
/* send ack here? but the socket is dead */
/*if (need_ack)
dcc_send_ack (dcc);*/
dcc_close (dcc, STAT_FAILED, FALSE); dcc_close (dcc, STAT_FAILED, FALSE);
return TRUE; return TRUE;
} }
@@ -1383,7 +1380,6 @@ dcc_connect (struct DCC *dcc)
dcc_close (dcc, STAT_FAILED, FALSE); dcc_close (dcc, STAT_FAILED, FALSE);
return; return;
} }
/* possible problems with filenames containing spaces? */
if (dcc->type == TYPE_RECV) if (dcc->type == TYPE_RECV)
g_snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ? g_snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ?
"DCC SEND \"%s\" %u %d %" G_GUINT64_FORMAT " %d" : "DCC SEND \"%s\" %u %d %" G_GUINT64_FORMAT " %d" :
@@ -1660,17 +1656,14 @@ dcc_listen_init (struct DCC *dcc, session *sess)
SAddr.sin_family = AF_INET; SAddr.sin_family = AF_INET;
/*if local_ip is specified use that*/
if (prefs.local_ip != 0xffffffff) if (prefs.local_ip != 0xffffffff)
{ {
my_addr = prefs.local_ip; my_addr = prefs.local_ip;
SAddr.sin_addr.s_addr = prefs.local_ip; SAddr.sin_addr.s_addr = prefs.local_ip;
} }
/*otherwise use the default*/
else else
my_addr = SAddr.sin_addr.s_addr; my_addr = SAddr.sin_addr.s_addr;
/*if we have a valid portrange try to use that*/
if (prefs.hex_dcc_port_first > 0) if (prefs.hex_dcc_port_first > 0)
{ {
SAddr.sin_port = 0; SAddr.sin_port = 0;
@@ -1680,7 +1673,6 @@ dcc_listen_init (struct DCC *dcc, session *sess)
{ {
SAddr.sin_port = htons (prefs.hex_dcc_port_first + i); SAddr.sin_port = htons (prefs.hex_dcc_port_first + i);
i++; i++;
/*printf("Trying to bind against port: %d\n",ntohs(SAddr.sin_port));*/
bindretval = bind (dcc->sok, (struct sockaddr *) &SAddr, sizeof (SAddr)); bindretval = bind (dcc->sok, (struct sockaddr *) &SAddr, sizeof (SAddr));
} }
@@ -1707,12 +1699,8 @@ dcc_listen_init (struct DCC *dcc, session *sess)
dcc->port = ntohs (SAddr.sin_port); dcc->port = ntohs (SAddr.sin_port);
/*if we have a dcc_ip, we use that, so the remote client can connect*/
/*else we try to take an address from hex_dcc_ip*/
/*if something goes wrong we tell the client to connect to our LAN ip*/
dcc->addr = dcc_get_my_address (sess); dcc->addr = dcc_get_my_address (sess);
/*if nothing else worked we use the address we bound to*/
if (dcc->addr == 0) if (dcc->addr == 0)
dcc->addr = my_addr; dcc->addr = my_addr;
@@ -1728,7 +1716,7 @@ dcc_listen_init (struct DCC *dcc, session *sess)
} }
static struct session *dccsess; static struct session *dccsess;
static char *dccto; /* lame!! */ static char *dccto;
static gint64 dccmaxcps; static gint64 dccmaxcps;
static int recursive = FALSE; static int recursive = FALSE;

View File

@@ -153,8 +153,6 @@ ignore_showlist (session *sess)
strcat (tbuf, _("NO ")); strcat (tbuf, _("NO "));
strcat (tbuf, "\n"); strcat (tbuf, "\n");
PrintText (sess, tbuf); PrintText (sess, tbuf);
/*EMIT_SIGNAL (XP_TE_IGNORELIST, sess, ig->mask, 0, 0, 0, 0); */
/* use this later, when TE's support 7 args */
list = list->next; list = list->next;
} }
@@ -413,4 +411,3 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct
} }
return 1; return 1;
} }

View File

@@ -108,7 +108,6 @@ find_session_from_nick (char *nick, server *serv)
if (serv->front_session) if (serv->front_session)
{ {
// If we are here for ChanServ, then it is usually a reply for the user
if (!g_ascii_strcasecmp(nick, "ChanServ") || userlist_find (serv->front_session, nick)) if (!g_ascii_strcasecmp(nick, "ChanServ") || userlist_find (serv->front_session, nick))
return serv->front_session; return serv->front_session;
} }
@@ -2121,7 +2120,6 @@ scram_authenticate (server *serv, const char *data, const char *digest,
if (status == SCRAM_IN_PROGRESS) if (status == SCRAM_IN_PROGRESS)
{ {
// Authentication is still in progress
encoded = g_base64_encode ((guchar *) output, output_len); encoded = g_base64_encode ((guchar *) output, output_len);
tcp_sendf (serv, "AUTHENTICATE %s\r\n", encoded); tcp_sendf (serv, "AUTHENTICATE %s\r\n", encoded);
g_free (encoded); g_free (encoded);
@@ -2129,13 +2127,11 @@ scram_authenticate (server *serv, const char *data, const char *digest,
} }
else if (status == SCRAM_SUCCESS) else if (status == SCRAM_SUCCESS)
{ {
// Authentication succeeded
tcp_sendf (serv, "AUTHENTICATE +\r\n"); tcp_sendf (serv, "AUTHENTICATE +\r\n");
g_clear_pointer (&serv->scram_session, scram_session_free); g_clear_pointer (&serv->scram_session, scram_session_free);
} }
else if (status == SCRAM_ERROR) else if (status == SCRAM_ERROR)
{ {
// Authentication failed
tcp_sendf (serv, "AUTHENTICATE *\r\n"); tcp_sendf (serv, "AUTHENTICATE *\r\n");
if (serv->scram_session->error != NULL) if (serv->scram_session->error != NULL)

View File

@@ -96,11 +96,6 @@ textevents = custom_target('textevents',
command: [make_te, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@'] command: [make_te, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@']
) )
# TODO:
# LOOKUPD
# SIGACTION
# HAVE_GTK_MAC
if libssl_dep.found() if libssl_dep.found()
common_sources += 'ssl.c' common_sources += 'ssl.c'
common_deps += libssl_dep common_deps += libssl_dep

View File

@@ -87,7 +87,7 @@ notify_do_network (struct notify *notify, server *serv)
return TRUE; return TRUE;
if (token_foreach (notify->networks, ',', notify_netcmp, serv)) if (token_foreach (notify->networks, ',', notify_netcmp, serv))
return FALSE; /* network list doesn't contain this one */ return FALSE;
return TRUE; return TRUE;
} }
@@ -106,8 +106,6 @@ notify_find_server_entry (struct notify *notify, struct server *serv)
list = list->next; list = list->next;
} }
/* not found, should we add it, or is this not a network where
we're monitoring this nick? */
if (!notify_do_network (notify, serv)) if (!notify_do_network (notify, serv))
return NULL; return NULL;
@@ -123,11 +121,7 @@ notify_save (void)
{ {
int fh; int fh;
struct notify *notify; struct notify *notify;
// while reading the notify.conf file, elements are added by prepending to the GSList *list = g_slist_reverse (g_slist_copy (notify_list));
// list. reverse the list before writing to disk to keep the original
// order of the list
GSList *list = g_slist_copy(notify_list);
list = g_slist_reverse(list);
fh = zoitechat_open_file ("notify.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE); fh = zoitechat_open_file ("notify.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
if (fh != -1) if (fh != -1)
@@ -146,7 +140,7 @@ notify_save (void)
} }
close (fh); close (fh);
} }
g_slist_free(list); g_slist_free (list);
} }
void void

View File

@@ -42,19 +42,16 @@ struct notify_per_server
extern GSList *notify_list; extern GSList *notify_list;
extern int notify_tag; extern int notify_tag;
/* the WATCH stuff */
void notify_set_online (server * serv, char *nick, void notify_set_online (server * serv, char *nick,
const message_tags_data *tags_data); const message_tags_data *tags_data);
void notify_set_offline (server * serv, char *nick, int quiet, void notify_set_offline (server * serv, char *nick, int quiet,
const message_tags_data *tags_data); const message_tags_data *tags_data);
/* the MONITOR stuff */
void notify_set_online_list (server * serv, char *users, void notify_set_online_list (server * serv, char *users,
const message_tags_data *tags_data); const message_tags_data *tags_data);
void notify_set_offline_list (server * serv, char *users, int quiet, void notify_set_offline_list (server * serv, char *users, int quiet,
const message_tags_data *tags_data); const message_tags_data *tags_data);
void notify_send_watches (server * serv); void notify_send_watches (server * serv);
/* the general stuff */
void notify_adduser (char *name, char *networks); void notify_adduser (char *name, char *networks);
int notify_deluser (char *name); int notify_deluser (char *name);
void notify_cleanup (void); void notify_cleanup (void);
@@ -65,7 +62,6 @@ gboolean notify_is_in_list (server *serv, char *name);
int notify_isnotify (session *sess, char *name); int notify_isnotify (session *sess, char *name);
struct notify_per_server *notify_find_server_entry (struct notify *notify, struct server *serv); struct notify_per_server *notify_find_server_entry (struct notify *notify, struct server *serv);
/* the old ISON stuff - remove me? */
void notify_markonline (server *serv, char *word[], void notify_markonline (server *serv, char *word[],
const message_tags_data *tags_data); const message_tags_data *tags_data);
int notify_checklist (void); int notify_checklist (void);

View File

@@ -30,7 +30,7 @@
#define _(x) zoitechat_gettext(ph,x) #define _(x) zoitechat_gettext(ph,x)
static zoitechat_plugin *ph; /* plugin handle */ static zoitechat_plugin *ph;
static GSList *timer_list = NULL; static GSList *timer_list = NULL;
#define STATIC #define STATIC
@@ -146,7 +146,6 @@ timer_showlist (void)
zoitechat_print (ph, _(HELP)); zoitechat_print (ph, _(HELP));
return; return;
} }
/* 00000 00000000 0000000 abc */
zoitechat_print (ph, _("\026 Ref# Seconds Repeat Command \026\n")); zoitechat_print (ph, _("\026 Ref# Seconds Repeat Command \026\n"));
list = timer_list; list = timer_list;
while (list) while (list)
@@ -218,7 +217,6 @@ zoitechat_plugin_init
(zoitechat_plugin *plugin_handle, char **plugin_name, (zoitechat_plugin *plugin_handle, char **plugin_name,
char **plugin_desc, char **plugin_version, char *arg) char **plugin_desc, char **plugin_version, char *arg)
{ {
/* we need to save this for use with any zoitechat_* functions */
ph = plugin_handle; ph = plugin_handle;
*plugin_name = "Timer"; *plugin_name = "Timer";
@@ -227,5 +225,5 @@ zoitechat_plugin_init
zoitechat_hook_command (ph, "TIMER", ZOITECHAT_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;
} }

View File

@@ -28,7 +28,6 @@
#define CLIENT_KEY "Client Key" #define CLIENT_KEY "Client Key"
#define SERVER_KEY "Server Key" #define SERVER_KEY "Server Key"
// EVP_MD_CTX_create() and EVP_MD_CTX_destroy() were renamed in OpenSSL 1.1.0
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
#define EVP_MD_CTX_new(ctx) EVP_MD_CTX_create(ctx) #define EVP_MD_CTX_new(ctx) EVP_MD_CTX_create(ctx)
#define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy(ctx) #define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy(ctx)
@@ -46,7 +45,6 @@ scram_session
if (md == NULL) if (md == NULL)
{ {
// Unknown message digest
return NULL; return NULL;
} }
@@ -189,7 +187,6 @@ process_server_first (scram_session *session, const char *data, char **output,
client_nonce_len = strlen (session->client_nonce_b64); client_nonce_len = strlen (session->client_nonce_b64);
// The server can append his nonce to the client's nonce
if (strlen (server_nonce_b64) < client_nonce_len || if (strlen (server_nonce_b64) < client_nonce_len ||
strncmp (server_nonce_b64, session->client_nonce_b64, client_nonce_len)) strncmp (server_nonce_b64, session->client_nonce_b64, client_nonce_len))
{ {
@@ -199,28 +196,22 @@ process_server_first (scram_session *session, const char *data, char **output,
g_base64_decode_inplace ((gchar *) salt, &salt_len); g_base64_decode_inplace ((gchar *) salt, &salt_len);
// SaltedPassword := Hi(Normalize(password), salt, i)
session->salted_password = g_malloc (session->digest_size); session->salted_password = g_malloc (session->digest_size);
PKCS5_PBKDF2_HMAC (session->password, strlen (session->password), (unsigned char *) salt, PKCS5_PBKDF2_HMAC (session->password, strlen (session->password), (unsigned char *) salt,
salt_len, iteration_count, session->digest, session->digest_size, salt_len, iteration_count, session->digest, session->digest_size,
session->salted_password); session->salted_password);
// AuthMessage := client-first-message-bare + "," +
// server-first-message + "," +
// client-final-message-without-proof
client_final_message_without_proof = g_strdup_printf ("c=biws,r=%s", server_nonce_b64); client_final_message_without_proof = g_strdup_printf ("c=biws,r=%s", server_nonce_b64);
session->auth_message = g_strdup_printf ("%s,%s,%s", session->client_first_message_bare, session->auth_message = g_strdup_printf ("%s,%s,%s", session->client_first_message_bare,
data, client_final_message_without_proof); data, client_final_message_without_proof);
// ClientKey := HMAC(SaltedPassword, "Client Key")
client_key = g_malloc0 (session->digest_size); client_key = g_malloc0 (session->digest_size);
HMAC (session->digest, session->salted_password, session->digest_size, HMAC (session->digest, session->salted_password, session->digest_size,
(unsigned char *) CLIENT_KEY, strlen (CLIENT_KEY), client_key, &client_key_len); (unsigned char *) CLIENT_KEY, strlen (CLIENT_KEY), client_key, &client_key_len);
// StoredKey := H(ClientKey)
if (!create_SHA (session, client_key, session->digest_size, stored_key, &stored_key_len)) if (!create_SHA (session, client_key, session->digest_size, stored_key, &stored_key_len))
{ {
g_free (client_final_message_without_proof); g_free (client_final_message_without_proof);
@@ -230,12 +221,10 @@ process_server_first (scram_session *session, const char *data, char **output,
return SCRAM_ERROR; return SCRAM_ERROR;
} }
// ClientSignature := HMAC(StoredKey, AuthMessage)
client_signature = g_malloc0 (session->digest_size); client_signature = g_malloc0 (session->digest_size);
HMAC (session->digest, stored_key, stored_key_len, (unsigned char *) session->auth_message, HMAC (session->digest, stored_key, stored_key_len, (unsigned char *) session->auth_message,
strlen ((char *) session->auth_message), client_signature, NULL); strlen ((char *) session->auth_message), client_signature, NULL);
// ClientProof := ClientKey XOR ClientSignature
client_proof = g_malloc0 (client_key_len); client_proof = g_malloc0 (client_key_len);
for (i = 0; i < client_key_len; i++) for (i = 0; i < client_key_len; i++)
@@ -276,12 +265,10 @@ process_server_final (scram_session *session, const char *data)
verifier = g_strdup (data + 2); verifier = g_strdup (data + 2);
g_base64_decode_inplace (verifier, &verifier_len); g_base64_decode_inplace (verifier, &verifier_len);
// ServerKey := HMAC(SaltedPassword, "Server Key")
server_key = g_malloc0 (session->digest_size); server_key = g_malloc0 (session->digest_size);
HMAC (session->digest, session->salted_password, session->digest_size, HMAC (session->digest, session->salted_password, session->digest_size,
(unsigned char *) SERVER_KEY, strlen (SERVER_KEY), server_key, &server_key_len); (unsigned char *) SERVER_KEY, strlen (SERVER_KEY), server_key, &server_key_len);
// ServerSignature := HMAC(ServerKey, AuthMessage)
server_signature = g_malloc0 (session->digest_size); server_signature = g_malloc0 (session->digest_size);
HMAC (session->digest, server_key, session->digest_size, HMAC (session->digest, server_key, session->digest_size,
(unsigned char *) session->auth_message, strlen ((char *) session->auth_message), (unsigned char *) session->auth_message, strlen ((char *) session->auth_message),
@@ -330,4 +317,4 @@ scram_process (scram_session *session, const char *input, char **output, size_t
return status; return status;
} }
#endif #endif

View File

@@ -510,16 +510,7 @@ server_stopconnecting (server * serv)
static void static void
ssl_cb_info (SSL * s, int where, int ret) ssl_cb_info (SSL * s, int where, int ret)
{ {
/* char buf[128];*/
return; /* FIXME: make debug level adjustable in serverlist or settings */ return; /* FIXME: make debug level adjustable in serverlist or settings */
/* g_snprintf (buf, sizeof (buf), "%s (%d)", SSL_state_string_long (s), where);
if (g_sess)
EMIT_SIGNAL (XP_TE_SSLMESSAGE, g_sess, buf, NULL, NULL, NULL, 0);
else
fprintf (stderr, "%s\n", buf);*/
} }
static int static int
@@ -625,14 +616,6 @@ ssl_do_connect (server * serv)
cert_info.algorithm, cert_info.algorithm_bits); cert_info.algorithm, cert_info.algorithm_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0); NULL, 0);
/*if (cert_info.rsa_tmp_bits)
{
g_snprintf (buf, sizeof (buf),
" Public key algorithm uses ephemeral key with %d bits",
cert_info.rsa_tmp_bits);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
NULL, 0);
}*/
g_snprintf (buf, sizeof (buf), " Sign algorithm %s", g_snprintf (buf, sizeof (buf), " Sign algorithm %s",
cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/); cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/);
EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL,
@@ -675,8 +658,6 @@ ssl_do_connect (server * serv)
} }
break; break;
} }
/* g_snprintf (buf, sizeof (buf), "* Verify OK (?)"); */
/* EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, NULL, 0); */
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE:
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
@@ -1870,11 +1851,9 @@ server_set_defaults (server *serv)
char * char *
server_get_network (server *serv, gboolean fallback) server_get_network (server *serv, gboolean fallback)
{ {
/* check the network list */
if (serv->network) if (serv->network)
return ((ircnet *)serv->network)->name; return ((ircnet *)serv->network)->name;
/* check the network name given in 005 NETWORK=... */
if (serv->server_session && *serv->server_session->channel) if (serv->server_session && *serv->server_session->channel)
return serv->server_session->channel; return serv->server_session->channel;
@@ -1893,7 +1872,6 @@ server_set_name (server *serv, char *name)
if (name[0] == 0) if (name[0] == 0)
name = serv->hostname; name = serv->hostname;
/* strncpy parameters must NOT overlap */
if (name != serv->servername) if (name != serv->servername)
{ {
safe_strcpy (serv->servername, name, sizeof (serv->servername)); safe_strcpy (serv->servername, name, sizeof (serv->servername));

View File

@@ -1065,7 +1065,7 @@ servlist_load (void)
} }
} }
if (buf[0] == 'N') if (buf[0] == 'N')
net = servlist_net_add (buf + 2, /* comment */ NULL, FALSE); net = servlist_net_add (buf + 2, NULL, FALSE);
} }
fclose (fp); fclose (fp);

View File

@@ -125,8 +125,4 @@ GSList *servlist_favchan_listadd (GSList *chanlist, char *channel, char *key);
gboolean joinlist_is_in_list (server *serv, char *channel); gboolean joinlist_is_in_list (server *serv, char *channel);
/* FIXME
void joinlist_split (char *autojoin, GSList **channels, GSList **keys);
void joinlist_free (GSList *channels, GSList *keys);
*/
#endif #endif

View File

@@ -465,7 +465,6 @@ static char *read_hdd_info (IWbemClassObject *object)
if (name_len >= 4 && name_bstr[0] == L'\\' && name_bstr[1] == L'\\' && name_bstr[2] == L'?' && name_bstr[3] == L'\\') if (name_len >= 4 && name_bstr[0] == L'\\' && name_bstr[1] == L'\\' && name_bstr[2] == L'?' && name_bstr[3] == L'\\')
{ {
// This is not a named volume. Skip it.
VariantClear (&name_variant); VariantClear (&name_variant);
return NULL; return NULL;

View File

@@ -95,7 +95,6 @@ url_save_node (char* url)
{ {
FILE *fd; FILE *fd;
/* open <config>/url.log in append mode */
fd = zoitechat_fopen_file ("url.log", "a", 0); fd = zoitechat_fopen_file ("url.log", "a", 0);
if (fd == NULL) if (fd == NULL)
{ {
@@ -118,7 +117,6 @@ url_add (char *urltext, int len)
char *data; char *data;
int size; int size;
/* we don't need any URLs if we have neither URL grabbing nor URL logging enabled */
if (!prefs.hex_url_grabber && !prefs.hex_url_logging) if (!prefs.hex_url_grabber && !prefs.hex_url_logging)
{ {
return; return;
@@ -126,12 +124,11 @@ url_add (char *urltext, int len)
data = g_strndup (urltext, len); data = g_strndup (urltext, len);
if (data[len - 1] == '.') /* chop trailing dot */ if (data[len - 1] == '.')
{ {
len--; len--;
data[len] = 0; data[len] = 0;
} }
/* chop trailing ) but only if there's no counterpart */
if (data[len - 1] == ')' && strchr (data, '(') == NULL) if (data[len - 1] == ')' && strchr (data, '(') == NULL)
{ {
data[len - 1] = 0; data[len - 1] = 0;
@@ -142,7 +139,6 @@ url_add (char *urltext, int len)
url_save_node (data); url_save_node (data);
} }
/* the URL is saved already, only continue if we need the URL grabber too */
if (!prefs.hex_url_grabber) if (!prefs.hex_url_grabber)
{ {
g_free (data); g_free (data);
@@ -162,11 +158,8 @@ url_add (char *urltext, int len)
} }
size = tree_size (url_tree); size = tree_size (url_tree);
/* 0 is unlimited */
if (prefs.hex_url_grabber_limit > 0 && size >= prefs.hex_url_grabber_limit) if (prefs.hex_url_grabber_limit > 0 && size >= prefs.hex_url_grabber_limit)
{ {
/* the loop is necessary to handle having the limit lowered while
ZoiteChat is running */
size -= prefs.hex_url_grabber_limit; size -= prefs.hex_url_grabber_limit;
for(; size > 0; size--) for(; size > 0; size--)
{ {
@@ -183,10 +176,6 @@ url_add (char *urltext, int len)
fe_url_add (data); fe_url_add (data);
} }
/* check if a word is clickable. This is called on mouse motion events, so
keep it FAST! This new version was found to be almost 3x faster than
2.4.4 release. */
static int laststart = 0; static int laststart = 0;
static int lastend = 0; static int lastend = 0;
static int lasttype = 0; static int lasttype = 0;
@@ -234,7 +223,6 @@ match_nick (const char *word, int *start, int *end)
if (!regex_match (re_nick (), word, start, end)) if (!regex_match (re_nick (), word, start, end))
return FALSE; return FALSE;
/* ignore matches with prefixes that the server doesn't use */
if (strchr (NICKPRE, word[*start]) if (strchr (NICKPRE, word[*start])
&& !strchr (nick_prefixes, word[*start])) && !strchr (nick_prefixes, word[*start]))
return FALSE; return FALSE;

View File

@@ -169,13 +169,12 @@ errorstring (int err)
return tbuf; return tbuf;
} }
} }
} /* ! if (osvi.dwMajorVersion >= 5) */ }
/* fallback to error number */
sprintf (tbuf, "%s %d", _("Error"), err); sprintf (tbuf, "%s %d", _("Error"), err);
return tbuf; return tbuf;
} /* ! if (err >= WSABASEERR) */ }
#endif /* ! WIN32 */ #endif
return strerror (err); return strerror (err);
} }

View File

@@ -502,16 +502,13 @@ lastact_update(session *sess)
else if (sess->tab_state & TAB_STATE_NEW_DATA) else if (sess->tab_state & TAB_STATE_NEW_DATA)
newidx = dia? LACT_QUERY: LACT_CHAN_DATA; newidx = dia? LACT_QUERY: LACT_CHAN_DATA;
/* If already first at the right position, just return */
if (oldidx == newidx && if (oldidx == newidx &&
(newidx == LACT_NONE || g_list_index(sess_list_by_lastact[newidx], sess) == 0)) (newidx == LACT_NONE || g_list_index(sess_list_by_lastact[newidx], sess) == 0))
return; return;
/* Remove from the old position */
if (oldidx != LACT_NONE) if (oldidx != LACT_NONE)
sess_list_by_lastact[oldidx] = g_list_remove(sess_list_by_lastact[oldidx], sess); sess_list_by_lastact[oldidx] = g_list_remove(sess_list_by_lastact[oldidx], sess);
/* Add at the new position */
sess->lastact_idx = newidx; sess->lastact_idx = newidx;
if (newidx != LACT_NONE) if (newidx != LACT_NONE)
sess_list_by_lastact[newidx] = g_list_prepend(sess_list_by_lastact[newidx], sess); sess_list_by_lastact[newidx] = g_list_prepend(sess_list_by_lastact[newidx], sess);
@@ -533,7 +530,6 @@ lastact_getfirst(int (*filter) (session *sess))
session *sess = NULL; session *sess = NULL;
GList *curitem; GList *curitem;
/* 5 is the number of priority classes LACT_ */
for (i = 0; i < 5 && !sess; i++) for (i = 0; i < 5 && !sess; i++)
{ {
curitem = sess_list_by_lastact[i]; curitem = sess_list_by_lastact[i];
@@ -672,9 +668,8 @@ away_check (void)
return 1; return 1;
doover: doover:
/* request an update of AWAY status of 1 channel every 30 seconds */
full = TRUE; full = TRUE;
sent = 0; /* number of WHOs (users) requested */ sent = 0;
list = sess_list; list = sess_list;
while (list) while (list)
{ {
@@ -689,12 +684,10 @@ doover:
{ {
full = FALSE; full = FALSE;
/* if we're under 31 WHOs, send another channels worth */
if (sent < 31 && !sess->doing_who) if (sent < 31 && !sess->doing_who)
{ {
sess->done_away_check = TRUE; sess->done_away_check = TRUE;
sess->doing_who = TRUE; sess->doing_who = TRUE;
/* this'll send a WHO #channel */
sess->server->p_away_status (sess->server, sess->channel); sess->server->p_away_status (sess->server, sess->channel);
sent += sess->total; sent += sess->total;
} }
@@ -704,7 +697,6 @@ doover:
list = list->next; list = list->next;
} }
/* done them all, reset done_away_check to FALSE and start over unless we have away-notify */
if (full) if (full)
{ {
list = sess_list; list = sess_list;
@@ -723,22 +715,20 @@ doover:
return 1; return 1;
} }
/* these are only run if the lagometer is enabled */
static int static int
zoitechat_lag_check (void) /* this gets called every 30 seconds */ zoitechat_lag_check (void)
{ {
lag_check (); lag_check ();
return 1; return 1;
} }
static int static int
zoitechat_lag_check_update (void) /* this gets called every 0.5 seconds */ zoitechat_lag_check_update (void)
{ {
lagcheck_update (); lagcheck_update ();
return 1; return 1;
} }
/* call whenever timeout intervals change */
void void
zoitechat_reinit_timers (void) zoitechat_reinit_timers (void)
{ {
@@ -746,7 +736,6 @@ zoitechat_reinit_timers (void)
static int lag_check_tag = 0; static int lag_check_tag = 0;
static int away_tag = 0; static int away_tag = 0;
/* notify timeout */
if (prefs.hex_notify_timeout && notify_tag == 0) if (prefs.hex_notify_timeout && notify_tag == 0)
{ {
notify_tag = fe_timeout_add_seconds (prefs.hex_notify_timeout, notify_tag = fe_timeout_add_seconds (prefs.hex_notify_timeout,
@@ -758,7 +747,6 @@ zoitechat_reinit_timers (void)
notify_tag = 0; notify_tag = 0;
} }
/* away status tracking */
if (prefs.hex_away_track && away_tag == 0) if (prefs.hex_away_track && away_tag == 0)
{ {
away_tag = fe_timeout_add_seconds (prefs.hex_away_timeout, away_check, NULL); away_tag = fe_timeout_add_seconds (prefs.hex_away_timeout, away_check, NULL);
@@ -769,7 +757,6 @@ zoitechat_reinit_timers (void)
away_tag = 0; away_tag = 0;
} }
/* lag-o-meter */
if (prefs.hex_gui_lagometer && lag_check_update_tag == 0) if (prefs.hex_gui_lagometer && lag_check_update_tag == 0)
{ {
lag_check_update_tag = fe_timeout_add (500, zoitechat_lag_check_update, NULL); lag_check_update_tag = fe_timeout_add (500, zoitechat_lag_check_update, NULL);
@@ -780,7 +767,6 @@ zoitechat_reinit_timers (void)
lag_check_update_tag = 0; lag_check_update_tag = 0;
} }
/* network timeouts and lag-o-meter */
if ((prefs.hex_net_ping_timeout != 0 || prefs.hex_gui_lagometer) if ((prefs.hex_net_ping_timeout != 0 || prefs.hex_gui_lagometer)
&& lag_check_tag == 0) && lag_check_tag == 0)
{ {
@@ -794,8 +780,6 @@ zoitechat_reinit_timers (void)
} }
} }
/* executed when the first irc window opens */
static void static void
irc_init (session *sess) irc_init (session *sess)
{ {

View File

@@ -24,7 +24,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gio/gio.h> #include <gio/gio.h>
#include <time.h> /* need time_t */ #include <time.h>
#ifndef ZOITECHAT_H #ifndef ZOITECHAT_H
#define ZOITECHAT_H #define ZOITECHAT_H
@@ -44,11 +44,11 @@ gboolean zoitechat_apply_theme (const char *theme_name, GError **error);
#include "tree.h" #include "tree.h"
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
#include <openssl/ssl.h> /* SSL_() */ #include <openssl/ssl.h>
#include "scram.h" #include "scram.h"
#endif #endif
#ifdef __EMX__ /* for o/s 2 */ #ifdef __EMX__
#define OFLAGS O_BINARY #define OFLAGS O_BINARY
#define g_ascii_strcasecmp stricmp #define g_ascii_strcasecmp stricmp
#define g_ascii_strncasecmp strnicmp #define g_ascii_strncasecmp strnicmp
@@ -59,7 +59,7 @@ gboolean zoitechat_apply_theme (const char *theme_name, GError **error);
/* force a 32bit CMP.L */ /* force a 32bit CMP.L */
#define WORDL(c0, c1, c2, c3) (guint32)(c0 | (c1 << 8) | (c2 << 16) | (c3 << 24)) #define WORDL(c0, c1, c2, c3) (guint32)(c0 | (c1 << 8) | (c2 << 16) | (c3 << 24))
#ifdef WIN32 /* for win32 */ #ifdef WIN32
#define OFLAGS O_BINARY #define OFLAGS O_BINARY
#define sleep(t) Sleep(t*1000) #define sleep(t) Sleep(t*1000)
#include <direct.h> #include <direct.h>
@@ -71,7 +71,7 @@ gboolean zoitechat_apply_theme (const char *theme_name, GError **error);
#define S_ISDIR(m) ((m) & _S_IFDIR) #define S_ISDIR(m) ((m) & _S_IFDIR)
#endif #endif
#define NETWORK_PRIVATE #define NETWORK_PRIVATE
#else /* for unix */ #else
#define OFLAGS 0 #define OFLAGS 0
#endif #endif

View File

@@ -190,11 +190,11 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv)
gtk_adjustment_set_value (adj, new_value); gtk_adjustment_set_value (adj, new_value);
tab_left_is_moving = 0; /* hSP: set to false in case we didnt get stopped (the normal case) */ tab_left_is_moving = 0;
} }
else else
{ {
tab_left_is_moving = 0; /* hSP: jump directly to next element if user is clicking faster than we can scroll.. */ tab_left_is_moving = 0;
} }
} }
@@ -239,11 +239,11 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
gtk_adjustment_set_value (adj, new_value); gtk_adjustment_set_value (adj, new_value);
tab_right_is_moving = 0; /* hSP: set to false in case we didnt get stopped (the normal case) */ tab_right_is_moving = 0;
} }
else else
{ {
tab_right_is_moving = 0; /* hSP: jump directly to next element if user is clicking faster than we can scroll.. */ tab_right_is_moving = 0;
} }
} }
@@ -332,7 +332,6 @@ cv_tabs_init (chanview *cv)
((tabview *)cv)->outer = outer; ((tabview *)cv)->outer = outer;
g_signal_connect (G_OBJECT (outer), "size_allocate", g_signal_connect (G_OBJECT (outer), "size_allocate",
G_CALLBACK (cv_tabs_sizealloc), cv); G_CALLBACK (cv_tabs_sizealloc), cv);
/* gtk_container_set_border_width (GTK_CONTAINER (outer), 2);*/
gtk_widget_show (outer); gtk_widget_show (outer);
viewport = gtk_viewport_new (0, 0); viewport = gtk_viewport_new (0, 0);
@@ -574,7 +573,7 @@ tab_pressed_cb (GtkToggleButton *tab, chan *ch)
ignore_toggle = FALSE; ignore_toggle = FALSE;
cv->focused = ch; cv->focused = ch;
if (/*tab->active*/is_switching) if (is_switching)
/* call the focus callback */ /* call the focus callback */
cv->cb_focus (cv, ch, ch->tag, ch->userdata); cv->cb_focus (cv, ch, ch->tag, ch->userdata);
} }

View File

@@ -925,8 +925,6 @@ fe_main (void)
void void
fe_cleanup (void) fe_cleanup (void)
{ {
/* it's saved when pressing OK in setup.c */
/*palette_save ();*/
} }
void void
@@ -963,8 +961,7 @@ log_handler (const gchar *log_domain,
{ {
session *sess; session *sess;
/* 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)");
if (!sess) if (!sess)
@@ -977,8 +974,6 @@ log_handler (const gchar *log_domain,
#endif #endif
/* install tray stuff */
static int static int
fe_idle (gpointer data) fe_idle (gpointer data)
{ {

View File

@@ -1199,11 +1199,6 @@ corrupt_file:
return 5; return 5;
} }
/* ***** Key actions start here *********** */
/* See the NOTES above --AGL */
/* "Run command" */
static int static int
key_action_handle_command (GtkWidget * wid, GdkEventKey * evt, char *d1, key_action_handle_command (GtkWidget * wid, GdkEventKey * evt, char *d1,
char *d2, struct session *sess) char *d2, struct session *sess)
@@ -1224,7 +1219,6 @@ key_action_handle_command (GtkWidget * wid, GdkEventKey * evt, char *d1,
/* /*
* Check if the given session is inside the main window. This predicate * Check if the given session is inside the main window. This predicate
* is passed to lastact_getfirst() as a way to filter out detached sessions. * is passed to lastact_getfirst() as a way to filter out detached sessions.
* XXX: Consider moving this in a different file?
*/ */
static int static int
session_check_is_tab(session *sess) session_check_is_tab(session *sess)
@@ -1806,7 +1800,7 @@ key_action_move_tab_left (GtkWidget * wid, GdkEventKey * ent, char *d1,
char *d2, struct session *sess) char *d2, struct session *sess)
{ {
mg_move_tab (sess, +1); mg_move_tab (sess, +1);
return 2; /* don't allow default action */ return 2;
} }
static int static int
@@ -1814,7 +1808,7 @@ key_action_move_tab_right (GtkWidget * wid, GdkEventKey * ent, char *d1,
char *d2, struct session *sess) char *d2, struct session *sess)
{ {
mg_move_tab (sess, -1); mg_move_tab (sess, -1);
return 2; /* -''- */ return 2;
} }
static int static int
@@ -1822,7 +1816,7 @@ key_action_move_tab_family_left (GtkWidget * wid, GdkEventKey * ent, char *d1,
char *d2, struct session *sess) char *d2, struct session *sess)
{ {
mg_move_tab_family (sess, +1); mg_move_tab_family (sess, +1);
return 2; /* don't allow default action */ return 2;
} }
static int static int
@@ -1830,7 +1824,7 @@ key_action_move_tab_family_right (GtkWidget * wid, GdkEventKey * ent, char *d1,
char *d2, struct session *sess) char *d2, struct session *sess)
{ {
mg_move_tab_family (sess, -1); mg_move_tab_family (sess, -1);
return 2; /* -''- */ return 2;
} }
static int static int
@@ -1839,12 +1833,9 @@ key_action_put_history (GtkWidget * wid, GdkEventKey * ent, char *d1,
{ {
history_add (&sess->history, SPELL_ENTRY_GET_TEXT (wid)); history_add (&sess->history, SPELL_ENTRY_GET_TEXT (wid));
SPELL_ENTRY_SET_TEXT (wid, ""); SPELL_ENTRY_SET_TEXT (wid, "");
return 2; /* -''- */ return 2;
} }
/* -------- */
static void static void
replace_handle (GtkWidget *t) replace_handle (GtkWidget *t)
{ {

View File

@@ -668,8 +668,6 @@ static void
gtkutil_file_req_done (GtkWidget * wid, struct file_req *freq) gtkutil_file_req_done (GtkWidget * wid, struct file_req *freq)
{ {
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (freq->dialog), freq); gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (freq->dialog), freq);
/* this should call the "destroy" cb, where we free(freq) */
gtk_widget_destroy (freq->dialog); gtk_widget_destroy (freq->dialog);
} }
@@ -682,7 +680,6 @@ gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
return; return;
} }
/* this should call the "destroy" cb, where we free(freq) */
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }
@@ -1360,16 +1357,6 @@ gtkutil_treemodel_string_to_iter (GtkTreeModel *model, gchar *pathstr, GtkTreeIt
return success; return success;
} }
/*gboolean
gtkutil_treeview_get_selected_iter (GtkTreeView *view, GtkTreeIter *iter_ret)
{
GtkTreeModel *store;
GtkTreeSelection *select;
select = gtk_tree_view_get_selection (view);
return gtk_tree_selection_get_selected (select, &store, iter_ret);
}*/
gboolean gboolean
gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...) gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...)
{ {

View File

@@ -81,11 +81,9 @@ joind_ok_cb (GtkWidget *ok, server *serv)
return; return;
} }
/* do nothing */
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio1))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio1)))
goto xit; goto xit;
/* join specific channel */
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio2))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio2)))
{ {
char *text = (char *)gtk_entry_get_text (GTK_ENTRY (serv->gui->joind_entry)); char *text = (char *)gtk_entry_get_text (GTK_ENTRY (serv->gui->joind_entry));
@@ -98,7 +96,6 @@ joind_ok_cb (GtkWidget *ok, server *serv)
goto xit; goto xit;
} }
/* channel list */
chanlist_opengui (serv, TRUE); chanlist_opengui (serv, TRUE);
xit: xit:

View File

@@ -1278,7 +1278,6 @@ mg_switch_page (int relative, int num)
static void static void
mg_topdestroy_cb (GtkWidget *win, session *sess) mg_topdestroy_cb (GtkWidget *win, session *sess)
{ {
/* printf("enter mg_topdestroy. sess %p was destroyed\n", sess);*/
session_free (sess); /* tell zoitechat.c about it */ session_free (sess); /* tell zoitechat.c about it */
} }
@@ -1293,7 +1292,6 @@ mg_ircdestroy (session *sess)
if (mg_gui == NULL) if (mg_gui == NULL)
{ {
/* puts("-> mg_gui is already NULL");*/
return; return;
} }
@@ -1303,13 +1301,11 @@ mg_ircdestroy (session *sess)
sess = list->data; sess = list->data;
if (sess->gui->is_tab) if (sess->gui->is_tab)
{ {
/* puts("-> some tabs still remain");*/
return; return;
} }
list = list->next; list = list->next;
} }
/* puts("-> no tabs left, killing main tabwindow");*/
gtk_widget_destroy (mg_gui->window); gtk_widget_destroy (mg_gui->window);
active_tab = NULL; active_tab = NULL;
mg_gui = NULL; mg_gui = NULL;
@@ -2089,7 +2085,6 @@ mg_tabwindow_kill_cb (GtkWidget *win, gpointer userdata)
GSList *list, *next; GSList *list, *next;
session *sess; session *sess;
/* puts("enter mg_tabwindow_kill_cb");*/
zoitechat_is_quitting = TRUE; zoitechat_is_quitting = TRUE;
/* see if there's any non-tab windows left */ /* see if there's any non-tab windows left */
@@ -2101,7 +2096,6 @@ mg_tabwindow_kill_cb (GtkWidget *win, gpointer userdata)
if (!sess->gui->is_tab) if (!sess->gui->is_tab)
{ {
zoitechat_is_quitting = FALSE; zoitechat_is_quitting = FALSE;
/* puts("-> will not exit, some toplevel windows left");*/
} else } else
{ {
mg_ircdestroy (sess); mg_ircdestroy (sess);
@@ -2135,7 +2129,6 @@ mg_changui_destroy (session *sess)
/* avoid calling the "destroy" callback */ /* avoid calling the "destroy" callback */
g_signal_handlers_disconnect_by_func (G_OBJECT (sess->gui->window), g_signal_handlers_disconnect_by_func (G_OBJECT (sess->gui->window),
mg_topdestroy_cb, sess); mg_topdestroy_cb, sess);
/*gtk_widget_destroy (sess->gui->window);*/
/* don't destroy until the new one is created. Not sure why, but */ /* don't destroy until the new one is created. Not sure why, but */
/* it fixes: Gdk-CRITICAL **: gdk_colormap_get_screen: */ /* it fixes: Gdk-CRITICAL **: gdk_colormap_get_screen: */
/* assertion `GDK_IS_COLORMAP (cmap)' failed */ /* assertion `GDK_IS_COLORMAP (cmap)' failed */

View File

@@ -77,12 +77,6 @@ if host_machine.system() == 'windows'
zoitechat_gtk_sources += 'notifications/notification-windows.c' zoitechat_gtk_sources += 'notifications/notification-windows.c'
zoitechat_gtk_deps += cc.find_library('dwmapi', required: true) zoitechat_gtk_deps += cc.find_library('dwmapi', required: true)
# TODO: mingw doesn't have these headers or libs
# add_languages('cpp')
# shared_module('hcnotifications-winrt',
# sources: 'notifications/notification-winrt.cpp'
#)
else else
zoitechat_gtk_sources += 'notifications/notification-freedesktop.c' zoitechat_gtk_sources += 'notifications/notification-freedesktop.c'
endif endif
@@ -102,7 +96,7 @@ endif
resources = gnome.compile_resources('resources', resources = gnome.compile_resources('resources',
'../../data/zoitechat.gresource.xml', '../../data/zoitechat.gresource.xml',
source_dir: '../../data', # TODO: Fix upstream source_dir: '../../data',
c_name: 'zoitechat', c_name: 'zoitechat',
extra_args: ['--manual-register'] extra_args: ['--manual-register']
) )

View File

@@ -66,7 +66,6 @@ extern "C"
node_list->GetAt (1)->AppendChild ( node_list->GetAt (1)->AppendChild (
toastTemplate->CreateTextNode (Platform::StringReference (wtext.c_str (), wtext.size ()))); toastTemplate->CreateTextNode (Platform::StringReference (wtext.c_str (), wtext.size ())));
// Mute sound, we already play our own
auto node = toastTemplate->SelectSingleNode (L"/toast"); auto node = toastTemplate->SelectSingleNode (L"/toast");
auto audio_elem = toastTemplate->CreateElement (L"audio"); auto audio_elem = toastTemplate->CreateElement (L"audio");
audio_elem->SetAttribute (L"silent", L"true"); audio_elem->SetAttribute (L"silent", L"true");

View File

@@ -168,7 +168,6 @@ load_pixmap (const char *filename)
g_free (path); g_free (path);
} }
// Hack to avoid unbearably tiny icons on HiDPI screens.
scale = g_getenv ("GDK_SCALE"); scale = g_getenv ("GDK_SCALE");
if (scale) if (scale)
{ {

View File

@@ -80,7 +80,6 @@ show_notification (const char *title, const char *text)
{ {
char *stripped_title, *stripped_text; char *stripped_title, *stripped_text;
/* Strip all colors */
stripped_title = zoitechat_strip (ph, title, -1, 7); stripped_title = zoitechat_strip (ph, title, -1, 7);
stripped_text = zoitechat_strip (ph, text, -1, 7); stripped_text = zoitechat_strip (ph, text, -1, 7);
@@ -125,13 +124,10 @@ incoming_message_cb (char *word[], gpointer userdata)
flags = zoitechat_list_int(ph, NULL, "flags"); flags = zoitechat_list_int(ph, NULL, "flags");
/* Let sure that can alert */
if (should_alert()) { if (should_alert()) {
/* Follow the channel rules if set */
if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) { if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) {
alert = (flags & CHANNEL_FLAG_BALLOON); alert = (flags & CHANNEL_FLAG_BALLOON);
} else { } else {
/* Else follow global environment */
alert = (zoitechat_get_prefs(ph, "input_balloon_chans", NULL, &message) == 3 && message); alert = (zoitechat_get_prefs(ph, "input_balloon_chans", NULL, &message) == 3 && message);
} }
} }
@@ -151,13 +147,10 @@ incoming_priv_cb (char *word[], gpointer userdata)
flags = zoitechat_list_int(ph, NULL, "flags"); flags = zoitechat_list_int(ph, NULL, "flags");
/* Let sure that can alert */
if (should_alert()) { if (should_alert()) {
/* Follow the private rules if set */
if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) { if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) {
alert = (flags & CHANNEL_FLAG_BALLOON); alert = (flags & CHANNEL_FLAG_BALLOON);
} else { } else {
/* Else follow global environment */
alert = (zoitechat_get_prefs(ph, "input_balloon_priv", NULL, &priv) == 3 && priv); alert = (zoitechat_get_prefs(ph, "input_balloon_priv", NULL, &priv) == 3 && priv);
} }
} }
@@ -234,7 +227,6 @@ notification_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, c
zoitechat_hook_print (ph, "Private Action", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, NULL); zoitechat_hook_print (ph, "Private Action", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, NULL);
zoitechat_hook_print (ph, "Private Action to Dialog", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, NULL); zoitechat_hook_print (ph, "Private Action to Dialog", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, NULL);
/* Special events treated as priv */
zoitechat_hook_print (ph, "Notice", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (1)); zoitechat_hook_print (ph, "Notice", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (1));
zoitechat_hook_print (ph, "Invited", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (2)); zoitechat_hook_print (ph, "Invited", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (2));
zoitechat_hook_print (ph, "DCC Offer", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (3)); zoitechat_hook_print (ph, "DCC Offer", ZOITECHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (3));

View File

@@ -314,15 +314,14 @@ static const char *const noticeposmenu[] =
static const char *const swtype[] = static const char *const swtype[] =
{ {
N_("Tabs"), /* 0 tabs */ N_("Tabs"),
"", /* 1 reserved */ "",
N_("Tree"), /* 2 tree */ N_("Tree"),
NULL NULL
}; };
static const setting tabs_settings[] = static const setting tabs_settings[] =
{ {
/*{ST_HEADER, N_("Channel Switcher"),0,0,0},*/
{ST_RADIO, N_("Switcher type:"),P_OFFINTNL(hex_gui_tab_layout), 0, swtype, 0}, {ST_RADIO, N_("Switcher type:"),P_OFFINTNL(hex_gui_tab_layout), 0, swtype, 0},
{ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(hex_gui_tab_server), 0, 0, 0}, {ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(hex_gui_tab_server), 0, 0, 0},
{ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(hex_gui_autoopen_dialog), 0, 0, 0}, {ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(hex_gui_autoopen_dialog), 0, 0, 0},
@@ -954,7 +953,6 @@ setup_apply_trans (int *tag)
gtk_window_set_opacity (GTK_WINDOW (current_sess->gui->window), gtk_window_set_opacity (GTK_WINDOW (current_sess->gui->window),
(prefs.hex_gui_transparency / 255.)); (prefs.hex_gui_transparency / 255.));
/* mg_update_xtext (current_sess->gui->xtext); */
*tag = 0; *tag = 0;
return 0; return 0;
} }
@@ -1000,8 +998,8 @@ setup_create_hscale (GtkWidget *table, int row, const setting *set)
} }
static GtkWidget *proxy_user; /* username GtkEntry */ static GtkWidget *proxy_user;
static GtkWidget *proxy_pass; /* password GtkEntry */ static GtkWidget *proxy_pass;
static void static void
setup_menu_cb (GtkWidget *cbox, const setting *set) setup_menu_cb (GtkWidget *cbox, const setting *set)

View File

@@ -37,7 +37,6 @@
#define ICON_URLGRAB_COPY "zc-menu-copy" #define ICON_URLGRAB_COPY "zc-menu-copy"
#define ICON_URLGRAB_SAVE_AS "zc-menu-save-as" #define ICON_URLGRAB_SAVE_AS "zc-menu-save-as"
/* model for the URL treeview */
enum enum
{ {
URL_COLUMN, URL_COLUMN,
@@ -60,7 +59,6 @@ url_treeview_url_clicked_cb (GtkWidget *view, GdkEventButton *event,
if (!event || !gtk_tree_view_get_path_at_pos (tree, event->x, event->y, &path, 0, 0, 0)) if (!event || !gtk_tree_view_get_path_at_pos (tree, event->x, event->y, &path, 0, 0, 0))
return FALSE; return FALSE;
/* select what they right-clicked on */
sel = gtk_tree_view_get_selection (tree); sel = gtk_tree_view_get_selection (tree);
gtk_tree_selection_unselect_all (sel); gtk_tree_selection_unselect_all (sel);
gtk_tree_selection_select_path (sel, path); gtk_tree_selection_select_path (sel, path);
@@ -103,7 +101,6 @@ url_treeview_new (GtkWidget *box)
gtk_widget_set_vexpand (scroll, TRUE); gtk_widget_set_vexpand (scroll, TRUE);
g_signal_connect (G_OBJECT (view), "button_press_event", g_signal_connect (G_OBJECT (view), "button_press_event",
G_CALLBACK (url_treeview_url_clicked_cb), NULL); G_CALLBACK (url_treeview_url_clicked_cb), NULL);
/* don't want column headers */
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
gtk_widget_show (view); gtk_widget_show (view);
return view; return view;
@@ -172,7 +169,6 @@ fe_url_add (const char *urltext)
URL_COLUMN, urltext, URL_COLUMN, urltext,
-1); -1);
/* remove any overflow */
if (prefs.hex_url_grabber_limit > 0) if (prefs.hex_url_grabber_limit > 0)
{ {
valid = gtk_tree_model_iter_nth_child ( valid = gtk_tree_model_iter_nth_child (

View File

@@ -44,7 +44,7 @@
#include "fe-text.h" #include "fe-text.h"
static int done = FALSE; /* finished ? */ static int done = FALSE;
static void static void
@@ -227,10 +227,9 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
i++; i++;
} }
break; break;
/* don't actually want hidden text */ case '\010':
case '\010': /* hidden */
break; break;
case '\026': /* REVERSE */ case '\026':
if (reverse) if (reverse)
{ {
reverse = FALSE; reverse = FALSE;
@@ -242,7 +241,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
} }
j = strlen (newtext); j = strlen (newtext);
break; break;
case '\037': /* underline */ case '\037':
if (under) if (under)
{ {
under = FALSE; under = FALSE;
@@ -254,7 +253,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
} }
j = strlen (newtext); j = strlen (newtext);
break; break;
case '\002': /* bold */ case '\002':
if (bold) if (bold)
{ {
bold = FALSE; bold = FALSE;
@@ -273,7 +272,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
j++; j++;
} }
break; break;
case '\017': /* reset all */ case '\017':
strcpy (&newtext[j], "\033[m"); strcpy (&newtext[j], "\033[m");
j += 3; j += 3;
reverse = FALSE; reverse = FALSE;
@@ -361,12 +360,11 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
i++; i++;
} }
break; break;
/* don't actually want hidden text */ case '\010':
case '\010': /* hidden */ case '\026':
case '\026': /* REVERSE */ case '\037':
case '\037': /* underline */ case '\002':
case '\002': /* bold */ case '\017':
case '\017': /* reset all */
break; break;
case '\007': case '\007':
if (!prefs.hex_input_filter_beep) if (!prefs.hex_input_filter_beep)
@@ -535,7 +533,7 @@ fe_args (int argc, char *argv[])
return 0; return 0;
} }
if (arg_cfgdir) /* we want filesystem encoding */ if (arg_cfgdir)
{ {
g_free (xdir); g_free (xdir);
xdir = g_strdup(arg_cfgdir); xdir = g_strdup(arg_cfgdir);
@@ -550,10 +548,8 @@ fe_args (int argc, char *argv[])
void void
fe_init (void) fe_init (void)
{ {
/* the following should be default generated, not enfoced in binary */
prefs.hex_gui_tab_server = 0; prefs.hex_gui_tab_server = 0;
prefs.hex_gui_autoopen_dialog = 0; prefs.hex_gui_autoopen_dialog = 0;
/* except for these, there is no lag meter, there is no server list */
prefs.hex_gui_lagometer = 0; prefs.hex_gui_lagometer = 0;
prefs.hex_gui_slist_skip = 1; prefs.hex_gui_slist_skip = 1;
} }
@@ -565,7 +561,6 @@ fe_main (void)
main_loop = g_main_loop_new(NULL, FALSE); main_loop = g_main_loop_new(NULL, FALSE);
/* Keyboard Entry Setup */
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
keyboard_input = g_io_channel_win32_new_fd(STDIN_FILENO); keyboard_input = g_io_channel_win32_new_fd(STDIN_FILENO);
#else #else
@@ -834,10 +829,8 @@ fe_idle_add (void *func, void *data)
void void
fe_ctrl_gui (session *sess, fe_gui_action action, int arg) fe_ctrl_gui (session *sess, fe_gui_action action, int arg)
{ {
/* only one action type handled for now, but could add more */
switch (action) switch (action)
{ {
/* gui focus is really the only case zoitechat-text needs to worry about */
case FE_GUI_FOCUS: case FE_GUI_FOCUS:
current_sess = sess; current_sess = sess;
current_tab = sess; current_tab = sess;

View File

@@ -32,8 +32,6 @@
ENCHANT_PLUGIN_DECLARE ("win8") ENCHANT_PLUGIN_DECLARE ("win8")
/* --------- Utils ----------*/
static char * static char *
utf16_to_utf8 (const wchar_t * const str, bool from_bcp47) utf16_to_utf8 (const wchar_t * const str, bool from_bcp47)
{ {
@@ -106,7 +104,7 @@ utf8_to_utf16 (const char * const str, int len, bool to_bcp47)
static char ** static char **
enumstring_to_chararray (IEnumString *strings, size_t *out_len, bool from_bcp47) enumstring_to_chararray (IEnumString *strings, size_t *out_len, bool from_bcp47)
{ {
char **chars = static_cast<char**>(std::calloc (256, sizeof (char*))); /* Hopefully large enough */ char **chars = static_cast<char**>(std::calloc (256, sizeof (char*)));
LPOLESTR wstr = nullptr; LPOLESTR wstr = nullptr;
size_t i = 0; size_t i = 0;
@@ -134,8 +132,6 @@ enumstring_to_chararray (IEnumString *strings, size_t *out_len, bool from_bcp47)
return chars; return chars;
} }
/* ---------- Dict ------------ */
static void static void
win8_dict_add_to_personal (EnchantDict *dict, const char *const word, size_t len) win8_dict_add_to_personal (EnchantDict *dict, const char *const word, size_t len)
{ {
@@ -169,18 +165,18 @@ win8_dict_check (EnchantDict *dict, const char *const word, size_t len)
std::free (wword); std::free (wword);
if (FAILED (hr)) if (FAILED (hr))
return -1; /* Error */ return -1;
if (errors->Next (&error) == S_OK) if (errors->Next (&error) == S_OK)
{ {
error->Release (); error->Release ();
errors->Release (); errors->Release ();
return 1; /* Spelling Issue */ return 1;
} }
else else
{ {
errors->Release (); errors->Release ();
return 0; /* Correct */ return 0;
} }
} }
@@ -204,8 +200,6 @@ win8_dict_suggest (EnchantDict *dict, const char *const word, size_t len, size_t
return enumstring_to_chararray (suggestions, out_n_suggs, false); return enumstring_to_chararray (suggestions, out_n_suggs, false);
} }
/* ---------- Provider ------------ */
static EnchantDict * static EnchantDict *
win8_provider_request_dict (EnchantProvider *provider, const char *const tag) win8_provider_request_dict (EnchantProvider *provider, const char *const tag)
{ {
@@ -225,7 +219,7 @@ win8_provider_request_dict (EnchantProvider *provider, const char *const tag)
dict->suggest = win8_dict_suggest; dict->suggest = win8_dict_suggest;
dict->check = win8_dict_check; dict->check = win8_dict_check;
dict->add_to_personal = win8_dict_add_to_personal; dict->add_to_personal = win8_dict_add_to_personal;
dict->add_to_exclude = win8_dict_add_to_personal; /* Basically the same */ dict->add_to_exclude = win8_dict_add_to_personal;
dict->add_to_session = win8_dict_add_to_session; dict->add_to_session = win8_dict_add_to_session;
dict->user_data = checker; dict->user_data = checker;