$kernel->post( $src, $replypath, "Failed to fetch list of hugs.", $dest );
}
}
+
+CHEKCMEMO: |-
+ 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 ) } };
+ for my $memo( @memos ) {
+ my @memo = @$memo;
+ my $t = time - $memo[1];
+ my $response;
+ if( $t > 86400 ) {
+ $response .= floor($t/86400)."d ";
+ $t = $t % 86400;
+ }
+ if( $t > 3600 ) {
+ $response .= floor($t/3600)."h ";
+ $t = $t % 3600;
+ }
+ if( $t > 60 ) {
+ $response .= floor($t/60)."m ";
+ $t = $t % 60;
+ }
+ $response .= $t."s ago";
+ $kernel->post( $src, $replypath, "From: ".$memo[0].", $response ago: ".$memo[2], $dest );
+ }
+ delete $heap->{ 'memo' }->{ uc( $who ) };
+ }
+
+MEMO: |-
+ sub {
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ my( $rec, $msg ) = split( / /, $what, 2 );
+ if( !exists( $heap->{ 'memo' } ) ) {
+ $heap->{ 'memo' } = {};
+ }
+ if( !exists( $heap->{ 'memo' }->{ uc( $rec ) } ) ) {
+ $heap->{ 'memo' }->{ uc( $rec ) } = [];
+ }
+ push @{ $heap->{ 'memo' }->{ uc( $rec ) } }, [ $who, time, $msg ];
+ $kernel->post( $src, $replypath, "Memo left for $rec.", $dest );
+ }