Commit Graph

13 Commits

Author SHA1 Message Date
Kevin Easton
496bbc8b74 Add send_text() flag STXT_LOG
Eventually to replace the 'log' parameter to send_text().
2017-07-08 21:49:59 +10:00
Kevin Easton
2d0b3e728f Replace 'hook' and 'noisy' flags in functions downstream of send_text() with !(stxt_flags & STXT_QUIET)
This is in preparation for consolidating the various send_text() options into one set of consistent flags.
2017-07-07 15:19:39 +10:00
Kevin Easton
3f87eb31b1 Standardise header include guards
Tokens that begin with two underscores __* or an underscore and an uppercase letter _X* are reserved,
so we should avoid those for our own include guards.  The standard I'm settling on for foo.h is FOO_H_.
2017-05-10 23:30:11 +10:00
Kevin Easton
492d5658d1 Simplify handling of /DETACH socket path
init_socketpath() was building a sprintf() format string intended to be used by /DETACH to create the socket
file name.  This included the actual socket path, plus a %d for the port, plus the sanitised tty name and
hostname.

Only one caller needed all this though - the /DETACH command - and the other callers (in scr-bx.c) just
wanted to truncate it to the actual socket path.  The format string also wasn't safe - if the home directory
path, hostname or ttyname contained % characters these werent being escaped.

It simplifies things to have init_socketpath() just return the actual socket path, after creating the 'screens'
directory if necessary.  This lets the code in scr-bx.c use it as-is, and removes the need for the global
socket_path variable.  The code to include the sanitised tty name and hostname in the socket file name can
be moved to the create_ipc_socket() function.

There's no need to check access() for the socket path before trying to create it - just call mkdir() regardless,
since it will fail if the path already exists, which is fine.

This commit also adds error handling to the create_ipc_socket() function for the case where creation of the
socket file fails, and switches the chmod() and chown() for the opened file to the more appropriate fchmod()
and fchown().
2017-05-03 00:13:24 +10: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
563493dd6a Add COLOR_CHAR and BELL_CHAR defines to replace open-coded values 2015-06-16 19:06:30 +10: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
Tim Cava
44e59337ee Include the size of hostname, nickname, realname, userhost and username
in their forward declarations.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@313 13b04d17-f746-0410-82c6-800466cd88b0
2013-08-12 10:36:14 +00:00
Kevin Easton
d22a4531d8 Update old email addresses in user-visible messages.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@206 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-13 12:34:32 +00:00
Kevin Easton
252d1bf004 On systems that support it, supply the AI_ADDRCONFIG flag to getaddrinfo().
This means that we shouldn't try to connect using IPv6 if the local machine
doesn't have an IPv6 address itself.

This also simplifies the IPv6 code in BX_connect_by_number() a bit.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@203 13b04d17-f746-0410-82c6-800466cd88b0
2012-06-02 11:38:37 +00:00
Kevin Easton
5cf8ed2c79 Cleanup create_ipc_socket() and ensure it detects all errors in
connect_by_number().  Make function static since it is only used in one
source file.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@145 13b04d17-f746-0410-82c6-800466cd88b0
2012-02-01 13:21:47 +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