Fix broken queries
This commit is contained in:
parent
90cce21e3a
commit
5594d49d11
|
@ -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": {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue