Commit Graph

48 Commits

Author SHA1 Message Date
Kevin Easton
1769c03951 Replace set_server_flag() with update_server_umode() and remove get_possible_umodes()
The idea here is not to expose the internal server implementation for storing umodes,
but instead have callers just work in terms of umode characters.

The 'possible umodes' have always been the same for all servers anyway.  We just assume
that [a-zA-Z] is the bounding set.
2017-12-06 23:30:24 +11:00
Kevin Easton
305cfe2afb Move reinstate_user_modes() and update_user_mode() from funny.c to server.c and parse.c
Move these functions where they belong.
2017-12-06 22:13:34 +11:00
Kevin Easton
c4ba093ca5 Rework update_user_mode() 2017-12-04 17:43:47 +11:00
gdinit
bac141898b Correct spelling of some client messages, comments and function names 2017-10-20 14:57:17 +11:00
Kevin Easton
cd9c358eed Fix CHANGE_NICK_ON_KILL feature
Remove the 'resend_only' flag option to fudge_nickname().  The only caller passing it was the CHANGE_NICK_ON_KILL
feature, and in that case it was the wrong thing too (and stopped that function from working at all).

Some other minor cleanups in fudge_nickname() while we're there.
2017-07-15 23:29:14 +10:00
Kevin Easton
3c2028e167 Rename crypt_msg() / decrypt_msg() to sed_encrypt_msg() / sed_decrypt_msg() and move to ctcp.c
These functions are really specific to parsing and creating CTCP SED messages, which means they belong
in ctcp.c with the other CTCP code.

Also remove unnecessary inclusions of encrypt.h and ctcp.h.
2017-06-28 22:26:08 +10:00
Kevin Easton
0c51ac19d4 Cleanups and simplifications in p_privmsg 2017-06-26 17:11:08 +10:00
Kevin Easton
06aa5cb671 Move all handling of SED messages and notices into ctcp.c, re-enable SED notices
Actual encryped messages and notices are now printed directly from do_sed() / do_reply_sed().
Inline CTCP replacement is only done if the message cannot be decrypted (for the [ENCRYPTED MESSAGE]
placeholder).

This removes the need for the global flag 'sed' to alter the NOTICE and PRIVMSG handling.

A side-effect of this is that SED PRIVMSGs now do not go through the usual PRIVMSG ignore
and flood handling.  This is acceptable because messages can only go through this path if
the sender has actually been added as a SED peer with /ENCRYPT, and it still goes through
the CTCP ignore and flood handling.
2017-06-26 15:13:40 +10:00
Kevin Easton
64d524804c Test sent_kick instead of kickcount for KICKFLOOD kicking
kickcount is for counting KICKs sent by the user to detect KICK floods.
2017-06-11 00:36:53 +10:00
Kevin Easton
b4ec2f6a0e Minor cleanups in p_kick()
Remove dead store to ptr.  Rename 'who' to 'target'.
2017-06-10 23:34:22 +10:00
Kevin Easton
0a16ab16ac Introduce strbegins() macro and replace all open-coded instances
This test is done quite a bit across the tree, and the open-coded variants make it easy to have an
accidental mismatch between the length of the prefix being tested and the length actually passed to
strncmp().

This fixes an issue of that type comparing the server version against the prefix "u2.10", where the old
code used an incorrect length of 4.
2017-06-06 23:47:10 +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
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
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