{"action":"created","issue":{"url":"https://api.github.com/repos/sorcix/irc/issues/2","labels_url":"https://api.github.com/repos/sorcix/irc/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/sorcix/irc/issues/2/comments","events_url":"https://api.github.com/repos/sorcix/irc/issues/2/events","html_url":"https://github.com/sorcix/irc/issues/2","id":54703877,"number":2,"title":"TOPIC with empty Trailing message is wrongly treated as equivalent to TOPIC without Trailing message","user":{"login":"stapelberg","id":55506,"avatar_url":"https://avatars.githubusercontent.com/u/55506?v=3","gravatar_id":"","url":"https://api.github.com/users/stapelberg","html_url":"https://github.com/stapelberg","followers_url":"https://api.github.com/users/stapelberg/followers","following_url":"https://api.github.com/users/stapelberg/following{/other_user}","gists_url":"https://api.github.com/users/stapelberg/gists{/gist_id}","starred_url":"https://api.github.com/users/stapelberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stapelberg/subscriptions","organizations_url":"https://api.github.com/users/stapelberg/orgs","repos_url":"https://api.github.com/users/stapelberg/repos","events_url":"https://api.github.com/users/stapelberg/events{/privacy}","received_events_url":"https://api.github.com/users/stapelberg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sorcix/irc/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"sorcix","id":65006,"avatar_url":"https://avatars.githubusercontent.com/u/65006?v=3","gravatar_id":"","url":"https://api.github.com/users/sorcix","html_url":"https://github.com/sorcix","followers_url":"https://api.github.com/users/sorcix/followers","following_url":"https://api.github.com/users/sorcix/following{/other_user}","gists_url":"https://api.github.com/users/sorcix/gists{/gist_id}","starred_url":"https://api.github.com/users/sorcix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorcix/subscriptions","organizations_url":"https://api.github.com/users/sorcix/orgs","repos_url":"https://api.github.com/users/sorcix/repos","events_url":"https://api.github.com/users/sorcix/events{/privacy}","received_events_url":"https://api.github.com/users/sorcix/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-01-18T17:48:51Z","updated_at":"2015-01-19T17:52:12Z","closed_at":null,"body":"According to https://tools.ietf.org/html/rfc2812#section-3.2.4, these two messages are different:\r\n\r\n```\r\n   TOPIC #test :                   ; Command to clear the topic on\r\n                                   #test.\r\n\r\n   TOPIC #test                     ; Command to check the topic for\r\n                                   #test.\r\n```\r\n\r\nHowever, this code prints “broken”:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n\r\n    \"github.com/sorcix/irc\"\r\n)\r\n\r\nfunc main() {\r\n    m1 := irc.ParseMessage(\"TOPIC #foo :\")\r\n    m2 := irc.ParseMessage(\"TOPIC #foo\")\r\n    if string(m1.Bytes()) == string(m2.Bytes()) {\r\n        fmt.Println(\"broken\")\r\n    }\r\n}\r\n```\r\n\r\nI think we should add a HasTrailing bool to `irc.Message` so that these two messages can be distinguished. What do you think?"},"comment":{"url":"https://api.github.com/repos/sorcix/irc/issues/comments/70534098","html_url":"https://github.com/sorcix/irc/issues/2#issuecomment-70534098","issue_url":"https://api.github.com/repos/sorcix/irc/issues/2","id":70534098,"user":{"login":"stapelberg","id":55506,"avatar_url":"https://avatars.githubusercontent.com/u/55506?v=3","gravatar_id":"","url":"https://api.github.com/users/stapelberg","html_url":"https://github.com/stapelberg","followers_url":"https://api.github.com/users/stapelberg/followers","following_url":"https://api.github.com/users/stapelberg/following{/other_user}","gists_url":"https://api.github.com/users/stapelberg/gists{/gist_id}","starred_url":"https://api.github.com/users/stapelberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stapelberg/subscriptions","organizations_url":"https://api.github.com/users/stapelberg/orgs","repos_url":"https://api.github.com/users/stapelberg/repos","events_url":"https://api.github.com/users/stapelberg/events{/privacy}","received_events_url":"https://api.github.com/users/stapelberg/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T17:52:12Z","updated_at":"2015-01-19T17:52:12Z","body":"I think `EmptyTrailing` makes more sense:\r\n\r\nWhen the user creates a message, EmptyTrailing will be false by default, meaning that Trailing == \"\" will be encoded as \"\".\r\n\r\nWhen the user creates a message with EmptyTrailing == true, Trailing == \"\" will be encoded as \":\".\r\n\r\nParseMessage sets EmptyTrailing to true if and only if the message ends in \":\"."}}