blob: 6f7620beb0c4e9c071a4fdfbc5245b4eda5ee597 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
<?php
/**
* Beechat
*
* @package beechat
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Beechannels <contact@beechannels.com>
* @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('', 1000000000, 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();
?>
|