From 9666cbf7b7c3f6b9a104203078363c7b29226630 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Mon, 28 Dec 2015 04:56:51 +0100
Subject: musicgrid.cgi now uses POST to set and GET to get music grids


diff --git a/rh-bin/musicgrid.cgi b/rh-bin/musicgrid.cgi
index f2bf9db..5e2888d 100755
--- a/rh-bin/musicgrid.cgi
+++ b/rh-bin/musicgrid.cgi
@@ -35,7 +35,7 @@ my @clocks = ();
 my $q = CGI->new;
 my $username = $q->param('LOGIN_NAME');
 my $token = $q->param('PASSWORD');
-my $cmd = $q->param('COMMAND');
+my $cmd = $q->request_method();
 
 sub get_clocks
 {
@@ -83,24 +83,21 @@ if(!defined $username) {
 } elsif(!defined $token) {
   $responsecode = 400;
   $errorstring = "mandatory field PASSWORD is missing";
-} elsif(!defined $cmd) {
-  $responsecode = 400;
-  $errorstring = "mandatory field COMMAND is missing";
 } else {
   (my $ctx, $status, $errorstring) = RHRD::rddb::init();
   if(defined $ctx) {
     (my $authenticated, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token);
     my $authorized = RHRD::rddb::is_musicpools_user($ctx, $username);
     if($authenticated == 1 && $authorized == 1) {
-      if($cmd eq "get") {
+      if($cmd eq "GET") {
         ($responsecode, $errorstring) = get_clocks($ctx);
       }
-      elsif($cmd eq "set") {
+      elsif($cmd eq "POST") {
         ($responsecode, $errorstring) = set_clock($ctx);
       }
       else {
-        $responsecode = 400;
-        $errorstring = "command '$cmd' is unknown";
+        $responsecode = 405;
+        $errorstring = "request method '$cmd' is unknown";
       }
     } elsif($authenticated == 0) {
       $responsecode = 401;
@@ -117,7 +114,7 @@ if(!defined $username) {
 print "Content-type: application/xml; charset=UTF-8\n";
 print "Status: $responsecode\n\n";
 
-if($cmd eq "set" || $responsecode != 200) {
+if($cmd eq "POST" || $responsecode != 200) {
   print "<RDWebResult>\n";
   print "  <ResponseCode>" . xml_quote($responsecode) . "</ResponseCode>\n";
   print "  <ErrorString>" . xml_quote($errorstring) . "</ErrorString>\n";
-- 
cgit v0.10.2


From b1dbfb3682d7d231ceed2f43819cac10c0012690 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Mon, 28 Dec 2015 05:24:40 +0100
Subject: listdropboxes now supports type to be specified to limit the list of
 dropboxes


diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi
index 2b753d1..61e85d9 100755
--- a/rh-bin/listdropboxes.cgi
+++ b/rh-bin/listdropboxes.cgi
@@ -35,6 +35,7 @@ my @dropboxes = ();
 my $q = CGI->new;
 my $username = $q->param('LOGIN_NAME');
 my $token = $q->param('PASSWORD');
+my $type = $q->param('TYPE');
 
 if(!defined $username) {
   $responsecode = 400;
@@ -49,7 +50,7 @@ if(!defined $username) {
     ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token);
     if($result == 1) {
       $responsecode = 200;
-      @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username);
+      @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username, $type);
       if(!defined $dropboxes[0] && defined $dropboxes[1]) {
         $responsecode = 500;
         $status = $dropboxes[1];
-- 
cgit v0.10.2


From 00638c1416bc314c581b0ca67efe59c76f12e838 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Mon, 28 Dec 2015 05:38:14 +0100
Subject: fixed call to get_dropboxes


diff --git a/rh-bin/listdropboxes.cgi b/rh-bin/listdropboxes.cgi
index 61e85d9..2eabf22 100755
--- a/rh-bin/listdropboxes.cgi
+++ b/rh-bin/listdropboxes.cgi
@@ -50,7 +50,7 @@ if(!defined $username) {
     ($result, $status, $errorstring) = RHRD::rddb::check_token($ctx, $username, $token);
     if($result == 1) {
       $responsecode = 200;
-      @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username, $type);
+      @dropboxes = RHRD::rddb::get_dropboxes($ctx, $username, undef, $type);
       if(!defined $dropboxes[0] && defined $dropboxes[1]) {
         $responsecode = 500;
         $status = $dropboxes[1];
-- 
cgit v0.10.2