use new pingback2 class structure/naming
[stapibas.git] / www / xmlrpc.php
index baaceeaa502462f2fc58c4eacae4e0c9241f820b..52bdf6e0d7e0f506aaa83eb135678761dbb9f1d9 100644 (file)
@@ -22,8 +22,8 @@ function __autoload($className)
 $db = new PDO($dbdsn, $dbuser, $dbpass);
 
 class PingbackStorage
-    implements \PEAR2\Services\Pingback2\Server_Callback_IStorage,
-    \PEAR2\Services\Pingback2\Server_Callback_ILink
+    implements \PEAR2\Services\Pingback\Server\Callback\IStorage,
+    \PEAR2\Services\Pingback\Server\Callback\ILink
 {
     public function __construct(PDO $db)
     {
@@ -51,6 +51,7 @@ class PingbackStorage
             )
         );
     }
+
     /**
      * Verifies that a link from $source to $target exists.
      *
@@ -70,7 +71,27 @@ class PingbackStorage
     }
 }
 
-$s = new \PEAR2\Services\Pingback2\Server();
+class PingbackMailer
+    implements \PEAR2\Services\Pingback\Server\Callback\IStorage
+{
+    public function storePingback(
+        $target, $source, $sourceBody, \HTTP_Request2_Response $res
+    ) {
+        mail(
+            'cweiske@cweiske.de',
+            'New pingback',
+            "A pingback just came in, for\n"
+            . '> '  . $target . "\n"
+            . "from\n"
+            . '> ' . $source . "\n"
+            . "\n\nLove, stapibas",
+            "From: stapibas <server@cweiske.de>"
+        );
+    }
+}
+
+$s = new \PEAR2\Services\Pingback\Server();
 $s->addCallback(new PingbackStorage($db));
+$s->addCallback(new PingbackMailer());
 $s->run();
 ?>