Fix '/msg' and '/say' commands

This commit is contained in:
Mattias Erming 2014-08-02 05:08:26 -07:00
parent 7ceffbe3c3
commit f4dc6212e3
3 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,5 @@
{ {
"port": 9000, "port": 9000,
"theme": "themes/example.css", "theme": "themes/example.css",
"public": false "public": true
} }

View file

@ -6,24 +6,27 @@ module.exports = function(network, chan, cmd, args) {
return; return;
} }
var client = this;
var irc = network.irc;
if (args.length === 0 || args[0] === "") { if (args.length === 0 || args[0] === "") {
return; return;
} }
var client = this;
var irc = network.irc;
var target = args[0].charAt(0) == "#" ? args[0] : chan.name; var target = "";
if (target !== chan.name) { if (cmd == "msg") {
chan = _.findWhere(network.channels, { target = args.shift();
name: target if (args.length === 0) {
}); return;
}
} else {
target = chan.name;
} }
var text = args.join(" "); var text = args.join(" ");
irc.send(target, text); irc.send(target, text);
if (typeof chan !== "undefined") { if (target == chan.name && typeof chan !== "undefined") {
var msg = new Msg({ var msg = new Msg({
type: Msg.Type.MESSAGE, type: Msg.Type.MESSAGE,
from: irc.me, from: irc.me,

View file

@ -1,7 +1,7 @@
{ {
"name": "shout", "name": "shout",
"description": "A web IRC client", "description": "A web IRC client",
"version": "0.8.6", "version": "0.8.7",
"homepage": "http://github.com/erming/shout", "homepage": "http://github.com/erming/shout",
"author": { "author": {
"name": "Mattias Erming", "name": "Mattias Erming",