diff options
author | Paul Schoenfelder <paulschoenfelder@gmail.com> | 2016-09-12 12:27:27 -0500 |
---|---|---|
committer | Paul Schoenfelder <paulschoenfelder@gmail.com> | 2016-09-12 12:27:27 -0500 |
commit | 340065949f4fd5906cbb60142ad611e01fa8ae81 (patch) | |
tree | 0aa5a740796fb10a2a712b60d515391d880248f2 | |
parent | Handle RPL_NOTOPIC in client (diff) |
Add case clause for RPL_TOPIC when no topic was set. See #52
-rw-r--r-- | lib/exirc/client.ex | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/exirc/client.ex b/lib/exirc/client.ex index 96179cf..aad131c 100644 --- a/lib/exirc/client.ex +++ b/lib/exirc/client.ex @@ -571,10 +571,14 @@ defmodule ExIrc.Client do # Called on joining a channel, to tell us the channel topic # Message with three arguments is not RFC compliant but very common # Message with two arguments is RFC compliant + # Message with a single argument is not RFC compliant, but is present + # to handle poorly written IRC servers which send RPL_TOPIC with an empty + # topic (such as Slack's IRC bridge), when they should be sending RPL_NOTOPIC def handle_data(%IrcMessage{cmd: @rpl_topic} = msg, state) do {channel, topic} = case msg.args do [_nick, channel, topic] -> {channel, topic} [channel, topic] -> {channel, topic} + [channel] -> {channel, "No topic is set"} end if state.debug? do debug "INITIAL TOPIC MSG" |