Navigation Menu

Skip to content

Commit

Permalink
whatever i changed
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchy committed Mar 2, 2015
1 parent cc6da58 commit eec82c1
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 18 deletions.
1 change: 0 additions & 1 deletion freenode.ini
Expand Up @@ -9,7 +9,6 @@ INIT_CHAN_LIST=#sylnt,##exec,##php-bots
IRC_HOST_CONNECT=irc.freenode.net
IRC_HOST=irc.freenode.net
IRC_PORT=6667
MEMORY_LIMIT=128M
OPERATOR_ACCOUNT=crutchy
DEBUG_CHAN=##exec
NICKSERV_IDENTIFY_PROMPT=This nickname is registered. Please choose a different nickname, or identify via /msg NickServ identify <password>.
Expand Down
9 changes: 0 additions & 9 deletions irc.php
Expand Up @@ -25,7 +25,6 @@
define("IRC_HOST_CONNECT","irc.sylnt.us");
define("IRC_HOST","irc.sylnt.us");
define("IRC_PORT","6667");
define("MEMORY_LIMIT","128M");
define("OPERATOR_ACCOUNT","crutchy");
define("DEBUG_CHAN","#debug");
define("NICKSERV_IDENTIFY_PROMPT","You have 60 seconds to identify to your nickname before it is changed.");
Expand Down Expand Up @@ -57,14 +56,6 @@

# TODO: ADD FLAG TO HAVE EXEC IGNORE ITSELF

ini_set("memory_limit",MEMORY_LIMIT);

if (file_exists(PASSWORD_FILE)==False)
{
term_echo("bot NickServ password file not found. quitting");
return;
}

define("EXEC_DELIM","|");
define("EXEC_DIRECTIVE_DELIM"," ");
define("EXEC_INCLUDE","include");
Expand Down
9 changes: 8 additions & 1 deletion irc_lib.php
Expand Up @@ -216,6 +216,10 @@ function handle_errors($data)

function log_items($items)
{
if ((BOT_SCHEMA=="") or (LOG_TABLE==""))
{
return;
}
$fieldnames=array_keys($items);
$placeholders=array_map("callback_prepare",$fieldnames);
$fieldnames=array_map("callback_quote",$fieldnames);
Expand Down Expand Up @@ -1403,7 +1407,10 @@ function handle_data($data,$is_sock=False,$auth=False,$exec=False)
}
if (($items["cmd"]=="NOTICE") and ($items["nick"]=="NickServ") and ($items["trailing"]==NICKSERV_IDENTIFY_PROMPT))
{
rawmsg("NickServ IDENTIFY ".trim(file_get_contents(PASSWORD_FILE)),True);
if (file_exists(PASSWORD_FILE)==True)
{
rawmsg("NickServ IDENTIFY ".trim(file_get_contents(PASSWORD_FILE)),True);
}
startup();
}
$args=explode(" ",$items["trailing"]);
Expand Down
4 changes: 3 additions & 1 deletion scripts/filth.php
Expand Up @@ -3,11 +3,13 @@
#####################################################################################################

/*
exec:~filth|30|300|0|1|||||php scripts/filth.php %%trailing%% %%dest%% %%nick%%
exec:~filth|30|2700|0|1|||||php scripts/filth.php %%trailing%% %%dest%% %%nick%%
*/

#####################################################################################################

return;

require_once("lib.php");
require_once("lib_mysql.php");

Expand Down
45 changes: 39 additions & 6 deletions scripts/logs-sylnt-us.php
Expand Up @@ -8,16 +8,12 @@
#exec:~last|0|0|0|1|||||php scripts/logs-sylnt-us.php %%trailing%% %%nick%% %%dest%% %%alias%%
#exec:~find-first|0|0|0|1|||||php scripts/logs-sylnt-us.php %%trailing%% %%nick%% %%dest%% %%alias%%
#exec:~find-last|0|0|0|1|||||php scripts/logs-sylnt-us.php %%trailing%% %%nick%% %%dest%% %%alias%%
#exec:~chart|0|0|0|1|crutchy||||php scripts/logs-sylnt-us.php %%trailing%% %%nick%% %%dest%% %%alias%%
*/

#####################################################################################################

date_default_timezone_set("UTC");
require_once("lib.php");
require_once("logs-sylnt-us_lib.php");

define("CACHE_PATH","/var/www/irciv.us.to/logs.sylnt.us/");

$trailing=trim($argv[1]);
$nick=trim($argv[2]);
Expand All @@ -28,8 +24,6 @@
$html=wget("logs.sylnt.us",$uri,80);
$html=strip_headers($html);

#term_echo("downloaded http://logs.sylnt.us$uri => ".strlen($html)." bytes (content)");

strip_all_tag($html,"head");

$links=explode("<a href=\"",$html);
Expand Down Expand Up @@ -119,6 +113,21 @@
$line_msg=$line;
$line_dest=$dest;
$line_date=$date_parts[0];

$items=array();
$items["server"]="irc.sylnt.us";
$items["microtime"]=convert_timestamp($record["date"]." ".$record["time"],"Y-m-d H:i:s");;
$items["time"]="";
$items["data"]="";
$items["prefix"]="";
$items["params"]=$line_dest;
$items["trailing"]="";
$items["nick"]=$line_nick;
$items["user"]="";
$items["hostname"]="";
$items["destination"]=$line_dest;
$items["cmd"]="PRIVMSG";

$record=array();
$record["dest"]=$line_dest;
$record["date"]=$line_date;
Expand Down Expand Up @@ -284,4 +293,28 @@

#####################################################################################################

function register_loggie_channel($channel)
{
$items=array();
$items["server"]="irc.sylnt.us";
$items["microtime"]="";
$items["time"]="";
$items["data"]="";
$items["prefix"]="";
$items["params"]="";
$items["trailing"]="";
$items["nick"]="";
$items["user"]="";
$items["hostname"]="";
$items["destination"]="";
$items["cmd"]="";

$fieldnames=array_keys($items);
$placeholders=array_map("callback_prepare",$fieldnames);
$fieldnames=array_map("callback_quote",$fieldnames);
execute_prepare("INSERT INTO ".BOT_SCHEMA.".".LOG_TABLE." (".implode(",",$fieldnames).") VALUES (".implode(",",$placeholders).")",$items);
}

#####################################################################################################

?>
1 change: 1 addition & 0 deletions scripts/privmsg.php
Expand Up @@ -26,6 +26,7 @@
if ($trailing=="!stats")
{
privmsg("http://stats.sylnt.us/social/soylent/");
privmsg("http://antiartificial.com/stats/soylent/soylentnews.html");
return;
}

Expand Down

0 comments on commit eec82c1

Please sign in to comment.