diff options
author | Test_User <hax@andrewyu.org> | 2023-08-10 03:20:10 -0400 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2023-08-10 03:20:10 -0400 |
commit | 833f715ec2a6917c0afb4300e6505b135410ec3a (patch) | |
tree | 2db0dede15484873564ee3f56b7f7bddbf8cf805 /commands.c | |
parent | c58679ab1055fc48e31ebc661d38f470bdec3142 (diff) | |
download | c_coupserv-833f715ec2a6917c0afb4300e6505b135410ec3a.tar.gz c_coupserv-833f715ec2a6917c0afb4300e6505b135410ec3a.zip |
privmsg() now takes an array rather than a single string, more stuff switched from server-only to privmsg()
Diffstat (limited to 'commands.c')
-rw-r--r-- | commands.c | 25 |
1 files changed, 8 insertions, 17 deletions
@@ -43,23 +43,14 @@ int help_command(struct string sender, struct string original_message, struct st for (uint64_t i = 0; i < user_commands.len; i++) { struct command_def *def = user_commands.array[i].ptr; - uint64_t len = command_prefix.len; - len += user_commands.array[i].name.len; - len += 2; - len += def->summary.len; - - char data[len]; - struct string message = {.data = data, .len = len}; - uint64_t offset = 0; - memcpy(&(message.data[offset]), command_prefix.data, command_prefix.len); - offset += command_prefix.len; - memcpy(&(message.data[offset]), user_commands.array[i].name.data, user_commands.array[i].name.len); - offset += user_commands.array[i].name.len; - memcpy(&(message.data[offset]), "\x0F" " ", 2); - offset += 2; - memcpy(&(message.data[offset]), def->summary.data, def->summary.len); - - privmsg(STRING("1HC000000"), to, message); + struct string message[] = { + command_prefix, + user_commands.array[i].name, + STRING("\x0F" " "), + def->summary, + }; + + privmsg(STRING("1HC000000"), to, sizeof(message)/sizeof(*message), message); } return 0; |