Fix broken queries

This commit is contained in:
Mattias Erming 2014-08-27 07:34:03 -07:00
parent 90cce21e3a
commit 5594d49d11
3 changed files with 5 additions and 7 deletions

View File

@ -1,7 +1,7 @@
{
"name": "shout",
"description": "A web IRC client",
"version": "0.12.1",
"version": "0.12.2",
"author": "Mattias Erming",
"preferGlobal": true,
"bin": {

View File

@ -5,14 +5,11 @@ module.exports = function(network, chan, cmd, args) {
if (cmd != "say" && cmd != "msg") {
return;
}
if (args.length === 0 || args[0] === "") {
return;
}
var client = this;
var irc = network.irc;
var target = "";
if (cmd == "msg") {
target = args.shift();
@ -22,10 +19,8 @@ module.exports = function(network, chan, cmd, args) {
} else {
target = chan.name;
}
var text = args.join(" ");
irc.send(target, text);
if (target == chan.name && typeof chan !== "undefined") {
irc.emit("message", {
from: irc.me,

View File

@ -6,7 +6,10 @@ module.exports = function(irc, network) {
var client = this;
irc.on("message", function(data) {
var target = data.to;
var chan = _.findWhere(network.channels, {name: target.charAt(0) == "#" ? target : data.from});
if (target == irc.me) {
target = data.from;
}
var chan = _.findWhere(network.channels, {name: target});
if (typeof chan === "undefined") {
chan = new Chan({
type: Chan.Type.QUERY,