Commit Graph

870 Commits

Author SHA1 Message Date
Kevin Easton
7ee8799b8e Minor fixes in dll_load()
The test for p != NULL is pointless, it has already been dereferenced and modified.

The argument to tolower() and toupper() must be in the range of unsigned char.

Fix some spelling errors in user-visible messages.
2017-04-24 17:34:07 +10:00
Kevin Easton
afc4793cd8 Remove unnecessary variable from userhost_scanport() and findports() 2017-04-17 13:27:35 +10:00
Kevin Easton
d851661942 Remove unused function argument from scan() 2017-04-16 23:28:18 +10:00
Kevin Easton
1ccd082cd2 Cleanup remove_channel()
remove_channel() is only called in direct response to a message from a server,
so it always acts on from_server - remove the unnecessary server argument.

The channel argument is always non-NULL - remove the dead code that removed all
channels if a NULL channel was passed.
2017-04-16 16:19:55 +10:00
Kevin Easton
53f3a34ca5 Change channel argument of is_current_channel() to const char * 2017-04-16 16:14:13 +10:00
Kevin Easton
2eabfabc35 Change lookup_channel() channel argument to be const char * 2017-04-16 16:03:01 +10:00
Kevin Easton
274ba92c2e Remove useless NULL checks
m_strdup() never returns NULL.
2017-04-15 22:56:36 +10:00
Kevin Easton
a01a93eaa3 Fix removal of DCC_PROC-type plugin addins
The declaration of dcc_dllcommands in modules.c was wrong - add it to dcc.h so it's checked against the definition in dcc.c
and include it from there.

The DCC_dllcommands structure isn't structured like a "List2" so remove_module() doesn't work - use remove_from_list_ext().
2017-04-15 22:50:24 +10:00
Kevin Easton
eca1e54602 Simplify addidle() a little 2017-04-11 01:54:31 +10:00
Kevin Easton
83770fd645 Simplify and clean up putlog() 2017-04-11 01:44:47 +10:00
Kevin Easton
3cf21ccc9d Simplify a conditional expression 2017-04-11 01:27:31 +10:00
Kevin Easton
170b79c0d0 Switch /VER command to use ctcp_simple() 2017-04-11 01:24:36 +10:00
Kevin Easton
bad8c2fa02 Remove netfinger client code and repurpose /FINGER command to send a CTCP FINGER instead
No-one runs fingerd servers anymore so this code was entirely obsolete.
2017-04-11 01:19:32 +10:00
Kevin Easton
eace841366 Enable use of cached whowas info for /IG* and /UNIG* commands
Previously these codepaths were dead because it was passing an argument like "+HOST" to check_whowas_nick_buffer()
in place of the channel name, so it would never find anything.

Now that function supports a NULL channel to mean "any channel", so we can use that.  The actual code itself needed to be
fixed as well, it's now similar to the way userhost_unban() is written.
2017-04-05 22:55:43 +10:00
Kevin Easton
484fc156ed Remove HAVE_SSL define from configure
This is no longer needed, we use the HAVE_LIBSSL from AC_CHECK_LIB now.
2017-03-17 01:27:30 +11:00
Kevin Easton
184af728c7 Add support for OpenSSL 1.1.0 to configure script
OpenSSL 1.1.0 removed the SSLeay() function and replaced it with a macro, that AC_CHECK_LIB can't see.

Search for ERR_get_error() instead.
2017-03-17 00:38:46 +11:00
Kevin Easton
2fa0bf818a Replace uses of HAVE_SSL with HAVE_LIBSSL
autoconf's AC_CHECK_LIB automatically sets HAVE_LIBSSL, whereas HAVE_SSL has to be set manually.

This prepares us to remove some code from configure.
2017-03-17 00:07:38 +11:00
Kevin Easton
1fbafddc59 UNBAN <nick> can use cached whowas info to unset bans
The use of the whowas cache in userhost_unban() would never work, because it was passing 'args' as the channel
name which also included the window number.

