Commit Graph

610 Commits

Author SHA1 Message Date
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
94f4e1c2a3 Don't #include <sys/ioctl.h> or <unistd.h> more than once
<unistd.h> is included by irc.h so it does not need to be included again here.

<sys/ioctl.h> only needs to be included once.
2016-03-18 16:46:36 +11:00
Kevin Easton
82d606979b Add HAVE_*_H checks around inclusions of netinet/in.h and sys/socket.h
Only include <netinet/in.h> and <sys/socket.h> if the system supplies them.
This is necessary to try and get the mingw32 build working again.

No need to include <sys/types.h> and <netinet/in.h> from cdns.c - these are
already included by <irc.h>.
2016-03-17 21:39:17 +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
f2ae2327e3 Improve toplevel Makefile "all" target to work better with parallel make
Change the all: target in the toplevel Makefile so that it doesn't try to
resolve build dependencies at the top level - instead, it just recursively
builds the all: target in source/ and dll/.

Change the all: target in the source/Makefile so that it builds the EXTRAS
(scr-bx and wserv) as well as the main client binary.

The upshot of all this is that one "make" invocation is responsible for both
scr-bx and wserv, which is necessary for parallel make (make -j) to work
correctly as these binaries share some object files.
2016-02-19 22:54:50 +11:00
Kevin Easton
04f5138a6c Improve a couple of messages in /window create 2015-11-11 17:05:58 +11:00
Kevin Easton
8886c20c1b Improve messages shown by /window size 2015-11-11 14:59:21 +11:00
Kevin Easton
4ee14e00c2 Minor cleanup in add_userhost_to_dcc() 2015-10-29 22:17:10 +11:00
Kevin Easton
a2e8e103e0 Modularise handling of DCC offers
There's several different types of DCC offers, all of which need slightly
different handling.  Previously they were all handled by the monster function
register_dcc_type() - this breaks them out into seperate functions for handling
SEND, RESEND, CHAT and BOT offers, moves common code into static helper
functions and renames the entry point from ctcp.c to handle_dcc_offer().

This will allow adding a way for modules to register DCC offer types that
they're interested in.

This also moves rename_file() from misc.c into dcc.c, where its only user is.
2015-10-28 21:46:38 +11:00
Kevin Easton
af3b0c920a Change find_name_in_genericlist() to take const char * argument 2015-10-28 21:42:33 +11:00
Kevin Easton
f2262d5b01 Change hash_nickname() to take a const char * argument 2015-10-28 21:38:26 +11:00
Kevin Easton
a24f1d12ec Convert lookup_userlevelc() to accept const char * parameters
Also converted dependant functions check_channel_match() and
find_bestmatch() to use const char *.
2015-10-20 23:12:33 +11:00
Kevin Easton
51ecdb8d1b Re-add code for DCC CHAT autoget mistakenly removed in [be6bd5aca] 2015-10-12 17:22:52 +11:00
Kevin Easton
cfe6735ef0 Simplify find_dcc() and find_dcc_pending()
Extract the common DCC matching code into one function and simplify
it a little.
2015-10-12 16:26:23 +11:00
Kevin Easton
fe368ac875 Fix argument order for dcc_getfile_resume_start()
The last two arguments are port, then offset (as per the DCC ACCEPT CTCP
command).  We don't really use these anyway - port is passed to dcc_create()
but for pre-existing DCC entries all that did was add it to the socketinfo,
which doesn't seem to have any real effect.

Also fix dcc_create() so it passes the actual remote port to add_socketread()
(as above, this doesn't seem to have any real effect but is consistent with
the other code).
2015-10-10 22:48:26 +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
c173af3f65 Remove unused DCC_CNCT_PEND flag and always define DCC_SSL
DCC_CNCT_PEND was only ever set, not tested, so it was pointless.

There's no point only defining DCC_SSL when HAVE_SSL is defined: we can't
re-use that flag bit anyway, so might as well just define it always.

