summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Schoenfelder <paulschoenfelder@gmail.com>2016-09-12 12:27:27 -0500
committerPaul Schoenfelder <paulschoenfelder@gmail.com>2016-09-12 12:27:27 -0500
commit340065949f4fd5906cbb60142ad611e01fa8ae81 (patch)
tree0aa5a740796fb10a2a712b60d515391d880248f2
parentHandle RPL_NOTOPIC in client (diff)
Add case clause for RPL_TOPIC when no topic was set. See #52
-rw-r--r--lib/exirc/client.ex4
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"