(* Initialise the toplevel environment. -*- tuareg -*-
- * $Id: init,v 1.7 2007/06/29 21:43:21 rjones Exp $
+ * $Id: init,v 1.8 2008/01/23 15:44:46 rjones Exp $
* - Removes the Pervasives module and any dangerous functions.
* - Loads just the modules we want to give access to, and just
* the functions within those modules that we want to give.
let _ = List.length
let _ = Nativeint.to_string
let _ = Num.add_num
+let _ = Random.int
let _ = Ratio.null_denominator
let _ = Stack.create
let _ = Str.regexp
(* Initialise the toplevel environment. -*- tuareg -*-
- * $Id: init.in,v 1.4 2007/06/29 19:39:13 rjones Exp $
+ * $Id: init.in,v 1.5 2008/01/23 15:44:46 rjones Exp $
* - Removes the Pervasives module and any dangerous functions.
* - Loads just the modules we want to give access to, and just
* the functions within those modules that we want to give.
let _ = List.length
let _ = Nativeint.to_string
let _ = Num.add_num
+let _ = Random.int
let _ = Ratio.null_denominator
let _ = Stack.create
let _ = Str.regexp
/* -*- C -*-
- * $Id: ocamlbotwrapper.c,v 1.6 2007/06/29 21:43:21 rjones Exp $
+ * $Id: ocamlbotwrapper.c,v 1.7 2008/01/23 15:44:46 rjones Exp $
* SUID wrapper around ocaml program.
*/
setrlimit (RLIMIT_NOFILE, &lim);
#endif
#ifdef RLIMIT_NPROC
- lim.rlim_cur = lim.rlim_max = 2;
+ /* If you want to run several instances of xavierbot, you may need
+ * to increase this limit.
+ */
+ lim.rlim_cur = lim.rlim_max = 4;
setrlimit (RLIMIT_NPROC, &lim);
#endif
#ifdef RLIMIT_SIGPENDING
# xavierbot : an OCaml interpreter IRC bot.
# By Richard W.M. Jones <rich@annexia.org>.
# This code is in the Public Domain.
-# $Id: xavierbot.pl,v 1.11 2007/07/05 12:43:14 rjones Exp $
+# $Id: xavierbot.pl,v 1.12 2008/01/23 15:44:46 rjones Exp $
use strict;
use POE qw(Component::IRC Wheel::Run);
if ($what =~ /^\s*xavierbot\b.*\bhelp\b/) {
my $nick = (split /!/, $who)[0];
$kernel->post ($sender => privmsg => $channel =>
- "hello $nick, I am xavierbot 0.6, an OCaml toplevel");
+ "hello $nick, I am xavierbot 0.7, an OCaml toplevel");
$kernel->post ($sender => privmsg => $channel => $_)
foreach (@usage);
}
+ elsif ($what =~ /^\s*xavierbot\b.*\brestart\b/) {
+ $sleeping = 0;
+ print STDOUT "got instruction to restart ...\n";
+ restart_toplevel ($heap->{ocaml});
+ }
elsif (!$sleeping) {
if (my ($stmt) = $what =~ m/^\s*([^\#].*;;)\s*$/) {
$heap->{ocaml}->put ("$stmt\n");
$kernel->post ($sender => privmsg => $channel =>
"xavierbot wakes up");
}
- elsif ($what =~ /^\s*xavierbot\b.*\brestart\b/) {
- $sleeping = 0;
- print STDOUT "got instruction to restart ...\n";
- restart_toplevel ($heap->{ocaml});
- }
}
undef;
}
# xavierbot : an OCaml interpreter IRC bot.
# By Richard W.M. Jones <rich@annexia.org>.
# This code is in the Public Domain.
-# $Id: xavierbot.pl.in,v 1.8 2007/07/05 12:43:14 rjones Exp $
+# $Id: xavierbot.pl.in,v 1.9 2008/01/23 15:44:46 rjones Exp $
use strict;
use POE qw(Component::IRC Wheel::Run);
$kernel->post ($sender => privmsg => $channel => $_)
foreach (@usage);
}
+ elsif ($what =~ /^\s*xavierbot\b.*\brestart\b/) {
+ $sleeping = 0;
+ print STDOUT "got instruction to restart ...\n";
+ restart_toplevel ($heap->{ocaml});
+ }
elsif (!$sleeping) {
if (my ($stmt) = $what =~ m/^\s*([^\#].*;;)\s*$/) {
$heap->{ocaml}->put ("$stmt\n");
$kernel->post ($sender => privmsg => $channel =>
"xavierbot wakes up");
}
- elsif ($what =~ /^\s*xavierbot\b.*\brestart\b/) {
- $sleeping = 0;
- print STDOUT "got instruction to restart ...\n";
- restart_toplevel ($heap->{ocaml});
- }
}
undef;
}