Add messages window.
Sort various queries/messages so they go to it.
Bump version.
this.genericError(target, message);
return true;
},
+ irc_genericQueryError: function(prefix, params) {
+ var target = params[1];
+ var message = params.indexFromEnd(-1);
+
+ this.genericQueryError(target, message);
+ return true;
+ },
setupGenericErrors: function() {
- this.irc_ERR_CHANOPPRIVSNEEDED = this.irc_ERR_NOSUCHNICK = this.irc_ERR_CANNOTSENDTOCHAN = this.irc_genericError;
+ this.irc_ERR_CHANOPPRIVSNEEDED = this.irc_ERR_CANNOTSENDTOCHAN = this.irc_genericError;
+ this.irc_ERR_NOSUCHNICK = this.irc_genericQueryError;
return true;
},
irc_RPL_AWAY: function(prefix, params) {
this.send = parentObject.send;
this.parentObject = parentObject;
},
- newTargetLine: function(target, type, message, extra) {
+ buildExtra: function(extra, target, message) {
if(!extra)
extra = {}
extra["n"] = this.parentObject.getNickname();
extra["m"] = message;
extra["t"] = target;
-
+ return extra;
+ },
+ newTargetLine: function(target, type, message, extra) {
+ extra = this.buildExtra(extra, target, message);
var window = this.parentObject.getWindow(target);
var channel;
if(!window) {
this.parentObject.newLine(target, "OUR" + type, extra);
},
+ newQueryLine: function(target, type, message, extra) {
+ extra = this.buildExtra(extra, target, message);
+
+ if(this.parentObject.ui.uiOptions.DEDICATED_MSG_WINDOW) {
+ var window = this.parentObject.getWindow(target);
+ if(!window) {
+ var w = this.parentObject.ui.newWindow(this.parentObject, qwebirc.ui.WINDOW_MESSAGES, "Messages");
+ w.addLine("OURTARGETED" + type, extra);
+ return;
+ }
+ }
+ return this.newTargetLine(target, type, message, extra);
+ },
dispatch: function(line) {
if(line.length == 0)
return;
var fn = cmdopts[3];
var w = this.getActiveWindow();
- if(activewin && w.type == qwebirc.ui.WINDOW_STATUS) {
+ if(activewin && (w.type != qwebirc.ui.WINDOW_CHANNEL && w.type != qwebirc.ui.WINDOW_QUERY)) {
w.errorMessage("Can't use this command in this window");
return;
}
if(!this.send("PRIVMSG " + target + " :\x01ACTION " + args + "\x01"))
return;
- this.newTargetLine(target, "ACTION", args);
+ this.newQueryLine(target, "ACTION", args);
}],
cmd_CTCP: [false, 3, 2, function(args) {
var target = args[0];
if(!this.parentObject.isChannel(target))
this.parentObject.pushLastNick(target);
if(this.send("PRIVMSG " + target + " :" + message))
- this.newTargetLine(target, "MSG", message, {});
+ this.newQueryLine(target, "MSG", message, {});
}],
cmd_NOTICE: [false, 2, 2, function(args) {
var target = args[0];
var message = "";
var channel;
- if(w.type == qwebirc.ui.WINDOW_STATUS) {
+ if(w.type != qwebirc.ui.WINDOW_CHANNEL) {
if(!args || args.length == 0) {
w.errorMessage("Insufficient arguments for command.");
return;
return w;
},
+ newQueryWindow: function(name) {
+ if(this.ui.uiOptions.DEDICATED_MSG_WINDOW)
+ return this.ui.newWindow(this, qwebirc.ui.WINDOW_MESSAGES, "Messages");
+ return this.newWindow(name, qwebirc.ui.WINDOW_QUERY, false);
+ },
+ newQueryLine: function(window, type, data, active) {
+ if(this.getWindow(window))
+ return this.newLine(window, type, data);
+
+ var w = this.ui.getWindow(this, qwebirc.ui.WINDOW_MESSAGES);
+
+ if(this.ui.uiOptions.DEDICATED_MSG_WINDOW && w) {
+ return w.addLine(type, data);
+ } else {
+ if(active) {
+ return this.newActiveLine(window, type, data);
+ } else {
+ return this.newLine(window, type, data);
+ }
+ }
+ },
+ newQueryOrActiveLine: function(window, type, data) {
+ this.newQueryLine(window, type, data, true);
+ },
getActiveWindow: function() {
return this.ui.getActiveIRCWindow(this);
},
args = "";
if(type == "ACTION") {
- this.newWindow(nick, qwebirc.ui.WINDOW_QUERY);
- this.newLine(nick, "PRIVACTION", {"m": args, "x": type, "h": host, "n": nick});
+ this.newQueryWindow(nick);
+ this.newQueryLine(nick, "PRIVACTION", {"m": args, "x": type, "h": host, "n": nick});
return;
}
var nick = user.hostToNick();
var host = user.hostToHost();
- this.newWindow(nick, qwebirc.ui.WINDOW_QUERY);
+ this.newQueryWindow(nick);
this.pushLastNick(nick);
- this.newLine(nick, "PRIVMSG", {"m": message, "h": host, "n": nick});
+ this.newQueryLine(nick, "PRIVMSG", {"m": message, "h": host, "n": nick});
},
serverNotice: function(message) {
this.newServerLine("SERVERNOTICE", {"m": message});
this.disconnect();
},
awayMessage: function(nick, message) {
- this.newLine(nick, "AWAY", {"n": nick, "m": message});
+ this.newQueryLine(nick, "AWAY", {"n": nick, "m": message});
},
whois: function(nick, type, data) {
var ndata = {"n": nick};
genericError: function(target, message) {
this.newTargetOrActiveLine(target, "GENERICERROR", {m: message, t: target});
},
+ genericQueryError: function(target, message) {
+ this.newQueryOrActiveLine(target, "GENERICERROR", {m: message, t: target});
+ },
awayStatus: function(state, message) {
this.newActiveLine("GENERICMESSAGE", {m: message});
},
qwebirc.ui.WINDOW_CHANNEL = 3;
qwebirc.ui.WINDOW_CUSTOM = 4;
qwebirc.ui.WINDOW_CONNECT = 5;
+qwebirc.ui.WINDOW_MESSAGES = 6;
qwebirc.ui.CUSTOM_CLIENT = "custom";
qwebirc.ui.BaseUI = new Class({
return client.id;
}
},
- newWindow: function(client, type, name) {
- var identifier = name;
+ getWindowIdentifier: function(type, name) {
+ if(type == qwebirc.ui.WINDOW_MESSAGES)
+ return "-M";
if(type == qwebirc.ui.WINDOW_STATUS)
- identifier = "";
+ return "";
+ return "_" + name;
+ },
+ newWindow: function(client, type, name) {
+ var w = this.getWindow(client, type, name);
+ if($defined(w))
+ return w;
- var w = this.windows[this.getClientId(client)][identifier] = new this.windowClass(this, client, type, name, identifier);
+ var wId = this.getWindowIdentifier(type, name);
+ var w = this.windows[this.getClientId(client)][wId] = new this.windowClass(this, client, type, name, wId);
this.windowArray.push(w);
return w;
},
+ getWindow: function(client, type, name) {
+ var c = this.windows[this.getClientId(client)];
+ if(!$defined(c))
+ return null;
+
+ return c[this.getWindowIdentifier(type, name)];
+ },
getActiveWindow: function() {
return this.active;
},
getActiveIRCWindow: function(client) {
if(!this.active || this.active.type == qwebirc.ui.WINDOW_CUSTOM) {
- return this.windows[this.getClientId(client)][""];
+ return this.windows[this.getClientId(client)][this.getWindowIdentifier(qwebirc.ui.WINDOW_STATUS)];
} else {
return this.active;
}
var w = this.newWindow(qwebirc.ui.CUSTOM_CLIENT, type, name);
w.addEvent("close", function(w) {
- delete this.windows[qwebirc.ui.CUSTOM_CLIENT][name];
+ delete this.windows[qwebirc.ui.CUSTOM_CLIENT][w.identifier];
}.bind(this));
if(select)
hilight = qwebirc.ui.HILIGHT_ACTIVITY;
if(type.match(/(NOTICE|ACTION|MSG)$/)) {
- if(this.type == qwebirc.ui.WINDOW_QUERY) {
- hilight = qwebirc.ui.HILIGHT_US;
+ if(this.type == qwebirc.ui.WINDOW_QUERY || this.type == qwebirc.ui.WINDOW_MESSAGES) {
+ if(type.match(/^OUR/)) {
+ hilight = qwebirc.ui.HILIGHT_ACTIVITY;
+ } else {
+ hilight = qwebirc.ui.HILIGHT_US;
+ }
}
if(!type.match(/^OUR/) && this.client.hilightController.match(line["m"])) {
lhilight = true;
qwebirc.ui.MochaUI.Window = new Class({
Extends: qwebirc.ui.Window,
- initialize: function(parentObject, client, type, name) {
- this.parent(parentObject, client, type, name);
+ initialize: function(parentObject, client, type, name, identifier) {
+ this.parent(parentObject, client, type, name, identifier);
this.lines = new Element("div", {styles: {overflow: "auto", "width": "90"}});
ui.setBeepOnMention(value);
}
}],
- [2, "OPEN_QUERIES", "Open new queries automatically", false]
+ [2, "DEDICATED_MSG_WINDOW", "Use dedicated messages window", false],
+ [3, "TEXT_STATUS", "Show status (@/+) before nicknames", true]
];
qwebirc.config.DefaultOptions = null;
qwebirc.ui.QUI.Window = new Class({
Extends: qwebirc.ui.Window,
- initialize: function(parentObject, client, type, name) {
- this.parent(parentObject, client, type, name);
+ initialize: function(parentObject, client, type, name, identifier) {
+ this.parent(parentObject, client, type, name, identifier);
this.tab = new Element("a", {"href": "#"});
this.tab.addClass("tab");
qwebirc.ui.SWMUI.Window = new Class({
Extends: qwebirc.ui.Window,
- initialize: function(parentObject, client, type, name) {
- this.parent(parentObject, client, type, name);
+ initialize: function(parentObject, client, type, name, identifier) {
+ this.parent(parentObject, client, type, name, identifier);
this.contentPanel = new qwebirc.ui.SWMUI.Panel(parentObject.mainPanel, true);
this.contentPanel.addClass("content");
qwebirc.ui.UglyUI.Window = new Class({
Extends: qwebirc.ui.Window,
- initialize: function(parentObject, client, type, name) {
- this.parent(parentObject, client, type, name);
+ initialize: function(parentObject, client, type, name, identifier) {
+ this.parent(parentObject, client, type, name, identifier);
this.outerContainer = new Element("div");
this.outerContainer.addClass("outercontainer");
-qwebirc.VERSION = "0.53"
+qwebirc.VERSION = "0.60"