]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Add +x support, don't reveal the users host with autojoins.
authorChris Porter <redacted>
Sat, 6 Dec 2008 16:32:39 +0000 (16:32 +0000)
committerChris Porter <redacted>
Sat, 6 Dec 2008 16:32:39 +0000 (16:32 +0000)
Also add /autojoin.

TODO.txt
js/irc/commandparser.js
js/irc/ircclient.js
js/ui/baseui.js
js/ui/optionspane.js

index 8fa297f0ff7ac94454d6b79e1a4fc945691d1e96..38c29ba92ef170cf538dcbe7d96d0db84607fa53 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -9,13 +9,13 @@ UI:
   FEAT: branding\r
   TIDY: warning/info messages should have their colour decided by CSS\r
   FEAT: privacy policy\r
-  FEAT: +x\r
   TIDY: connect dialog offset looks non-centred\r
   \r
 Authing:\r
   TIDY: Finish integration (notably login button on non-autoconnect page).\r
   TIDY: Login button should save state on form.\r
   TIDY: Fix up state inconsistency if backend is restarted (state is stored in user cookie and not refreshed except on login).\r
+  FEAT: bind qticket to session to prevent ticket reuse within time limit.\r
   \r
 IRC:  \r
   TIDY: /msg $ goes to status, as does /notice $, should go to active.\r
index 199fe9b8cbc723a651de1848066d1195518fcb88..a8300d3bd363bce36552f8fbbedd42f98ca6164d 100644 (file)
@@ -281,6 +281,10 @@ qwebirc.irc.CommandParser = new Class({
   cmd_UMODE: [false, 1, 0, function(args) {
     this.send("MODE " + this.parentObject.getNickname() + (args?(" " + args[0]):""));
   }],
+  cmd_AUTOJOIN: [false, undefined, undefined, function(args) {
+    var realargs = this.parentObject.options.autojoin.splitMax(" ", 2);
+    return ["JOIN", realargs[0], realargs[1]];
+  }],
   cmd_CLEAR: [false, undefined, undefined, function(args) {
     var w = this.getActiveWindow().lines;
     while(w.childNodes.length > 0)
index 5d138a30f5a1f4d6e46992bf3732445d83ec3470..afaa5a25f83d89df50a259fd8ba6c960f791fc15 100644 (file)
@@ -193,8 +193,25 @@ qwebirc.irc.IRCClient = new Class({
     this.nickname = nickname;
     this.newServerLine("SIGNON");
     
-    if(this.options.autojoin)
-      this.commandparser.dispatch("/JOIN " + this.options.autojoin);
+    /* we guarantee that +x is sent out before the joins */
+    if(this.ui.uiOptions.USE_HIDDENHOST)
+      this.exec("/UMODE +x");
+      
+    if(qwebirc.auth.loggedin && this.options.autojoin) {
+      if(this.ui.uiOptions.USE_HIDDENHOST) {
+        var d = function() {
+          if($defined(this.activeTimers.autojoin))
+            this.ui.getActiveWindow().infoMessage("Waiting for login before joining channels...");
+        }.delay(5, this);
+        this.activeTimers.autojoin = function() {
+          var w = this.ui.getActiveWindow();
+          w.errorMessage("No login response in 10 seconds.");
+          w.errorMessage("You may want to try authing to Q and then type: /autojoin (if you don't auth your host may be visible).");
+        }.delay(10000, this);
+      } else {
+        this.exec("/AUTOJOIN");
+      }
+    }
   },
   userJoined: function(user, channel) {
     var nick = user.hostToNick();
@@ -368,10 +385,21 @@ qwebirc.irc.IRCClient = new Class({
   userPrivmsg: function(user, message) {
     var nick = user.hostToNick();
     var host = user.hostToHost();
-    
     this.newQueryWindow(nick, true);
     this.pushLastNick(nick);
     this.newQueryLine(nick, "PRIVMSG", {"m": message, "h": host, "n": nick}, true);
+
+    this.checkLogin(user, message);
+  },
+  checkLogin: function(user, message) {
+    if(this.isNetworkService(user) && $defined(this.activeTimers.autojoin)) {
+      if(message.match(/^You are now logged in as [^ ]+\.$/)) {
+        $clear(this.activeTimers.autojoin);
+        delete this.activeTimers["autojoin"];
+        this.ui.getActiveWindow().infoMessage("Joining channels...");
+        this.exec("/AUTOJOIN");
+      }
+    }
   },
   serverNotice: function(user, message) {
     if(user == "") {
@@ -390,6 +418,8 @@ qwebirc.irc.IRCClient = new Class({
     } else {
       this.newTargetOrActiveLine(nick, "PRIVNOTICE", {"m": message, "h": host, "n": nick});
     }
+    
+    this.checkLogin(user, message);
   },
   isNetworkService: function(user) {
     /* TODO: refactor */
index bc96096cc28e829b11c910b653b11e3316dd7659..2e82a903c438e9595f4f60c27d5824b47a0e02c6 100644 (file)
@@ -213,7 +213,7 @@ qwebirc.ui.StandardUI = new Class({
       new Event(x).stop();
   },
   getInputFocused: function(x) {
-    return  $$("input").indexOf(x.target) > -1;
+    return $$("input").indexOf(x.target) > -1;
   },
   newCustomWindow: function(name, select, type) {
     if(!type)
index ce2ad297d1235fbbac8d5c80b7a8b7b1e3df4338..42ce76193e2c2e153af5684e7ac985f7b5065e77 100644 (file)
@@ -19,6 +19,7 @@ qwebirc.config.DEFAULT_OPTIONS = [
   [4, "DEDICATED_NOTICE_WINDOW", "Send notices to dedicated message window", false],
   [3, "NICK_OV_STATUS", "Show status (@/+) before nicknames", true],
   [5, "ACCEPT_SERVICE_INVITES", "Automatically join channels when invited by Q", true],
+  [6, "USE_HIDDENHOST", "Hide your hostmask when authed to Q (+x)", true],
 ];
 
 qwebirc.config.DefaultOptions = null;