Commit Graph

156 Commits

Author SHA1 Message Date
Kevin Easton
df2e250ccf Clean up handling of oper server notices
This switches from somewhat gory string parsing based on strncmp() and next_arg() to a simpler alternative
based on sscanf().  I think these are much easier to understand now, and shouldn't have any subtle bugs
lurking like the old code.

This also removes support for some obsolete messages that don't seem to be in any modern ircds:
"Identd reponse differs"; bot messages like "Rejecting vlad/joh/com bot:" except for "is a possible spambot"
which is still in use; and the "High-traffic mode" messages.
2016-05-07 00:44:29 +10:00
Kevin Easton
e53d1cab7b Unify handling of SWATCH NONE between OperView and non-OperView modes
Previously, SWATCH NONE meant "show no server notices" if OperView was
enabled, but "show all server notices" if OperView was disabled.  Now,
it always means "show no server notices" (the default SWATCH is ALL,
so the default will behave the same).

This allows us to simplify the code a great deal as well.

Also trim off leading "***" if the server messages are handled by
handle_oper_vision(), as they already are in parse_server_notice().
2016-04-15 00:11:08 +10:00
Kevin Easton
d236b19410 Don't double-up server notices in the /RELS list
serversay() calls add_last_type(), so there's no need for the callers to do so
as well.

Remove the first argument to serversay() because it was always called with 1
anyway.
2016-04-14 21:51:49 +10:00
Kevin Easton
d296739f6f Don't fire the SERVER_NOTICE hook more than once per NOTICE
The previous code would fire the hook twice per NOTICE if handle_oper_vision()
didn't handle the NOTICE (eg. /set SWATCH NONE).
2016-04-12 23:05:34 +10:00
Kevin Easton
0b91d61496 Fix conversion of SWATCH flags to string form
This was broken in commit [07cdd587], where 'sizeof' was used on a pointer
instead of the buffer pointed-to.

Fix this by having the caller of ircop_flags_to_str() supply a buffer and
length, since there's only two callers and both can use happily use stack
objects.
2016-04-10 21:38:38 +10:00
Kevin Easton
9e4602360a Remove the extra space from default SERVER_NOTICE format
Remove the extra space in the default /fset SERVER_NOTICE, and similarly
the extra space in the HUMBLE /set SERVER_PROMPT.

The code in the client always _intended_ to add a space between SERVER_PROMPT
and SERVER_NOTICE_FSET but a bug in 75p3 and below meant it that it didn't.
This bug was fixed in 1.0b but the formats were never updated.

Also remove replace the embedded ANSI in the default SERVER_PROMPT with
% color code.
2016-04-09 00:36:08 +10:00
Kevin Easton
1f64201362 Always treat NOTICEs received before registration as local server notices
We don't know the server's proper name until registration, so the test against
that isn't reliable.  We shouldn't be able to receive messages from anyone else
until we're registered, so this should be safe.

This requires changing serversay() to accept the from name instead of the
from_server.  While we're there, replace the use of alloca() with simpler
logic based on m_sprintf().
2016-04-07 00:11:27 +10:00
Kevin Easton
b1277f75d4 Add /on NOTICE_GROUP and /fset NOTICE_GROUP analogous to MSG_GROUP
This hook and format are used for NOTICEs where the destination isn't
a channel and isn't yourself - eg. global targets like $$*.org.  This was
already the case for PRIVMSGs (using the MSG_GROUP hook and format).

Previously these were being routed like a normal NOTICE, and those don't
display the target, so it looked exactly like a private NOTICE to you.

This will also catch server notices sent before you're registered.
2016-03-31 23:55:14 +11:00
Kevin Easton
83741aca7a Add configure check for <sys/sockio.h>
Some systems need <sys/sockio.h> for the SIOCGIFCONF ioctl - this switches
to using a proper configure check for that header rather than just assuming
it'll be there if we can't find SIOCGIFCONF.  Should be more robust.
2016-03-20 23:48:31 +11:00
Kevin Easton
f21b89e428 Improve /WINDOW DESCRIBE output
Instead of showing a meaningless pointer value for Screen:, we show the
screen number and ttyname.

Also take the CO, LI values from the window's screen.

