From bb43ee6192710517186088d65d8ee9f1d556b909 Mon Sep 17 00:00:00 2001 From: "Duck (Jakob Munih)" Date: Sun, 15 Feb 2009 18:00:45 +0100 Subject: [PATCH] Add application dirver --- folks/lib/Friends/application.php | 119 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 folks/lib/Friends/application.php diff --git a/folks/lib/Friends/application.php b/folks/lib/Friends/application.php new file mode 100644 index 000000000..9f4b6607b --- /dev/null +++ b/folks/lib/Friends/application.php @@ -0,0 +1,119 @@ + + * @package Folks + */ +class Folks_Friends_application extends Folks_Friends { + + /** + * Add user to a friend list + * + * @param string $friend Friend's usersame + */ + protected function _addFriend($friend) + { + if (!$GLOBALS['registry']->hasMethod('addFriend', $this->_params['app'])) { + return PEAR::raiseError(_("Unsupported")); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'addFriend', array($friend)); + } + + /** + * Remove user from a fiend list + * + * @param string $friend Friend's usersame + */ + public function removeFriend($friend) + { + if (!$GLOBALS['registry']->hasMethod('removeFriend', $this->_params['app'])) { + return PEAR::raiseError(_("Unsupported")); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'removeFriend', array($friend)); + } + + /** + * Get user friends + * + * @return array of users + */ + public function getFriends() + { + if (!$GLOBALS['registry']->hasMethod('getFriends', $this->_params['app'])) { + return PEAR::raiseError(_("Unsupported")); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'getFriends', array($this->_user)); + } + + /** + * Get user blacklist + * + * @return array of users blacklist + */ + public function getBlacklist() + { + if (!$GLOBALS['registry']->hasMethod('getBlacklist', $this->_params['app'])) { + return PEAR::raiseError(_("Unsupported")); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'getBlacklist', array($this->_user)); + } + + /** + * Add user to a blacklist list + * + * @param string $user Usersame + */ + protected function _addBlacklisted($user) + { + if (!$GLOBALS['registry']->hasMethod('addBlacklisted', $this->_params['app'])) { + return PEAR::raiseError(_("Unsupported")); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'addBlacklisted', array($user)); + } + + /** + * Add user to a blacklist list + * + * @param string $user Usersame + */ + public function removeBlacklisted($user) + { + if (!$GLOBALS['registry']->hasMethod('removeBlacklisted', $this->_params['app'])) { + return PEAR::raiseError(_("Unsupported")); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'removeBlacklisted', array($user)); + } + + /** + * Get avaiable groups + */ + public function getGroups() + { + if (!$GLOBALS['registry']->hasMethod('getGroups', $this->_params['app'])) { + return array(); + } + + return $GLOBALS['registry']->callByPackage( + $this->_params['app'], 'getGroups'); + } +} \ No newline at end of file -- 2.11.0