From: Jack Allnutt Date: Wed, 13 Jul 2011 03:26:28 +0000 (+0100) Subject: Modified front-end files X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c984ba1b436c072e44c429d312e676199b937e8a;p=KiwiIRC.git Modified front-end files --- diff --git a/index.php b/index.php index d1b1f45..cd43e8a 100644 --- a/index.php +++ b/index.php @@ -45,7 +45,7 @@ - + @@ -152,4 +152,4 @@ - \ No newline at end of file + diff --git a/js/gateway.js b/js/gateway.js index 610d6e5..065977f 100644 --- a/js/gateway.js +++ b/js/gateway.js @@ -8,9 +8,10 @@ var gateway = { channel_prefix: '#', network_name: '', user_prefixes: [], + socket: null, - connect: function(s_host, s_port, s_ssl, callback){ + /*connect: function(s_host, s_port, s_ssl, callback){ var data = { method: 'connect', args: { @@ -23,12 +24,14 @@ var gateway = { //$.post('poll.php', data, callback, 'json'); gateway.sendData(data, callback); - }, - + },*/ + connect: function(host,port,ssl,callback) { + socket.emit('irc connect', this.nick, host, port, ssl, function() { console.log('callback'); callback}); + }, - start: function(){ + /*start: function(){ if(typeof WebSocket != "undefined"){ //alert("Starting websocket support.."); gateway.socket(); @@ -36,10 +39,35 @@ var gateway = { //alert("Starting polling support.."); gateway.poll(); } + },*/ + start: function() { + socket = io.connect('http://192.168.1.127:7777/'); + socket.on('connection',function() { + gateway.sendData = function(data,callback) { + socket.send({sid:this.session_id,data:$.toJSON(data)},function(){console.log('callbacl'); callback}); + } + socket.on('message', function(msg) { + gateway.buffer += msg; + + if(gateway.buffer.indexOf("\n") > 0){ + var msgs = gateway.buffer.split("\n"); + for(var i=0; i