Don't show the Prompt: unless one is set.
2016-03-16 23:50:38 +11:00
Kevin Easton
9427b3db84 Try all addresses returned by getaddrinfo() until we find one that socket() is happy with
Someone reported being unable to connect with the error "Address family not
supported", which is probably being returned by socket().  It is likely a
system where getaddrinfo() is returning AF_INET6 addresses, but socket()
won't create AF_INET6 sockets.

To handle this case, we loop over all the addresses returned by getaddrinfo()
until we find one that socket() will accept.
2016-03-08 23:53:16 +11:00
Kevin Easton
c2a2d68d8d Only show version once with -v command line option
Reported by cpet.
2016-02-24 17:23:38 +11:00
Kevin Easton
6dc89247e2 Drop group privileges before dropping user privileges when execing
This ensures that the saved-set-gid is also set, although this shouldn't
matter in practice since we always call execve() soon after, which
overwrites the saved-set-gid with the effective gid anyway.
2016-02-24 16:52:33 +11:00
Kevin Easton
1359f013e8 Make autogen.sh prompt to run configure
Patch from cpet, thanks!
2016-02-19 23:09:30 +11:00
Kevin Easton
8886c20c1b Improve messages shown by /window size 2015-11-11 14:59:21 +11:00
Kevin Easton
be6bd5aca4 Simplify and improve code around DCC auto-get / auto-rename / auto-resume
This improves the client messages - eg previously the message to tell you that
you could use /DCC RESUME never got shown due to a logic error.

It also won't try to auto-resume if the local file is already the same size or
bigger than the incoming file.
2015-10-10 00:08:00 +11:00
Kevin Easton
ce3fd79652 Global spelling fix s/recieve/receive/ across codebase
This includes some user-visible messages and help files, so if anyone has
hooked them with /ON WINDOW their hooks will need updating.
2015-10-04 09:06:38 +11:00
Kevin Easton
726884b0b0 Ignore DCC ACCEPT if we didn't request a DCC RESUME
Mark DCC connections that we have requested RESUME on, so that we know
whether or not to act on a DCC ACCEPT that is received.

Also fixes up a slightly wrong message in /DCC RESUME.
2015-10-04 00:44:47 +10:00
Kevin Easton
857a5fa524 Fix /KB so that it kicks-then-bans as documented
This also fixes a few others - eg /KBI now kicks-then-bans, and
/BKI bans-then-kicks (previously these were the wrong way around).

Reported by profiler.
2015-09-20 21:54:54 +10:00
Kevin Easton
e54106de83 Add missing Changelog entry for commit [b944573]. 2015-09-09 13:02:33 +10:00
Kevin Easton
aea7050efe Don't create a double stack frame when calling aliases
The old code created a new stack frame in parse_line_alias_special(), then
another one in parse_line().  This prevented $functioncall() from working,
and made the output of CALL look odd.

|Rain| mentioned this years ago in starman.irc.
2015-09-08 23:35:06 +10:00
Kevin Easton
8cc9684c76 Ensure close_server() clears the who/ison/userhost queues for the right server
close_server() should call clear_server_queues() on the server that's being
closed, not from_server.  This also lets us remove a few other calls to
clear_server_queues() that are right next to calls to close_server().
2015-09-07 16:34:41 +10:00
Kevin Easton
35b1a65f03 Remove obsolete AIM plugin
The servers for the TOC protocol used by this plugin were decomissioned
by AOL in 2012, so it can't be used any longer.
2015-09-06 23:33:36 +10:00
Kevin Easton
2520bd32f6 Separate parsing of channel WALLs into a function and clean it up
Channel WALL notices now have to match "[%Wall%/%] *", and have to be for
a channel that the client is actually on.  Otherwise, they just appear as
ordinary NOTICEs.
2015-09-06 22:47:20 +10:00
Kevin Easton
d1816fdc8b Don't mangle ANSI sequences in NOTICEs.
We pass through ANSI just fine in PRIVMSGs, so we might as well treat
NOTICEs the same way too.  The old code wasn't just stripping them out,
either - it was turning them into printable garbage.
2015-09-01 23:04:01 +10:00
Kevin Easton
ff251080da Add get_kill_reason() that uses BitchX.kill, and convert all /KILL users to it
Previously only send_kill() used BitchX.kill - the other KILL commands (eg.
/WHOKILL) were using the random kick reasons.  Standardise them all on
BitchX.kill, and add this file to the source so it can be installed along
with the other random reason files.
2015-06-27 23:18:38 +10:00
Kevin Easton
05cf540a99 Fix use of uninitialised variable and hostmask matching logic in userhost_unban()
Initialise ip_str so that it isn't used uninitialised.

