diff options
author | friendica <info@friendica.com> | 2014-02-02 03:43:52 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-02 03:43:52 -0800 |
commit | e83419b53e27078867f8449f476d87b064b9d502 (patch) | |
tree | d02cdea385de99975d27c43ca555e57942ba2ee5 /mod/chatsvc.php | |
parent | 6b15e57cdbb1b525528f1e67aaa071d0ef4e6e25 (diff) | |
download | volse-hubzilla-e83419b53e27078867f8449f476d87b064b9d502.tar.gz volse-hubzilla-e83419b53e27078867f8449f476d87b064b9d502.tar.bz2 volse-hubzilla-e83419b53e27078867f8449f476d87b064b9d502.zip |
add links to change chat status and leave room
Diffstat (limited to 'mod/chatsvc.php')
-rw-r--r-- | mod/chatsvc.php | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/mod/chatsvc.php b/mod/chatsvc.php index 0a69834f0..bbe616c48 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -29,17 +29,6 @@ function chatsvc_post(&$a) { $room_id = $a->data['chat']['room_id']; $text = escape_tags($_REQUEST['chat_text']); - $status = strip_tags($_REQUEST['status']); - - if($status && $room_id) { - $r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", - dbesc($status), - dbesc(datetime_convert()), - intval($room_id), - dbesc(get_observer_hash()), - dbesc($_SERVER['REMOTE_ADDR']) - ); - } if(! $text) return; @@ -65,6 +54,27 @@ function chatsvc_post(&$a) { function chatsvc_content(&$a) { + $status = strip_tags($_REQUEST['status']); + $room_id = intval($a->data['chat']['room_id']); + + if($status && $room_id) { + + $x = q("select channel_address from channel where channel_id = %d limit 1", + intval($a->data['chat']['uid']) + ); + + $r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", + dbesc($status), + dbesc(datetime_convert()), + intval($room_id), + dbesc(get_observer_hash()), + dbesc($_SERVER['REMOTE_ADDR']) + ); + + goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id); + } + + $lastseen = intval($_REQUEST['last']); $ret = array('success' => false); |