Latest and greatest guestbook script
This commit is contained in:
parent
e46e0b78c4
commit
202094b660
|
@ -24,25 +24,20 @@ open(my $thoughtCrimes, '.msg.bans') or die "$@";
|
||||||
open(my $nameBans, '.name.bans') or die "$@";
|
open(my $nameBans, '.name.bans') or die "$@";
|
||||||
|
|
||||||
# Get creds file
|
# Get creds file
|
||||||
my $dotfile = ".mmCreds.xml";
|
my $dotfile = ".mmCreds.xml";
|
||||||
# Create XML::LibXML object
|
# Create XML::LibXML object
|
||||||
my $dom = XML::LibXML->load_xml(location => $dotfile);
|
my $dom = XML::LibXML->load_xml(location => $dotfile);
|
||||||
# Grab the values from creds file
|
# Grab the values from creds file
|
||||||
my $user = $dom->findvalue('/credentials/username');
|
my %conf;
|
||||||
my $pass = $dom->findvalue('/credentials/password');
|
$conf{'authenticate'} = 1;
|
||||||
my $url = $dom->findvalue('/credentials/base_url');
|
$conf{'username'} = $dom->findvalue('/credentials/username');
|
||||||
my $chan = $dom->findvalue('/credentials/channel_id');
|
$conf{'password'} = $dom->findvalue('/credentials/password');
|
||||||
my $spam = $dom->findvalue('/credentials/spam_chan_id');
|
$conf{'base_url'} = $dom->findvalue('/credentials/base_url');
|
||||||
# Put the values into place
|
my $chan = $dom->findvalue('/credentials/channel_id');
|
||||||
my %conf = (
|
my $spam = $dom->findvalue('/credentials/spam_chan_id');
|
||||||
authenticate => 1,
|
|
||||||
username => "$user",
|
|
||||||
password => "$pass",
|
|
||||||
base_url => "$url"
|
|
||||||
);
|
|
||||||
# Create new WebService::Mattermost objects (mm && resource)
|
# Create new WebService::Mattermost objects (mm && resource)
|
||||||
my $mm = WebService::Mattermost->new(%conf);
|
my $mm = WebService::Mattermost->new(%conf);
|
||||||
my $resource = $mm->api->posts;
|
my $resource = $mm->api->posts;
|
||||||
|
|
||||||
## Functions ##
|
## Functions ##
|
||||||
|
|
||||||
|
@ -195,7 +190,6 @@ print $q->header(-charset => 'UTF-8');
|
||||||
|
|
||||||
# Print the head & title, begin the body
|
# Print the head & title, begin the body
|
||||||
print $q->start_html(
|
print $q->start_html(
|
||||||
#-dtd => 'html',
|
|
||||||
-title => 'SwaggNet Guestbook',
|
-title => 'SwaggNet Guestbook',
|
||||||
-style => '/css/swagg.css'
|
-style => '/css/swagg.css'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue