summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-10-26 11:20:43 -0400
committerEvan Prodromou <evan@status.net>2010-10-26 11:20:43 -0400
commitbec00094a7447df2f2cc831083f7dd2edc904ff7 (patch)
treec3296a5fc0f687795aecd6aa0402101fd2f3b95d
parent511566a132734b44fb709d69023a86423dbf20ec (diff)
Blacklist plugin checks PuSH and Salmon notices
-rw-r--r--plugins/Blacklist/BlacklistPlugin.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php
index 10f89ef72..60b59168f 100644
--- a/plugins/Blacklist/BlacklistPlugin.php
+++ b/plugins/Blacklist/BlacklistPlugin.php
@@ -463,4 +463,45 @@ class BlacklistPlugin extends Plugin
$hostname = parse_url($homepage, PHP_URL_HOST);
return $hostname;
}
+
+ function onStartHandleFeedEntry($activity)
+ {
+ return $this->_checkActivity($activity);
+ }
+
+ function onStartHandleSalmon($activity)
+ {
+ return $this->_checkActivity($activity);
+ }
+
+ function _checkActivity($activity)
+ {
+ $actor = $activity->actor;
+
+ if (empty($actor)) {
+ return true;
+ }
+
+ $homepage = strtolower($actor->link);
+
+ if (!empty($homepage)) {
+ if (!$this->_checkUrl($homepage)) {
+ $msg = sprintf(_m("Users from '%s' blocked."),
+ $homepage);
+ throw new ClientException($msg);
+ }
+ }
+
+ $nickname = strtolower($actor->poco->preferredUsername);
+
+ if (!empty($nickname)) {
+ if (!$this->_checkNickname($nickname)) {
+ $msg = sprintf(_m("Posts from nickname '%s' disallowed."),
+ $nickname);
+ throw new ClientException($msg);
+ }
+ }
+
+ return true;
+ }
}