From: <arn...@us...> - 2007-12-22 22:18:14
|
Revision: 109 http://adchpp.svn.sourceforge.net/adchpp/?rev=109&view=rev Author: arnetheduck Date: 2007-12-22 14:18:06 -0800 (Sat, 22 Dec 2007) Log Message: ----------- Update docs, fix some minor issues Modified Paths: -------------- adchpp/trunk/License.txt adchpp/trunk/SConstruct adchpp/trunk/adchpp/PluginManager.h adchpp/trunk/adchpp/SettingsManager.h adchpp/trunk/adchpp/version.cpp adchpp/trunk/changelog.txt adchpp/trunk/etc/Script.xml adchpp/trunk/etc/adchpp.xml adchpp/trunk/plugins/Script/examples/access.lua adchpp/trunk/plugins/Script/src/ScriptManager.cpp adchpp/trunk/readme.txt adchpp/trunk/unix/main.cpp adchpp/trunk/unix/po/adchppd.pot Modified: adchpp/trunk/License.txt =================================================================== --- adchpp/trunk/License.txt 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/License.txt 2007-12-22 22:18:06 UTC (rev 109) @@ -1,5 +1,5 @@ adchpp -Copyright (C) 2006 Jacek Sieka, arnetheduck on gmail point com +Copyright (C) 2006-2007 Jacek Sieka, arnetheduck on gmail point com Here follows the full text of the GPL-2: Modified: adchpp/trunk/SConstruct =================================================================== --- adchpp/trunk/SConstruct 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/SConstruct 2007-12-22 22:18:06 UTC (rev 109) @@ -117,7 +117,6 @@ if env['savetemps'] and 'gcc' in env['TOOLS']: env.Append(CCFLAGS = ['-save-temps', '-fverbose-asm']) - if env['CC'] == 'cl': flags = msvc_flags xxflags = msvc_xxflags Modified: adchpp/trunk/adchpp/PluginManager.h =================================================================== --- adchpp/trunk/adchpp/PluginManager.h 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/adchpp/PluginManager.h 2007-12-22 22:18:06 UTC (rev 109) @@ -205,7 +205,7 @@ } /** @internal */ void shutdown(); - + private: virtual ~PluginManager() throw(); Modified: adchpp/trunk/adchpp/SettingsManager.h =================================================================== --- adchpp/trunk/adchpp/SettingsManager.h 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/adchpp/SettingsManager.h 2007-12-22 22:18:06 UTC (rev 109) @@ -89,7 +89,7 @@ void set(IntSetting key, bool value) { set(key, (int)value); } void load() { - load(Util::getCfgPath() + _T("adchpp.xml")); + load(Util::getCfgPath() + "adchpp.xml"); } void load(const std::string& aFileName); Modified: adchpp/trunk/adchpp/version.cpp =================================================================== --- adchpp/trunk/adchpp/version.cpp 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/adchpp/version.cpp 2007-12-22 22:18:06 UTC (rev 109) @@ -18,7 +18,7 @@ #define BUILDSTRING "Release" #endif -#define FULLVERSIONSTRING APPNAME " v" VERSIONSTRING "-" BUILDSTRING +#define FULLVERSIONSTRING APPNAME " v" VERSIONSTRING " " BUILDSTRING namespace adchpp { Modified: adchpp/trunk/changelog.txt =================================================================== --- adchpp/trunk/changelog.txt 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/changelog.txt 2007-12-22 22:18:06 UTC (rev 109) @@ -1,3 +1,2 @@ --- 2.0 -- -* Initial release - +-- 2.1 -- + * Initial ADC 1.0 release \ No newline at end of file Modified: adchpp/trunk/etc/Script.xml =================================================================== --- adchpp/trunk/etc/Script.xml 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/etc/Script.xml 2007-12-22 22:18:06 UTC (rev 109) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <ScriptPlugin> - <Engine scriptPath="Scripts/"> + <Engine language="lua" scriptPath="Scripts/"> <Script>access.lua</Script> </Engine> </ScriptPlugin> Modified: adchpp/trunk/etc/adchpp.xml =================================================================== --- adchpp/trunk/etc/adchpp.xml 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/etc/adchpp.xml 2007-12-22 22:18:06 UTC (rev 109) @@ -6,7 +6,7 @@ <!-- This is the name of the hub as it should be reported to the clients during login and to the hub registration services. --> <HubName type="string">ADCH++</HubName> - <Description>ADCH++ Test hub</Description> + <Description type="string">ADCH++ Test hub</Description> <!-- Logging --> <!-- Enable/disable logging --> Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-22 22:18:06 UTC (rev 109) @@ -6,10 +6,16 @@ adchpp = luadchpp -- Configuration + +-- Where to read/write user database local users_file = adchpp.Util_getCfgPath() .. "users.txt" +-- Maximum number of non-registered users, -1 = no limit, 0 = no unregistered users allowed +local max_users = -1 + +-- Users with level lower than the specified will not be allowed to run command at all local command_min_levels = { --- [adchpp.CMD_DSC] = 2 +-- [adchpp.AdcCommand.CMD_MSG] = 2 } -- Regexes for the various fields. @@ -159,10 +165,13 @@ end local function dump(c, code, msg) + print("dumping") + print(code) + print(msg) answer = adchpp.AdcCommand(adchpp.AdcCommand_CMD_STA, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) answer:addParam("" .. tostring(adchpp.AdcCommand_SEV_FATAL) .. code):addParam(msg) c:send(answer) - c:disconnect() + c:disconnect(0) end local function reply(c, msg) @@ -171,6 +180,23 @@ c:send(answer) end +local function check_max_users() + + if max_users == -1 then + return + end + + if max_users == 0 then + return adchpp.AdcCommand_ERROR_REGGED_ONLY, "Only registered users are allowed in here" + end + + local count = cm:getClients():size() + if count >= max_users then + return adchpp.AdcCommand_ERROR_HUB_FULL, "Hub full, please try again later" + end + return +end + local function get_user(cid, nick) local user if cid then @@ -291,6 +317,11 @@ local user = get_user(cid, nick) if not user then + local code, err = check_max_users() + if code then + dump(c, code, err) + return command_processed + end return 0 end Modified: adchpp/trunk/plugins/Script/src/ScriptManager.cpp =================================================================== --- adchpp/trunk/plugins/Script/src/ScriptManager.cpp 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/plugins/Script/src/ScriptManager.cpp 2007-12-22 22:18:06 UTC (rev 109) @@ -62,9 +62,15 @@ xml.fromXML(File(Util::getCfgPath() + "Script.xml", File::READ).read()); xml.stepIn(); while(xml.findChild("Engine")) { - std::string scriptPath = xml.getChildAttrib("scriptPath"); + const std::string& scriptPath = xml.getChildAttrib("scriptPath"); + const std::string& language = xml.getChildAttrib("language"); - engines.push_back(new LuaEngine); + if(language.empty() || language == "lua") { + engines.push_back(new LuaEngine); + } else { + LOG(className, "Unrecognised language " + language); + continue; + } xml.stepIn(); while(xml.findChild("Script")) { @@ -84,7 +90,6 @@ load(); } - void ScriptManager::onReceive(Client& c, AdcCommand& cmd, int& override) { if(cmd.getCommand() != AdcCommand::CMD_MSG) { Modified: adchpp/trunk/readme.txt =================================================================== --- adchpp/trunk/readme.txt 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/readme.txt 2007-12-22 22:18:06 UTC (rev 109) @@ -1,59 +1,98 @@ --- License -- -See license.txt - --- Introduction -- - -ADCH++ is a hub for the ADC network. It implements the ADC protocol, which can -be found here: http://dcplusplus.sf.net/ADC.html. - --- Requirements -- - -Win2k/XP/2k3 (may run on NT4 with a fresh service pack as well...don't know). -or -Linux 2.6.x - -A network card with a correctly configured TCP/IP stack. -A computer that can run the above mentioned OS. -An administrator/root account (to install as service / run on port < 1024 on unix). -A brain (to understand the readme and setup) -gcc 4.2+ (linux or mingw) -scons (http://www.scons.org) -swig 1.3.33 - -** Important!! The hub will _NOT_ run on Win9x/ME. ** - -On the client side, I've only tested with DC++. - --- Building -- -Install swig and scons. Ensure that your compiler is available in the -PATH. To build with gcc (*nix, mingw), run "scons" in the adchpp root folder. -To build with msvc (windows), run "scons tools=default" in the adchpp root -folder. To build a release build, add "mode=release" to the build line. -For additional build options, type "scons -h". - --- Command line options -- - --c <configdir> Run with an alternate config directoy. Must be an absolute path. --i <name> Install the hub service to enable running as a service. * Windows only * --u <name> Remove the service you created earlier. * Windows only * --v Print version information (make sure to include this in any bug reports) --d Run as a daemon. Kill with a standard sigterm. * Linux only * --p <pid-file> Write process pid to <pid-file> * Linux only * - --- Where to find more info -- - -Try http://adchpp.sf.net/ or http://dcpp.net/forum/. - --- Send in patches -- -I'll gladly accept patches, but in order to avoid future licensing issues, I ask you to -give me copyright over any submitted code. Make sure that the code doesn't break support -for any of the platforms supported and that it looks more or less like the rest of the -code (indent, names etc). -Please use unified patches agains latest svn trunk (i e svn diff or diff -u). - --- Donate money -- - -If you feel like helping out but don't know how, this is obviously a good way =)...paste this link in your -browser (goes to paypal): - -https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8 += ADCH++ - A hub software for ADC + +== Introduction + +ADCH++ is a hub for the ADC network. It implements the +http://dcplusplus.sf.net/ADC.html[ADC protocol]. The core application is very +simple, but extensible using plugins. Among the standard plugins there is a +scripting plugin that allows hub owners to further customize the hub using the +http://www.lua.org[Lua] scripting language. The core is also exposed as a +Python module, thus it is possible to use it within a Python application. + +== License +ADCH++ is licensed under the GPL. For details, see license.txt supplied with +the application. A side effect of the license is that any plugins you write +must be released under a license compatible with the GPL. + +== Download +The latest version of ADCH++ can be downloaded from +http://sourceforge.net/projects/adchpp/[SourceForge]. The source code resides +in http://sourceforge.net/svn/?group_id=172105[SVN]. + +== Requirements +To run ADCH++ you will need the following: + +* A computer with a network card +* Linux with a 2.6-based kernel or Windows 2000/XP +* A brain (to understand the readme and do the setup) +* Optional: An administrator account (to install as service / run on port < 1024 on + unix) + +NOTE: The hub will not run on Windows 9x/ME + +To compile the sources you will also need: + +* GCC 4.2+ (Linux or http://www.mingw.org[MinGW]) +* http://www.scons.org[SCons 0.97] +* http://www.swig.org[SWIG 1.3.33] +* http://www.python.org[Python] 2.5 (Windows) or 2.4+ (Linux) + +== Building +To build ADCH++ from source you have to: + +* Install SWIG and ensure it's in your PATH +* Install Python and ensure it's in your PATH +* Install SCons and ensure it's in your PATH +* Windows: Install MinGW and ensure it's in your PATH +* Linux: Install GCC 4.2+ and appropriate header files +* In the source folder, type "scons -h" to see additional compile options +* Type "scons" to create a debug build. "scons mode=release" will create a + release build. + +== Configuration +ADCH++ is configured using an XML file, as are the standard plugins. The +example configuration contains enough comments to get you started. In Linux, +the default location for configuration files is "/etc/adchpp/". In Windows, it's +a directory named "config" under the installation directory. + +== Running +ADCH++ will normally run as a console / terminal application but can also be +convinced to run in the background (daemon/service). It accepts various +command line options such as: + +[separator="|"] +``_ +-c <configdir> | Run with an alternate config directoy. Must be an absolute path. +-i <name> | Install the hub service to enable running as a service. * Windows only * +-u <name> | Remove the service you created earlier. * Windows only * +-v | Print version information (make sure to include this in any bug reports) +-d | Run as a daemon. Kill with a standard sigterm. * Linux only * +-p <pid-file> | Write process pid to <pid-file> * Linux only * +___ + +== Where to find more info +Try its http://adchpp.sf.net/[home page] or the +http://dcplusplus.sf.net/[DC++ home page]. + +== Patches and contributions +I'll gladly accept patches, but in order to avoid future licensing issues, I ask you to +give me copyright over any submitted code. Make sure that the code doesn't break support +for any of the platforms supported and that it looks more or less like the +rest of the code (indent, names etc). + +Patches should be sent to the dcplusplus-devel mailing list. Subscription +information can be found +https://lists.sourceforge.net/lists/listinfo/dcplusplus-devel[here]. + +Please use unified patches agains latest svn trunk (i e svn diff) and supply a +description of what the patch does. + +== Donations + +If you feel like helping out but don't know how, this is obviously a good way +=) + +https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8[Donate!] + +// vim: set syntax=asciidoc: + Modified: adchpp/trunk/unix/main.cpp =================================================================== --- adchpp/trunk/unix/main.cpp 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/unix/main.cpp 2007-12-22 22:18:06 UTC (rev 109) @@ -168,7 +168,6 @@ int main(int argc, char* argv[]) { - // IMHO, argv[0] is the program name... char buf[PATH_MAX + 1]; char* path = buf; if (readlink("/proc/self/exe", buf, sizeof (buf)) == -1) { Modified: adchpp/trunk/unix/po/adchppd.pot =================================================================== --- adchpp/trunk/unix/po/adchppd.pot 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/unix/po/adchppd.pot 2007-12-22 22:18:06 UTC (rev 109) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \"adchpp\"--copyright-holder=\"Jacek Sieka\"\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-09 20:22+0100\n" +"POT-Creation-Date: 2007-12-22 23:02+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -45,27 +45,27 @@ msgid "Usage: adchpp [[-c <configdir>] [-d]] | [-v] | [-h]\n" msgstr "" -#: unix/main.cpp:189 +#: unix/main.cpp:188 #, c-format msgid "-c <directory>\n" msgstr "" -#: unix/main.cpp:195 +#: unix/main.cpp:194 #, c-format msgid "Config dir must be an absolute path\n" msgstr "" -#: unix/main.cpp:204 +#: unix/main.cpp:203 #, c-format msgid "-p <pid-file>\n" msgstr "" -#: unix/main.cpp:213 +#: unix/main.cpp:212 #, c-format msgid "Unknown parameter: %s\n" msgstr "" -#: unix/main.cpp:222 +#: unix/main.cpp:221 #, c-format msgid "Can't open %s for writing\n" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |