Added full source code

This commit is contained in:
Emmanuel BENOîT 2016-01-10 11:01:49 +01:00
commit 33f8586698
1377 changed files with 123808 additions and 0 deletions

View file

View file

@ -0,0 +1,81 @@
;+---------------------------------------------------------------------------
;| PHP-IRC Internal DCC Function Configuration File
;| ========================================================
;| by Manick
;| (c) 2001-2004 by http://phpbots.sf.net
;| Contact: manick@manekian.com
;| irc: #manekian@irc.rizon.net
;| ========================================
;+---------------------------------------------------------------------------
;| > 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 2
;| > 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, write to the Free Software
;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;+---------------------------------------------------------------------------
file dcc_mod modules/default/dcc_mod.php
privmsg dcc_mod monitor_check
mode dcc_mod monitor_check
join dcc_mod monitor_check
kick dcc_mod monitor_check
part dcc_mod monitor_check
;new feature in 2.2.0, section definitions
section standard "Standard Functions"
section channel "Channel Functions"
section dcc "DCC Functions"
section info "Information Functions"
section admin "Administrative Functions"
section comm "IRC/Communication Functions"
dcc monitor ~; command text (typed in dcc iface)
0 ~; number of required arguments
"<channel>" ~; argument descriptions <arg1> <arg2> (or however you damn well please to do it hehe ;)
"Show messages from channel in dcc chat interface" ~; description of command
true ~; must be admin to use this command?
dcc_mod ~; class name (see file import section above)
dcc_monitor ~; function name
channel ; section name
dcc exit 0 "" "Exits the DCC interface" false dcc_mod dcc_exit standard
dcc raw 1 "<raw query>" "Sends raw query to server" true dcc_mod dcc_raw comm
dcc who 0 "" "See who\'s online" false dcc_mod dcc_who standard
dcc ignore 0 "" "View ignore list" true dcc_mod dcc_ignore admin
dcc rignore 1 "<host>" "Remove ignore for a specified host" true dcc_mod dcc_rignore admin
dcc clearqueue 0 "<user>" "Removes all text queues, or queues for a specified user." true dcc_mod dcc_clearqueue admin
dcc server 1 "<server> <port>" "Change server to specified server" true dcc_mod dcc_server admin
dcc chat 1 "<text>" "Sends message to all admin users using the DCC interface" true dcc_mod dcc_chat comm
dcc restart 0 "" "Reconnect to the current server" true dcc_mod dcc_restart admin
dcc say 2 "<channel> <text>" "Sends text to some channel" true dcc_mod dcc_say comm
dcc action 2 "<channel> <text>" "Sends text to some channel in /me format" true dcc_mod dcc_action comm
dcc users 0 "" "Shows users in all channels" true dcc_mod dcc_users info
dcc maintain 0 "<channel> <key>" "Shows maintained channels, and adds or removes one" true dcc_mod dcc_maintain channel
dcc help 0 "" "Get information about command(s)" false dcc_mod dcc_help standard
dcc join 1 "<channel>" "Join a channel" true dcc_mod dcc_join channel
dcc part 1 "<channel>" "Part a channel" true dcc_mod dcc_part channel
dcc rejoin 1 "<channel>" "Rejoin a channel" true dcc_mod dcc_rejoin channel
dcc status 0 "" "Get status of bot, same as 5 minute status update" true dcc_mod dcc_status info
dcc function 0 "<activate/deactivate> <function>" "See which functions are activated, or activate/deactivate a function" true dcc_mod dcc_function admin
dcc reloadfunc 0 "" "Reloads function definition file" true dcc_mod dcc_reloadfunc admin
dcc shutdown 0 "" "Shuts the bot down" true dcc_mod dcc_shutdown admin
dcc connect 0 "" "Force connection to server when disconnected" true dcc_mod dcc_connect admin
dcc rehash 0 "" "Reload the configuration file" true dcc_mod dcc_rehash admin
dcc send 2 "<nick> <file>" "Send a user a file" true dcc_mod dcc_send dcc
dcc dcc 0 "" "Check current dcc status" true dcc_mod dcc_dccs dcc
dcc close 1 "<id>" "Close a download, upload, or chat window" true dcc_mod dcc_close dcc
dcc upload 1 "<yes/no>" "Allow files to be sent to this bot" true dcc_mod dcc_upload dcc
dcc botinfo 0 "" "View information about the bot" true dcc_mod dcc_botinfo info
dcc timers 0 "" "View active timer information" true dcc_mod dcc_timers info
dcc listul 0 "" "List upload directory contents" true dcc_mod dcc_listul dcc
dcc modules 0 "" "List installed modules" true dcc_mod dcc_modules info
dcc spawn 1 "<config file>" "Spawn a new bot in this process" true dcc_mod dcc_spawn admin

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
;+---------------------------------------------------------------------------
;| PHP-IRC Internal PRIVMSG Function Configuration File
;| ========================================================
;| by Manick
;| (c) 2001-2004 by http://phpbots.sf.net
;| Contact: manick@manekian.com
;| irc: #manekian@irc.rizon.net
;| ========================================
;+---------------------------------------------------------------------------
;| > 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 2
;| > 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, write to the Free Software
;| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;+---------------------------------------------------------------------------
file priv_mod modules/default/priv_mod.php
priv admin ~; text typed in the channel/pm (admin)
true ~; active command on statup?
false ~; inform admins in dcc chat iface if this command is used
false ~; can be deactivated with 'function' dcc command
0 ~; times used.. just leave this 0 (its for stats).
priv_mod ~; class name (see file import section above)
priv_admin ; function name
priv !ad true true true 0 priv_mod priv_ad

