- logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
-
- if(! $xml)
- http_status_exit(500);
-
- logger('mod-diaspora: message is okay', LOGGER_DEBUG);
-
- $msg = diaspora_decode($importer,$xml);
+ if (!$xml) {
+ $postdata = file_get_contents("php://input");
+ if ($postdata == '') {
+ System::httpExit(500);
+ }
+
+ logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
+ $msg = Diaspora::decodeRaw($importer, $postdata);
+ } else {
+ logger('mod-diaspora: decode message in the old format', LOGGER_DEBUG);
+ $msg = Diaspora::decode($importer, $xml);
+
+ if ($public && !$msg) {
+ logger('mod-diaspora: decode message in the new format', LOGGER_DEBUG);
+ $msg = Diaspora::decodeRaw($importer, $xml);
+ }
+ }