Skip to content

Commit

Permalink
Fix a linker bug
Browse files Browse the repository at this point in the history
  • Loading branch information
paraboul committed Oct 11, 2009
1 parent d2b4d00 commit 519e20d
Show file tree
Hide file tree
Showing 7 changed files with 14,150 additions and 4 deletions.
5 changes: 5 additions & 0 deletions bin/scripts/commands/inlinepush.js
@@ -0,0 +1,5 @@
Ape.registerCmd("control", false, function(params, infos) {
if (params.password == Ape.config("control.conf", "password")) {
var chan = Ape.getChannelByName(params.channel).pipe.sendRaw(params.raw, params.data);
}
})
64 changes: 64 additions & 0 deletions bin/scripts/commands/proxy.js
@@ -0,0 +1,64 @@
Ape.registerCmd("PROXY_CONNECT", true, function(params, infos) {
if (!$defined(params.host) || !$defined(params.port)) {
return 0;
}
var socket = new Ape.sockClient(params.port, params.host);
socket.chl = infos.chl;
/* TODO : Add socket to the user */

socket.onConnect = function() {
/* "this" refer to socket object */
/* Create a new pipe (with a pubid) */
var pipe = new Ape.pipe();

infos.user.proxys.set(pipe.getProperty('pubid'), pipe);

/* Set some private properties */
pipe.link = socket;
pipe.nouser = false;
this.pipe = pipe;

/* Called when an user send a "SEND" command on this pipe */
pipe.onSend = function(user, params) {
/* "this" refer to the pipe object */
this.link.write(Ape.base64.decode(params.msg));
}

pipe.onDettach = function() {
this.link.close();
}

/* Send a PROXY_EVENT raw to the user and attach the pipe */
infos.user.pipe.sendRaw("PROXY_EVENT", {"event": "connect", "chl": this.chl}, {from: this.pipe});
}

socket.onRead = function(data) {
infos.user.pipe.sendRaw("PROXY_EVENT", {"event": "read", "data": Ape.base64.encode(data)}, {from: this.pipe});
}

socket.onDisconnect = function(data) {
if ($defined(this.pipe)) {
if (!this.pipe.nouser) { /* User is not available anymore */
infos.user.pipe.sendRaw("PROXY_EVENT", {"event": "disconnect"}, {from: this.pipe});
infos.user.proxys.erase(this.pipe.getProperty('pubid'));
}
/* Destroy the pipe */
this.pipe.destroy();
}
}

return 1;
});

Ape.addEvent("deluser", function(user) {
user.proxys.each(function(val) {
val.nouser = true;
val.onDettach();
});
});

Ape.addEvent("adduser", function(user) {
user.proxys = new $H;
})


1 change: 1 addition & 0 deletions bin/scripts/main.ape.js
@@ -1,5 +1,6 @@
Ape.addEvent("init", function() {
include("./scripts/framework/mootools.js");
include("./scripts/framework/userslist.js");
include("./scripts/utils/utils.js");
include("./scripts/commands/proxy.js");
include("./scripts/commands/inlinepush.js");
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Expand Up @@ -3,7 +3,7 @@
cd ./libs/udns-0.0.9/
make clean && ./configure && make
cd ../js1.8/src/
autoconf && ./configure && make
./configure && make
cd ../../../
make
cd modules
Expand Down

0 comments on commit 519e20d

Please sign in to comment.