Repository: osa1/tiny (language: rust)

Issue:
/msg nick pattern error
Reported on IRC:

> using /msg *status znc_help gives a tiny error msg. i think the pattern matched
> for /msg needs to change to support *status

It appears that we don't match on '*' for the nickname in /msg
```
pub(crate) fn is_nick_first_char(c: char) -> bool {
    c.is_alphabetic() || "[]\\`_^{|}".contains(c)
}
```


Discussion / hints:
According to RFC 2812 nicks can't start with `*`. The code you quoted implements nicks as described in RFC 2812.

That said, I think it's fine to just reject `#` as the first character (as `/msg` is for PRIVMSGs to users, not channels) and accept everything else.

We could also repurpose `/msg` to allow sending to channels too. I don't remember why I wanted to disallow channel names in `/msg`.

I suggest we do the former for now and allow everything except `#` as the first char.

Fix patch:
diff --git a/crates/tiny/src/utils.rs b/crates/tiny/src/utils.rs
index c911930b..9e55f5b5 100644
--- a/crates/tiny/src/utils.rs
+++ b/crates/tiny/src/utils.rs
@@ -31,10 +31,10 @@ pub(crate) fn split_whitespace_indices(str: &str) -> SplitWhitespaceIndices {
 // letter     =  %x41-5A / %x61-7A ; A-Z / a-z
 // special    =  %x5B-60 / %x7B-7D ; "[", "]", "\", "`", "_", "^", "{", "|", "}"
 //
-// we use a simpler check here (allows strictly more nicks)
-
+// We use a simpler check here (allows strictly more nicks)
+// Only check to see if the nick does not begin with '#', https://github.com/osa1/tiny/issues/324
 pub(crate) fn is_nick_first_char(c: char) -> bool {
-    c.is_alphabetic() || "[]\\`_^{|}".contains(c)
+    c != '#'
 }
 
 /*


Test patch: