Permalink
Browse files

working on making socket.io and irc runnable

  • Loading branch information...
1 parent 9327bfb commit 677f18784481f358da853ae6ff18445873436276 @butu5 committed Aug 20, 2011
Showing with 32,309 additions and 17 deletions.
  1. +27 −17 index.coffee
  2. +43 −0 index.js
  3. +4 −0 node_modules/socket.io-client/.gitignore
  4. +2 −0 node_modules/socket.io-client/.npmignore
  5. +60 −0 node_modules/socket.io-client/History.md
  6. +20 −0 node_modules/socket.io-client/Makefile
  7. +246 −0 node_modules/socket.io-client/README.md
  8. +285 −0 node_modules/socket.io-client/bin/builder.js
  9. BIN node_modules/socket.io-client/dist/WebSocketMain.swf
  10. BIN node_modules/socket.io-client/dist/WebSocketMainInsecure.swf
  11. +3,692 −0 node_modules/socket.io-client/dist/socket.io.js
  12. +2 −0 node_modules/socket.io-client/dist/socket.io.min.js
  13. +184 −0 node_modules/socket.io-client/lib/events.js
  14. +205 −0 node_modules/socket.io-client/lib/io.js
  15. +322 −0 node_modules/socket.io-client/lib/json.js
  16. +242 −0 node_modules/socket.io-client/lib/namespace.js
  17. +262 −0 node_modules/socket.io-client/lib/parser.js
  18. +1 −0 node_modules/socket.io-client/lib/socket.io-client.js
  19. +519 −0 node_modules/socket.io-client/lib/socket.js
  20. +234 −0 node_modules/socket.io-client/lib/transport.js
  21. +186 −0 node_modules/socket.io-client/lib/transports/flashsocket.js
  22. +172 −0 node_modules/socket.io-client/lib/transports/htmlfile.js
  23. +217 −0 node_modules/socket.io-client/lib/transports/jsonp-polling.js
  24. +185 −0 node_modules/socket.io-client/lib/transports/websocket.js
  25. +155 −0 node_modules/socket.io-client/lib/transports/xhr-polling.js
  26. +213 −0 node_modules/socket.io-client/lib/transports/xhr.js
  27. +366 −0 node_modules/socket.io-client/lib/util.js
  28. +1 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/.gitignore
  29. +157 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/README.md
  30. BIN node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMain.swf
  31. BIN node_modules/socket.io-client/lib/vendor/web-socket-js/WebSocketMainInsecure.zip
  32. +8 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/IWebSocketLogger.as
  33. +464 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocket.as
  34. +33 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocketEvent.as
  35. +150 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocketMain.as
  36. +19 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/WebSocketMainInsecure.as
  37. +10 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/build.sh
  38. +204 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/adobe/net/proxies/RFC2817Socket.as
  39. +375 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/gsolo/encryption/MD5.as
  40. +287 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/Crypto.as
  41. +3,235 −0 ...t.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/MozillaRootCertificates.as
  42. +218 −0 ...es/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509Certificate.as
  43. +57 −0 ...io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509CertificateCollection.as
  44. +82 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as
  45. +27 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHMAC.as
  46. +21 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHash.as
  47. +137 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MAC.as
  48. +124 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD2.as
  49. +204 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD5.as
  50. +106 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA1.as
  51. +28 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA224.as
  52. +115 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA256.as
  53. +71 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHABase.as
  54. +90 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/ARC4.as
  55. +20 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/IPRNG.as
  56. +119 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/Random.as
  57. +142 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/TLSPRF.as
  58. +339 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as
  59. +2,797 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/AESKey.as
  60. +375 −0 ...s/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/BlowFishKey.as
  61. +55 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CBCMode.as
  62. +61 −0 ...ules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFB8Mode.as
  63. +64 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFBMode.as
  64. +58 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CTRMode.as
  65. +365 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/DESKey.as
  66. +86 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ECBMode.as
  67. +21 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ICipher.as
  68. +15 −0 ...modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IMode.as
  69. +32 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IPad.as
  70. +21 −0 ...socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IStreamCipher.as
  71. +35 −0 ...socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ISymmetricKey.as
  72. +110 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IVMode.as
  73. +34 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/NullPad.as
  74. +52 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/OFBMode.as
  75. +44 −0 ...modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/PKCS5.as
  76. +44 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SSLPad.as
  77. +60 −0 .../socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SimpleIVMode.as
  78. +42 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TLSPad.as
  79. +88 −0 .../socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TripleDESKey.as
  80. +94 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/XTeaKey.as
  81. +29 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/aeskey.pl
  82. +2,304 −0 ...modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/dump.txt
  83. +1,220 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/AESKeyTest.as
  84. +58 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ARC4Test.as
  85. +39 −0 ...es/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BigIntegerTest.as
  86. +148 −0 ...s/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BlowFishKeyTest.as
  87. +160 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CBCModeTest.as
  88. +71 −0 ...ules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFB8ModeTest.as
  89. +98 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFBModeTest.as
  90. +109 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CTRModeTest.as
  91. +112 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/DESKeyTest.as
  92. +151 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ECBModeTest.as
  93. +184 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/HMACTest.as
  94. +20 −0 ...ules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ITestHarness.as
  95. +56 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD2Test.as
  96. +58 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD5Test.as
  97. +101 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/OFBModeTest.as
  98. +92 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/RSAKeyTest.as
  99. +198 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA1Test.as
  100. +58 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA224Test.as
  101. +60 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA256Test.as
  102. +51 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TLSPRFTest.as
  103. +42 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TestCase.as
  104. +59 −0 .../socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TripleDESKeyTest.as
  105. +66 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/XTeaKeyTest.as
  106. +102 −0 ...modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/BulkCiphers.as
  107. +117 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/CipherSuites.as
  108. +14 −0 ...es/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/IConnectionState.as
  109. +29 −0 ...socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/ISecurityParameters.as
  110. +24 −0 ...odules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/KeyExchanges.as
  111. +38 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as
  112. +171 −0 .../socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLConnectionState.as
  113. +26 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLEvent.as
  114. +340 −0 ...cket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLSecurityParameters.as
  115. +70 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConfig.as
  116. +151 −0 .../socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConnectionState.as
  117. +895 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEngine.as
  118. +39 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSError.as
  119. +27 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEvent.as
  120. +197 −0 ...cket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSecurityParameters.as
  121. +370 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocket.as
  122. +26 −0 ...ules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocketEvent.as
  123. +180 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSTest.as
  124. +90 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/BarrettReduction.as
  125. +1,543 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/BigInteger.as
  126. +35 −0 ..._modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/ClassicReduction.as
  127. +11 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/IReduction.as
  128. +85 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/MontgomeryReduction.as
  129. +34 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/NullReduction.as
  130. +11 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/math/bi_internal.as
  131. +25 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/ArrayUtil.as
  132. +189 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Base64.as
  133. +66 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Hex.as
  134. +28 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/Memory.as
  135. +43 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ByteString.as
  136. +210 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/DER.as
  137. +21 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/IAsn1Type.as
  138. +44 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Integer.as
  139. +35 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/OID.as
  140. +112 −0 ...ules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as
  141. +118 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/PEM.as
  142. +49 −0 ...dules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/PrintableString.as
  143. +90 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Sequence.as
  144. +27 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Set.as
  145. +94 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/Type.as
  146. +60 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/util/der/UTCTime.as
  147. +75 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/sample.html
  148. +4 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/swfobject.js
  149. +349 −0 node_modules/socket.io-client/lib/vendor/web-socket-js/web_socket.js
  150. +33 −0 node_modules/socket.io-client/package.json
  151. +121 −0 node_modules/socket.io-client/test/events.test.js
  152. +31 −0 node_modules/socket.io-client/test/io.test.js
  153. +102 −0 node_modules/socket.io-client/test/node/builder.common.js
  154. +131 −0 node_modules/socket.io-client/test/node/builder.test.js
  155. +352 −0 node_modules/socket.io-client/test/parser.test.js
  156. +335 −0 node_modules/socket.io-client/test/socket.test.js
  157. +156 −0 node_modules/socket.io-client/test/util.test.js
