Commit Graph

35 Commits

Author SHA1 Message Date
Kevin Easton
95a422cd27 Directly link string format to numargs in do_dirlasttype()
This is just a simplification - the string format should always match the arguments passed,
and none of the options are using anything but plain %s formats.

This also requires modifying /RELI to store the invited-channel in .last_msg so that it
can use the numargs = 3 format.
2016-05-15 22:43:01 +10: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
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
563493dd6a Add COLOR_CHAR and BELL_CHAR defines to replace open-coded values 2015-06-16 19:06:30 +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
af017816e2 Use time_since() and time_until() instead of open-coded variants
Use these helpers in the places where we're calling get_time() and
comparing it against a single struct timeval.
2015-05-14 00:02:51 +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
dea26d0c1c Remove unused variables in check_bitch_mode() and parse_server() 2015-05-09 00:01:07 +10:00
Kevin Easton
32659b9998 Simplify LAMEIDENT code and remove unused variable.
Replace open-coded loop with strpbrk(), make the constant lame_chars string
static const and remove the unused variable 'user'.

I think LAMEIDENT might be obsolete now anyway - I can't find a server that
allows control chars in usernames these days.
2015-05-08 23:25:41 +10:00
Kevin Easton
a497d3ab09 Remove unused variables in whoreply() and add_user_who()
The result of add_to_channel() isn't used in these functions, so we don't
need to store it.
2015-05-08 22:24:36 +10:00
Kevin Easton
941a3c6c63 Removed unused variables in p_privmsg()
com_do_log and com_lines are static variables that are set, but never
checked by any code.
2015-05-08 21:50:14 +10:00
Kevin Easton
5e9263f325 Simplify and improve ANNOY_KICK checks.
The annoy kick code looks for messages that are longer than 12 characters
and more than 75% of them are highlighted (eg. bold).  The old code counted
the whoel message length, so it could be fooled by padding the message with
lots of nonprinting control characters.  This change makes it count only
displaying characters.

Also fix the check for beep (it's a single character, not a highlighting
toggle, so we just check for one of them), and add a check for the blinking
highlight.
2015-05-07 22:30:59 +10:00
Kevin Easton
e646ab42d2 Move char_fucknut() and caps_fucknut() from misc.c to parse.c.
These functions are only used by parse.c:annoy_kicks(), so move them next
to that function and make them static.

This also changes their arguments from unsigned char * to char *, getting rid
of some signed/unsigned mismatch warnings.
2015-05-05 20:30:07 +10:00
Kevin Easton
9f7cf6b6c2 Alter the way PINGs for /sping and lag check are used.
We now send PING <server> :<server> for /spings, and
PING LAG!<cookie>.<tv_sec>.<tv_usec> :<server> for lag checks.  The cookie is
set randomly at server connect time, and means that clients connected to the
same bouncer shouldn't act on each other's lag checks.

We can now remove in_sping entirely - previously it would get out of synch if
you disconnected with a sping in progress.
2015-05-04 00:13:08 +10:00
Kevin Easton
443b87a8aa Remove alternate /sping implementation for systems without gettimeofday()
This changes the code to use struct timeval and get_time() on all systems,
which simplifies the code by removing most of the checks for HAVE_GETTIMEOFDAY.

The only user-visible change is that ancient systems without gettimeofday()
will see message like "Server pong from irc.choopa.net 1.0000 seconds" instead
of "Server pong from irc.choopa.net 1.x seconds".  And really, I seriously
doubt that there's any systems like that left out there anyway.
2015-03-29 20:35:57 +11:00
Kevin Easton
f6d42f35d4 Fix spelling mistake in client message.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@521 13b04d17-f746-0410-82c6-800466cd88b0
2014-11-03 10:26:13 +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
de1145ffc9 Refine illegal message source characters: * is in, - is out.
IRCNet uses message sources like *.se (ie masked server names) after a
netsplit.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@509 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 13:44:45 +00:00
Kevin Easton
8fde6f8248 Don't allow message source name to include ','.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@507 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-14 12:37:56 +00:00
Kevin Easton
4d14d35d1a Allow nicknames to start with ~, apparently allowed by IRCnet.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@505 13b04d17-f746-0410-82c6-800466cd88b0
2014-10-05 22:19:39 +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
Tim Cava
112b38ac7a Revert the last commit. It accidentally had autogenerated files in it.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@432 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-07 03:00:24 +00:00
Tim Cava
276fd24258 Use snprintf rather than sprintf. From pvaldes.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@431 13b04d17-f746-0410-82c6-800466cd88b0
2013-11-07 02:41:16 +00:00
Kevin Easton
092d9789e0 Order the rfc1459[] array correctly.
This is a longstanding bug - it's also present in EPIC4 and EPIC5 so it's
probably been in BitchX since the beginning.  The bug has been latent until
the AUTHENTICATE and CAP commands were added, which perturbed the binary
search so that the client didn't see invite messages properly.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@235 13b04d17-f746-0410-82c6-800466cd88b0
2013-04-24 12:05:44 +00:00
Kevin Easton
73269ea887 Bail out of check_auto_reply() early if auto_str is NULL. This fixes a
crash after /SETAR -.

