]>
jfr.im git - irc/quakenet/qwebirc.git/blob - js/irc/ircconnection.js
1 var IRCConnection
= new Class({
2 Implements: [Events
, Options
],
4 initialNickname: "ircconnX"
6 initialize: function(options
) {
7 this.setOptions(options
);
9 this.initialNickname
= this.options
.initialNickname
;
12 this.disconnected
= false;
14 send: function(data
) {
15 var r
= new Request
.JSON({url: "/e/p/" + this.sessionid
+ "?c=" + encodeURIComponent(data
) + "&t=" + this.counter
++, onComplete: function(o
) {
17 alert("An error occured: " + o
[1]);
23 this.fireEvent("recv", [[false, "moo"]]);
29 var r
= new Request
.JSON({url: "/e/s/" + this.sessionid
+ "?t=" + this.counter
++, onComplete: function(o
) {
31 alert("An error occured: " + o
[1]);
35 this.fireEvent("recv", [x
]);
43 var r
= new Request
.JSON({url: "/e/n?nick=" + encodeURIComponent(this.initialNickname
) + "&r=" + Math
.random() * 1024 * 1024, onComplete: function(o
) {
45 alert("An error occured: " + o
[1]);
48 this.sessionid
= o
[1];
54 disconnect: function() {
55 this.disconnected
= true;