Rework this substantially, including using lookup_channel() and set_display_target() in place of prepare_command().
2017-02-25 00:34:58 +11:00
Kevin Easton
3a5a489f25 Add option to check_whowas_nick_buffer() to scan all channels in whowas list
Passing NULL channel lets you scan the full whowas list, which is useful for functions not tied to a channel
like ignore.
2017-02-22 23:03:17 +11:00
Kevin Easton
2363ea709d Remove unused 'unlink' argument from check_whowas_nick_buffer()
Every caller was passing 0 for unlink, so remove it.  This simplifies the function.

Also change the nick and channel arguments to const char *.
2017-02-22 22:28:17 +11:00
Kevin Easton
0c721de2a5 Remove dead code and clean up convert_output_format_raw()
The second branch of if (str) ... else if (str) is dead code, remove it.  Also remove the if() entirely because
the while condition covers it exactly anyway.

Move the static variables used only in this function to function scope.

Change color_mod to const static and remove unneeded variable c_mod.

Move the increment of cparse_recurse to after the point where we bail.

None of this should have any user-visible impact.
2017-02-18 01:04:39 +11:00
Kevin Easton
61ff399b3d Remove superfluous test for current_window
It is always non-NULL, and we dereference it unconditionally anyway.
2017-02-18 00:32:23 +11:00
Kevin Easton
5574ff043b Replace an alloca() call with new_malloc() / new_free()
This also cleans up the code here a bit.
2017-02-18 00:00:45 +11:00
Kevin Easton
e5b2a65fe2 Remove pointless NULL test and unreachable return
There is no point testing ptr for NULL - we dereference it anyway, this function can't be called with a
NULL pointer for the first argument.
2017-02-17 21:55:11 +11:00
Kevin Easton
a0e8bd5742 Cast pid_t to long for fprintf()
pid_t is defined by POSIX to be a signed integer type, so the %u format is wrong.

Cast to long and print with %ld - it is unlikely that any real-world system has pid_t bigger than long.
2017-02-17 16:50:41 +11:00
Kevin Easton
686344314f Unsetting CMDCHARS sets it back to the default
Previously you could unset CMDCHARS and the effect would be to treat it like it was set to DEFAULT_CMDCHARS,
except that some code was missing the fallback (eg. ignore_last_nick()) which would make it crash.

Instead of having the fallback everywhere, just make it so that you can't unset the variable - if you try, it
sets it to DEFAULT_CMDCHARS.  This reflects what the behaviour has always been, it just makes it explicit to
the user and the bonus is we don't have the test it for NULL everywhere.
2017-02-16 23:42:52 +11:00
Kevin Easton
debfebf3a7 Fix a double-free bug when a window on an alternate screen queries an exec process
The 'free_it' variable was only initialised to zero at the start of the function, so when non-main screens
were processed in the later iterations of the loop, it could keep a value of 1 from the previous iteration.

We don't actually need a free_it variable at all - just use a NULL value of ptr_free to indicate that there
is nothing to free (and passing a NULL to new_free() is a no-op).

This also simplifies a test because ptr is always non-NULL (strip_ansi() never returns NULL).
2017-02-16 23:12:38 +11:00
Kevin Easton
790cb771ed Use 127.0.0.1 for wserv socket, which fixes /WINDOW CREATE with IPv6
If wserv is told to connect to "localhost" it might try to connect to ::1, which won't work because
the wserv socket is AF_INET only.

So explicitly bind the socket and make the connection to "127.0.0.1" instead.
2017-02-16 22:06:32 +11:00
Kevin Easton
1f062fb7de Remove unnecessary repeated check
tmp has already been tested in the previous line.
2017-02-12 23:55:16 +11:00
Kevin Easton
3d353f5a48 Remove dead store to a variable 2017-02-11 22:42:32 +11:00
Kevin Easton
95ad004ff0 Remove unused function is_ignored() 2017-02-08 23:56:36 +11:00
Kevin Easton
ce92ddc8fc Fix typo in unused function is_ignored() 2017-02-05 00:09:51 +11:00
Kevin Easton
bbaeca3bc3 Allow INVITE and WALLOP floods to trigger auto-ignore
Previously, INVITE and WALLOP were tracked for flooding, but if the flood triggered then the auto-ignore
didn't happen.  As far as I can tell, this was just an oversight.
2017-01-25 17:12:38 +11:00
Kevin Easton
27b2f3e939 Change ignore_type() arguments to (const char *, size_t)
This just changes the arguments to match the strncmp() calls in the function.
2017-01-21 14:23:57 +11:00
Kevin Easton
69296c2c5a Switch *_FLOOD constants to sequential rather than bits and add flood type lookup table
Using sequential constants for *_FLOOD constants means that we can use a simple lookup table to convert them
into text for display and IGNORE_* constants.
2017-01-21 14:17:42 +11:00
Kevin Easton
81ddf52909 Introduce an enum flood_type for the *_FLOOD constants
This allows the debugger to show the decoded constant name.
2017-01-19 17:10:32 +11:00
Kevin Easton
fef98f43ba Separate notion of _FLOOD constant from the flags stored in the Flooding struct
This adds a FLOOD_FLAG() macro to convert a _FLOOD constant to the appropriate flag.  For now this just
casts the argument to unsigned int.

