The function provided (either by #define to the module table or directly in the case of scr-bx.c)
is called my_ltoa(), and the #define in irc_std.h aliases this to ltoa().
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.
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.
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().
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.
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().
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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).