1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-27 16:06:38 +02:00
Commit Graph

2365 Commits

Author SHA1 Message Date
Bram Matthys 720f597ad6 Get rid of current snomask system and allow ircops to set any snomask
(that is: a-z A-Z) so to use the dynamic system with the new logging.
Largely untested.
2021-09-22 15:49:20 +02:00
Bram Matthys 7fdd14de95 Remove sendto_snomask() and sendto_snomask_global() as this is no longer
the way we do things with the new logging stuff.

And converted the last few calls to these functions to unreal_log().
2021-09-22 14:27:50 +02:00
Bram Matthys 381454bd1d 1) Change from .prefix_priority to .rank.
2) Make higher value = higher ranking
3) Ship with defines for these:
 #define RANK_CHANOWNER  4000
 #define RANK_CHANADMIN  3000
 #define RANK_CHANOP     2000
 #define RANK_HALFOP     1000
 #define RANK_VOICE        -1
2021-09-20 16:09:14 +02:00
Bram Matthys 139098919b Get rid of PREFIX_* in sendto_channel(), message.c and in chanmsg hook.
We use char *member_modes like we now have at all the other places,
which contains eg "o".

TODO: fix prefix sending rules or remove some if 0'd out code

And not sure if we want to do it entirely this way :D
2021-09-20 15:54:57 +02:00
Bram Matthys 6277efd85e Make SAJOIN code use generic prefix framework. Also fix multi-channel
joins in such a case, code was wrong (things being done in the wrong
scope).

This also fixes a bug where an OperOverride message was generated
for SAJOIN nick @#test
2021-09-20 14:19:04 +02:00
Bram Matthys 83f4619e78 Get rid of the choice for/aginst PREFIX_AQ for three reasons:
1) All IRC clients support prefixes nowadays
2) People generally misunderstand the question and think this
   disabled +q (channel owner) and +a (channel admin), when
   in fact it does not. It only enables/disables the showing
   of prefixes, and it changes some of the rules eg requiring
   +qo / +ao for actions that normally only require +q / +a.
3) We now have the modularized +q and +a, so you can actually
   disable channel owner and channel admin, which is what most
   users want(ed) that previously disabled PREFIX_AQ.

For all users (95%+) that enable PREFIX_AQ there is no effective
change. For the other 5% it is likely only for the better.
2021-09-20 13:19:51 +02:00
Bram Matthys 4cea88645c Modularize member modes (vhoaq).
Still need to clean up a bit after this, but it passes all tests :)
2021-09-13 18:44:18 +02:00
Bram Matthys 6586fe8acd Remove all unused numerics from include/numeric.h. 2021-09-12 16:46:25 +02:00
Bram Matthys cf936078d4 Get rid of the legacy numeric stuff. The file src/numeric.c is removed
as all the numerics are in include/numeric.h now, so we can have
format string checks with a few macro tricks.
(See also previous commits)
2021-09-12 16:31:26 +02:00
Bram Matthys 6237bf5f5f Convert watch code to use new sendnumeric(), getting rid of the temporary
sendnumeric_legacy() calls.

This also fixes some small format string bugs (eg: argument too much and
some time_t fun, like the previous commits elsewhere... nothing fancy).
2021-09-12 16:28:04 +02:00
Bram Matthys 4392468c3e Update HOOKTYPE_CAN_JOIN and HOOKTYPE_CAN_JOIN_LIMITEXCEEDED to take
an extra char **errmsg argument. Upon failure (non zero return value)
this should contain a format string to be sent to the client
(with the return value denoting the number of the numeric).

This gets rid of sendnumeric_legacy() in join.c
2021-09-12 16:09:36 +02:00
Bram Matthys e27749f556 Use long long casts due to time_t difference on Windows vs Linux.
Should now compile without errors on both.
2021-09-12 15:29:26 +02:00
Bram Matthys e046ec7244 Regenerate and mention actual number of the numeric in STR_ERR_*/STR_RPL_*. 2021-09-12 14:46:43 +02:00
Bram Matthys fc9bf5d607 Change sendnumeric() so it can check for format string problems.
This already found a few issues.

As a side-effect, this also means you can only use RPL_xxx and
ERR_xxx in the 2nd argument from now on. You can no longer use
a dynamic integer (eg 'reply') at runtime, since then the format
string cannot be checked.

More to follow, after making sure it works on Windows too.
2021-09-12 14:30:34 +02:00
Bram Matthys 6577721089 Get rid of the option to show modes in /LIST. Always do this.
I don't think there were more than a handful of people who disabled
this, and it clutters the source badly (not to mention that this
should not be a compile time option at all).
2021-09-12 11:28:07 +02:00
Bram Matthys 6ce95c3d79 Fixes for previous commit now that we use -Waddress (well, implicitly
through -Wall/-Wextra)
2021-09-12 09:19:46 +02:00
Bram Matthys 8353a9e17b Change char *parv[] to const char *parv[] everywhere. This is a BIG change.
It means you can no longer modify eg parv[1] in-place with strtoken and such.

The main reason for this is that as a command handler you have no idea
where the arguments may come from. It could be from a do_cmd() with
read-only storage (eg a string literal) and so on.

It started with an experiment of how far I could get and how annoying the
side-effects would be, but they seem to be quite managable, so I'm
committing this stuff.

