summaryrefslogtreecommitdiff
path: root/classes/pluginhost.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-27 16:14:27 +0400
committerAndrew Dolgov <[email protected]>2013-03-27 16:15:25 +0400
commita413f53ebff7d28033090dc343d1ed1d0993ae0b (patch)
treedb02d7ab6427985603384ac489a72646e702befa /classes/pluginhost.php
parentcedfac22e33b944c65675b4c939464344268bf58 (diff)
add experimental base for plugin vfeeds (3 pane mode not yet
implemented)
Diffstat (limited to 'classes/pluginhost.php')
-rw-r--r--classes/pluginhost.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/classes/pluginhost.php b/classes/pluginhost.php
index 0ef17b77e..5f584cd00 100644
--- a/classes/pluginhost.php
+++ b/classes/pluginhost.php
@@ -6,6 +6,7 @@ class PluginHost {
private $handlers = array();
private $commands = array();
private $storage = array();
+ private $feeds = array();
private $owner_uid;
private $debug;
@@ -301,5 +302,43 @@ class PluginHost {
function get_debug() {
return $this->debug;
}
+
+ // Plugin feed functions are *EXPERIMENTAL*!
+
+ // cat_id: only -1 is supported (Special)
+ function add_feed($cat_id, $title, $icon, $sender) {
+ if (!$this->feeds[$cat_id]) $this->feeds[$cat_id] = array();
+
+ $id = count($this->feeds[$cat_id]);
+
+ array_push($this->feeds[$cat_id],
+ array('id' => $id, 'title' => $title, 'sender' => $sender, 'icon' => $icon));
+
+ return $id;
+ }
+
+ function get_feeds($cat_id) {
+ return $this->feeds[$cat_id];
+ }
+
+ // convert feed_id (e.g. -129) to pfeed_id first
+ function get_feed_handler($pfeed_id) {
+ foreach ($this->feeds as $cat) {
+ foreach ($cat as $feed) {
+ if ($feed['id'] == $pfeed_id) {
+ return $feed['sender'];
+ }
+ }
+ }
+ }
+
+ static function pfeed_to_feed_id($label) {
+ return PLUGIN_FEED_BASE_INDEX - 1 - abs($label);
+ }
+
+ static function feed_to_pfeed_id($feed) {
+ return PLUGIN_FEED_BASE_INDEX - 1 + abs($feed);
+ }
+
}
?>