Also fixes a "flags && DCC_WAIT" that should have been "flags & DCC_WAIT".
This has no practical effect though I believe, since as far as I can tell
DCC_WAIT would always be set at that point anyway.
2015-10-03 22:10:15 +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
e0bdc609c1 Fix type mismatches and remove unused variables in nap plugin
Should just fix compiler warnings.
2015-09-10 17:00:09 +10:00
Kevin Easton
6d6717e56e Fix type mismatch errors in fserv module
No functional change, this just fixes some compiler warnings.
2015-09-10 16:31:34 +10:00
Kevin Easton
723cb5be9b Remove some set-but-not-used variables in the cavlink module
Cleans up some compiler warnings.
2015-09-10 14:57:00 +10:00
Kevin Easton
c99345f1ce Fix char / unsigned char mismatch in blowfish module
Cleans up a compile warning, no functional change.
2015-09-09 23:14:01 +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
642ab8829d Fix up some type mismatch errors in the arcfour module 2015-09-07 17:12:04 +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
9606ab312f Remove now-unused stripansi() function. 2015-09-06 22:54:12 +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
d62914af15 Optimise add_last_type() and change it to accept const char * pointers
The optimisation reduces the number of malloc_strcpy() calls, from 50 to 5
for most last types.
2015-09-03 01:04:12 +10:00
Kevin Easton
c881dd7a9a Change 'from' and 'format' arguments of logmsg() to const char *
This allows callers to pass const char * pointers to them.
2015-09-02 23:39:53 +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
75bd647d15 Switch stripansi() to stripansicodes() in the CTCP reply parser.
stripansi() actually just munged control-characters, so it just turned ANSI
codes into visible junk.

stripansicodes() instead leaves control characters alone but removes complete
ANSI sequences from the string.  I'm not sure if even that is necessary,
really - after all, we always allowed ^B, ^C etc style formatting in CTCP
replies.
2015-08-30 22:03:38 +10:00
Kevin Easton
498631e74a Introduce get_kick_reason() and switch all kick commands to use it
get_reason() is then used only for the implementation of get_kick_reason()
and for the $getreason() scripting function.  Add current nick as an
explicit argument for get_reason(), which pushes all use of from_server
out of the ransom reason functions.

Also switch a few instances of send_to_server() to my_send_to_server() where
the current server has been returned by prepare_command().
2015-06-28 00:35:50 +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
27e32a0319 Cleanup and simplify get_reason() and related functions
Rename randreason() to fread_random() to better reflect its function,
and change it to a one-pass algorithm.  Have it write into a caller-provided
buffer instead of a static buffer.  Fixes a file leak when an empty
file is given to this function.

Change freadln() so that it never returns an empty line - it only returns
0 at end-of-file now.  This simplifies its callers.

Factor out some common code from the several get_reason()-type functions,
which greatly simplifies them.
2015-06-27 00:38:40 +10:00
Kevin Easton
5f4429bf7b Removed unused variable from output_reject_ctcp()
Also remove unnecessary tests for stuff and stuff->user - these are always
non-null when the callback is called.
2015-06-25 11:45:09 +10:00
Kevin Easton
ee0cd23ae5 Rearrange code in bankick() to silence a compiler warning
Re-checking the command name to see if it's a timed ban means that the
compiler can't see that it's the same check.

This also makes sure you can't specify a negative timeout.
2015-06-24 23:38:28 +10:00
Kevin Easton
28bd7a66b6 Remove useless check for !nick from userhostbase callbacks
The userhostbase callback is always called with non-null nick.  Checking for
this is just noise which also sometimes results in odd compiler warnings.
2015-06-24 23:20:53 +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
90f85dec0c Clean up unsigned char / char mismatches in screen.c
Also remove a couple of unused variables in prepare_display()
and create_additional_screen().
2015-06-21 22:50:44 +10:00
Kevin Easton
91d6169cb7 Fix unsigned char / char mismatches in a few remaining places in functions.c
Also slightly clean up function_stripansi(), removing a redundant mask.
2015-06-21 18:01:11 +10:00
Kevin Easton
69bbcfd83d Convert stripansi() from unsigned char to char
This silences a few compiler warnings.

This also cleans the function up by removing some always-true checks.
I'm not convinced that this function makes a whole lot of sense, though.
Will look into it further...
2015-06-21 00:18:03 +10:00