ADCH++

From DCBase Wiki

Jump to: navigation, search
ADCH++
Adchpp icon.png
Adchpp screenshot.png
ADCH++ 2.3 rev 221 running in Windows 7
Developed byJacek Sieka
Initial release2008
Stable releaseN / A [edit]
Beta release2.5.2  (2010-08-01; 1053 days ago)
Written inC++, C
PlatformWindows, Linux
Available in1 languages
TypeHubsoft
LicenseGNU GPL 2
WebsiteADCH++ Sourceforge Site
ADCH++ Launchpad Site

Contents

Introduction

ADCH++ is a hubsoft written in C++ the first version was pushed out in 2008 [1], the hubsoft has a python and lua interface that makes it easy for scripters to insert functions into adchpp module[2].

ADCH++ runs under both Windows and Unix systems (see requirements below) for compiling your version of ADCH++ or use the build archive (Windows only), the distribution is released on Sourceforge and it consists of an windows installer, a windows binary package and a platform independent source zip for each release but for bleeding edge source ADCH++ uses launchpad bazaar branch.

Another part of ADCH++ thats is being worked on is a GUI [3][4] written in python, this uses the core of ADCH++ as a plugin over a python interface and its available at Launchpad.

For documentation on the API for both LUA and Python use Doxygen or our online documentation on Sourceforge for futher information on how to build a plugin for ADCH++ can be found at the following adress:

http://adchpp.sourceforge.net/doc/pluginapi.html

Scripting Example

The following section is information about how to script in python [5] for ADCH++ for more information about this subject visit: http://www.adcportal.com or the online documentation

Here are an example:

#!/usr/bin/python
 
#import python adchpp module
import pyadchpp
#import os module
import os
import time
 
def run():
   #initialize the hubsoft with the complete path to your config directory containing adchpp.xml
   pyadchpp.initialize(os.getcwd()+'\config\\')
   pyadchpp.startup()
   #create a loop so the program doesnt exit
   while 1:
      time.sleep(0.1)
 
if __name__== '__main__':
   run()

The following section is information about how to script in LUA for ADCH++ here are an example:

-- This is an example script that scripters might want to use as a basis for their work. It
-- documents the bare minimum needed to make an Lua script interface with ADCH++.
 
-- For more detailed information, peeking into other, more evolved (but less documented) example
-- scripts as well as the Doxygen documentation of ADCH++ <http://adchpp.sourceforge.net/doc> would
-- be a good idea.
 
-- Generally, to reach member "bar" of the class "foo" of ADCH++, one has to use: adchpp.foo_bar.
-- Examples: adchpp.Util_getCfgPath(), adchpp.AdcCommand_CMD_MSG, adchpp.Entity_STATE_NORMAL...
 
-- When manipulating Entity objects, it can be useful to convert them to Client objects (which
-- are aware of socket features such as a send method) by using:
-- local client = entity:asClient()
 
-- Feel free to use <https://answers.launchpad.net/adchpp> or <www.adcportal.com> if you need help.
 
-- The global functions of Lua are privately imported into "base"; therefore, be sure to always
-- reference it when calling these functions; eg base.print("blah"), base.pcall(protected_func)...
local base = _G
 
module("example") -- Give each module a unique name so they don't clash.
 
-- Import the ADCH++ Lua DLL (luadchpp.dll).
base.require('luadchpp')
local adchpp = base.luadchpp
 
-- Import various base sets of Lua methods. Only import those you need for your specific module.
local io = base.require('io')
local math = base.require('math')
local os = base.require('os')
local string = base.require('string')
local table = base.require('table')
 
-- Import some utilitary Lua Scripts; these don't need to be explicitly loaded by ADCH++ (eg if
-- using the adchppd daemon, they don't need to be referenced in Scripts.xml).
local autil = base.require('autil')
local json = base.require('json')
 
-- Cache pointers to some managers of ADCH++ that we frequently use.
local cm = adchpp.getCM() -- ClientManager
local pm = adchpp.getPM() -- PluginManager
 
-- Listeners to connect to ADCH++. Define one unique identifier for each listener (i chose to call
-- them example_1, example_2 and so on) to make sure the variable holding the listener doesn't get
-- collected by Lua's garbage collector until the program is over.
 
-- ClientManager::signalConnected: called after an Entity entity has connected.
example_1 = cm:signalConnected():connect(function(entity)
	-- Process signalConnected here.
end)
 
-- ClientManager::signalReceive: called when an AdcCommand cmd is received from Entity entity.
example_2 = cm:signalReceive():connect(function(entity, cmd, ok)
	local res = (function(entity, cmd, ok)
		-- Skip messages that have been handled and deemed as discardable by others.
		if not ok then
			return ok
		end
		-- Process signalReceive here.
		-- Return true to let the command be dispatched, false to block it.
	end)(entity, cmd, ok)
	if not res then
		cmd:setPriority(adchpp.AdcCommand_PRIORITY_IGNORE)
	end
	return res
end)
 
-- ClientManager::signalState: called after the state of an online Entity entity has changed.
example_3 = cm:signalState():connect(function(entity)
	-- Process signalState here.
end)
 
-- ClientManager::signalDisconnected: called after an Entity entity has disconnected.
example_4 = cm:signalDisconnected():connect(function(entity)
	-- Process signalDisconnected here.
end)
 
-- PluginManager::getCommandSignal(string): called when a +command managed by another plugin is
-- being executed.
example_5 = pm:getCommandSignal("blah"):connect(function(entity, list, ok)
	-- Skip messages that have been handled and deemed as discardable by others.
	if not ok then
		return ok
	end
	-- Process getCommandSignal here.
	-- Return true to let the command be executed, false to block it.
end)

additionally you can now run Ptokax scripts in ADCH++ via ADCH++ Ptokax Bridge since that emulates the Ptokax LUA API.

Advantages

Disadvantages

Misc

References

  1. ADCH++ First Release by Pietry (Jan 6, 2008)
  2. ADCH++ now more then an empty shell by Toast (Sep 30, 2009)
  3. First Looks at the ADCH++ Gui by Toast (Feb 02, 2009)
  4. ADCH++ Gui update by Toast (Sun Feb 08)
  5. ADCH++ Python scripts by Sulan (Jan 21, 2009)
  6. Bloom filters by cologic (Jan 7, 2008)

Links

Implementations

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox