Merge pull request #218 from thelounge/xpaw/query
Add a query command that simply opens a query window
This commit is contained in:
commit
7ee7dc79f0
@ -17,6 +17,7 @@ $(function() {
|
|||||||
"/notice",
|
"/notice",
|
||||||
"/op",
|
"/op",
|
||||||
"/part",
|
"/part",
|
||||||
|
"/query",
|
||||||
"/quit",
|
"/quit",
|
||||||
"/raw",
|
"/raw",
|
||||||
"/say",
|
"/say",
|
||||||
|
@ -42,6 +42,7 @@ var inputs = [
|
|||||||
"kick",
|
"kick",
|
||||||
"mode",
|
"mode",
|
||||||
"notice",
|
"notice",
|
||||||
|
"query",
|
||||||
"quit",
|
"quit",
|
||||||
"raw",
|
"raw",
|
||||||
"topic",
|
"topic",
|
||||||
|
26
src/plugins/inputs/query.js
Normal file
26
src/plugins/inputs/query.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
var _ = require("lodash");
|
||||||
|
var Chan = require("../../models/chan");
|
||||||
|
|
||||||
|
exports.commands = ["query"];
|
||||||
|
|
||||||
|
exports.input = function(network, chan, cmd, args) {
|
||||||
|
if (args.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var target = args[0];
|
||||||
|
var query = _.find(network.channels, {name: target});
|
||||||
|
if (typeof query !== "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newChan = new Chan({
|
||||||
|
type: Chan.Type.QUERY,
|
||||||
|
name: target
|
||||||
|
});
|
||||||
|
network.channels.push(newChan);
|
||||||
|
this.emit("join", {
|
||||||
|
network: network.id,
|
||||||
|
chan: newChan
|
||||||
|
});
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user