Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The way of determining modes here is error prone. #1

Closed
llmII opened this issue Feb 16, 2021 · 1 comment · Fixed by #3
Closed

The way of determining modes here is error prone. #1

llmII opened this issue Feb 16, 2021 · 1 comment · Fixed by #3

Comments

@llmII
Copy link

llmII commented Feb 16, 2021

for _, modenick := range strings.Split(e.Message(), " ") {
nickandmode := mode_split.FindStringSubmatch(modenick)
u := User{}
if len(nickandmode) == 3 {
if nickandmode[1] == "@" {
u.Mode = "+o" // Ooof should be mode struct?
} else if nickandmode[1] == "+" {
u.Mode = "+v" // Ooof should be mode struct?
} else if nickandmode[1] == "%" {
u.Mode = "+h"
}
irc.Channels[channelName].Users[nickandmode[2]] = u

We need to get the mode characters from RPL_ISUPPORT. This would stop us from needing to do things like the following:

https://github.com/llmII/go-discord-irc/blob/485c29f816b8e5007fa80a47e5ecf21034acd98e/bridge/irc_listener.go#L61-L74

@llmII
Copy link
Author

llmII commented Feb 19, 2021

Should remove need for mode_split regex (just loop through the list of modes on first character and set an index for nick if matched). Parse out ISUPPORT for nick length and prefix modes. These are sort of pointers at "how to fix".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant