aboutsummaryrefslogtreecommitdiffstats
path: root/mod/chatsvc.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-29 20:40:37 -0800
committerfriendica <info@friendica.com>2014-01-29 20:40:37 -0800
commit7b609782623d91c2bdf81c04cd801aaae927e9fa (patch)
tree3e1a7e41bf0cefbc0bd96a44cc1766247f1bbea3 /mod/chatsvc.php
parent9fdee53c9a35d584de8cacd071c6608de88a18b6 (diff)
downloadvolse-hubzilla-7b609782623d91c2bdf81c04cd801aaae927e9fa.tar.gz
volse-hubzilla-7b609782623d91c2bdf81c04cd801aaae927e9fa.tar.bz2
volse-hubzilla-7b609782623d91c2bdf81c04cd801aaae927e9fa.zip
back-end for changing online status and keeping presence refreshed
Diffstat (limited to 'mod/chatsvc.php')
-rw-r--r--mod/chatsvc.php21
1 files changed, 20 insertions, 1 deletions
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;