sub {
use Digest::MD5 qw( md5_hex );
my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ if( $what !~ /[^ ]+ [^ ]+/ ) {
+ $kernel->post( $src, $replypath, "Usage: PASSWORD <old password> <new password>", $dest );
+ return;
+ }
my( $old, $new ) = split( / /, $what, 2 );
if( exists( $heap->{ 'users' }->{ uc( $who ) } ) ) {
if( $heap->{ 'users' }->{ uc( $who ) } eq md5_hex( $old ) ) {
DumpFile( "memos.yaml", $heap->{ 'memo' } );
}
+COUNTMEMO: |-
+ sub {
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ if( !exists( $heap->{ 'memo' } ) ) {
+ $heap->{ 'memo' } = {};
+ }
+ if( !exists( $heap->{ 'memo' }->{ uc( $who ) } ) ) {
+ $kernel->post( $src, $replypath, "No memos found.", $dest );
+ return 1;
+ }
+ my @memos = @{ $heap->{ 'memo' }->{ uc( $who ) } };
+ my $count = scalar @memos;
+ $kernel->post(
+ $src,
+ $replypath,
+ "You have $count memo".($count==1?"":"s")." waiting. To check your memos, please first REGISTER (if you haven't already) and then IDENTIFY.",
+ $dest
+ );
+ }
+
MEMOLIST: |-
sub {
my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
my $response = $userAgent->request( POST $oaRequest->to_url() );
if( !$response->is_success() ) {
print( "TWITTER: Error: ".$response->status_line(), "\n" );
+ print( "TWITTER: URL was '".$oaRequest->to_url()."'\n" );
if( $response->code == "401" ) {
$kernel->post( $src, $replypath, "401 from Twitter: This generally means Destult ".
"has been de-authorized to update your Twitter ".
}
$heap->{ 'seen' }->{ uc( $who ) } = time;
if( exists( $heap->{ 'memo' } ) &&
- exists( $heap->{ 'memo' }->{ uc( $who ) } ) &&
- exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) ) {
- $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $who, "send_private", $trusted );
+ exists( $heap->{ 'memo' }->{ uc( $who ) } ) ) {
+ if( exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) ) {
+ $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $who, "send_private", $trusted );
+ } else {
+ $kernel->yield( "cmd", $who, "COUNTMEMO", $src, $who, "send_private", $trusted );
+ }
}
}
# this should check for hooks stored on the heap. TODO.
sub on_public {
my( $kernel, $heap, $who, $what, $src, $dest, $replypath, $trusted ) = @_[ KERNEL, HEAP, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5 ];
- $kernel->yield( "seen", $who, $what, $src, $dest, $replypath, $trusted );
my $cmd = ( split( / /, $what, 2 ) )[0];
# Check for the presence of a command
if( $cmd =~ /^~.*/ ) {
$kernel->yield( "cmd", $who, "KARMAUP $1", $src, $dest, $replypath, $trusted );
}
}
+ $kernel->yield( "seen", $who, $what, $src, $dest, $replypath, $trusted );
}
$msg =~ s/(\x3)[0-9]{0,2}//g;
$msg =~ s/\x02//g;
$cmd = ( split( / /, $msg, 2 ) )[0];
- $kernel->post( "core", "seen", $who, $msg, $self->{ "ssid" }, $who, "send_private", 1 );
$kernel->post( "core", "cmd", $who, $msg, $self->{ "ssid" }, $who, "send_private", 1 );
+ $kernel->post( "core", "seen", $who, $msg, $self->{ "ssid" }, $who, "send_private", 1 );
}
sub send_public {