Hopefully this catches/solves some stupid bugs somewhere :)
2021-09-11 16:02:44 +02:00
Bram Matthys 39edbd643d Get rid of proto.h and integrate the 20 lines into h.h. 2021-09-11 10:26:18 +02:00
Bram Matthys 5dc6411419 Const const const. This completes the work in h.h. 2021-09-11 10:21:54 +02:00
Bram Matthys fcf020b99e It's raining consts... 2021-09-11 09:56:22 +02:00
Bram Matthys 7cabd4b79e Const const const 2021-09-11 08:17:12 +02:00
Bram Matthys ac84d4f207 Const const const... modules.c and elsewhere. 2021-09-11 07:53:30 +02:00
Bram Matthys 5bc244c1f3 Add a lot more consts. This finishes the work for all hooktypes. 2021-09-10 20:36:38 +02:00
Bram Matthys 74d1481dcb Do the same for RunHookReturn() and RunHookReturnInt().
NOTE: The arguments are swapped, it is now eg:
RunHookReturn(HOOKTYPE_SOMETHING, !=0, a, b, c);
2021-09-10 19:32:17 +02:00
Bram Matthys 7dac12e31e Get rid of RunHook2/3/4/5/6/etc and just have RunHook with __VA_ARGS__ 2021-09-10 19:27:18 +02:00
Bram Matthys cb9b24686b Module API changes:
- For HOOKTYPE_LOCAL_JOIN and HOOKTYPE_REMOTE_JOIN: drop parv[] argument
  as it was useless anyway, it only contained the channel name in parv[1]
  but never the key, sometimes was entirely NULL even.
- For HOOKTYPE_PRE_LOCAL_JOIN instead of char *parv[] we now pass
  const char *key. As predicted more than a year ago when fixing
  0902ed7a99
2021-09-10 19:22:47 +02:00
Bram Matthys 5b091975f5 Get rid of parv[] in HOOKTYPE_CAN_JOIN and HOOKTYPE_CAN_JOIN_LIMITEXCEEDED
as it already has a 'key' argument too.
2021-09-10 19:11:37 +02:00
k4be e13815b604 Add extjwt module 2021-09-10 16:19:07 +02:00
Bram Matthys 86fa29aaee Add consts in support.c 2021-09-10 15:48:58 +02:00
Bram Matthys 9438ddfd93 Add consts in user.c 2021-09-10 15:40:50 +02:00
Bram Matthys 09a412782d Const stuff for misc.c 2021-09-10 15:25:21 +02:00
Bram Matthys 447555e044 More consts in stats.c 2021-09-10 15:07:17 +02:00
Bram Matthys f085173d46 More const char * stuff... mostly in conf.c but also elsewhere. 2021-09-10 15:01:23 +02:00
Bram Matthys 2e82ab0eca Make CommandOverrideAddEx() the new CommandOverrideAdd():
IOTW, change CommandOverrideAdd() to require a priority argument:
-       CommandOverrideAdd(modinfo->handle, "TEST", override_test);
+       CommandOverrideAdd(modinfo->handle, "TEST", 0, override_test);
2021-09-10 14:13:07 +02:00
Bram Matthys bba0124bd3 Drop the Ex... CallbackAdd*Ex() -> CallbackAdd*() 2021-09-10 14:09:22 +02:00
Bram Matthys 6ebddc8817 Update channel mode API to use more consts 2021-09-10 14:06:57 +02:00
Bram Matthys 08a32429ff Update extban API to use more consts 2021-09-10 13:39:26 +02:00
Bram Matthys d4d4da6a8d Add another const to ValidatePermissionsForPath. Fix Windows build, maybe? 2021-09-10 12:58:15 +02:00
Bram Matthys 66a51fb659 Massive conversions from 'char *' to 'const char *' and 'char **' to 'const char **' 2021-09-10 12:46:31 +02:00
Bram Matthys edfdfe4a03 Add HookAddConstString() and friends.
Also EfunctionAddPChar() -> EfunctionAddString(), and callbacks etc.
2021-09-10 11:59:14 +02:00
Bram Matthys a3bfa210e9 HookAddPChar() -> HookAddString()
and .pcharfunc -> .stringfunc
2021-09-10 11:49:06 +02:00
Bram Matthys fe3907f153 Use more const char * 2021-09-10 11:39:04 +02:00
Bram Matthys d648cd0729 Use strlncpy() everywhere where we previously used strlncat() with a empty
buffer (due to the lack of strlncpy before...).
2021-09-10 11:26:36 +02:00
Bram Matthys c550d95619 Add strlncpy(): works just like strlcpy except that it has an extra
argument which specifies how many characters to copy max.

strlncpy(dest, src, sizeof(dest), maxcopybytes);
vs
strlcpy(dest, src, MIN(sizeof(dest),maxcopybytes+1));

We already had a strlncat() vs strlcat()
2021-09-10 11:19:57 +02:00
Bram Matthys cd88e02f3d Use more const char * 2021-09-10 11:11:54 +02:00
Bram Matthys 463c7d4ddf Spoof remote connecting/disconnecting notices with sender being the
server where the client is (or was) on. Just like we did in UnrealIRCd 5.

Not sure if API-wise and variable-name-wise I want to do it this way,
but whatever...
2021-09-10 08:54:29 +02:00
Bram Matthys 9ef1d06afd Remove more unused stuff in dynconf.h, and drop set::dns which did
nothing since 3.2 or so.
2021-09-03 21:17:51 +02:00
Bram Matthys 13dc17f5dc Code cleanup: remove unused structs and variables. 2021-09-03 21:07:38 +02:00
Bram Matthys 617288991e Remove find_except(), conf_except and struct ConfigItem_except.
These are all unused since the addition of ELINE.
2021-09-03 20:46:06 +02:00
Bram Matthys f3c7b8c456 Windows: fix an external variable not being MODVAR, causing a funny
"no more connections available" error. Oh Windows.... such a joy!!!
[skip ci]
2021-08-29 12:19:15 +02:00