diff --git a/.github/workflows/solus-eopkg-build.yml b/.github/workflows/solus-eopkg-build.yml index 9166b3ea..873342e9 100644 --- a/.github/workflows/solus-eopkg-build.yml +++ b/.github/workflows/solus-eopkg-build.yml @@ -62,17 +62,8 @@ jobs: sh -lc ' set -euo pipefail eopkg update-repo -y - # Do not remove openssl-11 here: it can trigger a very large - # dependency cascade (including python3/eopkg itself), which - # 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. + # Keep file-conflict handling on: some base images still carry + # openssl-11 leftovers, and Meson tooling is not always preinstalled. eopkg install -y --ignore-file-conflicts \ ypkg git meson ninja pkgconf gcc gettext ypkg build "$PACKAGE_YML" diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 7ea8f67f..a723ced1 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -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 & 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 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")) { New-Item -Path $pyDir -ItemType Directory -Force | Out-Null $target = Join-Path $pyDir "${{ matrix.platform }}" diff --git a/Makefile b/Makefile index 2d267a60..ab533354 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ CONFIG_STAMP := $(BUILD_DIR)/build.ninja 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) diff --git a/osx/makebundle.sh b/osx/makebundle.sh index dc750491..3a62f4f4 100755 --- a/osx/makebundle.sh +++ b/osx/makebundle.sh @@ -6,6 +6,4 @@ rm -f *.app.zip python $HOME/.local/bin/gtk-mac-bundler zoitechat.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 - diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c index 0e1fe7e7..4a8888f9 100644 --- a/plugins/checksum/checksum.c +++ b/plugins/checksum/checksum.c @@ -26,7 +26,7 @@ #include "zoitechat-plugin.h" -static zoitechat_plugin *ph; /* plugin handle */ +static zoitechat_plugin *ph; static char name[] = "Checksum"; static char desc[] = "Calculate checksum for DCC file transfers"; static char version[] = "4.0"; @@ -42,18 +42,14 @@ typedef struct { static void print_sha256_result (ChecksumCallbackInfo *info, const char *checksum, const char *filename, GError *error) { - // So then we get the next best available channel, since we always want to print at least somewhere, it's fine zoitechat_context *ctx = zoitechat_find_context(ph, info->servername, info->channel); if (!ctx) { - // before we print a private message to the wrong channel, we exit early if (info->send_message) { return; } - // if the context isn't found the first time, we search in the server ctx = zoitechat_find_context(ph, info->servername, NULL); if (!ctx) { - // The second time we exit early, since printing in another server isn't desireable return; } } diff --git a/plugins/exec/exec.c b/plugins/exec/exec.c index ad8d871e..1d9d581b 100644 --- a/plugins/exec/exec.c +++ b/plugins/exec/exec.c @@ -25,7 +25,7 @@ #include "zoitechat-plugin.h" -static zoitechat_plugin *ph; /* plugin handle */ +static zoitechat_plugin *ph; static char name[] = "Exec"; static char desc[] = "Execute commands inside ZoiteChat"; static char version[] = "1.2"; @@ -71,7 +71,7 @@ run_command (char *word[], char *word_eol[], void *userdata) 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 (&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 ) { - /* avoid garbage */ buffer[dwRead] = '\0'; if (announce) { - /* Say each line seperately, TODO: improve... */ token = strtok_s (buffer, "\n", &context); while (token != NULL) { @@ -110,13 +108,11 @@ run_command (char *word[], char *word_eol[], void *userdata) } else { - /* this way we'll more likely get full lines */ SleepEx (100, TRUE); } timeElapsed = difftime (time (0), start); } - /* display a newline to separate things */ if (!announce) 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_printf (ph, "%s plugin loaded\n", name); - return 1; /* return 1 for success */ + return 1; } int diff --git a/plugins/fishlim/irc.c b/plugins/fishlim/irc.c index 19b810eb..e2f39118 100644 --- a/plugins/fishlim/irc.c +++ b/plugins/fishlim/irc.c @@ -39,13 +39,11 @@ gboolean irc_parse_message(const char *words[], if (prefix) *prefix = NULL; if (command) *command = NULL; - /* See if the message starts with a prefix (sender user) */ if (words[w][0] == ':') { if (prefix) *prefix = &words[w][1]; w++; } - - /* Check command */ + if (words[w][0] == '\0') return FALSE; if (command) *command = words[w]; w++; @@ -72,11 +70,9 @@ char *irc_prefix_get_nick(const char *prefix) { if (!prefix) return NULL; - /* Find end of nick */ end = prefix; while (*end != '\0' && *end != '!' && *end != '@') end++; - - /* Allocate string */ + length = end - prefix; return g_strndup (prefix, length); } diff --git a/plugins/fishlim/plugin_zoitechat.c b/plugins/fishlim/plugin_zoitechat.c index 5482522d..c38dda2d 100644 --- a/plugins/fishlim/plugin_zoitechat.c +++ b/plugins/fishlim/plugin_zoitechat.c @@ -277,15 +277,6 @@ char *decrypt_raw_message(const char *message, const char *key) { 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. */ @@ -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_attrs(ph, "NOTICE", 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, "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); return 1; } - diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index 05ecf2f3..3671353f 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -440,8 +440,6 @@ server_cb (char *word[], char *word_eol[], void *userdata) if (data->depth) return ZOITECHAT_EAT_NONE; - /* zoitechat_printf (ph, */ - /* "Received %d words in server callback", av_len (wd)); */ PUSHMARK (SP); XPUSHs (newRV_noinc ((SV *) array2av (word))); XPUSHs (newRV_noinc ((SV *) array2av (word_eol))); @@ -489,8 +487,6 @@ command_cb (char *word[], char *word_eol[], void *userdata) if (data->depth) return ZOITECHAT_EAT_NONE; - /* zoitechat_printf (ph, "Received %d words in command callback", */ - /* av_len (wd)); */ PUSHMARK (SP); XPUSHs (newRV_noinc ((SV *) array2av (word))); 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); XPUSHs (newRV_noinc ((SV *) wd)); XPUSHs (data->userdata); diff --git a/plugins/python/_zoitechat.py b/plugins/python/_zoitechat.py index bd5df219..74739b6e 100644 --- a/plugins/python/_zoitechat.py +++ b/plugins/python/_zoitechat.py @@ -79,7 +79,6 @@ def emit_print(event_name, *args, **kwargs): return ret -# TODO: this shadows itself. command should be changed to cmd def command(command): lib.zoitechat_command(lib.ph, command.encode()) @@ -221,7 +220,6 @@ def get_list(name): 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): plugin = __get_current_plugin() hook = plugin.add_hook(callback, userdata) diff --git a/plugins/python/generate_plugin.py b/plugins/python/generate_plugin.py index a4d9bd1a..3ebbdbc4 100755 --- a/plugins/python/generate_plugin.py +++ b/plugins/python/generate_plugin.py @@ -5,11 +5,9 @@ import cffi builder = cffi.FFI() -# zoitechat-plugin.h with open(sys.argv[1]) as f: output = [] eat_until_endif = 0 - # This is very specific to zoitechat-plugin.h, it is not a cpp for line in f: if line.startswith('#define'): continue @@ -81,9 +79,7 @@ int zoitechat_plugin_deinit(void) } ''') -# python.py with open(sys.argv[2]) as f: builder.embedding_init_code(f.read()) -# python.c builder.emit_c_code(sys.argv[3]) diff --git a/plugins/python/python.py b/plugins/python/python.py index fb9c0677..ec90f3a8 100644 --- a/plugins/python/python.py +++ b/plugins/python/python.py @@ -19,12 +19,11 @@ else: if not hasattr(sys, 'argv'): sys.argv = [''] -VERSION = b'2.18.0~pre2' # Sync with zoitechat.__version__ +VERSION = b'2.18.0~pre2' PLUGIN_NAME = ffi.new('char[]', b'Python') PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1])) PLUGIN_VERSION = ffi.new('char[]', VERSION) -# TODO: Constants should be screaming snake case zoitechat = None local_interp = None zoitechat_stdout = None @@ -106,8 +105,6 @@ if sys.version_info[0] == 2: return compile(string, '', 'eval', dont_inherit=True) except SyntaxError: - # For some reason `print` is invalid for eval - # This will hide any return value though return compile(string, '', 'exec', dont_inherit=True) else: def compile_file(data, filename): @@ -115,7 +112,6 @@ else: def compile_line(string): - # newline appended to solve unexpected EOF issues return compile(string + '\n', '', 'single', optimize=2, dont_inherit=True) @@ -200,8 +196,6 @@ else: return string.decode() -# There can be empty entries between non-empty ones so find the actual last value - def _cstr(ptr): """Safely convert a C char* (possibly NULL) to bytes.""" if ptr == ffi.NULL: @@ -212,7 +206,6 @@ def _cstr(ptr): return b'' 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): if _cstr(words[i]): return i @@ -299,12 +292,8 @@ def _on_timer_hook(userdata): return 1 try: - # Avoid calling zoitechat_unhook twice if unnecessary hook.is_unload = True except ReferenceError: - # hook is a weak reference, it might have been destroyed by the callback - # 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 for h in hook.plugin.hooks: @@ -338,11 +327,9 @@ def _on_say_command(word, word_eol, userdata): if not python: return 1 - # Don’t let exceptions here swallow core commands or wedge the UI. try: exec_in_interp(python) except Exception: - # Best effort: surface the traceback in the python tab. exc = traceback.format_exc().encode('utf-8', errors='replace') lib.zoitechat_print(lib.ph, exc) return 1 @@ -397,11 +384,10 @@ def autoload(): configdir = __decode(_cstr(lib.zoitechat_get_info(lib.ph, b'configdir'))) addondir = os.path.join(configdir, 'addons') try: - with change_cwd(addondir): # Maintaining old behavior + with change_cwd(addondir): for f in os.listdir(addondir): if f.endswith('.py'): log('Autoloading', f) - # TODO: Set cwd load_filename(os.path.join(addondir, f)) except FileNotFoundError as e: diff --git a/plugins/sysinfo/sysinfo.c b/plugins/sysinfo/sysinfo.c index 2b901623..908cc9e9 100644 --- a/plugins/sysinfo/sysinfo.c +++ b/plugins/sysinfo/sysinfo.c @@ -208,7 +208,6 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata) int offset = 0, channel_type; char *cmd; - /* Allow overriding global announce setting */ if (!strcmp ("-e", word[2])) { announce = FALSE; @@ -220,7 +219,6 @@ sysinfo_cb (char *word[], char *word_eol[], void *userdata) offset++; } - /* Cannot send to server tab */ channel_type = zoitechat_list_int (ph, NULL, "type"); if (channel_type != 2 /* SESS_CHANNEL */ && channel_type != 3 /* SESS_DIALOG */) 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); - /* Match the classic label from HexChat so people can actually find it. */ zoitechat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\""); zoitechat_printf (ph, _("%s plugin loaded\n"), name); return 1; @@ -255,7 +252,6 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char int 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/Display System Info\""); zoitechat_printf (ph, _("%s plugin unloaded\n"), name); diff --git a/plugins/sysinfo/unix/pci.c b/plugins/sysinfo/unix/pci.c index 528afd97..fac2f76e 100644 --- a/plugins/sysinfo/unix/pci.c +++ b/plugins/sysinfo/unix/pci.c @@ -132,7 +132,6 @@ void pci_find_fullname(char *fullname, char *vendor, char *device) if(fp == NULL) { 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; } diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index ec075733..84cd27ab 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -26,7 +26,7 @@ #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 desc[] = "Check for ZoiteChat updates automatically"; static char version[] = "5.0"; diff --git a/plugins/winamp/winamp.c b/plugins/winamp/winamp.c index 1cc84851..4a064702 100644 --- a/plugins/winamp/winamp.c +++ b/plugins/winamp/winamp.c @@ -20,7 +20,7 @@ #define PLAYING 1 #define PAUSED 3 -static zoitechat_plugin *ph; /* plugin handle */ +static zoitechat_plugin *ph; static int winamp(char *word[], char *word_eol[], void *userdata) @@ -130,7 +130,6 @@ zoitechat_plugin_init(zoitechat_plugin *plugin_handle, char **plugin_version, char *arg) { - /* we need to save this for use with any zoitechat_* functions */ ph = plugin_handle; *plugin_name = "Winamp"; @@ -142,7 +141,7 @@ zoitechat_plugin_init(zoitechat_plugin *plugin_handle, zoitechat_print (ph, "Winamp plugin loaded\n"); - return 1; /* return 1 for success */ + return 1; } int diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index f31375b5..4dc10533 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -764,7 +764,6 @@ load_default_config(void) prefs.hex_gui_input_style = 1; prefs.hex_gui_join_dialog = 1; prefs.hex_gui_quit_dialog = 1; - /* prefs.hex_gui_slist_skip = 1; */ prefs.hex_gui_tab_chans = 1; prefs.hex_gui_tab_dialogs = 1; prefs.hex_gui_tab_icons = 1; @@ -788,7 +787,7 @@ load_default_config(void) prefs.hex_irc_reconnect_rejoin = 1; prefs.hex_irc_cap_server_time = 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_net_auto_reconnect = 1; prefs.hex_net_throttle = 1; @@ -819,7 +818,7 @@ load_default_config(void) prefs.hex_flood_ctcp_num = 5; prefs.hex_flood_ctcp_time = 30; 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_minusers = 5; prefs.hex_gui_dialog_height = 256; diff --git a/src/common/chanopt.c b/src/common/chanopt.c index 8b73db0c..120a2c23 100644 --- a/src/common/chanopt.c +++ b/src/common/chanopt.c @@ -99,8 +99,6 @@ str_to_chanopt (const char *str) return SET_DEFAULT; } -/* handle the /CHANOPT command */ - int 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 (newval != -1) /* set new value */ + if (newval != -1) { *(guint8 *)G_STRUCT_MEMBER_P(sess, chanopt[i].offset) = newval; chanopt_changed = TRUE; } - if (!quiet) /* print value */ + if (!quiet) { strcpy (tbuf, chanopt[i].name); p = strlen (tbuf); @@ -177,18 +175,13 @@ chanopt_is_set (unsigned int global, guint8 per_chan_setting) return global; } -/* === below is LOADING/SAVING stuff only === */ - typedef struct { - /* Per-Channel Alerts */ - /* use a byte, because we need a pointer to each element */ guint8 alert_balloon; guint8 alert_beep; guint8 alert_taskbar; guint8 alert_tray; - /* Per-Channel Settings */ guint8 text_hidejoinpart; guint8 text_logging; guint8 text_scrollback; @@ -218,12 +211,10 @@ chanopt_find (char *network, char *channel, gboolean add_new) if (!add_new) return NULL; - /* allocate a new one */ co = g_new0 (chanopt_in_memory, 1); co->channel = g_strdup (channel); co->network = g_strdup (network); - /* set all values to SET_DEFAULT */ i = 0; 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 chanopt_load_all (void) { @@ -265,7 +254,6 @@ chanopt_load_all (void) char *network = NULL; chanopt_in_memory *current = NULL; - /* 1. load the old file into our GSList */ fh = zoitechat_open_file ("chanopt.conf", O_RDONLY, 0, 0); if (fh != -1) { @@ -326,7 +314,6 @@ chanopt_load (session *sess) if (!co) return; - /* fill in all the sess->xxxxx fields */ i = 0; while (i < sizeof (chanopt) / sizeof (channel_options)) { @@ -352,8 +339,6 @@ chanopt_save (session *sess) if (!network) return; - /* 2. reconcile sess with what we loaded from disk */ - co = chanopt_find (network, sess->session_name, TRUE); i = 0; diff --git a/src/common/dcc.c b/src/common/dcc.c index c293ac41..a8fb68fa 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -743,9 +743,6 @@ dcc_read (GIOChannel *source, GIOCondition condition, struct DCC *dcc) EMIT_SIGNAL (XP_TE_DCCRECVERR, dcc->serv->front_session, dcc->file, dcc->destfile, dcc->nick, 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); return TRUE; } @@ -1383,7 +1380,6 @@ dcc_connect (struct DCC *dcc) dcc_close (dcc, STAT_FAILED, FALSE); return; } - /* possible problems with filenames containing spaces? */ if (dcc->type == TYPE_RECV) g_snprintf (tbuf, sizeof (tbuf), strchr (dcc->file, ' ') ? "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; - /*if local_ip is specified use that*/ if (prefs.local_ip != 0xffffffff) { my_addr = prefs.local_ip; SAddr.sin_addr.s_addr = prefs.local_ip; } - /*otherwise use the default*/ else my_addr = SAddr.sin_addr.s_addr; - /*if we have a valid portrange try to use that*/ if (prefs.hex_dcc_port_first > 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); i++; - /*printf("Trying to bind against port: %d\n",ntohs(SAddr.sin_port));*/ 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); - /*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); - /*if nothing else worked we use the address we bound to*/ if (dcc->addr == 0) dcc->addr = my_addr; @@ -1728,7 +1716,7 @@ dcc_listen_init (struct DCC *dcc, session *sess) } static struct session *dccsess; -static char *dccto; /* lame!! */ +static char *dccto; static gint64 dccmaxcps; static int recursive = FALSE; diff --git a/src/common/ignore.c b/src/common/ignore.c index 501f3129..6163d236 100644 --- a/src/common/ignore.c +++ b/src/common/ignore.c @@ -153,8 +153,6 @@ ignore_showlist (session *sess) strcat (tbuf, _("NO ")); strcat (tbuf, "\n"); 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; } @@ -413,4 +411,3 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct } return 1; } - diff --git a/src/common/inbound.c b/src/common/inbound.c index 0b7ae0db..9584a919 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -108,7 +108,6 @@ find_session_from_nick (char *nick, server *serv) 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)) return serv->front_session; } @@ -2121,7 +2120,6 @@ scram_authenticate (server *serv, const char *data, const char *digest, if (status == SCRAM_IN_PROGRESS) { - // Authentication is still in progress encoded = g_base64_encode ((guchar *) output, output_len); tcp_sendf (serv, "AUTHENTICATE %s\r\n", encoded); g_free (encoded); @@ -2129,13 +2127,11 @@ scram_authenticate (server *serv, const char *data, const char *digest, } else if (status == SCRAM_SUCCESS) { - // Authentication succeeded tcp_sendf (serv, "AUTHENTICATE +\r\n"); g_clear_pointer (&serv->scram_session, scram_session_free); } else if (status == SCRAM_ERROR) { - // Authentication failed tcp_sendf (serv, "AUTHENTICATE *\r\n"); if (serv->scram_session->error != NULL) diff --git a/src/common/meson.build b/src/common/meson.build index 0d651787..0d097490 100644 --- a/src/common/meson.build +++ b/src/common/meson.build @@ -96,11 +96,6 @@ textevents = custom_target('textevents', command: [make_te, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@'] ) -# TODO: -# LOOKUPD -# SIGACTION -# HAVE_GTK_MAC - if libssl_dep.found() common_sources += 'ssl.c' common_deps += libssl_dep diff --git a/src/common/notify.c b/src/common/notify.c index 4fd0b159..5569c100 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -87,7 +87,7 @@ notify_do_network (struct notify *notify, server *serv) return TRUE; if (token_foreach (notify->networks, ',', notify_netcmp, serv)) - return FALSE; /* network list doesn't contain this one */ + return FALSE; return TRUE; } @@ -106,8 +106,6 @@ notify_find_server_entry (struct notify *notify, struct server *serv) 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)) return NULL; @@ -123,11 +121,7 @@ notify_save (void) { int fh; struct notify *notify; - // while reading the notify.conf file, elements are added by prepending to the - // 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); + GSList *list = g_slist_reverse (g_slist_copy (notify_list)); fh = zoitechat_open_file ("notify.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE); if (fh != -1) @@ -146,7 +140,7 @@ notify_save (void) } close (fh); } - g_slist_free(list); + g_slist_free (list); } void diff --git a/src/common/notify.h b/src/common/notify.h index 6eef651e..92974e7b 100644 --- a/src/common/notify.h +++ b/src/common/notify.h @@ -42,19 +42,16 @@ struct notify_per_server extern GSList *notify_list; extern int notify_tag; -/* the WATCH stuff */ void notify_set_online (server * serv, char *nick, const message_tags_data *tags_data); void notify_set_offline (server * serv, char *nick, int quiet, - const message_tags_data *tags_data); -/* the MONITOR stuff */ + const message_tags_data *tags_data); void notify_set_online_list (server * serv, char *users, const message_tags_data *tags_data); 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); -/* the general stuff */ void notify_adduser (char *name, char *networks); int notify_deluser (char *name); void notify_cleanup (void); @@ -65,7 +62,6 @@ gboolean notify_is_in_list (server *serv, char *name); int notify_isnotify (session *sess, char *name); 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[], const message_tags_data *tags_data); int notify_checklist (void); diff --git a/src/common/plugin-timer.c b/src/common/plugin-timer.c index 39d20f72..1c585d1f 100644 --- a/src/common/plugin-timer.c +++ b/src/common/plugin-timer.c @@ -30,7 +30,7 @@ #define _(x) zoitechat_gettext(ph,x) -static zoitechat_plugin *ph; /* plugin handle */ +static zoitechat_plugin *ph; static GSList *timer_list = NULL; #define STATIC @@ -146,7 +146,6 @@ timer_showlist (void) zoitechat_print (ph, _(HELP)); return; } - /* 00000 00000000 0000000 abc */ zoitechat_print (ph, _("\026 Ref# Seconds Repeat Command \026\n")); list = timer_list; while (list) @@ -218,7 +217,6 @@ zoitechat_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { - /* we need to save this for use with any zoitechat_* functions */ ph = plugin_handle; *plugin_name = "Timer"; @@ -227,5 +225,5 @@ zoitechat_plugin_init zoitechat_hook_command (ph, "TIMER", ZOITECHAT_PRI_NORM, timer_cb, _(HELP), 0); - return 1; /* return 1 for success */ + return 1; } diff --git a/src/common/scram.c b/src/common/scram.c index 479f05eb..a8318e38 100644 --- a/src/common/scram.c +++ b/src/common/scram.c @@ -28,7 +28,6 @@ #define CLIENT_KEY "Client 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) #define EVP_MD_CTX_new(ctx) EVP_MD_CTX_create(ctx) #define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy(ctx) @@ -46,7 +45,6 @@ scram_session if (md == NULL) { - // Unknown message digest 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); - // The server can append his nonce to the client's nonce if (strlen (server_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); - // SaltedPassword := Hi(Normalize(password), salt, i) session->salted_password = g_malloc (session->digest_size); PKCS5_PBKDF2_HMAC (session->password, strlen (session->password), (unsigned char *) salt, salt_len, iteration_count, session->digest, session->digest_size, 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); session->auth_message = g_strdup_printf ("%s,%s,%s", session->client_first_message_bare, data, client_final_message_without_proof); - // ClientKey := HMAC(SaltedPassword, "Client Key") client_key = g_malloc0 (session->digest_size); HMAC (session->digest, session->salted_password, session->digest_size, (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)) { 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; } - // ClientSignature := HMAC(StoredKey, AuthMessage) client_signature = g_malloc0 (session->digest_size); HMAC (session->digest, stored_key, stored_key_len, (unsigned char *) session->auth_message, strlen ((char *) session->auth_message), client_signature, NULL); - // ClientProof := ClientKey XOR ClientSignature client_proof = g_malloc0 (client_key_len); 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); g_base64_decode_inplace (verifier, &verifier_len); - // ServerKey := HMAC(SaltedPassword, "Server Key") server_key = g_malloc0 (session->digest_size); HMAC (session->digest, session->salted_password, session->digest_size, (unsigned char *) SERVER_KEY, strlen (SERVER_KEY), server_key, &server_key_len); - // ServerSignature := HMAC(ServerKey, AuthMessage) server_signature = g_malloc0 (session->digest_size); HMAC (session->digest, server_key, session->digest_size, (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; } -#endif \ No newline at end of file +#endif diff --git a/src/common/server.c b/src/common/server.c index 38759d7c..df5f1bca 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -510,16 +510,7 @@ server_stopconnecting (server * serv) static void ssl_cb_info (SSL * s, int where, int ret) { -/* char buf[128];*/ - - 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 @@ -625,14 +616,6 @@ ssl_do_connect (server * serv) cert_info.algorithm, cert_info.algorithm_bits); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, 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", cert_info.sign_algorithm/*, cert_info.sign_algorithm_bits*/); EMIT_SIGNAL (XP_TE_SSLMESSAGE, serv->server_session, buf, NULL, NULL, @@ -675,8 +658,6 @@ ssl_do_connect (server * serv) } 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_VERIFY_LEAF_SIGNATURE: case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: @@ -1870,11 +1851,9 @@ server_set_defaults (server *serv) char * server_get_network (server *serv, gboolean fallback) { - /* check the network list */ if (serv->network) return ((ircnet *)serv->network)->name; - /* check the network name given in 005 NETWORK=... */ if (serv->server_session && *serv->server_session->channel) return serv->server_session->channel; @@ -1893,7 +1872,6 @@ server_set_name (server *serv, char *name) if (name[0] == 0) name = serv->hostname; - /* strncpy parameters must NOT overlap */ if (name != serv->servername) { safe_strcpy (serv->servername, name, sizeof (serv->servername)); diff --git a/src/common/servlist.c b/src/common/servlist.c index c2eb3e77..b215e1e1 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -1065,7 +1065,7 @@ servlist_load (void) } } if (buf[0] == 'N') - net = servlist_net_add (buf + 2, /* comment */ NULL, FALSE); + net = servlist_net_add (buf + 2, NULL, FALSE); } fclose (fp); diff --git a/src/common/servlist.h b/src/common/servlist.h index b3170d97..f7ebdc15 100644 --- a/src/common/servlist.h +++ b/src/common/servlist.h @@ -125,8 +125,4 @@ GSList *servlist_favchan_listadd (GSList *chanlist, char *channel, char *key); 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 diff --git a/src/common/sysinfo/win32/backend.c b/src/common/sysinfo/win32/backend.c index b2ed3ab8..37f003d2 100644 --- a/src/common/sysinfo/win32/backend.c +++ b/src/common/sysinfo/win32/backend.c @@ -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'\\') { - // This is not a named volume. Skip it. VariantClear (&name_variant); return NULL; diff --git a/src/common/url.c b/src/common/url.c index 4e5bff48..d0b4d7ff 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -95,7 +95,6 @@ url_save_node (char* url) { FILE *fd; - /* open /url.log in append mode */ fd = zoitechat_fopen_file ("url.log", "a", 0); if (fd == NULL) { @@ -118,7 +117,6 @@ url_add (char *urltext, int len) char *data; 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) { return; @@ -126,12 +124,11 @@ url_add (char *urltext, int len) data = g_strndup (urltext, len); - if (data[len - 1] == '.') /* chop trailing dot */ + if (data[len - 1] == '.') { len--; data[len] = 0; } - /* chop trailing ) but only if there's no counterpart */ if (data[len - 1] == ')' && strchr (data, '(') == NULL) { data[len - 1] = 0; @@ -142,7 +139,6 @@ url_add (char *urltext, int len) url_save_node (data); } - /* the URL is saved already, only continue if we need the URL grabber too */ if (!prefs.hex_url_grabber) { g_free (data); @@ -162,11 +158,8 @@ url_add (char *urltext, int len) } size = tree_size (url_tree); - /* 0 is unlimited */ 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; for(; size > 0; size--) { @@ -183,10 +176,6 @@ url_add (char *urltext, int len) 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 lastend = 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)) return FALSE; - /* ignore matches with prefixes that the server doesn't use */ if (strchr (NICKPRE, word[*start]) && !strchr (nick_prefixes, word[*start])) return FALSE; diff --git a/src/common/util.c b/src/common/util.c index 4ad5dedd..f8a5f5bf 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -169,13 +169,12 @@ errorstring (int err) return tbuf; } } - } /* ! if (osvi.dwMajorVersion >= 5) */ + } - /* fallback to error number */ sprintf (tbuf, "%s %d", _("Error"), err); return tbuf; - } /* ! if (err >= WSABASEERR) */ -#endif /* ! WIN32 */ + } +#endif return strerror (err); } diff --git a/src/common/zoitechat.c b/src/common/zoitechat.c index eeb31fba..6c97bada 100644 --- a/src/common/zoitechat.c +++ b/src/common/zoitechat.c @@ -502,16 +502,13 @@ lastact_update(session *sess) else if (sess->tab_state & TAB_STATE_NEW_DATA) newidx = dia? LACT_QUERY: LACT_CHAN_DATA; - /* If already first at the right position, just return */ if (oldidx == newidx && (newidx == LACT_NONE || g_list_index(sess_list_by_lastact[newidx], sess) == 0)) return; - /* Remove from the old position */ if (oldidx != LACT_NONE) sess_list_by_lastact[oldidx] = g_list_remove(sess_list_by_lastact[oldidx], sess); - /* Add at the new position */ sess->lastact_idx = newidx; if (newidx != LACT_NONE) 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; GList *curitem; - /* 5 is the number of priority classes LACT_ */ for (i = 0; i < 5 && !sess; i++) { curitem = sess_list_by_lastact[i]; @@ -672,9 +668,8 @@ away_check (void) return 1; doover: - /* request an update of AWAY status of 1 channel every 30 seconds */ full = TRUE; - sent = 0; /* number of WHOs (users) requested */ + sent = 0; list = sess_list; while (list) { @@ -689,12 +684,10 @@ doover: { full = FALSE; - /* if we're under 31 WHOs, send another channels worth */ if (sent < 31 && !sess->doing_who) { sess->done_away_check = TRUE; sess->doing_who = TRUE; - /* this'll send a WHO #channel */ sess->server->p_away_status (sess->server, sess->channel); sent += sess->total; } @@ -704,7 +697,6 @@ doover: list = list->next; } - /* done them all, reset done_away_check to FALSE and start over unless we have away-notify */ if (full) { list = sess_list; @@ -723,22 +715,20 @@ doover: return 1; } -/* these are only run if the lagometer is enabled */ static int -zoitechat_lag_check (void) /* this gets called every 30 seconds */ +zoitechat_lag_check (void) { lag_check (); return 1; } static int -zoitechat_lag_check_update (void) /* this gets called every 0.5 seconds */ +zoitechat_lag_check_update (void) { lagcheck_update (); return 1; } -/* call whenever timeout intervals change */ void zoitechat_reinit_timers (void) { @@ -746,7 +736,6 @@ zoitechat_reinit_timers (void) static int lag_check_tag = 0; static int away_tag = 0; - /* notify timeout */ if (prefs.hex_notify_timeout && notify_tag == 0) { notify_tag = fe_timeout_add_seconds (prefs.hex_notify_timeout, @@ -758,7 +747,6 @@ zoitechat_reinit_timers (void) notify_tag = 0; } - /* away status tracking */ if (prefs.hex_away_track && away_tag == 0) { away_tag = fe_timeout_add_seconds (prefs.hex_away_timeout, away_check, NULL); @@ -769,7 +757,6 @@ zoitechat_reinit_timers (void) away_tag = 0; } - /* lag-o-meter */ if (prefs.hex_gui_lagometer && lag_check_update_tag == 0) { 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; } - /* network timeouts and lag-o-meter */ if ((prefs.hex_net_ping_timeout != 0 || prefs.hex_gui_lagometer) && lag_check_tag == 0) { @@ -794,8 +780,6 @@ zoitechat_reinit_timers (void) } } -/* executed when the first irc window opens */ - static void irc_init (session *sess) { diff --git a/src/common/zoitechat.h b/src/common/zoitechat.h index 64e08bde..4c0f11fe 100644 --- a/src/common/zoitechat.h +++ b/src/common/zoitechat.h @@ -24,7 +24,7 @@ #include #include -#include /* need time_t */ +#include #ifndef ZOITECHAT_H #define ZOITECHAT_H @@ -44,11 +44,11 @@ gboolean zoitechat_apply_theme (const char *theme_name, GError **error); #include "tree.h" #ifdef USE_OPENSSL -#include /* SSL_() */ +#include #include "scram.h" #endif -#ifdef __EMX__ /* for o/s 2 */ +#ifdef __EMX__ #define OFLAGS O_BINARY #define g_ascii_strcasecmp stricmp #define g_ascii_strncasecmp strnicmp @@ -59,7 +59,7 @@ gboolean zoitechat_apply_theme (const char *theme_name, GError **error); /* force a 32bit CMP.L */ #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 sleep(t) Sleep(t*1000) #include @@ -71,7 +71,7 @@ gboolean zoitechat_apply_theme (const char *theme_name, GError **error); #define S_ISDIR(m) ((m) & _S_IFDIR) #endif #define NETWORK_PRIVATE -#else /* for unix */ +#else #define OFLAGS 0 #endif diff --git a/src/fe-gtk/chanview-tabs.c b/src/fe-gtk/chanview-tabs.c index d174ba96..60643cef 100644 --- a/src/fe-gtk/chanview-tabs.c +++ b/src/fe-gtk/chanview-tabs.c @@ -190,11 +190,11 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv) 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 { - 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); - tab_right_is_moving = 0; /* hSP: set to false in case we didnt get stopped (the normal case) */ + tab_right_is_moving = 0; } 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; g_signal_connect (G_OBJECT (outer), "size_allocate", G_CALLBACK (cv_tabs_sizealloc), cv); -/* gtk_container_set_border_width (GTK_CONTAINER (outer), 2);*/ gtk_widget_show (outer); viewport = gtk_viewport_new (0, 0); @@ -574,7 +573,7 @@ tab_pressed_cb (GtkToggleButton *tab, chan *ch) ignore_toggle = FALSE; cv->focused = ch; - if (/*tab->active*/is_switching) + if (is_switching) /* call the focus callback */ cv->cb_focus (cv, ch, ch->tag, ch->userdata); } diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 42f18966..7bb5e37d 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -925,8 +925,6 @@ fe_main (void) void fe_cleanup (void) { - /* it's saved when pressing OK in setup.c */ - /*palette_save ();*/ } void @@ -963,8 +961,7 @@ log_handler (const gchar *log_domain, { 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)"); if (!sess) @@ -977,8 +974,6 @@ log_handler (const gchar *log_domain, #endif -/* install tray stuff */ - static int fe_idle (gpointer data) { diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c index 05de8554..7fa11cbe 100644 --- a/src/fe-gtk/fkeys.c +++ b/src/fe-gtk/fkeys.c @@ -1199,11 +1199,6 @@ corrupt_file: return 5; } -/* ***** Key actions start here *********** */ - -/* See the NOTES above --AGL */ - -/* "Run command" */ static int key_action_handle_command (GtkWidget * wid, GdkEventKey * evt, char *d1, 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 * is passed to lastact_getfirst() as a way to filter out detached sessions. - * XXX: Consider moving this in a different file? */ static int 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) { mg_move_tab (sess, +1); - return 2; /* don't allow default action */ + return 2; } static int @@ -1814,7 +1808,7 @@ key_action_move_tab_right (GtkWidget * wid, GdkEventKey * ent, char *d1, char *d2, struct session *sess) { mg_move_tab (sess, -1); - return 2; /* -''- */ + return 2; } static int @@ -1822,7 +1816,7 @@ key_action_move_tab_family_left (GtkWidget * wid, GdkEventKey * ent, char *d1, char *d2, struct session *sess) { mg_move_tab_family (sess, +1); - return 2; /* don't allow default action */ + return 2; } static int @@ -1830,7 +1824,7 @@ key_action_move_tab_family_right (GtkWidget * wid, GdkEventKey * ent, char *d1, char *d2, struct session *sess) { mg_move_tab_family (sess, -1); - return 2; /* -''- */ + return 2; } 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)); SPELL_ENTRY_SET_TEXT (wid, ""); - return 2; /* -''- */ + return 2; } - -/* -------- */ - static void replace_handle (GtkWidget *t) { diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c index ff96ecf8..97577aa1 100644 --- a/src/fe-gtk/gtkutil.c +++ b/src/fe-gtk/gtkutil.c @@ -668,8 +668,6 @@ static void gtkutil_file_req_done (GtkWidget * wid, struct file_req *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); } @@ -682,7 +680,6 @@ gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq) return; } - /* this should call the "destroy" cb, where we free(freq) */ gtk_widget_destroy (dialog); } @@ -1360,16 +1357,6 @@ gtkutil_treemodel_string_to_iter (GtkTreeModel *model, gchar *pathstr, GtkTreeIt 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 gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...) { diff --git a/src/fe-gtk/joind.c b/src/fe-gtk/joind.c index fcc9909c..ae07d3d5 100644 --- a/src/fe-gtk/joind.c +++ b/src/fe-gtk/joind.c @@ -81,11 +81,9 @@ joind_ok_cb (GtkWidget *ok, server *serv) return; } - /* do nothing */ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (serv->gui->joind_radio1))) goto xit; - /* join specific channel */ 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)); @@ -98,7 +96,6 @@ joind_ok_cb (GtkWidget *ok, server *serv) goto xit; } - /* channel list */ chanlist_opengui (serv, TRUE); xit: diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 1dcfb871..cad767bd 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -1278,7 +1278,6 @@ mg_switch_page (int relative, int num) static void 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 */ } @@ -1293,7 +1292,6 @@ mg_ircdestroy (session *sess) if (mg_gui == NULL) { -/* puts("-> mg_gui is already NULL");*/ return; } @@ -1303,13 +1301,11 @@ mg_ircdestroy (session *sess) sess = list->data; if (sess->gui->is_tab) { -/* puts("-> some tabs still remain");*/ return; } list = list->next; } -/* puts("-> no tabs left, killing main tabwindow");*/ gtk_widget_destroy (mg_gui->window); active_tab = NULL; mg_gui = NULL; @@ -2089,7 +2085,6 @@ mg_tabwindow_kill_cb (GtkWidget *win, gpointer userdata) GSList *list, *next; session *sess; -/* puts("enter mg_tabwindow_kill_cb");*/ zoitechat_is_quitting = TRUE; /* 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) { zoitechat_is_quitting = FALSE; -/* puts("-> will not exit, some toplevel windows left");*/ } else { mg_ircdestroy (sess); @@ -2135,7 +2129,6 @@ mg_changui_destroy (session *sess) /* avoid calling the "destroy" callback */ g_signal_handlers_disconnect_by_func (G_OBJECT (sess->gui->window), mg_topdestroy_cb, sess); - /*gtk_widget_destroy (sess->gui->window);*/ /* don't destroy until the new one is created. Not sure why, but */ /* it fixes: Gdk-CRITICAL **: gdk_colormap_get_screen: */ /* assertion `GDK_IS_COLORMAP (cmap)' failed */ diff --git a/src/fe-gtk/meson.build b/src/fe-gtk/meson.build index 26129961..dc4a6b5b 100644 --- a/src/fe-gtk/meson.build +++ b/src/fe-gtk/meson.build @@ -77,12 +77,6 @@ if host_machine.system() == 'windows' zoitechat_gtk_sources += 'notifications/notification-windows.c' 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 zoitechat_gtk_sources += 'notifications/notification-freedesktop.c' endif @@ -102,7 +96,7 @@ endif resources = gnome.compile_resources('resources', '../../data/zoitechat.gresource.xml', - source_dir: '../../data', # TODO: Fix upstream + source_dir: '../../data', c_name: 'zoitechat', extra_args: ['--manual-register'] ) diff --git a/src/fe-gtk/notifications/notification-winrt.cpp b/src/fe-gtk/notifications/notification-winrt.cpp index bb537c1f..1ed1c5f2 100644 --- a/src/fe-gtk/notifications/notification-winrt.cpp +++ b/src/fe-gtk/notifications/notification-winrt.cpp @@ -66,7 +66,6 @@ extern "C" node_list->GetAt (1)->AppendChild ( toastTemplate->CreateTextNode (Platform::StringReference (wtext.c_str (), wtext.size ()))); - // Mute sound, we already play our own auto node = toastTemplate->SelectSingleNode (L"/toast"); auto audio_elem = toastTemplate->CreateElement (L"audio"); audio_elem->SetAttribute (L"silent", L"true"); diff --git a/src/fe-gtk/pixmaps.c b/src/fe-gtk/pixmaps.c index 132fc325..7151e65f 100644 --- a/src/fe-gtk/pixmaps.c +++ b/src/fe-gtk/pixmaps.c @@ -168,7 +168,6 @@ load_pixmap (const char *filename) g_free (path); } - // Hack to avoid unbearably tiny icons on HiDPI screens. scale = g_getenv ("GDK_SCALE"); if (scale) { diff --git a/src/fe-gtk/plugin-notification.c b/src/fe-gtk/plugin-notification.c index cfb186a7..240aa9e2 100644 --- a/src/fe-gtk/plugin-notification.c +++ b/src/fe-gtk/plugin-notification.c @@ -80,7 +80,6 @@ show_notification (const char *title, const char *text) { char *stripped_title, *stripped_text; - /* Strip all colors */ stripped_title = zoitechat_strip (ph, title, -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"); - /* Let sure that can alert */ if (should_alert()) { - /* Follow the channel rules if set */ if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) { alert = (flags & CHANNEL_FLAG_BALLOON); } else { - /* Else follow global environment */ 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"); - /* Let sure that can alert */ if (should_alert()) { - /* Follow the private rules if set */ if (!(flags & CHANNEL_FLAG_BALLOON_UNSET)) { alert = (flags & CHANNEL_FLAG_BALLOON); } else { - /* Else follow global environment */ 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 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, "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)); diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index 89f4f063..36fc0822 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -314,15 +314,14 @@ static const char *const noticeposmenu[] = static const char *const swtype[] = { - N_("Tabs"), /* 0 tabs */ - "", /* 1 reserved */ - N_("Tree"), /* 2 tree */ + N_("Tabs"), + "", + N_("Tree"), NULL }; 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_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}, @@ -954,7 +953,6 @@ setup_apply_trans (int *tag) gtk_window_set_opacity (GTK_WINDOW (current_sess->gui->window), (prefs.hex_gui_transparency / 255.)); - /* mg_update_xtext (current_sess->gui->xtext); */ *tag = 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_pass; /* password GtkEntry */ +static GtkWidget *proxy_user; +static GtkWidget *proxy_pass; static void setup_menu_cb (GtkWidget *cbox, const setting *set) diff --git a/src/fe-gtk/urlgrab.c b/src/fe-gtk/urlgrab.c index 6abbf43d..7de40993 100644 --- a/src/fe-gtk/urlgrab.c +++ b/src/fe-gtk/urlgrab.c @@ -37,7 +37,6 @@ #define ICON_URLGRAB_COPY "zc-menu-copy" #define ICON_URLGRAB_SAVE_AS "zc-menu-save-as" -/* model for the URL treeview */ enum { 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)) return FALSE; - /* select what they right-clicked on */ sel = gtk_tree_view_get_selection (tree); gtk_tree_selection_unselect_all (sel); gtk_tree_selection_select_path (sel, path); @@ -103,7 +101,6 @@ url_treeview_new (GtkWidget *box) gtk_widget_set_vexpand (scroll, TRUE); g_signal_connect (G_OBJECT (view), "button_press_event", 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_widget_show (view); return view; @@ -172,7 +169,6 @@ fe_url_add (const char *urltext) URL_COLUMN, urltext, -1); - /* remove any overflow */ if (prefs.hex_url_grabber_limit > 0) { valid = gtk_tree_model_iter_nth_child ( diff --git a/src/fe-text/fe-text.c b/src/fe-text/fe-text.c index 60ef4595..53d85f30 100644 --- a/src/fe-text/fe-text.c +++ b/src/fe-text/fe-text.c @@ -44,7 +44,7 @@ #include "fe-text.h" -static int done = FALSE; /* finished ? */ +static int done = FALSE; static void @@ -227,10 +227,9 @@ fe_print_text (struct session *sess, char *text, time_t stamp, i++; } break; - /* don't actually want hidden text */ - case '\010': /* hidden */ + case '\010': break; - case '\026': /* REVERSE */ + case '\026': if (reverse) { reverse = FALSE; @@ -242,7 +241,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp, } j = strlen (newtext); break; - case '\037': /* underline */ + case '\037': if (under) { under = FALSE; @@ -254,7 +253,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp, } j = strlen (newtext); break; - case '\002': /* bold */ + case '\002': if (bold) { bold = FALSE; @@ -273,7 +272,7 @@ fe_print_text (struct session *sess, char *text, time_t stamp, j++; } break; - case '\017': /* reset all */ + case '\017': strcpy (&newtext[j], "\033[m"); j += 3; reverse = FALSE; @@ -361,12 +360,11 @@ fe_print_text (struct session *sess, char *text, time_t stamp, i++; } break; - /* don't actually want hidden text */ - case '\010': /* hidden */ - case '\026': /* REVERSE */ - case '\037': /* underline */ - case '\002': /* bold */ - case '\017': /* reset all */ + case '\010': + case '\026': + case '\037': + case '\002': + case '\017': break; case '\007': if (!prefs.hex_input_filter_beep) @@ -535,7 +533,7 @@ fe_args (int argc, char *argv[]) return 0; } - if (arg_cfgdir) /* we want filesystem encoding */ + if (arg_cfgdir) { g_free (xdir); xdir = g_strdup(arg_cfgdir); @@ -550,10 +548,8 @@ fe_args (int argc, char *argv[]) void fe_init (void) { - /* the following should be default generated, not enfoced in binary */ prefs.hex_gui_tab_server = 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_slist_skip = 1; } @@ -565,7 +561,6 @@ fe_main (void) main_loop = g_main_loop_new(NULL, FALSE); - /* Keyboard Entry Setup */ #ifdef G_OS_WIN32 keyboard_input = g_io_channel_win32_new_fd(STDIN_FILENO); #else @@ -834,10 +829,8 @@ fe_idle_add (void *func, void *data) void fe_ctrl_gui (session *sess, fe_gui_action action, int arg) { - /* only one action type handled for now, but could add more */ switch (action) { - /* gui focus is really the only case zoitechat-text needs to worry about */ case FE_GUI_FOCUS: current_sess = sess; current_tab = sess; diff --git a/src/libenchant_win8/win8_provider.cpp b/src/libenchant_win8/win8_provider.cpp index 584f64a6..1a95edc4 100644 --- a/src/libenchant_win8/win8_provider.cpp +++ b/src/libenchant_win8/win8_provider.cpp @@ -32,8 +32,6 @@ ENCHANT_PLUGIN_DECLARE ("win8") -/* --------- Utils ----------*/ - static char * 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 ** enumstring_to_chararray (IEnumString *strings, size_t *out_len, bool from_bcp47) { - char **chars = static_cast(std::calloc (256, sizeof (char*))); /* Hopefully large enough */ + char **chars = static_cast(std::calloc (256, sizeof (char*))); LPOLESTR wstr = nullptr; size_t i = 0; @@ -134,8 +132,6 @@ enumstring_to_chararray (IEnumString *strings, size_t *out_len, bool from_bcp47) return chars; } -/* ---------- Dict ------------ */ - static void 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); if (FAILED (hr)) - return -1; /* Error */ + return -1; if (errors->Next (&error) == S_OK) { error->Release (); errors->Release (); - return 1; /* Spelling Issue */ + return 1; } else { 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); } -/* ---------- Provider ------------ */ - static EnchantDict * 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->check = win8_dict_check; 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->user_data = checker;