+ front = {hue: Number(this.__styleValues.textHue), lightness: Number(this.__styleValues.textLightness), saturation: Number(this.__styleValues.textSaturation)}
+ }
+ var colours = {
+ back: back,
+ front: front
+ };
+
+ this.__styleSheet.set(function() {
+ var mode = arguments[0];
+ if(mode == "c") {
+ var t = colours[arguments[2]];
+ var x = new Color(arguments[1]);
+ var c = x.setHue(t.hue).setSaturation(x.hsb[1] + t.saturation).setBrightness(x.hsb[2] + t.lightness);
+ if(c == "255,255,255") /* IE confuses white with transparent... */
+ c = "255,255,254";
+
+ return "rgb(" + c + ")";
+ } else if(mode == "o") {
+ return this.uiOptions[arguments[1]] ? arguments[2] : arguments[3];
+ }
+ }.bind(this));
+ }
+});
+
+qwebirc.ui.NotificationUI = new Class({
+ Extends: qwebirc.ui.StandardUI,
+ initialize: function(parentElement, windowClass, uiName, options) {
+ this.parent(parentElement, windowClass, uiName, options);
+
+ this.__beeper = new qwebirc.ui.Beeper(this.uiOptions);
+ this.__flasher = new qwebirc.ui.Flasher(this.uiOptions);
+ this.__notifier = new qwebirc.ui.Notifier(this.uiOptions);
+
+ this.cancelFlash = this.__flasher.cancelFlash.bind(this.__flasher);
+ },
+ beep: function() {
+ this.__beeper.beep();
+ },
+ notify: function(title, message, callback) {
+ this.__beeper.beep();
+ this.__flasher.flash();
+ this.__notifier.notify(title, message, callback);
+ },
+ setBeepOnMention: function(value) {
+ if(value)
+ this.__beeper.soundInit();
+ },
+ setNotifications: function(value) {
+ this.__notifier.setEnabled(value);
+ },
+ updateTitle: function(text) {
+ if(this.__flasher.updateTitle(text))
+ this.parent(text);
+ },
+ focusChange: function(value) {
+ this.parent(value);
+ this.__flasher.focusChange(value);
+ this.__notifier.focusChange(value);
+ }
+});
+
+qwebirc.ui.NewLoginUI = new Class({
+ Extends: qwebirc.ui.NotificationUI,
+ loginBox: function(callbackfn, initialNickname, initialChannels, autoConnect, autoNick) {
+ this.postInitialize();
+
+ /* I'd prefer something shorter and snappier! */
+ var w = this.newCustomWindow("Connect", true, qwebirc.ui.WINDOW_CONNECT);
+ var callback = function(args) {
+ w.close();
+ callbackfn(args);
+ };
+
+ qwebirc.ui.GenericLoginBox(w.lines, callback, initialNickname, initialChannels, autoConnect, autoNick, this.options.networkName);
+ }
+});
+
+qwebirc.ui.QuakeNetUI = new Class({
+ Extends: qwebirc.ui.NewLoginUI,
+ urlDispatcher: function(name, window) {
+ if(name == "qwhois") {
+ return ["span", function(auth) {
+ this.client.exec("/MSG Q whois #" + auth);
+ }.bind(window)];
+ }
+ return this.parent(name, window);
+ },
+ logout: function() {
+ if(!qwebirc.auth.loggedin())
+ return;
+ if(confirm("Log out?")) {
+ this.clients.each(function(k, v) {
+ v.quit("Logged out");
+ }, this);
+
+ /* HACK */
+ var foo = function() { document.location = qwebirc.global.dynamicBaseURL + "auth?logout=1"; };
+ foo.delay(500);