diff --git a/extensions/hurt.c b/extensions/hurt.c index d5e08fe3..68615897 100644 --- a/extensions/hurt.c +++ b/extensions/hurt.c @@ -74,7 +74,6 @@ static void hurt_destroy(void *hurt); static int heal_nick(struct Client *, struct Client *); -static int nick_is_valid(const char *); /* }}} */ /* {{{ State containers */ @@ -312,7 +311,7 @@ mo_heal(struct Client *client_p, struct Client *source_p, return 0; } - if (nick_is_valid(parv[1])) + if (is_valid_nick(parv[1])) { target_p = find_named_person(parv[1]); if (target_p == NULL) @@ -364,7 +363,7 @@ me_heal(struct Client *client_p, struct Client *source_p, if (parc < 2) return 0; - if (nick_is_valid(parv[1])) + if (is_valid_nick(parv[1])) { target_p = find_person(parv[1]); if (target_p != NULL && MyConnect(target_p)) @@ -638,25 +637,6 @@ heal_nick(struct Client *source_p, struct Client *target_p) } /* }}} */ -/* - * Anything else... - */ - -/* {{{ static int nick_is_valid() */ -static int -nick_is_valid(const char *nick) -{ - const char *s = nick; - - for (; *s != '\0'; s++) { - if (!IsNickChar(*s)) - return 0; - } - - return 1; -} -/* }}} */ - /* * vim: ts=8 sw=8 noet fdm=marker tw=80 */ diff --git a/include/client.h b/include/client.h index f1a239c6..7f32b400 100644 --- a/include/client.h +++ b/include/client.h @@ -616,4 +616,25 @@ extern char *generate_uid(void); void allocate_away(struct Client *); void free_away(struct Client *); +static inline int +is_valid_nick(const char *nick) +{ + int len = 0; + + if(EmptyString(nick) || *nick == '-' || IsDigit(*nick)) + return 0; + + for(; *nick; nick++) + { + len++; + if(!IsNickChar(*nick)) + return 0; + } + + if(len >= NICKLEN) + return 0; + + return 1; +} + #endif /* INCLUDED_client_h */ diff --git a/modules/m_services.c b/modules/m_services.c index 8355b153..a1c93be6 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -154,27 +154,6 @@ me_login(struct Client *client_p, struct Client *source_p, return 0; } -static int -clean_nick(const char *nick) -{ - int len = 0; - - if(EmptyString(nick) || *nick == '-' || IsDigit(*nick)) - return 0; - - for(; *nick; nick++) - { - len++; - if(!IsNickChar(*nick)) - return 0; - } - - if(len >= NICKLEN) - return 0; - - return 1; -} - static int me_rsfnc(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) @@ -197,7 +176,7 @@ me_rsfnc(struct Client *client_p, struct Client *source_p, if(!MyClient(target_p)) return 0; - if(!clean_nick(parv[2])) + if(!is_valid_nick(parv[2])) return 0; curts = atol(parv[4]);