summaryrefslogtreecommitdiff
path: root/lib/irc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irc')
-rw-r--r--lib/irc/pubsub_handler.ex11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/irc/pubsub_handler.ex b/lib/irc/pubsub_handler.ex
index 3e78d7b..450dc2f 100644
--- a/lib/irc/pubsub_handler.ex
+++ b/lib/irc/pubsub_handler.ex
@@ -6,7 +6,7 @@ defmodule IRC.PubSubHandler do
## PubSub topics
- * `message` -- all messages (including triggers)
+ * `message` -- all messages (without triggers)
* `message:private` -- all messages without a channel
* `message:#CHANNEL` -- all messages within `#CHANNEL`
* `triggers` -- all triggers
@@ -34,6 +34,7 @@ defmodule IRC.PubSubHandler do
"-" => :minus,
"?" => :query,
"." => :dot,
+ "~" => :tilde
}
def handle_info({:received, text, sender, chan}, client) do
@@ -62,7 +63,7 @@ defmodule IRC.PubSubHandler do
end
defp publish(m = %IRC.Message{trigger: t = %IRC.Trigger{trigger: trigger}}, keys) do
- dispatch(["message", "triggers", "trigger:"<>trigger]++keys, {:irc, :trigger, trigger, m})
+ dispatch(["triggers", "trigger:"<>trigger], {:irc, :trigger, trigger, m})
end
defp dispatch(key, content) when is_binary(key), do: dispatch([key], content)
@@ -96,8 +97,10 @@ defmodule IRC.PubSubHandler do
# irc_reply(ExIRC.Client pid, {channel or nick, ExIRC.Sender}, binary | replies
# replies :: {:kick, reason} | {:kick, nick, reason} | {:mode, mode, nick}
- defp irc_reply(client, {target, _}, text) when is_binary(text) do
- ExIRC.Client.msg(client, :privmsg, target, text)
+ defp irc_reply(client, {target, _}, text) when is_binary(text) or is_list(text) do
+ for line <- IRC.splitlong(text) do
+ ExIRC.Client.msg(client, :privmsg, target, line)
+ end
end
defp irc_reply(client, {target, %{nick: nick}}, {:kick, reason}) do