#!/usr/bin/perl -w

use strict;
use esmith::AccountsDB;
use esmith::event;

my $accounts = esmith::AccountsDB->open() or
    die "Unable to open accounts db: $!";

my ($self, $account) = @ARGV;

# Find all "pseudonyms" entries in the e-smith accounts database and
# if the pseudonyms has an unexisting Account associated we change 
# it to user "admin".

foreach my $pseudo ( $accounts->pseudonyms ) {
    unless ( $accounts->get($pseudo->prop('Account')) ) {
        $pseudo->set_prop( 'Account', 'admin' );
    print "orphaned pseudonym " . $pseudo->key. " has been associated to admin account"
    }
}

