From 074dc8fda6f634cc8c024a913d8033600b336b3a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Oct 2012 09:04:43 +0000 Subject: initial commit. --- actions/get_statuses.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 actions/get_statuses.php (limited to 'actions/get_statuses.php') diff --git a/actions/get_statuses.php b/actions/get_statuses.php new file mode 100644 index 000000000..c328e44b7 --- /dev/null +++ b/actions/get_statuses.php @@ -0,0 +1,41 @@ + + * @copyright Beechannels 2007-2010 + * @link http://beechannels.com/ + */ + + header('Content-type: application/json'); + gatekeeper(); + $usernames = get_input('beechat_roster_items_usernames'); + if (!empty($usernames)) + { + $iconSize = 'small'; + $rosterItemsUsernames = explode(',', $usernames); + $userFriendsEntities = $_SESSION['user']->getFriends('', count($rosterItemsUsernames), 0); + + $res = array(); + foreach ($rosterItemsUsernames as $value) + { + foreach ($userFriendsEntities as $friend) + { + if (strtolower($friend->username) == strtolower($value)) + { + $status = get_entities_from_metadata("state", "current", "object", "status", $friend->get('guid')); + $res[$value] = ($status != false) ? $status[0]->description : ''; + break; + } + } + } + echo json_encode($res); + } + else + echo json_encode(null); + + exit(); + +?> -- cgit v1.2.3