Seperate out numerics.
Fix double spaces.
Fix setAtEnd.
Refactor some target or active new line messages.
Add away messages.
del /q compiled\*.js\r
\r
cd js\r
-copy qwebirc.js + version.js + jslib.js + irc\ircconnection.js + irc\irclib.js + irc\baseircclient.js + irc\irctracker.js + irc\commandparser.js + irc\ircclient.js + ui\baseui.js + ui\baseuiwindow.js + ui\colour.js + ui\url.js + ui\theme.js + ui\genericlogin.js + ui\embedwizard.js + qwebircinterface.js + irc\commandhistory.js ..\compiled\qwebirc-concat.js /b\r
+copy qwebirc.js + version.js + jslib.js + irc\ircconnection.js + irc\irclib.js + irc\numerics.js + irc\baseircclient.js + irc\irctracker.js + irc\commandparser.js + irc\ircclient.js + ui\baseui.js + ui\baseuiwindow.js + ui\colour.js + ui\url.js + ui\theme.js + ui\genericlogin.js + ui\embedwizard.js + qwebircinterface.js + irc\commandhistory.js ..\compiled\qwebirc-concat.js /b\r
copy ui\swmui.js + ui\swmlayout.js ..\compiled\swmui-concat.js /b\r
cd ..\compiled\r
\r
rm -f compiled/*.js
cd js
-cat qwebirc.js version.js jslib.js irc/ircconnection.js irc/irclib.js irc/baseircclient.js irc/irctracker.js irc/commandparser.js irc/ircclient.js ui/baseui.js ui/baseuiwindow.js ui/colour.js ui/url.js ui/theme.js ui/genericlogin.js ui/embedwizard.js irc/commandhistory.js qwebircinterface.js > ../compiled/qwebirc-concat.js
+cat qwebirc.js version.js jslib.js irc/ircconnection.js irc/irclib.js irc/numerics.js irc/baseircclient.js irc/irctracker.js irc/commandparser.js irc/ircclient.js ui/baseui.js ui/baseuiwindow.js ui/colour.js ui/url.js ui/theme.js ui/genericlogin.js ui/embedwizard.js irc/commandhistory.js qwebircinterface.js > ../compiled/qwebirc-concat.js
cat ui/swmui.js ui/swmlayout.js > ../compiled/swmui-concat.js
error() {
-qwebirc.irc.Numerics = {"001": "RPL_WELCOME", "433": "ERR_NICKNAMEINUSE", "004": "RPL_MYINFO", "005": "RPL_ISUPPORT", "353": "RPL_NAMREPLY", "366": "RPL_ENDOFNAMES", "331": "RPL_NOTOPIC", "332": "RPL_TOPIC", "333": "RPL_TOPICWHOTIME"};
-
qwebirc.irc.RegisteredCTCPs = {
"VERSION": function(x) {
return "qwebirc v" + qwebirc.VERSION + ", copyright (C) Chris Porter 2008 -- user agent: " + Browser.Engine.name + " (" + Browser.Platform.name + ")";
},
irc_RPL_TOPICWHOTIME: function(prefix, params) {
return true;
+ },
+ irc_RPL_WHOISUSER: function(prefix, params) {
+ var nick = params[1];
+ this.whoisNick = nick;
+
+ return this.whois(nick, "user", {ident: params[2], hostname: params[3], realname: params.indexFromEnd(-1)});
+ },
+ irc_RPL_WHOISSERVER: function(prefix, params) {
+ var nick = params[1];
+ var server = params[2];
+ var serverdesc = params.indexFromEnd(-1);
+
+ return this.whois(nick, "server", {server: params[2], serverdesc: params.indexFromEnd(-1)});
+ },
+ irc_RPL_WHOISOPERATOR: function(prefix, params) {
+ var nick = params[1];
+ var text = params.indexFromEnd(-1);
+
+ return this.whois(nick, "oper", {opertext: params.indexFromEnd(-1)});
+ },
+ irc_RPL_WHOISIDLE: function(prefix, params) {
+ var nick = params[1];
+
+ return this.whois(nick, "idle", {idle: params[2], connected: params[3]});
+ },
+ irc_RPL_WHOISCHANNELS: function(prefix, params) {
+ var nick = params[1];
+
+ return this.whois(nick, "channels", {channels: params.indexFromEnd(-1)});
+ },
+ irc_RPL_WHOISACCOUNT: function(prefix, params) {
+ var nick = params[1];
+
+ return this.whois(nick, "account", {account: params[2]});
+ },
+ irc_RPL_WHOISACTUALLY: function(prefix, params) {
+ var nick = params[1];
+
+ return this.whois(nick, "actually", {hostmask: params[2], ip: params[3]});
+ },
+ irc_RPL_WHOISOPERNAME: function(prefix, params) {
+ var nick = params[1];
+ var opername = params[2];
+
+ return this.whois(nick, "opername", {opername: params[2]});
+ },
+ irc_RPL_ENDOFWHOIS: function(prefix, params) {
+ var nick = params[1];
+ var text = params.indexFromEnd(-1);
+ this.whoisNick = null;
+
+ return this.whois(nick, "end", {});
+ },
+ irc_RPL_AWAY: function(prefix, params) {
+ var nick = params[1];
+ var text = params.indexFromEnd(-1);
+
+ if(this.whoisNick && (this.whoisNick == nick))
+ return this.whois(nick, "away", {"away": text});
+
+ this.awayMessage(nick, text);
+ return true;
}
});
newActiveLine: function(type, data) {
this.ui.getActiveWindow().addLine(type, data);
},
+ newTargetOrActiveLine: function(target, type, data) {
+ if(this.getWindow(target)) {
+ this.newLine(target, type, data);
+ } else {
+ this.newActiveLine(type, data);
+ }
+ },
updateNickList: function(channel) {
var n1 = this.tracker.getChannel(channel);
var names = new Array();
return;
}
- if(this.getWindow(nick)) {
- this.newLine(nick, "PRIVCTCP", {"m": args, "x": type, "h": host, "n": nick, "-": this.nickname});
- } else {
- this.newActiveLine("PRIVCTCP", {"m": args, "x": type, "h": host, "n": nick, "-": this.nickname});
- }
+ this.newTargetOrActiveLine(nick, "PRIVCTCP", {"m": args, "x": type, "h": host, "n": nick, "-": this.nickname});
},
userCTCPReply: function(user, type, args) {
var nick = user.hostToNick();
if(args == undefined)
args = "";
- if(this.getWindow(nick)) {
- this.newLine(nick, "CTCPREPLY", {"m": args, "x": type, "h": host, "n": nick, "-": this.nickname});
- } else {
- this.newActiveLine("CTCPREPLY", {"m": args, "x": type, "h": host, "n": nick, "-": this.nickname});
- }
+ this.newTargetOrActiveLine(nick, "CTCPREPLY", {"m": args, "x": type, "h": host, "n": nick, "-": this.nickname});
},
channelPrivmsg: function(user, channel, message) {
this.newChanLine(channel, "CHANMSG", user, {"m": message});
var nick = user.hostToNick();
var host = user.hostToHost();
- if(this.getWindow(nick)) {
- this.newLine(nick, "PRIVNOTICE", {"m": message, "h": host, "n": nick});
- } else {
- this.newActiveLine("PRIVNOTICE", {"m": message, "h": host, "n": nick});
- }
+ this.newTargetOrActiveLine(nick, "PRIVNOTICE", {"m": message, "h": host, "n": nick});
},
userInvite: function(user, channel) {
var nick = user.hostToNick();
quit: function(message) {
this.send("QUIT :" + message);
this.disconnect();
+ },
+ awayMessage: function(nick, message) {
+ this.newLine(nick, "AWAY", {"n": nick, "m": message});
+ },
+ whois: function(nick, type, data) {
+ var ndata = {"n": nick};
+ var mtype;
+
+ var xsend = function() {
+ this.newTargetOrActiveLine(nick, "WHOIS" + mtype, ndata);
+ }.bind(this);
+
+ if(type == "user") {
+ mtype = "USER";
+ ndata.h = data.ident + "@" + data.hostname;
+ xsend();
+ mtype = "REALNAME";
+ ndata.m = data.realname;
+ } else if(type == "server") {
+ mtype = "SERVER";
+ ndata.x = data.server;
+ ndata.m = data.serverdesc;
+ } else if(type == "oper") {
+ mtype = "OPER";
+ } else if(type == "idle") {
+ mtype = "IDLE";
+ ndata.x = qwebirc.util.longtoduration(data.idle);
+ ndata.m = qwebirc.irc.IRCDate(new Date(data.connected * 1000));
+ } else if(type == "channels") {
+ mtype = "CHANNELS";
+ ndata.m = data.channels;
+ } else if(type == "account") {
+ mtype = "ACCOUNT";
+ ndata.m = data.account;
+ } else if(type == "away") {
+ mtype = "AWAY";
+ ndata.m = data.away;
+ } else if(type == "opername") {
+ mtype = "OPERNAME";
+ ndata.m = data.opername;
+ } else if(type == "actually") {
+ mtype = "ACTUALLY";
+ ndata.m = data.hostname;
+ ndata.x = data.ip;
+ } else if(type == "end") {
+ mtype = "END";
+ } else {
+ return false;
+ }
+
+ xsend();
+ return true;
}
});
--- /dev/null
+qwebirc.irc.Numerics = {
+ "001": "RPL_WELCOME",
+ "433": "ERR_NICKNAMEINUSE",
+ "004": "RPL_MYINFO",
+ "005": "RPL_ISUPPORT",
+ "353": "RPL_NAMREPLY",
+ "366": "RPL_ENDOFNAMES",
+ "331": "RPL_NOTOPIC",
+ "332": "RPL_TOPIC",
+ "333": "RPL_TOPICWHOTIME",
+ "311": "RPL_WHOISUSER",
+ "312": "RPL_WHOISSERVER",
+ "313": "RPL_WHOISOPERATOR",
+ "317": "RPL_WHOISIDLE",
+ "318": "RPL_ENDOFWHOIS",
+ "319": "RPL_WHOISCHANNELS",
+ "330": "RPL_WHOISACCOUNT",
+ "338": "RPL_WHOISACTUALLY",
+ "343": "RPL_WHOISOPERNAME",
+ "301": "RPL_AWAY"
+};
10: "Nov",
11: "Dec"
};
+
+qwebirc.util.NBSPCreate = function(text, element) {
+ var e = text.split(" ");
+ for(var i=0;i<e.length;i++) {
+ var tn = document.createTextNode(e[i]);
+ element.appendChild(tn);
+
+ if(i != e.length - 1) {
+ var e2 = new Element("span");
+ e2.set("html", " ");
+ element.appendChild(e2);
+ }
+ }
+};
+
+qwebirc.util.longtoduration = function(l) {
+ var seconds = l % 60;
+ var minutes = l / 60;
+ var hours = minutes / 60;
+ var days = hours / 24;
+
+ return days + " days " + hours + " hours " + minutes + " minutes " + seconds + " seconds";
+}
this.lastcvalue = result;
inputbox.value = result;
- setAtEnd(inputbox);
+ qwebirc.util.setAtEnd(inputbox);
}.bind(this));
},
setLines: function(lines) {
"CTCPREPLY": ["CTCP $x reply from $n: $m"],
"OURCHANCTCP": ["[ctcp($t)] $x $m"],
"OURPRIVCTCP": ["[ctcp($t)] $x $m"],
- "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"]
+ "OURTARGETEDCTCP": ["[ctcp($t)] $x $m"],
+ "WHOISUSER": ["$B$n$B [$h]", true],
+ "WHOISREALNAME": [" realname : $m", true],
+ "WHOISCHANNELS": [" channels : $m", true],
+ "WHOISSERVER": [" server : $x [$m]", true],
+ "WHOISACCOUNT": [" account : $m", true],
+ "WHOISIDLE": [" idle : $x [connected: $m]", true],
+ "WHOISAWAY": [" away : $m", true],
+ "WHOISOPER": [" : $BIRC Operator$B", true],
+ "WHOISOPERNAME": [" operedas : $m", true],
+ "WHOISACTUALLY": [" realhost : $m [ip: $x]", true],
+ "WHOISEND": ["End of WHOIS", true],
+ "AWAY": ["$n is away: $m", true]
};
qwebirc.ui.Theme = new Class({
};
var appendText = function(text) {
- element.appendChild(document.createTextNode(text));
+ qwebirc.util.NBSPCreate(text, element);
};
var appendChan = function(text) {
<script type="text/javascript" src="js/debug/jslib.js"></script>
<script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
<script type="text/javascript" src="js/debug/irc/irclib.js"></script>
+ <script type="text/javascript" src="js/debug/irc/numerics.js"></script>
<script type="text/javascript" src="js/debug/irc/baseircclient.js"></script>
<script type="text/javascript" src="js/debug/irc/irctracker.js"></script>
<script type="text/javascript" src="js/debug/irc/commandparser.js"></script>
<script type="text/javascript" src="js/debug/jslib.js"></script>
<script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
<script type="text/javascript" src="js/debug/irc/irclib.js"></script>
+ <script type="text/javascript" src="js/debug/irc/numerics.js"></script>
<script type="text/javascript" src="js/debug/irc/baseircclient.js"></script>
<script type="text/javascript" src="js/debug/irc/irctracker.js"></script>
<script type="text/javascript" src="js/debug/irc/commandparser.js"></script>
<script type="text/javascript" src="js/debug/jslib.js"></script>
<script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
<script type="text/javascript" src="js/debug/irc/irclib.js"></script>
+ <script type="text/javascript" src="js/debug/irc/numerics.js"></script>
<script type="text/javascript" src="js/debug/irc/baseircclient.js"></script>
<script type="text/javascript" src="js/debug/irc/irctracker.js"></script>
<script type="text/javascript" src="js/debug/irc/commandparser.js"></script>
<script type="text/javascript" src="js/debug/jslib.js"></script>
<script type="text/javascript" src="js/debug/irc/ircconnection.js"></script>
<script type="text/javascript" src="js/debug/irc/irclib.js"></script>
+ <script type="text/javascript" src="js/debug/irc/numerics.js"></script>
<script type="text/javascript" src="js/debug/irc/baseircclient.js"></script>
<script type="text/javascript" src="js/debug/irc/irctracker.js"></script>
<script type="text/javascript" src="js/debug/irc/commandparser.js"></script>