Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Directory moving
- Loading branch information
0 parents
commit 903d703
Showing
48 changed files
with
6,174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
http://www.ape-project.org | ||
|
||
Weelya <contact@weelya.com> <http://www.weelya.net> | ||
Anthony Catel <a.catel@weelya.com> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
EXEC=bin/aced | ||
|
||
prefix = /usr/local | ||
bindir = $(prefix)/bin | ||
|
||
|
||
SRC=src/entry.c src/sock.c src/hash.c src/handle_http.c src/raw.c src/users.c src/channel.c src/config.c src/json.c src/bots.c src/plugins.c src/http.c src/extend.c src/utils.c src/ticks.c | ||
|
||
CFLAGS=-Wall -g -minline-all-stringops -rdynamic | ||
LFLAGS=-ldl | ||
CC=gcc | ||
RM=rm -f | ||
|
||
all: aced | ||
|
||
aced: $(SRC) | ||
$(CC) $(CFLAGS) $(SRC) -o $(EXEC) $(LFLAGS) | ||
install: | ||
install -d $(bindir) | ||
install -m 755 $(EXEC) $(bindir) | ||
|
||
uninstall: | ||
$(RM) $(bindir)/aced | ||
|
||
clean: | ||
$(RM) $(EXEC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
To compile APE you need : | ||
- GCC | ||
- libc6-dev | ||
- 5 second' | ||
|
||
# make | ||
# cd modules/ | ||
# make | ||
# cd ../bin/ | ||
# ./aced |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# APE Server Configuration file | ||
|
||
# listen porn | ||
port=6969 | ||
#################### | ||
# Not used for the moment | ||
connectedfile=connected | ||
#################### | ||
# Launch APE as daemon [no/yes] | ||
daemon=no | ||
#################### | ||
# Script domain name [See documentation] | ||
domain=ape-project.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo = Rulez the world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Configuration for libape-mysql.c | ||
|
||
db_server = localhost | ||
db_name = APE | ||
db_user = root | ||
db_password = xxxx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/* define('_MODULE_NAME_', 'Helloworld PHP Script'); | ||
echo 'Loading Module' . "\n"; | ||
function init_module() | ||
{ | ||
echo 'bla' . "\n"; | ||
} | ||
*/ | ||
class ape_helloworld | ||
{ | ||
public function __construct() | ||
{ | ||
echo 'Anthony Catel is a god' . "\n"; | ||
return 'aaa'; | ||
} | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
See http://www.ape-project.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CFLAGS=-Wall -g -shared -fPIC -rdynamic | ||
CC=gcc | ||
INCLUDE_PATH = -Iphp/ -Iphp/include -Iphp/main/ -Iphp/Zend -Iphp/TSRM | ||
PHP_LIB=php/libs/libphp5.a | ||
|
||
all: modules | ||
|
||
modules: libape-chat.c libape-mysql.c libape-setcord.c libape-helloworld.c libape-php.c | ||
$(CC) $(CFLAGS) -Wl,-soname,libmod_mysql.so -L/usr/local/mysql/lib -lmysqlclient -lz -o lib/libmod_mysql.so libape-mysql.c | ||
$(CC) $(CFLAGS) -Wl,-soname,libmod_setcord.so -o lib/libmod_setcord.so libape-setcord.c | ||
$(CC) $(CFLAGS) -Wl,-soname,libmod_chat.so -o lib/libmod_chat.so libape-chat.c -L./lib -lmod_mysql -Xlinker "-R\$$ORIGIN" | ||
#$(CC) $(CFLAGS) -Wl,-soname,libmod_helloworld.so -o lib/libmod_helloworld.so libape-helloworld.c | ||
$(CC) -Wall -o ./objs/libape-php.o -c libape-php.c $(INCLUDE_PATH) | ||
$(CC) $(CFLAGS) -Wl,-soname,libmod_php.so -o lib/libmod_php.so objs/libape-php.o $(PHP_LIB) -ldl -lm -lcrypt -lresolv -lxml2 | ||
|
||
#./configure --enable-embed=static --with-zlib --enable-ftp --enable-static=zlib --disable-simplexml --disable-xmlreader --disable-xmlwriter --disable-soap | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Copyright (C) 2006, 2007, 2008, 2009 Anthony Catel <a.catel@weelya.com> | ||
This file is part of ACE Server. | ||
ACE is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
ACE is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with ACE ; if not, write to the Free Software Foundation, | ||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
/* global_plugins.h */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/* | ||
Adding support of nickname | ||
CONNECT raw is overrided with new param (nickname) GET /?IP&CONNECT&nickname&anticache HTTP/1.1 | ||
USER object has now a property identidied by "nickname" | ||
TODO : Move topic system, level, ban, kick, etc.. | ||
*/ | ||
|
||
#include "plugins.h" | ||
#include "global_plugins.h" | ||
#include "libape-mysql.h" | ||
|
||
#define MODULE_NAME "chat" | ||
|
||
static void hash_user(USERS *user, char *nick, acetables *g_ape); | ||
static USERS *get_user_by_nickname(char *nick, acetables *g_ape); | ||
/* This declaration is mandatory */ | ||
|
||
/* Donner un nom pour la resolution global */ | ||
static ace_plugin_infos infos_module = { | ||
"\"Chat\" system", // Module Name | ||
"0.01", // Module Version | ||
"Anthony Catel",// Module Author | ||
NULL // config file (bin/) | ||
}; | ||
|
||
static unsigned int chat_connect(callbackp *callbacki) | ||
{ | ||
USERS *nuser; | ||
RAW *newraw; | ||
|
||
struct json *jstr = NULL; | ||
|
||
if (get_user_by_nickname(callbacki->param[1], callbacki->g_ape)) { | ||
ENVOI(callbacki->fdclient, "NICK_USED"); | ||
|
||
return (FOR_NOTHING); | ||
} | ||
|
||
nuser = adduser(callbacki->fdclient, callbacki->host, callbacki->g_ape); | ||
|
||
callbacki->call_user = nuser; | ||
|
||
if (nuser == NULL) { | ||
ENVOI(callbacki->fdclient, ERR_CONNECT); | ||
|
||
return (FOR_NOTHING); | ||
} | ||
|
||
hash_user(nuser, callbacki->param[1], callbacki->g_ape); | ||
add_property_str(&nuser->properties, "name", callbacki->param[1]); | ||
|
||
|
||
set_json("sessid", nuser->sessid, &jstr); | ||
set_json("user", NULL, &jstr); | ||
|
||
json_attach(jstr, get_json_object_user(nuser), JSON_OBJECT); | ||
|
||
newraw = forge_raw(RAW_LOGIN, jstr); | ||
|
||
post_raw(newraw, nuser); | ||
|
||
#if 0 | ||
|
||
name = ape_mysql_get("SELECT name FROM user WHERE id = 1", callbacki->g_ape); | ||
|
||
printf("From char : %s\n", name); | ||
|
||
free(name); | ||
#endif | ||
|
||
return (FOR_LOGIN | FOR_UPDATE_IP); | ||
|
||
} | ||
|
||
static void chat_deluser(USERS *user, acetables *g_ape) | ||
{ | ||
hashtbl_erase(get_property(g_ape->properties, "nicklist")->val, get_property(user->properties, "name")->val); | ||
deluser(user, g_ape); | ||
} | ||
|
||
static void hash_user(USERS *user, char *nick, acetables *g_ape) | ||
{ | ||
// get_property(g_ape->properties, "nicklist")->val <= this return a hashtable identified by "nicklist" | ||
hashtbl_append(get_property(g_ape->properties, "nicklist")->val, nick, user); | ||
} | ||
|
||
static USERS *get_user_by_nickname(char *nick, acetables *g_ape) | ||
{ | ||
return hashtbl_seek(get_property(g_ape->properties, "nicklist")->val, nick); | ||
|
||
} | ||
|
||
void change_nick(USERS *user, char *nick, acetables *g_ape) | ||
{ | ||
struct CHANLIST *clist = user->chan_foot; | ||
|
||
hashtbl_erase(get_property(g_ape->properties, "nicklist")->val, get_property(user->properties, "name")->val); | ||
hash_user(user, nick, g_ape); | ||
|
||
add_property_str(&user->properties, "name", nick); | ||
|
||
while (clist != NULL) { | ||
//RAW *new_raw; | ||
|
||
clist = clist->next; | ||
} | ||
} | ||
|
||
static void init_module(acetables *g_ape) // Called when module is loaded | ||
{ | ||
// Adding hashtable identified by "nicklist" to g_ape properties | ||
add_property(&g_ape->properties, "nicklist", hashtbl_init()); | ||
|
||
// Overriding connect raw | ||
register_raw("CONNECT", 1, chat_connect, NEED_NOTHING, g_ape); | ||
} | ||
|
||
|
||
static ace_callbacks callbacks = { | ||
NULL, /* Called when new user is added */ | ||
chat_deluser, /* Called when a user is disconnected */ | ||
NULL, /* Called when new chan is created */ | ||
NULL, /* Called when a user join a channel */ | ||
NULL /* Called when a user leave a channel */ | ||
}; | ||
|
||
APE_INIT_PLUGIN(MODULE_NAME, init_module, callbacks) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include <stdio.h> | ||
|
||
#include "plugins.h" | ||
#include "global_plugins.h" | ||
|
||
#define MODULE_NAME "helloworld" // Unique identifier | ||
|
||
/* You must name this "infos_module" because of macro READ_CONF */ | ||
static ace_plugin_infos infos_module = { | ||
"HelloWorld", // Module Name | ||
"0.01", // Module Version | ||
"Anthony Catel", // Module Author | ||
"helloworld.conf" // Config file (from ./bin/) (can be NULL) | ||
}; | ||
|
||
|
||
|
||
|
||
static unsigned int raw_helloworld(callbackp *callbacki) | ||
{ | ||
/* Sending a simple raw "Monkey" with "Helloworld" value */ | ||
send_msg(callbacki->call_user, "Helloworld", "Monkey"); | ||
|
||
/* Most used return */ | ||
return (FOR_NOTHING); | ||
} | ||
|
||
static void init_module(acetables *g_ape) // Called when module is loaded (passed to APE_INIT_PLUGIN) | ||
{ | ||
/* Print "foo" key from helloworld.conf */ | ||
printf("Helloworld loaded ;-) [Conf foo : %s]\n", READ_CONF("foo")); | ||
|
||
/* Adding a new raw GET /?q&HELLOWORLD&[SESSID]&[ANTICACHE] */ | ||
register_raw("HELLOWORLD", 1, raw_helloworld, NEED_SESSID, g_ape); | ||
} | ||
|
||
/* Passed to callbacks list */ | ||
static USERS *helloworld_adduser(unsigned int fdclient, char *host, acetables *ace_tables) | ||
{ | ||
/* */ | ||
/* Everything put here will be executed BEFORE user is added */ | ||
/* */ | ||
|
||
|
||
/* Call parent function (can be another plugin callback) */ | ||
USERS *n = adduser(fdclient, host, ace_tables); | ||
|
||
|
||
/* */ | ||
/* Everything put here will be executed AFTER user is added */ | ||
/* */ | ||
|
||
if (n == NULL) { | ||
return NULL; | ||
} | ||
printf("[Helloworld !] => %s user added\n", n->pubid); | ||
|
||
/* Parent result must be returned (or NULL) */ | ||
return n; | ||
} | ||
|
||
|
||
|
||
|
||
/* See plugins.h for prototype */ | ||
static ace_callbacks callbacks = { | ||
helloworld_adduser, /* Called when new user is added */ | ||
NULL, /* Called when a user is disconnected */ | ||
NULL, /* Called when new chan is created */ | ||
NULL, /* Called when a user join a channel */ | ||
NULL /* Called when a user leave a channel */ | ||
}; | ||
|
||
/* Registering module (arg1 : unique identifier, arg2 : init function, arg3 : Callbacks list) */ | ||
APE_INIT_PLUGIN(MODULE_NAME, init_module, callbacks) |
Oops, something went wrong.