+ return api_apply_template("group_update", $type, array('result' => $success));
+ }
+ api_register_func('api/friendica/group_update', 'api_friendica_group_update', true, API_METHOD_POST);
+
+
+ function api_friendica_activity(&$a, $type) {
+ if (api_user()===false) throw new ForbiddenException();
+ $verb = strtolower($a->argv[3]);
+ $verb = preg_replace("|\..*$|", "", $verb);
+
+ $id = (x($_REQUEST, 'id') ? $_REQUEST['id'] : 0);
+
+ $res = do_like($id, $verb);
+
+ if ($res) {
+ if ($type == 'xml')
+ $ok = "true";
+ else
+ $ok = "ok";
+ return api_apply_template('test', $type, array('ok' => $ok));
+ } else {
+ throw new BadRequestException('Error adding activity');
+ }
+
+ }
+ api_register_func('api/friendica/activity/like', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/dislike', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/attendyes', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/attendno', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/attendmaybe', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/unlike', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/undislike', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/unattendyes', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/unattendno', 'api_friendica_activity', true, API_METHOD_POST);
+ api_register_func('api/friendica/activity/unattendmaybe', 'api_friendica_activity', true, API_METHOD_POST);
+
+ /**
+ * @brief Returns notifications
+ *
+ * @param App $a
+ * @param string $type Known types are 'atom', 'rss', 'xml' and 'json'
+ * @return string
+ */
+ function api_friendica_notification(&$a, $type) {
+ if (api_user()===false) throw new ForbiddenException();
+ if ($a->argc!==3) throw new BadRequestException("Invalid argument count");
+ $nm = new NotificationsManager();
+
+ $notes = $nm->getAll(array(), "+seen -date", 50);
+ return api_apply_template("<auto>", $type, array('$notes' => $notes));