Reported by riderplus.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@234 13b04d17-f746-0410-82c6-800466cd88b0
2013-03-01 12:33:00 +00:00
Tim Cava
d7a0c781f8 Convert simple uses of alloca/strcpy to LOCAL_COPY.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@232 13b04d17-f746-0410-82c6-800466cd88b0
2013-02-24 07:32:59 +00:00
Kevin Easton
1541299fa1 Merge infrastructure for SASL authentication support from flashback.
This includes all of the underlying support, but doesn't hook it up to the
/SERVER command yet, so it's not useable at this point.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@216 13b04d17-f746-0410-82c6-800466cd88b0
2012-12-30 02:22:56 +00:00
Kevin Easton
1e7c7edd1b Use LOG_PUBLIC instead of LOG_MSG for PRIVMSGs sent to channels.
This doesn't tend to affect what window they go to, since for channels
there's always a target window based on the channel.  But it does
affect logging.

This was fixed in EPIC4 back in 2001.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@214 13b04d17-f746-0410-82c6-800466cd88b0
2012-10-19 12:25:25 +00:00
Kevin Easton
c45c6a69bf Cleanup p_mode() and correct handling of user mode changes where the source
and the target aren't the same (reported by gauze).  This doesn't happen
on standard servers, but is used by services on some networks.

Adds /FSET USERMODE_OTHER.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@114 13b04d17-f746-0410-82c6-800466cd88b0
2011-03-31 22:20:21 +00:00
Kevin Easton
789ed916cd Backport changes from epic5 to make recv_nick, sent_nick and sent_body
per-server, and apply new version of do_oops from flewid (the BX2 version). 

This means that /oops, "/query .", "/query ,", "/msg ." and "/msg ," are now
per-server, along with the $. $, and $B aliases.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@87 13b04d17-f746-0410-82c6-800466cd88b0
2010-06-26 08:18:34 +00:00
Kevin Easton
147ea72710 Some cleanups in quit message handling. Fixed a bug where a quit from a user
that isn't in a channel with the client (god knows how *that* happens, but
someone reported the bug...) could crash the client, because a NULL pointer 
is passed to logmsg().  The bug didn't show under glibc because it handles
the NULL pointer OK.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@58 13b04d17-f746-0410-82c6-800466cd88b0
2008-07-07 11:55:00 +00:00
Kevin Easton
a9267d0716 Merge r5 from branches/ircii-pana-1.1 (fixes for CVE-2007-3360).
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@36 13b04d17-f746-0410-82c6-800466cd88b0
2008-05-07 10:26:50 +00:00
Kevin Easton
3de93b1dbc Far-reaching changes to make BitchX compatible with 64 bit architectures
like x86-64, where sizeof(int) != sizeof (void *).  This involves correctly
casting every function pointer from the global table to the correct
function type, which has the added benefit of allowing type-checking of
function arguments and return values.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@26 13b04d17-f746-0410-82c6-800466cd88b0
2008-04-30 13:57:56 +00:00
Kevin Easton
533c3dbcbf Turn on SVN keyword replacement for $Date$, $Author$, $Revision$, $Id$ for all
*.c and *.h files.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/branches/ircii-pana-1.1@3 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:49:14 +00:00
Kevin Easton
28febcfea9 Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
2008-02-25 09:25:32 +00:00