i99dev / ft_irc

implementation of the IRC network
3 stars 2 forks source link

wildcards strings #37

Closed i99dev closed 1 year ago

i99dev commented 1 year ago

Good news, wildcards support * and ?

All methods come under the Message class

If you want to check if Messages have wildcard only, you can call _message->getMask().size() if > 0, that means wildcard function implementation

The type like * and ? if you want to check only call _message->getType() for more understanding, you can check to commend Privmsg. There is an example if the user use

/msg *dev hi all --> will send message to all username end with dev ex: i99dev

There is a very important method call bool match_wildCard(std::string const &str); use to get what is value match and use it also Privmsg good example any questions please let me know

Saxsori commented 1 year ago

the wildcards check looks good to me ! it's a good start with wildcards .. but we need to add more conditions to it !

I have looked into the code and I have tested some of the cases .. and this is what I found..

1- This will work only for the cases when: the wildcard is applied only to nicknames

2- And it actually won't work on the following case -> if referred to everyone ex. /msg "hey" -> This kind of mask that will be needed later by invite and ban ex. nick!user@newtwork -> `!@some.com or !@*`

And the main reason is because of _message->getMask() .. since it doesn't cover these cases .. so I think will be better to make this function bool match_wildCard(std::string const &str); with two parameters that give us the chance to pass another string for the mask

i99dev commented 1 year ago

Good sound

l follow this link to start with wildcard, but if there any more special case need cover please let me know

i99dev commented 1 year ago

@Saxsori

Saxsori commented 1 year ago

okay I thought this /msg * "hi all" will work which it should,
but anyway when u refer to everyone on the server u use this *!*@* .. mostly used to invite or ban specific users for example : Screen Shot 2022-12-07 at 7 01 09 AM Screen Shot 2022-12-07 at 7 01 37 AM

and u can also use the wildcard in this way: ab* .. will refer to everyone starting with ab

Screen Shot 2022-12-07 at 7 06 33 AM

check this.. it helped me to understand the cases

I'm not sure but I think this mask *!*@* is not used with the commands that address the users by nicknames like PRIVMSG

i99dev commented 1 year ago

Now it supports * and ?, and you interact with the user class only it there are any more requests, let me know, please. message template /msg user!nick@exmaple.com different case: