diff --git a/lib/server.js b/lib/server.js index d0bfcdd..61cc2b0 100644 --- a/lib/server.js +++ b/lib/server.js @@ -338,7 +338,8 @@ function event(e, data) { break; case "message": - var chan = _.findWhere(channels, {name: data.to}); + var target = data.to; + var chan = _.findWhere(channels, {name: target.charAt(0) == "#" ? target : data.from}); if (typeof chan === "undefined") { chan = new Chan({ name: data.from,