]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Fixes issue 58 (attempt synchronous disconnect on page close.
authorChris Porter <redacted>
Sat, 25 Jul 2009 23:01:41 +0000 (00:01 +0100)
committerChris Porter <redacted>
Sat, 25 Jul 2009 23:01:41 +0000 (00:01 +0100)
js/irc/ircclient.js
js/irc/ircconnection.js

index 826f12b76f5b3f996dc8e47ed22e8df9551b3097..fff9ae735d44c569659b7f4b8a98186e7dd4bbbd 100644 (file)
@@ -528,7 +528,7 @@ qwebirc.irc.IRCClient = new Class({
     this.newServerLine("ERROR", {"m": message});
   },
   quit: function(message) {
-    this.send("QUIT :" + message);
+    this.send("QUIT :" + message, true);
     this.disconnect();
   },
   disconnect: function() {
index e006c986a60979ca7612d2029e359a974b2f5375..687dc7361260b64ee3532d9cb837b6e11856147b 100644 (file)
@@ -35,7 +35,7 @@ qwebirc.irc.IRCConnection = new Class({
     if(this.options.errorAlert)
       alert(text);
   },
-  newRequest: function(url, floodProtection) {
+  newRequest: function(url, floodProtection, synchronous) {
     if(this.disconnected)
       return null;
       
@@ -44,8 +44,13 @@ qwebirc.irc.IRCConnection = new Class({
       this.__error("BUG: uncontrolled flood detected -- disconnected.");
     }
     
+    var asynchronous = true;
+    if(synchronous)
+      asynchronous = false;
+
     var r = new Request.JSON({
-      url: "/e/" + url + "?r=" + this.cacheAvoidance + "&t=" + this.counter++
+      url: "/e/" + url + "?r=" + this.cacheAvoidance + "&t=" + this.counter++,
+      async: asynchronous
     });
     
     /* try to minimise the amount of headers */
@@ -83,10 +88,10 @@ qwebirc.irc.IRCConnection = new Class({
     this.__floodLastRequest = t;
     return false;
   },
-  send: function(data) {
+  send: function(data, synchronous) {
     if(this.disconnected)
       return false;
-    var r = this.newRequest("p");
+    var r = this.newRequest("p", false, synchronous);
     
     r.addEvent("complete", function(o) {
       if(!o || (o[0] == false)) {