From 7b609782623d91c2bdf81c04cd801aaae927e9fa Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 20:40:37 -0800 Subject: back-end for changing online status and keeping presence refreshed --- mod/chat.php | 3 +++ mod/chatsvc.php | 21 ++++++++++++++++++++- view/pdl/mod_chat.pdl | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 view/pdl/mod_chat.pdl diff --git a/mod/chat.php b/mod/chat.php index b8af4c1a6..fa3d05364 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -67,5 +67,8 @@ function chat_content(&$a) { )); return $o; } + require_once('include/widgets.php'); + + return widget_chatroom_list(array()); } \ No newline at end of file diff --git a/mod/chatsvc.php b/mod/chatsvc.php index 23b95cd1c..39161b5a7 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -29,7 +29,19 @@ 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; $sql_extra = permissions_sql($a->data['chat']['uid']); @@ -96,6 +108,13 @@ function chatsvc_content(&$a) { } } + $r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s' limit 1", + dbesc(datetime_convert()), + intval($room_id), + dbesc(get_observer_hash()), + dbesc($_SERVER['REMOTE_ADDR']) + ); + $ret['success'] = true; $ret['inroom'] = $inroom; $ret['chats'] = $chats; diff --git a/view/pdl/mod_chat.pdl b/view/pdl/mod_chat.pdl new file mode 100644 index 000000000..6b1d2a15e --- /dev/null +++ b/view/pdl/mod_chat.pdl @@ -0,0 +1,3 @@ +[region=aside] +[widget=profile][/widget] +[/region] -- cgit v1.2.3