Rev 1412 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1412 | Rev 1413 | ||
|---|---|---|---|
| Line 65... | Line 65... | ||
| 65 | this.mySocket.send(".quit\n"); |
65 | this.mySocket.send(".quit\n"); |
| 66 | this.myState = "DISCONNECTING" |
66 | this.myState = "DISCONNECTING" |
| 67 | } |
67 | } |
| 68 | else if (this.myState == "CONNECTING") |
68 | else if (this.myState == "CONNECTING") |
| 69 | { |
69 | { |
| - | 70 | var self = this; |
|
| 70 | this.myQuitCallback = function() { self.disconnect(); } |
71 | this.myQuitCallback = function() { self.disconnect(); } |
| 71 | } |
72 | } |
| 72 | } |
73 | } |
| 73 | 74 | ||
| 74 | EggdropIRCpost.prototype.post = function(channel, text) |
75 | EggdropIRCpost.prototype.post = function(channel, text) |
| 75 | { |
76 | { |
| 76 | this.mySendChn = channel; |
77 | this.mySendChn = channel; |
| 77 | this.mySendText = text; |
78 | this.mySendText = text; |
| 78 | var self = this; |
79 | var self = this; |
| 79 | 80 | ||
| 80 | if (this.mySocket && this.myState == "CONNECTED") |
81 | if (this.mySocket && this.myState == "CONNECTED") |
| 81 | { |
82 | { |
| 82 | /* To send text to a channel send text ".say <channelname> <text>" */ |
83 | /* To send text to a channel send text ".say <channelname> <text>" */ |
| 83 | this.mySocket.send(".say "+channel+" "+text+"\n"); |
84 | this.mySocket.send(".say "+channel+" "+text+"\n"); |
| Line 86... | Line 87... | ||
| 86 | this.myQuitCallback(); |
87 | this.myQuitCallback(); |
| 87 | this.myQuitCallback = null; |
88 | this.myQuitCallback = null; |
| 88 | } |
89 | } |
| 89 | } |
90 | } |
| 90 | else if (this.myState == "DISCONNECTED") |
91 | else if (this.myState == "DISCONNECTED") |
| 91 | { |
92 | { |
| 92 | /* Create the callback which should be called from socketCallback when reaching state==CONNECTED */ |
93 | /* Create the callback which should be called from socketCallback when reaching state==CONNECTED */ |
| 93 | this.myDataCallback = function() { self.DataCallback(); } |
94 | this.myDataCallback = function() { self.DataCallback(); } |
| 94 | this.connect(); |
95 | this.connect(); |
| 95 | } |
96 | } |
| 96 | else if (this.myState == "CONNECTING") |
97 | else if (this.myState == "CONNECTING") |
| 97 | { |
98 | { |
| 98 | this.myDataCallback = function() { self.DataCallback(); } |
99 | this.myDataCallback = function() { self.DataCallback(); } |
| 99 | } |
100 | } |
| 100 | } |
101 | } |
| 101 | 102 | ||
| 102 | EggdropIRCpost.prototype.postAndDisconnect = function(channel, text) |
103 | EggdropIRCpost.prototype.postAndDisconnect = function(channel, text) |
| 103 | { |
104 | { |
| - | 105 | var self = this; |
|
| 104 | this.myQuitCallback = function() { self.disconnect(); } |
106 | this.myQuitCallback = function() { self.disconnect(); } |
| 105 | this.post(channel, text); |
107 | this.post(channel, text); |
| 106 | } |
108 | } |
| 107 | 109 | ||
| 108 | EggdropIRCpost.prototype.DataCallback = function() |
110 | EggdropIRCpost.prototype.DataCallback = function() |