Rename Flooding.type to Flooding.flags and change it to unsigned int, to reflect that it's a bitfield of
flags for multiple flooding types.
2017-01-18 17:03:06 +11:00
Kevin Easton
78dbdea441 Remove 'type' argument of flood_prot()
All callers of flood_prot() were supplying { get_flood_types(flood_type), flood_type } as the second and third arguments,
except one that supplied { get_flood_types(CTCP_FLOOD), CTCP_ACTION_FLOOD }.

Hardwiring this logic in to flood_prot() lets us remove the 'type' argument without changing the behaviour.
2017-01-18 00:11:49 +11:00
Kevin Easton
7dce90d809 Move COMPILE-PROBLEMS into INSTALL 2017-01-07 14:54:10 +11:00
Kevin Easton
657acd8985 Remove dead store to currmatch in do_hook() 2017-01-03 00:12:23 +11:00
Kevin Easton
89a5417a11 Use %d sprintf() format for 'int' arguments rather than %u 2017-01-02 15:16:13 +11:00
Kevin Easton
a047eba6da Simplify unnecessarily complex condition
!match || (match && ...) is exactly equivalent to !match || ...
2017-01-02 15:09:21 +11:00
Kevin Easton
f8f6723b80 Update docs to remove references to bitchx.com
Thanks to cpet for the patch.
2017-01-02 01:10:28 +11:00
Kevin Easton
00ae33b67f Clean up formatting in function_sar() and function_msar(), remove redundant test
The test for !search in function_msar() wasn't necessary because it is assigned from a pointer
that was just tested for NULL above.
2017-01-02 00:47:43 +11:00
Kevin Easton
8975ba93dd Change $indextoword() so that the return value numbers the words from 0 rather than 1
This aligns the function with the documentation and what EPIC4/5 do. I couldn't find any example of an existing
script that actually called this function, so hopefully no-one is relying on the old behaviour.
2017-01-01 23:33:25 +11:00
Kevin Easton
678adbdd40 Rework and simplify $remw() implementation
This replaces calls to alloca() followed by two strcpy()s with a single
call to memmove(), and removes a confusing for/break structure.

The function should behave exactly as it did before.
2016-12-14 23:39:31 +11:00
Kevin Easton
39dd68b67b Add regression test script for $remw() 2016-12-14 23:38:28 +11:00
Kevin Easton
908e6cdf00 Remove doubled-up identical fset_string_var() calls 2016-12-07 23:53:14 +11:00
Kevin Easton
21a12c004b Correct issue where flood detection could become unreliable
The static 'pos' variable in check_flooding() would not stay in sync with the number of entries in
flood_list after clean_flood_list() was called.  This meant that check_flooding() would always end up
removing all previous entries if it tried to add a new one.

Fix this by removing the tracking of number of flood_list entries, and just removing stale ones (older
than /SET FLOOD_RATE).
2016-11-26 00:08:59 +11:00
Kevin Easton
966f1c6c27 Apply correct casts to check_ext_mail and check_ext_mail_status
As always, the funcion pointers should be cast to the correct type before calling them, rather
than calling them with the wrong type and trying to cast the result.  Fixes a warning compiling
mail.c on 64 bit architectures, and this might well have caused a crash when using the qmail plugin
on those architectures too.
2016-11-03 00:57:03 +11:00