diff --git a/include/h.h b/include/h.h index b3fb7c798..78b94e417 100644 --- a/include/h.h +++ b/include/h.h @@ -670,7 +670,7 @@ extern void del_async_connects(void); extern void isupport_init(void); extern void clicap_init(void); extern void efunctions_init(void); -extern void do_cmd(Client *client, MessageTag *mtags, char *cmd, int parc, char *parv[]); +extern void do_cmd(Client *client, MessageTag *mtags, const char *cmd, int parc, char *parv[]); extern MODVAR char *me_hash; extern MODVAR int dontspread; extern MODVAR int labeled_response_inhibit; @@ -755,7 +755,7 @@ extern MODVAR char *(*charsys_get_current_languages)(void); extern MODVAR void (*broadcast_sinfo)(Client *acptr, Client *to, Client *except); extern MODVAR void (*connect_server)(ConfigItem_link *aconf, Client *by, struct hostent *hp); extern MODVAR void (*parse_message_tags)(Client *cptr, char **str, MessageTag **mtag_list); -extern MODVAR char *(*mtags_to_string)(MessageTag *m, Client *acptr); +extern MODVAR const char *(*mtags_to_string)(MessageTag *m, Client *acptr); extern MODVAR int (*can_send_to_channel)(Client *cptr, Channel *channel, const char **msgtext, const char **errmsg, int notice); extern MODVAR void (*broadcast_md_globalvar)(ModDataInfo *mdi, ModData *md); extern MODVAR void (*broadcast_md_globalvar_cmd)(Client *except, Client *sender, const char *varname, const char *value); @@ -803,7 +803,7 @@ extern MODVAR EVP_MD *md5_function; /* End of TLS functions */ extern void parse_message_tags_default_handler(Client *client, char **str, MessageTag **mtag_list); -extern char *mtags_to_string_default_handler(MessageTag *m, Client *client); +extern const char *mtags_to_string_default_handler(MessageTag *m, Client *client); extern void *labeled_response_save_context_default_handler(void); extern void labeled_response_set_context_default_handler(void *ctx); extern void labeled_response_force_end_default_handler(void); diff --git a/include/modules.h b/include/modules.h index 965854797..783b28340 100644 --- a/include/modules.h +++ b/include/modules.h @@ -483,13 +483,13 @@ typedef struct { /** Message Tag Handler */ struct MessageTagHandler { MessageTagHandler *prev, *next; - char *name; /**< The name of the message-tag */ - int flags; /**< A flag of MTAG_HANDLER_FLAGS_* */ - int (*is_ok)(Client *, char *, char *); /**< Verify syntax and access rights */ - int (*should_send_to_client)(Client *); /**< Tag may be sent to this client (normally NULL!) */ - Module *owner; /**< Module introducing this CAP. */ - ClientCapability *clicap_handler; /**< Client capability handler associated with this */ - char unloaded; /**< Internal flag to indicate module is being unloaded */ + char *name; /**< The name of the message-tag */ + int flags; /**< A flag of MTAG_HANDLER_FLAGS_* */ + int (*is_ok)(Client *, const char *, const char *); /**< Verify syntax and access rights */ + int (*should_send_to_client)(Client *); /**< Tag may be sent to this client (normally NULL!) */ + Module *owner; /**< Module introducing this CAP. */ + ClientCapability *clicap_handler; /**< Client capability handler associated with this */ + char unloaded; /**< Internal flag to indicate module is being unloaded */ }; /** The struct used to register a message tag handler. @@ -498,7 +498,7 @@ struct MessageTagHandler { typedef struct { char *name; int flags; - int (*is_ok)(Client *, char *, char *); + int (*is_ok)(Client *, const char *, const char *); int (*should_send_to_client)(Client *); ClientCapability *clicap_handler; } MessageTagHandlerInfo; @@ -549,10 +549,10 @@ typedef struct HistoryBackend HistoryBackend; struct HistoryBackend { HistoryBackend *prev, *next; char *name; /**< The name of the history backend (eg: "mem") */ - int (*history_set_limit)(char *object, int max_lines, long max_time); /**< Impose a limit on a history object */ - int (*history_add)(char *object, MessageTag *mtags, char *line); /**< Add to history */ - HistoryResult *(*history_request)(char *object, HistoryFilter *filter); /**< Request history */ - int (*history_destroy)(char *object); /**< Destroy history of this object completely */ + int (*history_set_limit)(const char *object, int max_lines, long max_time); /**< Impose a limit on a history object */ + int (*history_add)(const char *object, MessageTag *mtags, const char *line); /**< Add to history */ + HistoryResult *(*history_request)(const char *object, HistoryFilter *filter); /**< Request history */ + int (*history_destroy)(const char *object); /**< Destroy history of this object completely */ Module *owner; /**< Module introducing this */ char unloaded; /**< Internal flag to indicate module is being unloaded */ }; @@ -562,10 +562,10 @@ struct HistoryBackend { */ typedef struct { char *name; - int (*history_set_limit)(char *object, int max_lines, long max_time); - int (*history_add)(char *object, MessageTag *mtags, char *line); - HistoryResult *(*history_request)(char *object, HistoryFilter *filter); - int (*history_destroy)(char *object); + int (*history_set_limit)(const char *object, int max_lines, long max_time); + int (*history_add)(const char *object, MessageTag *mtags, const char *line); + HistoryResult *(*history_request)(const char *object, HistoryFilter *filter); + int (*history_destroy)(const char *object); } HistoryBackendInfo; struct Hook { @@ -739,10 +739,10 @@ extern MODVAR Hooktype Hooktypes[MAXCUSTOMHOOKS]; extern MODVAR Callback *Callbacks[MAXCALLBACKS], *RCallbacks[MAXCALLBACKS]; extern MODVAR ClientCapability *clicaps; -extern Event *EventAdd(Module *module, char *name, vFP event, void *data, long every_msec, int count); +extern Event *EventAdd(Module *module, const char *name, vFP event, void *data, long every_msec, int count); extern void EventDel(Event *event); extern Event *EventMarkDel(Event *event); -extern Event *EventFind(char *name); +extern Event *EventFind(const char *name); extern int EventMod(Event *event, EventInfo *mods); extern void DoEvents(void); extern void EventStatus(Client *client); @@ -823,7 +823,7 @@ __extension__ ({ \ extern Hook *HookAddMain(Module *module, int hooktype, int priority, int (*intfunc)(), void (*voidfunc)(), char *(*stringfunc)(), const char *(*conststringfunc)()); extern Hook *HookDel(Hook *hook); -extern Hooktype *HooktypeAdd(Module *module, char *string, int *type); +extern Hooktype *HooktypeAdd(Module *module, const char *string, int *type); extern void HooktypeDel(Hooktype *hooktype, Module *module); #define RunHook(hooktype,...) do { Hook *h; for (h = Hooks[hooktype]; h; h = h->next) (*(h->func.intfunc))(__VA_ARGS__); } while(0) @@ -866,8 +866,8 @@ extern Callback *CallbackDel(Callback *cb); extern Efunction *EfunctionAddMain(Module *module, EfunctionType eftype, int (*intfunc)(), void (*voidfunc)(), void *(*pvoidfunc)(), char *(*stringfunc)(), const char *(*conststringfunc)()); extern Efunction *EfunctionDel(Efunction *cb); -extern Command *CommandAdd(Module *module, char *cmd, CmdFunc func, unsigned char params, int flags); -extern Command *AliasAdd(Module *module, char *cmd, AliasCmdFunc aliasfunc, unsigned char params, int flags); +extern Command *CommandAdd(Module *module, const char *cmd, CmdFunc func, unsigned char params, int flags); +extern Command *AliasAdd(Module *module, const char *cmd, AliasCmdFunc aliasfunc, unsigned char params, int flags); extern void CommandDel(Command *command); extern void CommandDelX(Command *command, RealCommand *cmd); extern int CommandExists(const char *name); diff --git a/src/api-command.c b/src/api-command.c index 3ce6501a8..a6054639f 100644 --- a/src/api-command.c +++ b/src/api-command.c @@ -23,8 +23,8 @@ #include "unrealircd.h" /* Forward declarations */ -static Command *CommandAddInternal(Module *module, char *cmd, CmdFunc func, AliasCmdFunc aliasfunc, unsigned char params, int flags); -static RealCommand *add_Command_backend(char *cmd); +static Command *CommandAddInternal(Module *module, const char *cmd, CmdFunc func, AliasCmdFunc aliasfunc, unsigned char params, int flags); +static RealCommand *add_Command_backend(const char *cmd); /** @defgroup CommandAPI Command API * @{ @@ -53,7 +53,7 @@ int CommandExists(const char *name) * @param flags Who may execute this command - one or more CMD_* flags * @returns The newly registered command, or NULL in case of error (eg: already exist) */ -Command *CommandAdd(Module *module, char *cmd, CmdFunc func, unsigned char params, int flags) +Command *CommandAdd(Module *module, const char *cmd, CmdFunc func, unsigned char params, int flags) { if (flags & CMD_ALIAS) { @@ -75,7 +75,7 @@ Command *CommandAdd(Module *module, char *cmd, CmdFunc func, unsigned char param * @param flags Who may execute this command - one or more CMD_* flags * @returns The newly registered command (alias), or NULL in case of error (eg: already exist) */ -Command *AliasAdd(Module *module, char *cmd, AliasCmdFunc aliasfunc, unsigned char params, int flags) +Command *AliasAdd(Module *module, const char *cmd, AliasCmdFunc aliasfunc, unsigned char params, int flags) { if (!(flags & CMD_ALIAS)) flags |= CMD_ALIAS; @@ -84,7 +84,7 @@ Command *AliasAdd(Module *module, char *cmd, AliasCmdFunc aliasfunc, unsigned ch /** @} */ -static Command *CommandAddInternal(Module *module, char *cmd, CmdFunc func, AliasCmdFunc aliasfunc, unsigned char params, int flags) +static Command *CommandAddInternal(Module *module, const char *cmd, CmdFunc func, AliasCmdFunc aliasfunc, unsigned char params, int flags) { Command *command = NULL; RealCommand *c; @@ -191,7 +191,7 @@ void CommandDel(Command *command) * @note If mtags is NULL then new message tags are created for the command * (and destroyed before return). */ -void do_cmd(Client *client, MessageTag *mtags, char *cmd, int parc, char *parv[]) +void do_cmd(Client *client, MessageTag *mtags, const char *cmd, int parc, char *parv[]) { RealCommand *cmptr; @@ -233,7 +233,7 @@ void init_CommandHash(void) CommandAdd(NULL, MSG_MODULE, cmd_module, MAXPARA, CMD_USER); } -static RealCommand *add_Command_backend(char *cmd) +static RealCommand *add_Command_backend(const char *cmd) { RealCommand *c = safe_alloc(sizeof(RealCommand)); diff --git a/src/api-efunctions.c b/src/api-efunctions.c index 678f16d6b..833a8d83f 100644 --- a/src/api-efunctions.c +++ b/src/api-efunctions.c @@ -105,7 +105,7 @@ char *(*charsys_get_current_languages)(void); void (*broadcast_sinfo)(Client *client, Client *to, Client *except); void (*connect_server)(ConfigItem_link *aconf, Client *by, struct hostent *hp); void (*parse_message_tags)(Client *client, char **str, MessageTag **mtag_list); -char *(*mtags_to_string)(MessageTag *m, Client *client); +const char *(*mtags_to_string)(MessageTag *m, Client *client); int (*can_send_to_channel)(Client *client, Channel *channel, const char **msgtext, const char **errmsg, int notice); void (*broadcast_md_globalvar)(ModDataInfo *mdi, ModData *md); void (*broadcast_md_globalvar_cmd)(Client *except, Client *sender, const char *varname, const char *value); diff --git a/src/api-event.c b/src/api-event.c index 98ee3a42d..9b2b5778e 100644 --- a/src/api-event.c +++ b/src/api-event.c @@ -45,7 +45,7 @@ extern EVENT(unrealdb_expire_secret_cache); * can be later, in case of high load, in very extreme cases even up to 1000 or 2000 * msec later but that would be very unusual. Just saying, it's not a guarantee.. */ -Event *EventAdd(Module *module, char *name, vFP event, void *data, long every_msec, int count) +Event *EventAdd(Module *module, const char *name, vFP event, void *data, long every_msec, int count) { Event *newevent; @@ -147,7 +147,7 @@ static void CleanupEvents(void) } } -Event *EventFind(char *name) +Event *EventFind(const char *name) { Event *eventptr; diff --git a/src/misc.c b/src/misc.c index 25ed6b670..2722d67cf 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1454,7 +1454,7 @@ void parse_message_tags_default_handler(Client *client, char **str, MessageTag * * This is only used if the 'mtags' module is NOT loaded, * which would be quite unusual, but possible. */ -char *mtags_to_string_default_handler(MessageTag *m, Client *client) +const char *mtags_to_string_default_handler(MessageTag *m, Client *client) { return NULL; } diff --git a/src/modules/account-tag.c b/src/modules/account-tag.c index 7c66ac5e2..b23578ae5 100644 --- a/src/modules/account-tag.c +++ b/src/modules/account-tag.c @@ -34,7 +34,7 @@ ModuleHeader MOD_HEADER /* Variables */ long CAP_ACCOUNT_TAG = 0L; -int account_tag_mtag_is_ok(Client *client, char *name, char *value); +int account_tag_mtag_is_ok(Client *client, const char *name, const char *value); void mtag_add_account(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); MOD_INIT() @@ -75,7 +75,7 @@ MOD_UNLOAD() * syntax. * We simply allow account-tag ONLY from servers and with any syntax. */ -int account_tag_mtag_is_ok(Client *client, char *name, char *value) +int account_tag_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client)) return 1; diff --git a/src/modules/batch.c b/src/modules/batch.c index 4c8b6fda7..692680c4d 100644 --- a/src/modules/batch.c +++ b/src/modules/batch.c @@ -37,7 +37,7 @@ CMD_FUNC(cmd_batch); /* Variables */ long CAP_BATCH = 0L; -int batch_mtag_is_ok(Client *client, char *name, char *value); +int batch_mtag_is_ok(Client *client, const char *name, const char *value); MOD_INIT() { @@ -111,7 +111,7 @@ CMD_FUNC(cmd_batch) * syntax. * We simply allow batch ONLY from servers and with any syntax. */ -int batch_mtag_is_ok(Client *client, char *name, char *value) +int batch_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client)) return 1; diff --git a/src/modules/bot-tag.c b/src/modules/bot-tag.c index c5c6bf7d7..2a300c360 100644 --- a/src/modules/bot-tag.c +++ b/src/modules/bot-tag.c @@ -36,7 +36,7 @@ ModuleHeader MOD_HEADER "unrealircd-6", }; -int bottag_mtag_is_ok(Client *client, char *name, char *value); +int bottag_mtag_is_ok(Client *client, const char *name, const char *value); void mtag_add_bottag(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); MOD_INIT() @@ -68,7 +68,7 @@ MOD_UNLOAD() /** This function verifies if the client sending the mtag is permitted to do so. */ -int bottag_mtag_is_ok(Client *client, char *name, char *value) +int bottag_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client) && (value == NULL)) return 1; /* OK */ diff --git a/src/modules/history_backend_mem.c b/src/modules/history_backend_mem.c index d443a18f1..03e3dbcab 100644 --- a/src/modules/history_backend_mem.c +++ b/src/modules/history_backend_mem.c @@ -97,16 +97,16 @@ static void freecfg(struct cfgstruct *cfg); static void hbm_init_hashes(ModuleInfo *m); static void init_history_storage(ModuleInfo *modinfo); int hbm_modechar_del(Channel *channel, int modechar); -int hbm_history_add(char *object, MessageTag *mtags, char *line); +int hbm_history_add(const char *object, MessageTag *mtags, const char *line); int hbm_history_cleanup(HistoryLogObject *h); -HistoryResult *hbm_history_request(char *object, HistoryFilter *filter); -int hbm_history_destroy(char *object); -int hbm_history_set_limit(char *object, int max_lines, long max_time); +HistoryResult *hbm_history_request(const char *object, HistoryFilter *filter); +int hbm_history_destroy(const char *object); +int hbm_history_set_limit(const char *object, int max_lines, long max_time); EVENT(history_mem_clean); EVENT(history_mem_init); static int hbm_read_masterdb(void); static void hbm_read_dbs(void); -static int hbm_read_db(char *fname); +static int hbm_read_db(const char *fname); static int hbm_write_masterdb(void); static int hbm_write_db(HistoryLogObject *h); static void hbm_delete_db(HistoryLogObject *h); @@ -427,12 +427,12 @@ static void init_history_storage(ModuleInfo *modinfo) ClientCapabilityAdd(modinfo->handle, &cap, NULL); } -uint64_t hbm_hash(char *object) +uint64_t hbm_hash(const char *object) { return siphash_nocase(object, siphashkey_history_backend_mem) % HISTORY_BACKEND_MEM_HASH_TABLE_SIZE; } -HistoryLogObject *hbm_find_object(char *object) +HistoryLogObject *hbm_find_object(const char *object) { int hashv = hbm_hash(object); HistoryLogObject *h; @@ -445,7 +445,7 @@ HistoryLogObject *hbm_find_object(char *object) return NULL; } -HistoryLogObject *hbm_find_or_add_object(char *object) +HistoryLogObject *hbm_find_or_add_object(const char *object) { int hashv = hbm_hash(object); HistoryLogObject *h; @@ -539,7 +539,7 @@ void hbm_duplicate_mtags(HistoryLogLine *l, MessageTag *m) } /** Add a line to a history object */ -void hbm_history_add_line(HistoryLogObject *h, MessageTag *mtags, char *line) +void hbm_history_add_line(HistoryLogObject *h, MessageTag *mtags, const char *line) { HistoryLogLine *l = safe_alloc(sizeof(HistoryLogLine) + strlen(line)); strcpy(l->line, line); /* safe, see memory allocation above ^ */ @@ -590,7 +590,7 @@ void hbm_history_del_line(HistoryLogObject *h, HistoryLogLine *l) } /** Add history entry */ -int hbm_history_add(char *object, MessageTag *mtags, char *line) +int hbm_history_add(const char *object, MessageTag *mtags, const char *line) { HistoryLogObject *h = hbm_find_or_add_object(object); if (!h->max_lines) @@ -958,7 +958,7 @@ static int hbm_return_between(HistoryResult *r, HistoryLogObject *h, HistoryFilt return 0; } -HistoryResult *hbm_history_request(char *object, HistoryFilter *filter) +HistoryResult *hbm_history_request(const char *object, HistoryFilter *filter) { HistoryResult *r; HistoryLogObject *h = hbm_find_object(object); @@ -1053,7 +1053,7 @@ int hbm_history_cleanup(HistoryLogObject *h) return 1; } -int hbm_history_destroy(char *object) +int hbm_history_destroy(const char *object) { HistoryLogObject *h = hbm_find_object(object); HistoryLogLine *l, *l_next; @@ -1078,7 +1078,7 @@ int hbm_history_destroy(char *object) } /** Set new limit on history object */ -int hbm_history_set_limit(char *object, int max_lines, long max_time) +int hbm_history_set_limit(const char *object, int max_lines, long max_time) { HistoryLogObject *h = hbm_find_or_add_object(object); h->max_lines = max_lines; @@ -1286,7 +1286,7 @@ static void hbm_read_dbs(void) /** Read a channel history db file */ -static int hbm_read_db(char *fname) +static int hbm_read_db(const char *fname) { UnrealDB *db = NULL; // header @@ -1486,7 +1486,7 @@ EVENT(history_mem_clean) } while(loopcnt++ < HISTORY_CLEAN_PER_LOOP); } -char *hbm_history_filename(HistoryLogObject *h) +const char *hbm_history_filename(HistoryLogObject *h) { static char fname[512]; char oname[OBJECTLEN+1]; @@ -1527,7 +1527,7 @@ char *hbm_history_filename(HistoryLogObject *h) static int hbm_write_db(HistoryLogObject *h) { UnrealDB *db; - char *realfname; + const char *realfname; char tmpfname[512]; HistoryLogLine *l; MessageTag *m; @@ -1600,7 +1600,7 @@ static int hbm_write_db(HistoryLogObject *h) static void hbm_delete_db(HistoryLogObject *h) { UnrealDB *db; - char *fname; + const char *fname; if (!cfg.persist || !hbm_prehash || !hbm_posthash) { #ifdef DEBUGMODE diff --git a/src/modules/history_backend_null.c b/src/modules/history_backend_null.c index dca6e95fd..7136ce260 100644 --- a/src/modules/history_backend_null.c +++ b/src/modules/history_backend_null.c @@ -20,10 +20,10 @@ ModuleHeader MOD_HEADER }; /* Forward declarations */ -int hbn_history_set_limit(char *object, int max_lines, long max_time); -int hbn_history_add(char *object, MessageTag *mtags, char *line); -HistoryResult *hbn_history_request(char *object, HistoryFilter *filter); -int hbn_history_destroy(char *object); +int hbn_history_set_limit(const char *object, int max_lines, long max_time); +int hbn_history_add(const char *object, MessageTag *mtags, const char *line); +HistoryResult *hbn_history_request(const char *object, HistoryFilter *filter); +int hbn_history_destroy(const char *object); MOD_INIT() { @@ -53,22 +53,22 @@ MOD_UNLOAD() return MOD_SUCCESS; } -int hbn_history_add(char *object, MessageTag *mtags, char *line) +int hbn_history_add(const char *object, MessageTag *mtags, const char *line) { return 1; } -HistoryResult *hbn_history_request(char *object, HistoryFilter *filter) +HistoryResult *hbn_history_request(const char *object, HistoryFilter *filter) { return NULL; } -int hbn_history_set_limit(char *object, int max_lines, long max_time) +int hbn_history_set_limit(const char *object, int max_lines, long max_time) { return 1; } -int hbn_history_destroy(char *object) +int hbn_history_destroy(const char *object) { return 1; } diff --git a/src/modules/json-log-tag.c b/src/modules/json-log-tag.c index 3a304799e..5354ef1bc 100644 --- a/src/modules/json-log-tag.c +++ b/src/modules/json-log-tag.c @@ -35,7 +35,7 @@ ModuleHeader MOD_HEADER long CAP_JSON_LOG = 0L; /* Forward declarations */ -int json_log_mtag_is_ok(Client *client, char *name, char *value); +int json_log_mtag_is_ok(Client *client, const char *name, const char *value); int json_log_mtag_should_send_to_client(Client *target); MOD_INIT() @@ -73,7 +73,7 @@ MOD_UNLOAD() /** This function verifies if the client sending * We simply allow from servers without any syntax checking. */ -int json_log_mtag_is_ok(Client *client, char *name, char *value) +int json_log_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client) || IsMe(client)) return 1; diff --git a/src/modules/labeled-response.c b/src/modules/labeled-response.c index 9b9088a84..5027fe08d 100644 --- a/src/modules/labeled-response.c +++ b/src/modules/labeled-response.c @@ -61,7 +61,7 @@ static long CAP_LABELED_RESPONSE = 0L; static char packet[8192]; -int labeled_response_mtag_is_ok(Client *client, char *name, char *value); +int labeled_response_mtag_is_ok(Client *client, const char *name, const char *value); MOD_TEST() { @@ -336,7 +336,7 @@ int lr_packet(Client *from, Client *to, Client *intended_to, char **msg, int *le /** This function verifies if the client sending the * tag is permitted to do so and uses a permitted syntax. */ -int labeled_response_mtag_is_ok(Client *client, char *name, char *value) +int labeled_response_mtag_is_ok(Client *client, const char *name, const char *value) { if (BadPtr(value)) return 0; diff --git a/src/modules/message-ids.c b/src/modules/message-ids.c index 27609ec6f..ec44b8c9e 100644 --- a/src/modules/message-ids.c +++ b/src/modules/message-ids.c @@ -34,7 +34,7 @@ ModuleHeader MOD_HEADER /* Variables */ long CAP_ACCOUNT_TAG = 0L; -int msgid_mtag_is_ok(Client *client, char *name, char *value); +int msgid_mtag_is_ok(Client *client, const char *name, const char *value); void mtag_add_or_inherit_msgid(Client *sender, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); MOD_INIT() @@ -69,7 +69,7 @@ MOD_UNLOAD() * syntax. * We simply allow msgid ONLY from servers and with any syntax. */ -int msgid_mtag_is_ok(Client *client, char *name, char *value) +int msgid_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client) && !BadPtr(value)) return 1; diff --git a/src/modules/message-tags.c b/src/modules/message-tags.c index 118009978..93f1caa35 100644 --- a/src/modules/message-tags.c +++ b/src/modules/message-tags.c @@ -32,14 +32,14 @@ ModuleHeader MOD_HEADER }; long CAP_MESSAGE_TAGS = 0L; -char *_mtags_to_string(MessageTag *m, Client *client); +const char *_mtags_to_string(MessageTag *m, Client *client); void _parse_message_tags(Client *client, char **str, MessageTag **mtag_list); MOD_TEST() { MARK_AS_OFFICIAL_MODULE(modinfo); - EfunctionAddString(modinfo->handle, EFUNC_MTAGS_TO_STRING, _mtags_to_string); + EfunctionAddConstString(modinfo->handle, EFUNC_MTAGS_TO_STRING, _mtags_to_string); EfunctionAddVoid(modinfo->handle, EFUNC_PARSE_MESSAGE_TAGS, _parse_message_tags); return 0; @@ -263,7 +263,7 @@ int client_accepts_tag(const char *token, Client *client) * Taking into account the restrictions that 'client' may have. * @returns A string (static buffer) or NULL if no tags at all (!) */ -char *_mtags_to_string(MessageTag *m, Client *client) +const char *_mtags_to_string(MessageTag *m, Client *client) { static char buf[4096], name[8192], value[8192]; static char tbuf[4094]; diff --git a/src/modules/reply-tag.c b/src/modules/reply-tag.c index 0ad2a9749..ef9e295dd 100644 --- a/src/modules/reply-tag.c +++ b/src/modules/reply-tag.c @@ -33,7 +33,7 @@ ModuleHeader MOD_HEADER "unrealircd-6", }; -int replytag_mtag_is_ok(Client *client, char *name, char *value); +int replytag_mtag_is_ok(Client *client, const char *name, const char *value); void mtag_add_replytag(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); MOD_INIT() @@ -73,9 +73,9 @@ MOD_UNLOAD() /** This function verifies if the client sending the mtag is permitted to do so. */ -int replytag_mtag_is_ok(Client *client, char *name, char *value) +int replytag_mtag_is_ok(Client *client, const char *name, const char *value) { - char *p; + const char *p; /* Require a non-empty parameter */ if (BadPtr(value)) diff --git a/src/modules/server-time.c b/src/modules/server-time.c index ad6b78d89..7116977df 100644 --- a/src/modules/server-time.c +++ b/src/modules/server-time.c @@ -34,7 +34,7 @@ ModuleHeader MOD_HEADER /* Variables */ long CAP_SERVER_TIME = 0L; -int server_time_mtag_is_ok(Client *client, char *name, char *value); +int server_time_mtag_is_ok(Client *client, const char *name, const char *value); void mtag_add_or_inherit_time(Client *sender, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); MOD_INIT() @@ -75,7 +75,7 @@ MOD_UNLOAD() * syntax. * We simply allow server-time ONLY from servers. */ -int server_time_mtag_is_ok(Client *client, char *name, char *value) +int server_time_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client) && !BadPtr(value)) return 1; diff --git a/src/modules/typing-indicator.c b/src/modules/typing-indicator.c index 33c86f65b..76f0320f4 100644 --- a/src/modules/typing-indicator.c +++ b/src/modules/typing-indicator.c @@ -31,7 +31,7 @@ ModuleHeader MOD_HEADER "unrealircd-6", }; -int ti_mtag_is_ok(Client *client, char *name, char *value); +int ti_mtag_is_ok(Client *client, const char *name, const char *value); void mtag_add_ti(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); MOD_INIT() @@ -69,7 +69,7 @@ MOD_UNLOAD() /** This function verifies if the client sending the mtag is permitted to do so. */ -int ti_mtag_is_ok(Client *client, char *name, char *value) +int ti_mtag_is_ok(Client *client, const char *name, const char *value) { /* Require a non-empty parameter */ if (BadPtr(value)) diff --git a/src/modules/userhost-tag.c b/src/modules/userhost-tag.c index 7411adc2b..26a84a635 100644 --- a/src/modules/userhost-tag.c +++ b/src/modules/userhost-tag.c @@ -34,7 +34,7 @@ ModuleHeader MOD_HEADER /* Variables */ long CAP_ACCOUNT_TAG = 0L; -int userhost_mtag_is_ok(Client *client, char *name, char *value); +int userhost_mtag_is_ok(Client *client, const char *name, const char *value); int userhost_mtag_should_send_to_client(Client *target); void mtag_add_userhost(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); @@ -71,7 +71,7 @@ MOD_UNLOAD() * syntax. * We simply allow userhost-tag ONLY from servers and with any syntax. */ -int userhost_mtag_is_ok(Client *client, char *name, char *value) +int userhost_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client)) return 1; diff --git a/src/modules/userip-tag.c b/src/modules/userip-tag.c index 7440e3e6e..3fba6b9e9 100644 --- a/src/modules/userip-tag.c +++ b/src/modules/userip-tag.c @@ -34,7 +34,7 @@ ModuleHeader MOD_HEADER /* Variables */ long CAP_ACCOUNT_TAG = 0L; -int userip_mtag_is_ok(Client *client, char *name, char *value); +int userip_mtag_is_ok(Client *client, const char *name, const char *value); int userip_mtag_should_send_to_client(Client *target); void mtag_add_userip(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature); @@ -71,7 +71,7 @@ MOD_UNLOAD() * syntax. * We simply allow userip-tag ONLY from servers and with any syntax. */ -int userip_mtag_is_ok(Client *client, char *name, char *value) +int userip_mtag_is_ok(Client *client, const char *name, const char *value) { if (IsServer(client)) return 1; diff --git a/src/send.c b/src/send.c index bc3b503ae..6b49da821 100644 --- a/src/send.c +++ b/src/send.c @@ -216,7 +216,7 @@ void sendto_one(Client *to, MessageTag *mtags, FORMAT_STRING(const char *pattern */ void vsendto_one(Client *to, MessageTag *mtags, const char *pattern, va_list vl) { - char *mtags_str = mtags ? mtags_to_string(mtags, to) : NULL; + const char *mtags_str = mtags ? mtags_to_string(mtags, to) : NULL; ircvsnprintf(sendbuf, sizeof(sendbuf), pattern, vl); @@ -1029,7 +1029,7 @@ void sendto_prefix_one(Client *to, Client *from, MessageTag *mtags, FORMAT_STRIN */ void vsendto_prefix_one(Client *to, Client *from, MessageTag *mtags, const char *pattern, va_list vl) { - char *mtags_str = mtags ? mtags_to_string(mtags, to) : NULL; + const char *mtags_str = mtags ? mtags_to_string(mtags, to) : NULL; if (to && from && MyUser(to) && from->user) vmakebuf_local_withprefix(sendbuf, sizeof sendbuf, from, pattern, vl);