View
@@ -13,20 +13,30 @@ io = require('socket.io').listen(app)
console.log "Server started listening on port 80..."
app.listen 80
-io.sockets.on 'connection', (socket) ->
-
- console.log "Connection establishes...."
- client = new irc.Client 'localhost', 'ircbot', {
- debug: false,
- channels: ['#node.js']
- }
-
- client.addListener 'error', (message) ->
- console.log 'ERROR: %s: %s', message.command, message.args.join(' ')
-
- client.addListener 'message', (from, to, message) ->
- console.log from + " > " + message
- socket.emit 'msg', {from: from,message: message}
-
- client.join '#node.js'
-
+client = new irc.Client 'localhost', 'butu5bot', {
+ debug: false,
+ channels: ['#node.js']
+}
+
+client.addListener 'error', (message) ->
+ console.log 'ERROR: %s: %s', message.command, message.args.join(' ')
+
+# client.join '#node.js'
+
+###
+client.addListener 'message', (from, to, message) ->
+ console.log from + " > " + message
+ socket.emit 'msg', {from: from,message: message}
+###
+socket = null
+msgReceived = (from, to, message) ->
+ if socket?
+ socket.emit "msg", {from: from, message: message}
+ console.log "socket is not null"
+ else
+ console.log "socket is null"
+
+client.addListener 'message', msgReceived
+
+io.sockets.on 'connection', (socket1) ->
+ socket = socket1
View
@@ -0,0 +1,43 @@
+(function() {
+ var app, client, file, http, io, irc, msgReceived, socket, static;
+ static = require("node-static");
+ http = require("http");
+ irc = require("irc");
+ file = new static.Server('./public');
+ app = http.createServer(function(req, res) {
+ return req.addListener('end', function() {
+ return file.serve(req, res);
+ });
+ });
+ io = require('socket.io').listen(app);
+ console.log("Server started listening on port 80...");
+ app.listen(80);
+ client = new irc.Client('localhost', 'butu5bot', {
+ debug: false,
+ channels: ['#node.js']
+ });
+ client.addListener('error', function(message) {
+ return console.log('ERROR: %s: %s', message.command, message.args.join(' '));
+ });
+ /*
+ client.addListener 'message', (from, to, message) ->
+ console.log from + " > " + message
+ socket.emit 'msg', {from: from,message: message}
+ */
+ socket = null;
+ msgReceived = function(from, to, message) {
+ if (socket != null) {
+ socket.emit("msg", {
+ from: from,
+ message: message
+ });
+ return console.log("socket is not null");
+ } else {
+ return console.log("socket is null");
+ }
+ };
+ client.addListener('message', msgReceived);
+ io.sockets.on('connection', function(socket1) {
+ return socket = socket1;
+ });
+}).call(this);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 677f187

Please sign in to comment.