View file

@ -0,0 +1,315 @@
<?php
/*
+---------------------------------------------------------------------------
| PHP-IRC v2.2.0
| ========================================================
| by Manick
| (c) 2001-2005 by http://phpbots.sf.net/
| Contact: manick@manekian.com
| irc: #manekian@irc.rizon.net
| ========================================
+---------------------------------------------------------------------------
| > priv_mod module
| > Module written by Manick
| > Module Version Number: 2.2.0
+---------------------------------------------------------------------------
| > 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 2
| > 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, write to the Free Software
| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+---------------------------------------------------------------------------
| Changes
| =======-------
| > If you wish to suggest or submit an update/change to the source
| > code, email me at manick@manekian.com with the change, and I
| > will look to adding it in as soon as I can.
+---------------------------------------------------------------------------
*/
class priv_mod extends module {
public $title = "Privmsg Utils";
public $author = "Manick";
public $version = "2.1.1";
public $dontShow = true;
private $ads;
public function init()
{
$this->loadAds();
}
public function destroy()
{
$this->destroyAds();
}
private function loadAds()
{
$ads = new ini("./modules/default/ads.ini");
if ($ads->getError())
{
return;
}
$sections = $ads->getSections();
foreach ($sections AS $ad)
{
$int = $ads->getIniVal($ad, "int");
$channel = $ads->getIniVal($ad, "chan");
$msg = $ads->getIniVal($ad, "msg");
$argArray = array('msg' => $msg, 'channel' => $channel);
$this->timerClass->addTimer($ad, $this, "misc_adTimer", $argArray, $int);
}
$this->ads = $ads;
}
private function destroyAds()
{
$sections = $this->ads->getSections();
foreach ($sections AS $ad)
{
$this->timerClass->removeTimer($ad);
}
}
// Misc Timer
public function misc_adTimer($msg)
{
$ad = DARK . "[" . BRIGHT . "Request" . DARK . "] - [" . BRIGHT .
$msg['msg'] . DARK .
"] - PHP-IRC v" . VERSION;
$raw = "PRIVMSG " . $msg['channel'] . " :" . $ad;
$this->ircClass->sendRaw($raw);
return true;
}
/* public Message/Channel Functions */
// This function is an example, it will display an add with timer
public function priv_ad($line, $args)
{
$channel = irc::myStrToLower($line['to']);
if ($channel == $this->ircClass->getNick())
{
return;
}
if (!$this->ircClass->isMode($line['fromNick'], $channel, "o"))
{
return;
}
if ($args['nargs'] == 0)
{
$timerString = "";
$timers = $this->timerClass->getTimers();
foreach ($timers AS $timer)
{
if (substr($timer->name, 0, 2) == "ad")
{
if ($timer->args['channel'] == $channel)
{
$timerString .= $timer->name . " ";
}
}
}
if ($timerString == "")
{
$this->ircClass->notice($line['fromNick'], "No ads currently for " . $channel . ".");
}
else
{
$this->ircClass->notice($line['fromNick'], "Current ads for " . $channel .":");
$this->ircClass->notice($line['fromNick'], $timerString);
}
$this->ircClass->notice($line['fromNick'], "Type !ad <interval(seconds)> <msg> to add an ad, or !ad <ad[id]> to view an ad.");
}
else if ($args['nargs'] >= 1)
{
if (substr($args['arg1'], 0, 2) == "ad" && strlen($args['arg1']) > 2)
{
$id = $args['arg1'];
$timers = $this->timerClass->getTimers();
foreach ($timers AS $timer)
{
if ($timer->name == $id)
{
break;
}
}
if ($timer == null || $channel != $timer->args['channel'])
{
$this->ircClass->notice($line['fromNick'], "There is no ad by that id.");
}
else
{
if ($args['nargs'] >= 2)
{
if (irc::myStrToLower($args['arg2']) == "delete")
{
$this->ads->deleteSection($timer->name);
$this->ads->writeIni();
$this->timerClass->removeTimer($timer->name);
$this->ircClass->notice($line['fromNick'], "Ad successfully deleted.");
}
else
{
$this->ircClass->notice($line['fromNick'], "Invalid option. Valid options: delete");
}
}
else
{
$this->ircClass->notice($line['fromNick'], "Ad: " . $timer->name);
$this->ircClass->notice($line['fromNick'], $timer->args['msg']);
$this->ircClass->notice($line['fromNick'], "Use '!ad " . $timer->name . " delete' to delete this ad.");
}
}
}
else
{
if ($args['nargs'] == 1)
{
$this->ircClass->notice($line['fromNick'], "You must specify a message!");
}
else
{
$int = intval($args['arg1']);
if ($int <= 5)
{
$this->ircClass->notice($line['fromNick'], "Invalid Interval. Interval must be greater than 5 seconds.");
}
else
{
$ad = substr($args['query'], strlen($args['arg1']) + 1);
$argArray = array('msg' => $ad, 'channel' => $channel);
//Find next id
$highest = 0;
$timers = $this->timerClass->getTimers();
foreach ($timers AS $timer)
{
if (substr($timer->name, 0, 2) == "ad")
{
$id = intval(substr($timer->name, 2));
if ($id > $highest)
{
$highest = $id;
}
}
}
$highest++;
$this->timerClass->addTimer('ad' . $highest, $this, "misc_adTimer", $argArray, $int, true);
$this->ircClass->notice($line['fromNick'], "The ad was successfully added.");
$this->ads->setIniVal('ad' . $highest, "int", $int);
$this->ads->setIniVal('ad' . $highest, "chan", $channel);
$this->ads->setIniVal('ad' . $highest, "msg", $ad);
$this->ads->writeIni();
}
}
}
}
}
public function priv_admin($line, $args)
{
if ($args['nargs'] < 2)
{
return;
}
if ($this->ircClass->getClientConf('dccadminpass') == "")
{
return;
}
if (md5($args['arg1']) != $this->ircClass->getClientConf('dccadminpass'))
{
return;
}
$query = substr($args['query'], strlen($args['arg1']) + 1);
$myArgs = parser::createLine($query);
switch ($args['arg2'])
{
case "chatme":
$port = $this->dccClass->addChat($line['fromNick'], null, null, true, null);
if ($port === false)
{
$this->ircClass->notice($line['fromNick'], "Error starting chat, please try again.", 1);
}
break;
default:
$chat = new chat_wrapper($line['fromNick'], $this->ircClass);
$cmdList = $this->parserClass->getCmdList();
$cmdLower = $myArgs['cmd'];
if (isset($cmdList['dcc'][$cmdLower]))
{
if ($myArgs['nargs'] < $cmdList['dcc'][$cmdLower]['numArgs'])
{
$chat->dccSend("Usage: " . $cmdLower . " " . $cmdList['dcc'][$cmdLower]['usage']);
break;
}
$module = $cmdList['dcc'][$cmdLower]['module'];
$class = $cmdList['file'][$module]['class'];
$func = $cmdList['dcc'][$cmdLower]['function'];
$class->$func($chat, $myArgs);
$chat->dccSend("ADMIN " . irc::myStrToUpper($cmdLower) . " Requested");
}
else
{
$chat->dccSend("Invalid Command: " . $myArgs['cmd']);
}
break;
}
}
}
?>