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

Nicks/usernames with spaces are not sent properly to IRC #184

Closed
Aketzu opened this issue May 24, 2018 · 1 comment
Closed

Nicks/usernames with spaces are not sent properly to IRC #184

Aketzu opened this issue May 24, 2018 · 1 comment

Comments

@Aketzu
Copy link
Contributor

Aketzu commented May 24, 2018

If Slack side has a bot user with spaces in name (e.g. "Travis CI") then IRC PRIVMSG's will be incorrect and fail parsing in IRC clients.

For example currently matterircd sends
Travis CI!Travis CI@Travis CI PRIVMSG #dev :Build done
whereas it should be
Travis_CI!Travis_CI@Travis_CI PRIVMSG #dev :Build done

One trivial fix would be to replace (at least) space in sorcix/irc

diff --git a/vendor/github.com/sorcix/irc/message.go b/vendor/github.com/sorcix/irc/message.go
index 088938d..9d34b27 100644
--- a/vendor/github.com/sorcix/irc/message.go
+++ b/vendor/github.com/sorcix/irc/message.go
@@ -123,14 +123,14 @@ func (p *Prefix) IsServer() bool {
 
 // writeTo is an utility function to write the prefix to the bytes.Buffer in Message.String().
 func (p *Prefix) writeTo(buffer *bytes.Buffer) {
-       buffer.WriteString(p.Name)
+       buffer.WriteString(strings.Replace(p.Name, " ", "_", -1))
        if len(p.User) > 0 {
                buffer.WriteByte(prefixUser)
-               buffer.WriteString(p.User)
+               buffer.WriteString(strings.Replace(p.User, " ", "_", -1))
        }
        if len(p.Host) > 0 {
                buffer.WriteByte(prefixHost)
-               buffer.WriteString(p.Host)
+               buffer.WriteString(strings.Replace(p.Host, " ", "_", -1))
        }
        return
 }

https://tools.ietf.org/html/rfc2812#section-2.3.1 contains list of allowed characters but at least for me it's enought to convert space into underscore

@42wim
Copy link
Owner

42wim commented Jun 11, 2018

Thanks for reporting, fixed this another way in master.
Please reopen if still an issues

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

No branches or pull requests

2 participants