summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/README46
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php11
-rw-r--r--plugins/OStatus/lib/salmonaction.php55
-rw-r--r--plugins/Sample/hello.php8
-rw-r--r--plugins/Sample/locale/Sample.po56
5 files changed, 124 insertions, 52 deletions
diff --git a/plugins/OStatus/README b/plugins/OStatus/README
index cbf3adbb9..3a98b7b25 100644
--- a/plugins/OStatus/README
+++ b/plugins/OStatus/README
@@ -2,23 +2,33 @@ Plugin to support importing updates from external RSS and Atom feeds into your t
Uses PubSubHubbub for push feed updates; currently non-PuSH feeds cannot be subscribed.
+Configuration options available:
+
+$config['ostatus']['hub']
+ (default internal hub)
+ Set to URL of an external PuSH hub to use it instead of our internal hub.
+
+$config['ostatus']['hub_retries']
+ (default 0)
+ Number of times to retry a PuSH send to consumers if using internal hub
+
+
+For testing, shouldn't be used in production:
+
+$config['ostatus']['skip_signatures']
+ (default use signatures)
+ Disable generation and validation of Salmon magicenv signatures
+
+$config['feedsub']['nohub']
+ (default require hub)
+ Allow low-level feed subscription setup for feeds without hubs.
+ Not actually usable at this stage, OStatus will check for hubs too
+ and we have no polling backend.
+
+
Todo:
-* set feed icon avatar for actual profiles as well as for preview
-* use channel image and/or favicon for avatar?
-* garbage-collect subscriptions that are no longer being used
-* administrative way to kill feeds?
-* functional l10n
-* clean up subscription form look and workflow
-* use ajax for test/preview in subscription form
-* rssCloud support? (Does anything use it that doesn't support PuSH as well?)
-* possibly a polling daemon to support non-PuSH feeds?
-* likely problems with multiple feeds from the same site, such as category feeds on a blog
- (currently each feed would publish a separate notice on a separate profile, but pointing to the same post URI.)
- (could use the local URI I guess, but that's so icky!)
-* problems with Atom feeds that list <link rel="alternate" href="..."/> but don't have the type
- (such as http://atomgen.appspot.com/feed/5 demo feed); currently it's not recognized and we end up with the feed's master URI
-* make it easier to see what you're subscribed to and unsub from things
-* saner treatment of fullname/nickname?
+* fully functional l10n
+* redo non-OStatus feed support
+** rssCloud support?
+** possibly a polling daemon to support non-PuSH feeds?
* make use of tags/categories from feeds
-* update feed profile data when it changes
-* XML_Feed_Parser has major problems with category and link tags; consider replacing?
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 144fdfa8b..4f73fd65b 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -668,10 +668,9 @@ class Ostatus_profile extends Memcached_DataObject
*/
protected function purify($html)
{
- // @fixme disable caching or set a sane temp dir
- require_once(INSTALLDIR.'/extlib/HTMLPurifier/HTMLPurifier.auto.php');
- $purifier = new HTMLPurifier();
- return $purifier->purify($html);
+ require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
+ $config = array('safe' => 1);
+ return htmLawed($html, $config);
}
/**
@@ -953,7 +952,7 @@ class Ostatus_profile extends Memcached_DataObject
* @param Activity $activity
* @return mixed matching Ostatus_profile or false if none known
*/
- protected static function getActorProfile($activity)
+ public static function getActorProfile($activity)
{
return self::getActivityObjectProfile($activity->actor);
}
@@ -1091,7 +1090,7 @@ class Ostatus_profile extends Memcached_DataObject
* @param ActivityObject $object
* @param array $hints
*/
- protected function updateFromActivityObject($object, $hints=array())
+ public function updateFromActivityObject($object, $hints=array())
{
if ($this->isGroup()) {
$group = $this->localGroup();
diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php
index 9aac2ed52..a03169101 100644
--- a/plugins/OStatus/lib/salmonaction.php
+++ b/plugins/OStatus/lib/salmonaction.php
@@ -38,11 +38,11 @@ class SalmonAction extends Action
parent::prepare($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
- $this->clientError(_('This method requires a POST.'));
+ $this->clientError(_m('This method requires a POST.'));
}
if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/atom+xml') {
- $this->clientError(_('Salmon requires application/atom+xml'));
+ $this->clientError(_m('Salmon requires application/atom+xml'));
}
$xml = file_get_contents('php://input');
@@ -76,8 +76,7 @@ class SalmonAction extends Action
{
StatusNet::setApi(true); // Send smaller error pages
- // TODO : Insert new $xml -> notice code
-
+ common_log(LOG_DEBUG, "Got a " . $this->act->verb);
if (Event::handle('StartHandleSalmon', array($this->activity))) {
switch ($this->act->verb)
{
@@ -106,8 +105,11 @@ class SalmonAction extends Action
case ActivityVerb::LEAVE:
$this->handleLeave();
break;
+ case ActivityVerb::UPDATE_PROFILE:
+ $this->handleUpdateProfile();
+ break;
default:
- throw new ClientException(_("Unimplemented."));
+ throw new ClientException(_m("Unrecognized activity type."));
}
Event::handle('EndHandleSalmon', array($this->activity));
}
@@ -115,56 +117,57 @@ class SalmonAction extends Action
function handlePost()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand posts."));
}
function handleFollow()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand follows."));
}
function handleUnfollow()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand unfollows."));
}
function handleFavorite()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand favorites."));
}
- /**
- * Remote user doesn't like one of our posts after all!
- * Confirm the post is ours, and delete a local favorite event.
- */
-
function handleUnfavorite()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand unfavorites."));
}
- /**
- * Hmmmm
- */
function handleShare()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand share events."));
}
- /**
- * Hmmmm
- */
function handleJoin()
{
- throw new ClientException(_("Unimplemented!"));
+ throw new ClientException(_m("This target doesn't understand joins."));
+ }
+
+ function handleLeave()
+ {
+ throw new ClientException(_m("This target doesn't understand leave events."));
}
/**
- * Hmmmm
+ * Remote user sent us an update to their profile.
+ * If we already know them, accept the updates.
*/
- function handleLeave()
+ function handleUpdateProfile()
{
- throw new ClientException(_("Unimplemented!"));
+ $oprofile = Ostatus_profile::getActorProfile($this->act);
+ if ($oprofile) {
+ common_log(LOG_INFO, "Got a profile-update ping from $oprofile->uri");
+ $oprofile->updateFromActivityObject($this->act->actor);
+ } else {
+ common_log(LOG_INFO, "Ignoring profile-update ping from unknown " . $this->act->actor->id);
+ }
}
/**
diff --git a/plugins/Sample/hello.php b/plugins/Sample/hello.php
index 0cfd8a1c3..dfbd0ad4f 100644
--- a/plugins/Sample/hello.php
+++ b/plugins/Sample/hello.php
@@ -119,13 +119,15 @@ class HelloAction extends Action
}
/**
- * show content in the content area
+ * Show content in the content area
*
* The default StatusNet page has a lot of decorations: menus,
* logos, tabs, all that jazz. This method is used to show
* content in the content area of the page; it's the main
* thing you want to overload.
*
+ * This method also demonstrates use of a plural localized string.
+ *
* @return void
*/
@@ -138,7 +140,9 @@ class HelloAction extends Action
$this->element('p', array('class' => 'greeting'),
sprintf(_m('Hello, %s'), $this->user->nickname));
$this->element('p', array('class' => 'greeting_count'),
- sprintf(_m('I have greeted you %d time(s).'),
+ sprintf(_m('I have greeted you %d time.',
+ 'I have greeted you %d times.',
+ $this->gc->greeting_count),
$this->gc->greeting_count));
}
}
diff --git a/plugins/Sample/locale/Sample.po b/plugins/Sample/locale/Sample.po
new file mode 100644
index 000000000..e0d2aa853
--- /dev/null
+++ b/plugins/Sample/locale/Sample.po
@@ -0,0 +1,56 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-02-24 16:33-0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: hello.php:115 SamplePlugin.php:266
+msgid "Hello"
+msgstr ""
+
+#: hello.php:117 hello.php:141
+#, php-format
+msgid "Hello, %s"
+msgstr ""
+
+#: hello.php:138
+msgid "Hello, stranger!"
+msgstr ""
+
+#: hello.php:143
+#, php-format
+msgid "I have greeted you %d time."
+msgid_plural "I have greeted you %d times."
+msgstr[0] ""
+msgstr[1] ""
+
+#: SamplePlugin.php:266
+msgid "A warm greeting"
+msgstr ""
+
+#: SamplePlugin.php:277
+msgid "A sample plugin to show basics of development for new hackers."
+msgstr ""
+
+#: User_greeting_count.php:163
+#, php-format
+msgid "Could not save new greeting count for %d"
+msgstr ""
+
+#: User_greeting_count.php:176
+#, php-format
+msgid "Could not increment greeting count for %d"
+msgstr ""