Commit Graph

1392 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 027333e56a Fix some compiler warnings
`-Weverything' seems to have found a few problems.

Also enabled clang sanitizers by default.
2014-07-19 17:44:49 +02:00
Přemysl Eric Janouch 43d34d2473 Add a LIST_HEADER macro
To save us from specifying the `next' and `prev' pointers all the time.

It's not perfect, just a tiny bit better.
2014-07-18 19:51:15 +02:00
Přemysl Eric Janouch 353230b18b Cleanup 2014-07-18 01:03:21 +02:00
Přemysl Eric Janouch b2a4d38e8c Implement TIME, VERSION, MOTD, LUSERS 2014-07-17 23:51:34 +02:00
Přemysl Eric Janouch 86e3ae951e Fix the ERR_NOTREGISTERED message 2014-07-17 23:48:38 +02:00
Přemysl Eric Janouch 057a01e2e5 Send LUSERS output upon registration 2014-07-17 23:48:38 +02:00
Přemysl Eric Janouch 081b9f6bd2 Fix handling of multiple NICK's before a USER
We have to release the old nickname _first_, so that we can register the
same one again (albeit with a slight race condition).
2014-07-17 23:48:38 +02:00
Přemysl Eric Janouch b1780e3efb Send the user's mode after registration 2014-07-17 23:48:38 +02:00
Přemysl Eric Janouch 531b1c71bf Return `struct error' from irc_initialize_ssl() 2014-07-17 08:43:21 +02:00
Přemysl Eric Janouch a508f85bea Implement daemonization
Now we're a real daemon, yay.
2014-07-16 23:56:42 +02:00
Přemysl Eric Janouch 1842fa90dd Revise usage of print_{error,fatal}()
Let's limit print_fatal() to unexpected conditions.

Also added exit_fatal() to save a few lines of code.
2014-07-16 23:56:42 +02:00
Přemysl Eric Janouch e00d2079b5 Only print the first OpenSSL error
Otherwise TLS autodetection and TLS communication itself seem to work, yay!
2014-07-16 23:56:09 +02:00
Přemysl Eric Janouch d28b722489 str_map::key_cmp -> str_map::key_xfrm
It seemed to be almost too easy to be true, and it actually was.

Now it should work.
2014-07-16 21:23:30 +02:00
Přemysl Eric Janouch 996e0912c2 First bugfixes
Now we can at least successfully register.
2014-07-16 00:57:55 +02:00
Přemysl Eric Janouch c419946729 Cleanup
No functional changes.
2014-07-16 00:54:23 +02:00
Přemysl Eric Janouch 2921eed702 Rip out error codes
As it turns out, they're rather annoying to maintain, and we don't even need
them.  They also clutter the code unnecessarily in their current form.

If it ever comes to having to have them, let's make another version of
error_set(), maybe error_set_with_code(), that makes it possible to also set
an integer within `struct error'.

The only problem with the above solution is when we aggregate errors from
multiple functions (be it by calling one after another, or through nesting of
functions that may return an error).

But let's care about that when the time comes for it.
2014-07-16 00:53:59 +02:00
Přemysl Eric Janouch a2a979ea2e Make it possible to route messages to syslog 2014-07-15 22:23:53 +02:00
Přemysl Eric Janouch 18cb2941f3 Resolve paths relative to XDG config. paths
This should make the programs an awful lot less painful to set up.
2014-07-14 22:15:56 +02:00
Přemysl Eric Janouch b0cf09fb4c Rename `struct connection' to `struct client'
It is shorter and makes more sense.  Also replaced "conn" with "c"
to keep it even more concise, and thus clearer.
2014-07-14 22:15:56 +02:00
Přemysl Eric Janouch cc4ca46cc3 Add a utility to extract a message catalogs 2014-07-14 22:15:56 +02:00
Přemysl Eric Janouch b58ee27362 Implement client registration
And shuffle around some functions so that they form logical blocks (at least
I've tried; it's not that easy when you try to avoid forward declarations).
2014-07-14 02:38:56 +02:00
Přemysl Eric Janouch c7cd0c40e0 Add support for custom str_map key comp. fun.
That wasn't hard.
2014-07-14 02:06:02 +02:00
Přemysl Eric Janouch 3206c86430 Don't forget that channels have users 2014-07-14 00:36:16 +02:00
Přemysl Eric Janouch d40d34b4ca Miscellaneous little things 2014-07-14 00:14:37 +02:00
Přemysl Eric Janouch 586ccd4e87 Put a prolog at the top of configuration files
Later I'm going to put in there some more information about the format etc.
2014-07-13 23:50:44 +02:00
Přemysl Eric Janouch f52fab9448 Load X/Open message catalogs
This is going to enable making changes to ERR and RPL messages without
modifying the source code.

Localized messages could be interesting. :)
2014-07-13 23:47:29 +02:00
Přemysl Eric Janouch aaedbf93f1 Load an MOTD on start 2014-07-13 21:27:38 +02:00
Přemysl Eric Janouch 03ec980f26 Add a strtoul() wrapper 2014-07-13 05:56:30 +02:00
Přemysl Eric Janouch 51909edc76 Apparently it's the "realname" 2014-07-13 05:38:05 +02:00
Přemysl Eric Janouch ab651284a2 Initialize the server name 2014-07-13 05:05:01 +02:00
Přemysl Eric Janouch 475c83618a Only compile regex's once 2014-07-13 04:30:23 +02:00
Přemysl Eric Janouch 4904128c98 Add a few token validation functions 2014-07-13 03:26:33 +02:00
Přemysl Eric Janouch ccb2e4006d Implement irc_try_write() 2014-07-12 23:17:38 +02:00
Přemysl Eric Janouch 5ad2781681 Rename connection_abort() to connection_kill() 2014-07-12 23:17:38 +02:00
Přemysl Eric Janouch 93450332fe Implement irc_try_read() 2014-07-12 23:17:38 +02:00
Přemysl Eric Janouch 13d3299816 Fix connection abortion 2014-07-12 22:54:35 +02:00
Přemysl Eric Janouch cdaab8fdf0 Move `SSL_CTX *' into `struct server_context'
It didn't make much sense to parse the configuration values and load the SSL
keys on each connection.
2014-07-12 22:00:54 +02:00
Přemysl Eric Janouch 0cb51320d6 Implement an iterator for `struct str_map' 2014-07-12 21:19:44 +02:00
Přemysl Eric Janouch 1edcbc5f3d Implement parsing of IRC 3.2 message tags
It's still in the making and we don't use it, but let's not fail on it if e.g.
a plugin decides to enable it.
2014-07-12 21:17:22 +02:00
Přemysl Eric Janouch 651d49ca9b Add .gitignore 2014-07-12 21:17:22 +02:00
Přemysl Eric Janouch 705c0e943e WIP: add a stub IRC daemon named `kike'
As it is going to share a great lot of functionality with ZyklonB, I have
decided to extract the common parts into `common.c' and make the two subprojects
include this file.

The Single Compile Unit concept has proven valuable (sub-second compile times,
dead code warnings, almost no need for function declarations, whole-program
optimizations), and the sources aren't that long so far anyway.

I am probably going to add CMake support later but so far it's not a priority.
This project is meant to be portable and freely relocatable (ie. no hardcoded
paths if I can avoid it).
2014-07-12 21:09:50 +02:00
Přemysl Eric Janouch 165a19da21 Initial commit 2014-07-05 01:28:16 +02:00