Remove unfinished validators

This commit is contained in:
Alex D. 2021-04-02 17:21:11 +00:00
parent e32ee3adca
commit 0096d57380
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 3 additions and 42 deletions

View File

@ -25,11 +25,9 @@
#ifndef UIRC_GUARD_PUBLIC_VALIDATORS
#define UIRC_GUARD_PUBLIC_VALIDATORS
size_t uirc_validator_string_nocrlf(const char* str);
size_t uirc_validator_string_nospcl(const char* str);
size_t uirc_validator_string_noblcm(const char* str);
size_t uirc_validator_buffer_channel(char* chan);
signed short uirc_validator_message(IRC_Message* mesg);
size_t uirc_validator_string_nocrlf(const char* str);
size_t uirc_validator_string_nospcl(const char* str);
size_t uirc_validator_string_noblcm(const char* str);
#endif /* UIRC_GUARD_PUBLIC_VALIDATORS */

View File

@ -54,40 +54,3 @@ uirc_validator_string_noblcm(const char* str)
}
return (size_t)(str - save);
}
// TODO: Make this read only
// TODO: Improve the logic for this
size_t
uirc_validator_buffer_channel(char* chan)
{
assert(chan != NULL);
if (*chan != '#' && *chan != '+' && *chan != '!' && *chan != '&') return 0;
const char* save = chan;
char* clps = ++chan;
if ((clps = strchr(chan, ':')) != NULL) {
*clps = '\0';
if (uirc_validator_string_nospcl(chan) != 1 || uirc_validator_string_nocrlf(chan) != 1 || uirc_validator_string_noblcm(chan) != 1) {
*clps = ':';
return 0;
}
*clps = ':';
chan = ++clps;
}
if (uirc_validator_string_nospcl(chan) != 1 || uirc_validator_string_nocrlf(chan) != 1 || uirc_validator_string_noblcm(chan) != 1) return 0;
return (size_t)(save - chan);
}
// TODO: Work on the logic for this
signed short
uirc_validator_message(IRC_Message* mesg)
{
assert(mesg != NULL);
for (unsigned int i = 0; mesg->args[i] != NULL; i++) {
if (Val_type_nocrlf(mesg->args[i]) != 1) return ERR_UIRC_VAL_FAILED;
if (!(mesg->args[i + 1] == NULL && mesg->trailing)) {
if (Val_type_nospcl(mesg->args[i]) != 1) return ERR_UIRC_VAL_FAILED;
}
}
return 1;
}