X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/f4d828ef96f60d51c29c9d15387d3fea6254d411..b5bf3505123e6667643af92563f2d14d6ab3b7c1:/modules/m_alias.c diff --git a/modules/m_alias.c b/modules/m_alias.c index 7b47e134..2645f121 100644 --- a/modules/m_alias.c +++ b/modules/m_alias.c @@ -31,16 +31,17 @@ #include "numeric.h" #include "send.h" #include "packet.h" +#include "s_assert.h" static const char alias_desc[] = "Provides the system for services aliases"; static int _modinit(void); static void _moddeinit(void); -static int reload_aliases(hook_data *); +static void reload_aliases(void *); static void m_alias(struct MsgBuf *, struct Client *, struct Client *, int, const char **); mapi_hfn_list_av1 alias_hfnlist[] = { - { "rehash", (hookfn)reload_aliases }, + { "rehash", reload_aliases }, { NULL, NULL }, }; @@ -61,7 +62,7 @@ create_aliases(void) RB_DICTIONARY_FOREACH(alias, &iter, alias_dict) { struct Message *message = rb_malloc(sizeof(*message) + strlen(alias->name) + 1); - char *cmd = (void*)message + sizeof(*message); + char *cmd = (char*)message + sizeof(*message); /* copy the alias name as it will be freed early on a rehash */ strcpy(cmd, alias->name); @@ -99,12 +100,11 @@ _moddeinit(void) destroy_aliases(); } -static int -reload_aliases(hook_data *data) +static void +reload_aliases(void *data) { destroy_aliases(); /* Clear old aliases */ create_aliases(); - return 0; } /* The below was mostly taken from the old do_alias */ @@ -113,7 +113,7 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p, { struct Client *target_p; struct alias_entry *aptr = rb_dictionary_retrieve(alias_dict, msgbuf->cmd); - char *p, *str; + char *p; if(aptr == NULL) { @@ -150,8 +150,8 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p, return; } - str = reconstruct_parv(parc, parv); - if(EmptyString(str)) + msgbuf_reconstruct_tail(msgbuf, 1); + if(EmptyString(parv[1])) { sendto_one(client_p, form_str(ERR_NOTEXTTOSEND), me.name, target_p->name); return; @@ -160,5 +160,5 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p, sendto_one(target_p, ":%s PRIVMSG %s :%s", get_id(client_p, target_p), p != NULL ? aptr->target : get_id(target_p, target_p), - str); + parv[1]); }