From 202094b660a07f4aa975aa0b3d97d163ba2f3d31 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Thu, 10 Jun 2021 21:05:30 -0400 Subject: [PATCH] Latest and greatest guestbook script --- cgi-bin/guest_mm.cgi | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/cgi-bin/guest_mm.cgi b/cgi-bin/guest_mm.cgi index a6215e3..c130773 100755 --- a/cgi-bin/guest_mm.cgi +++ b/cgi-bin/guest_mm.cgi @@ -24,25 +24,20 @@ open(my $thoughtCrimes, '.msg.bans') or die "$@"; open(my $nameBans, '.name.bans') or die "$@"; # Get creds file -my $dotfile = ".mmCreds.xml"; +my $dotfile = ".mmCreds.xml"; # 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 -my $user = $dom->findvalue('/credentials/username'); -my $pass = $dom->findvalue('/credentials/password'); -my $url = $dom->findvalue('/credentials/base_url'); -my $chan = $dom->findvalue('/credentials/channel_id'); -my $spam = $dom->findvalue('/credentials/spam_chan_id'); -# Put the values into place -my %conf = ( - authenticate => 1, - username => "$user", - password => "$pass", - base_url => "$url" - ); +my %conf; +$conf{'authenticate'} = 1; +$conf{'username'} = $dom->findvalue('/credentials/username'); +$conf{'password'} = $dom->findvalue('/credentials/password'); +$conf{'base_url'} = $dom->findvalue('/credentials/base_url'); +my $chan = $dom->findvalue('/credentials/channel_id'); +my $spam = $dom->findvalue('/credentials/spam_chan_id'); # Create new WebService::Mattermost objects (mm && resource) -my $mm = WebService::Mattermost->new(%conf); -my $resource = $mm->api->posts; +my $mm = WebService::Mattermost->new(%conf); +my $resource = $mm->api->posts; ## Functions ## @@ -195,7 +190,6 @@ print $q->header(-charset => 'UTF-8'); # Print the head & title, begin the body print $q->start_html( - #-dtd => 'html', -title => 'SwaggNet Guestbook', -style => '/css/swagg.css' );