Don't strip server flags from user@ portion of the hostmask, so that it will
not miss matching bans.

Switch ip_str from alloca() to malloc_sprintf() / new_free() - there's no
particular need for alloca() here.
2015-06-23 15:53:30 +10:00
Kevin Easton
3618f842aa Changelog update for unsigned char / char fixes 2015-06-23 15:50:29 +10:00
Kevin Easton
1b1734d7e1 Fix bxconfigure crash on terminals wider than 200 columns.
A few places created strings based on the terminal width, using fixed-sized
buffers and without checking for overflowing them.  Fix those, and also
replace all other sprintf() calls with snprintf().

Reported by cpet.
2015-06-19 20:42:44 +10:00
Kevin Easton
aa3dc1939d Remove obsolete Chatnet 310 numeric support (WANT_CHATNET)
Chatnet doesn't use the odd 310 numeric support anymore, it now uses 310 for
the same WHOIS_HELPFUL as Dalnet.  They apparently use a pretty bog-standard
Unreal ircd now.
2015-06-16 13:23:36 +10:00
Kevin Easton
6dbc712046 Rework and improve the scheduling of the server lag check
Previously the server lag check was run by update_clock() if the number of
seconds since client startup was a multiple of 20 (unless it had already been
done this second).  This meant that if update_clock() was not being called
frequently (eg. if your IRC connection was very quiet), it might go a long
time between lag checks.

This commit adds a /set LAG_CHECK_INTERVAL (defaulting to 30).  For each
server, a lag check ping is scheduled for every LAG_CHECK_INTERVAL seconds
after the connection is finalised/registered.  Setting this value to 0
disables the lag check pings entirely.

The old code set the lag to 'unknown' immediately after sending out a ping,
which meant that it was quite unpredictable how long the lag value would
stay around for.  The new code only sets this once the current lag value
has become stale (ie. a ping reply is overdue based on the current lag
value).  If your lag is staying the same or reducing, you shouldn't see
the [Lag ??] at all.
2015-06-12 15:54:43 +10:00
Kevin Easton
6f0f9dd8a8 Add missing Changelog entry for commit [8cdc62a] 2015-06-03 23:34:18 +10:00
Kevin Easton
72f5536121 Fix bug that prevents ignoring of NICK messages.
check_ignore() returns IGNORED for that case, not zero.
2015-05-10 14:22:12 +10:00
Kevin Easton
aab85f807a Update version number to 1.2.1 in preparation for release.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@537 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-14 10:42:09 +00:00
Kevin Easton
137fbd9b85 Prefer <fcntl.h> over <sys/fcntl.h>.
<fcntl.h> is the name used by POSIX, so we prefer this and only fall back to
<sys/fcntl.h> on non-POSIX systems.  Fixes warnings compiling against musl
libc.

Reported by ncopa.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@531 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-06 10:44:07 +00:00
Kevin Easton
93d06b03c9 Fix overflow in say() when handling a client message over the maximum.
This was noticed when /channel on a very large channel segfaulted.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@528 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-05 09:32:46 +00:00
Kevin Easton
0b6725dbe2 Remove WANT_CHAN_NICK_SERV define and include services commands by default.
They're pretty widely used these days, and the cost is trivial.  And quite frankly,
the less #ifdefs I have to see, the better.

This covers /NICKSERV, /CHANSERV, /OPERSERV and /MEMOSERV.  It also brings 
in the bahamut / unreal /SILENCE server-side-ignore command, and unreal's /HELPOP.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@524 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-04 10:27:19 +00:00
Kevin Easton
a05b1160c3 Change build to pass through CPPFLAGS if provided, and to use the DEFS value set by configure.
The DEFS Makefile variable has been renamed to CPPFLAGS, and is now set based on the CPPFLAGS,
INCLUDES and DEFS values provided by configure.

Reported by cpet, this allows the FreeBSD port to drop a patch.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@519 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-01 14:37:41 +00:00
Kevin Easton
db3fabfc3e Delay setting the /cset CHANMODE mode on new channels until the channel is synched.
Instead of setting the mode at NAMES time (when we know that the channel is new),
remember this for later by setting the GOTNEW flag in the joinlist entry.  Then
check this flag when the channel is synched.

Setting the channel mode takes us out of server "grace mode", which slows down the 
processing of subsequent commands and drastically reduces the number of commands we
can have outstanding before we get kicked off for flooding.  This change allows us
to stay in grace mode while we're synching every channel that we joined at connect.

In turn, this makes joining lots of channels on connect faster, and much less likely
to cause us to be booted with "Excess Flood".


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@515 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-29 14:07:05 +00:00
Kevin Easton
8054c3e4ab Rename show_channel_sync() to channel_sync(), and don't use prepare_command() before it.
prepare_command() does nothing useful here, and it sets the current server to an incorrect value
if the channel sync happens while the current window is set to a window from a different server.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@514 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-29 12:51:40 +00:00
Kevin Easton
7563f1d401 Cache the bitmask of the channel log level in the cset structure instead of the channel structure.
This fixes a bug where the cached channel log level bitmask was not correctly set unless you did a 
/cset CHANNEL_LOG_LEVEL after the channel had been joined, which resulted in most things not being
logged.

It makes most sense to cache the bitmask within the cset structure, and there was even an (ununsed)
field already there for it.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@512 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-26 13:08:43 +00:00
Kevin Easton
3f3bdf5387 Display user and channel mode changes at level MODEUSER and MODECHAN instead of CRAP.
These were already being logged at the correct level, this just fixes the
interaction with window level and window notify_level.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@510 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-18 13:18:13 +00:00
Kevin Easton
c41048b896 Increase size of buffer to handle maximum-length topics in status_topic().
This affects the maximum length of the topic that can be displayed by the %-
status format.  No topic can be longer than IRCD_BUFFER_SIZE, so use that.

Reported by oxy.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@508 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 12:57:01 +00:00
Kevin Easton
5126d21126 Add /FSET WHOIS_LOGGEDIN to format RPL_WHOISLOGGEDIN, used by hybrid, ratbox, ircu and derivatives.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@506 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-10 12:56:09 +00:00
Kevin Easton
b99118c030 Add sanity checking of incoming nicknames.
Check that at least the first character of an incoming nickname is valid (we
actually go a bit beyond the RFC by also allowing any char with bit 8 set - at
least Russian servers use nicknames like this).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@501 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-24 06:54:00 +00:00
Kevin Easton
6dc2335df9 The /mv command shouldn't send +v for already-voiced users.
The logic in the massop function to exclude already-voiced users from
massvoice was faulty - it was equivalent to just !nick_isop().


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@500 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-23 13:59:03 +00:00
Kevin Easton
e808dbe94b Change the lag check so that it does not try to format a time_t using %lu.
Recent OpenBSD and NetBSD have changed time_t to be a 64 bit type on all
platforms.  This means that on 32 bit systems, time_t is now longer than
long, and %lu can't be used to format it.

The lag check doesn't actually care what is in the first field of the PING
command, so change it to be our nick (which is arguably what it should be).


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@498 13b04d17-f746-0410-82c6-800466cd88b0
2014-09-21 14:54:12 +00:00
Kevin Easton
ced7f9bcc9 keys.c: Convert most uses of unsigned char to char, clearing up warnings.
This also fixes the ability to bind to key sequences ending in ^.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@476 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-17 21:37:32 +00:00
Kevin Easton
d03781f45b Fix the $timer() scripting function.
This function never worked - function_timer() was creating a string but then
never throwing it away and returning a part of the argument instead, which
then caused a crash because it couldn't be freed later in the expression
parsing.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@472 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:17:13 +00:00
Kevin Easton
ffea653764 Fix the /TKB (timed kickban) command.
An incorrect pointer was being passed to malloc_sprintf(), causing a
crash.  Use m_sprintf() instead.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@471 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-16 03:13:26 +00:00