DCWatch
| File:Dcwatch logo.png | |
| File:Dcwatch screen.png DCWatch running in Windows Vista | |
| Developed by | CyB |
|---|---|
| Initial release | 2007 |
| Stable release | N / A [edit] |
| Beta release | N / A [edit] |
| Written in | Java, LUA |
| Platform | Windows, Linux |
| Available in | 2 languages |
| Type | Misc |
| License | GNU GPL 3 |
| Website | DCWatch Official Website DCWatch Launchpad Website |
Introduction
DCWatch is an open source Direct Connect Bot. It supports both NMDC and ADC protocol, and it uses Embla protocol implementation library.
The bot has several uses it provide rss feed to hubs via ADC extension, the feed extension is still under drafting mode this is a preliminary implementation to test its uses. The bot can connect other hubs via link extension it may even connect Jabber accounts and it also provides a LUA scripting interface for those who wishes to make scripts (see script example below).
Since the bot is built on the Embla library it got support for many protocol extensions some of them are SHA1, PING, TYPE, FEED, LINK, UCMD that makes the bot very useful if any LUA Scripter or Java Developer wishes to make new ideas for the bot.
Version 0.4x runs both in 32bits and 64bits environments with support for both Linux distributions and Windows Operating systems.
List of features in 0.4x:
- Chatlink - Chatlink is used to connect hubs or jabber accounts
- Connection - Apart of chatlink this is used to make the connection
- Feed - Provides and manages hubs with RSS and ATOM feeds
- gc - Java Garbage Collector
- Info - Show statistic and general information via PHP to a web server uses Google Charts API
- Language - Language management
- Plugin - It has a plugin manager
- User - it has a User management system to grant administration rights
Scripting Example
<source lang="lua"> --[[ Copyright (C) 2008-2009 Viktor Bal�zs
This program 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 3 of the License, or (at your option) any later version.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. ]]--
demo = {}
function demo.dataReceived( data ) result = false
if data:getType() == "command" then kleodora:debug( "command: " .. data:getValue():toString() ) else kleodora:debug( data:getType() ) end
return result end
demoProxy = luajava.createProxy( "hu.dcwatch.common.service.ServiceListener", demo ) kleodora:addListener( "demo.lua", demoProxy ) </source>
Statistics PHP Files
<source lang="php"> - <?php
function generateChartURL( $width, $height, $margin, $background_color, $line_color, $line_width, $data ){ if( $width > 300 ){ $x_axis = "0:|0:00|3:00|6:00|9:00|12:00|15:00|18:00|21:00|24:00"; }else{ $x_axis = "0:|0:00||6:00||12:00||18:00||24:00"; }
if( $height > 150 ){ $y_axis = "1:||500|1000|1500|2000|2500|3000|3500|4000|4500|5000"; }else{ $y_axis = "1:|||1000||2000||3000||4000||5000"; }
$chart_url = "http://chart.apis.google.com/chart?" . "chs=" . $width . "x" . $height . "&" . "cht=lc&" . "chxt=x,y&" . "chg=4.166,10,1,2&" . "chf=bg,s," . $background_color . "&" . "chco=" . $line_color . "&" . "chls=" . $line_width . "&" . "chxl=" . $x_axis . "|" . $y_axis. "&" . "chma=" . $margin . "&" . "chd=t:" . $data;
return $chart_url; }
function googleChartURL( $datasource, $width, $height, $margin, $background_color, $line_color, $line_width ){ $data = "";
if( file_exists( $datasource ) ){ $handler = fopen( $datasource, 'r' ); $data = fgets( $handler ); fclose( $handler ); }
return generateChartURL( $width, $height, $margin, $background_color, $line_color, $line_width, $data ); }
?> </source>
<source lang="php"> <?php if( file_exists( "/home/hub/dcwatch/charts/google_chart.php" ) ){ include_once( "/home/hub/dcwatch/charts/google_chart.php" );
//-- FIXME ------------------------------------------------------------------------------------------- $url = "http://" . $_SERVER["SERVER_NAME"]; if( $_SERVER["SERVER_PORT"] != 80) { $url = $url . $_SERVER["SERVER_PORT"]; } $url = $url . "/dcwatch/"; //------------------------------------------------------------------------------------------------------
$archive = "/dcwatch/charts/archive"; $statistic = "usercount";
if( $_REQUEST["date"] == "" ) { $date = date("Y-m-d"); }else{ $date = $_REQUEST["date"]; }
$log_file = $archive . "/" . $statistic . "_" . $date . ".log";
$today = strtotime( $date ); $prev_date = strtotime( "-1 day", $today ); $next_date = strtotime( "+1day", $today );
echo "Number of users on the hub
"; echo "<tbody>"; echo ""; echo ""; echo ""; echo "</tbody>| <a href=\"" . $url . "?date=" . date("Y-m-d", $prev_date) . "\">" . date("Y-m-d", $prev_date) . "</a> | <a href=\"" . $url . "\">ma</a> | <a href=\"" . $url . "?date=" . date("Y-m-d", $next_date) . "\">" . date("Y-m-d", $next_date) . "</a> |
";
echo "<img src=\"" . googleChartURL( $log_file, 600, 300, "50,30,30,30", "EECF80", "B12C00", "3.0" ) . "\"/>";
echo "
" . date("Y-m-d", $today) . "
}else{
echo "This service is not available
";} ?> </source>