Gossamer Forum
Home : Products : Gossamer Mail : Development, Plugins and Globals :

Re: [Andy] Plugins in GMail

Quote Reply
Re: [Andy] Plugins in GMail In reply to
Code:
#!/usr/bin/perl -w

use strict;
use lib '.';

use GMail qw/:all/;
use GMail::Auth;

GMail::init('.');

$SIG{__DIE__} = \&GMail::fatal;
$| = 1;

main();

sub main {
# Load all template specific files.
my $t = GMail->template_set();
$CFG->load_template_set($t);

# If this site is disabled display the disabled page
if (!$CFG->{enabled}) {
return GMail->print_page('disabled.htm');
}

# Check to see if they are allowed to use the service
if (!GMail::Auth->allow_access()) {
require GMail::NoAuth;
return GMail::NoAuth->print_page($CFG->{templates}->{auth_error}, { error => ref($GMail::Auth::error) ? $GMail::Auth::error : \$GMail::Auth::error });
}

# Authenticate the user.
$GMail::Auth::error ||= ''; # -w warnings, ugg
my $ret = $PLG->dispatch('GMail::Auth::authenticate', sub { GMail::Auth->authenticate() });
unless ($ret) {
require GMail::NoAuth;
return GMail::NoAuth->auth_failed({ error => $GMail::Auth::error });
}

return $ret if $ret == EXIT;

# Find out which template set we are on.
$t = GMail->template_set();
$CFG->load_template_set($t);

GMail->print_page('foo.htm', { foo => "bar" });
}

Adrian
Subject Author Views Date
Thread Plugins in GMail Andy 13579 Aug 20, 2007, 5:41 AM
Post Re: [Andy] Plugins in GMail
Andy 13282 Aug 20, 2007, 5:47 AM
Thread Re: [Andy] Plugins in GMail
brewt 13265 Aug 20, 2007, 11:54 PM
Thread Re: [brewt] Plugins in GMail
Andy 13309 Aug 21, 2007, 2:18 AM
Thread Re: [Andy] Plugins in GMail
brewt 13243 Aug 22, 2007, 3:31 AM
Thread Re: [brewt] Plugins in GMail
Andy 13303 Aug 22, 2007, 3:49 AM
Thread Re: [Andy] Plugins in GMail
brewt 13261 Aug 22, 2007, 7:53 PM
Post Re: [brewt] Plugins in GMail
Andy 13255 Aug 23, 2007, 12:54 AM
Post Re: [brewt] Plugins in GMail
Andy 13311 Aug 22, 2007, 1:34 AM