last time a user has consulted his/her mailbox

Paul M Fleming pfleming at siumed.edu
Wed May 21 10:40:45 EDT 2003


look at the fud client.. (not sure if CMU is still supporting it) 
Mailboxes must have acl 0 set for the anonymous user for it to work..

imap.here.net> lam user.pfleming
anonymous 0
pfleming lrswipcda

and the client in perl

#!/usr/bin/perl -w

# perl port of contrib/fud-client.c that comes with the Cyrus IMAP
# distribution (http://asg.web.cmu.edu/)
# Written by Jason Englander <jason at englanders.cc>
# July 3, 2002

use Socket;
use Sys::Hostname;
use strict;

my ($hisiaddr, $hispaddr, $iaddr, $paddr, $port, $proto, $resp);

my $server = $ARGV[0];
my $user = $ARGV[1];
my $mailbox = $ARGV[2];

die "\nUsage: $0 server user mailbox\n\n" if ! $server || ! $user || !
$mailbox;

$iaddr = gethostbyname(hostname());
$proto = getprotobyname('udp');
$port = getservbyname('fud', 'udp');
$paddr = sockaddr_in(0, $iaddr);

socket(SOCKET, PF_INET, SOCK_DGRAM, $proto)   || die "socket: $!";
bind(SOCKET, $paddr) || die "bind: $!";

$| = 1;
$hisiaddr = inet_aton($server) || die "unknown host";
$hispaddr = sockaddr_in($port, $hisiaddr);
defined(send(SOCKET, "$user|$mailbox", 0, $hispaddr)) || die "send
$server: $!";

recv(SOCKET, $resp, 512, 0) || die "recv: $!";
close(SOCKET);
my $resp_str = unpack('A*',$resp);
if ("$resp_str" eq "UNKNOWN") { printf "Server did not recognize mailbox
%s\n", $mailbox; }
elsif ("$resp_str" eq "PERMDENY") { printf "Permission denied attempting
get mailbox info for %s", $mailb
ox; }
else {
  my ($uname,$mbox,$numrecent,$lread,$lappend) = split('\|',$resp_str);
  printf "user: %s\nmbox: %s\nNumber of Recent %d\n", $uname, $mbox,
$numrecent;
  $lread = localtime($lread);
  printf "Last read: %s\n", $lread;
  $lappend = localtime($lappend);
  printf "Last arrived: %s\n", $lappend;
}




"dreamwvr at dreamwvr.com" wrote:
> 
> On Wed, May 21, 2003 at 08:28:00AM +0200, Laurent LAVAUD wrote:
> > Hello,
> >
> >   Is there a way to know when a user has read his/her mailbox for the last time ?
> >
> man stat
> You can write a small program in PERL or C that traverses users
> mailbox to check the status. YMMV
> 
> HIH
> Best Regards,
> dreamwvr at dreamwvr.com
> 
> --
> /*  Security is a work in progress - dreamwvr                 */
> #                               48 69 65 72 6F 70 68 61 6E 74 32
> # Note: To begin Journey type man afterboot,man help,man hier[.]
> # 66 6F 72 20 48 69 72 65                              0000 0001
> // "Who's Afraid of Schrodinger's Cat?" /var/(.)?mail/me \?  ;-]




More information about the Info-cyrus mailing list