diff options
author | friendica <info@friendica.com> | 2014-02-02 15:50:07 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-02 15:50:07 -0800 |
commit | 67899677db8bde044284aaec6237559a68a27b6a (patch) | |
tree | d9f34238fc2500a4bbb0b9113e908ed231ebfc80 | |
parent | 02e4527de682042562dccac83899ef562c4b1e05 (diff) | |
download | volse-hubzilla-67899677db8bde044284aaec6237559a68a27b6a.tar.gz volse-hubzilla-67899677db8bde044284aaec6237559a68a27b6a.tar.bz2 volse-hubzilla-67899677db8bde044284aaec6237559a68a27b6a.zip |
make chat honour the pause key (but we still need to ping the server to maintain the in_room status), also the recent change to pull css out of the template file used classes instead of ids so none of the styles were sticking
-rw-r--r-- | mod/chatsvc.php | 94 | ||||
-rw-r--r-- | view/css/mod_chat.css | 8 | ||||
-rw-r--r-- | view/tpl/chat.tpl | 4 |
3 files changed, 55 insertions, 51 deletions
diff --git a/mod/chatsvc.php b/mod/chatsvc.php index bbe616c48..e6590f57a 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -56,6 +56,7 @@ function chatsvc_content(&$a) { $status = strip_tags($_REQUEST['status']); $room_id = intval($a->data['chat']['room_id']); + $stopped = ((x($_REQUEST,'stopped') && intval($_REQUEST['stopped'])) ? true : false); if($status && $room_id) { @@ -74,58 +75,60 @@ function chatsvc_content(&$a) { goaway(z_root() . '/chat/' . $x[0]['channel_address'] . '/' . $room_id); } + if(! $stopped) { - $lastseen = intval($_REQUEST['last']); + $lastseen = intval($_REQUEST['last']); - $ret = array('success' => false); + $ret = array('success' => false); - $sql_extra = permissions_sql($a->data['chat']['uid']); + $sql_extra = permissions_sql($a->data['chat']['uid']); - $r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra", - intval($a->data['chat']['uid']), - intval($a->data['chat']['room_id']) - ); - if(! $r) - json_return_and_die($ret); + $r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra", + intval($a->data['chat']['uid']), + intval($a->data['chat']['room_id']) + ); + if(! $r) + json_return_and_die($ret); - $inroom = array(); + $inroom = array(); - $r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name", - intval($a->data['chat']['room_id']) - ); - if($r) { - foreach($r as $rr) { - switch($rr['cp_status']) { - case 'away': - $status = t('Away'); - break; - case 'online': - default: - $status = t('Online'); - break; + $r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name", + intval($a->data['chat']['room_id']) + ); + if($r) { + foreach($r as $rr) { + switch($rr['cp_status']) { + case 'away': + $status = t('Away'); + break; + case 'online': + default: + $status = t('Online'); + break; + } + + $inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], status => $status); } - - $inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], status => $status); } - } - $chats = array(); + $chats = array(); - $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d", - intval($a->data['chat']['room_id']), - intval($lastseen) - ); - if($r) { - foreach($r as $rr) { - $chats[] = array( - 'id' => $rr['chat_id'], - 'img' => zid($rr['xchan_photo_m']), - 'img_type' => $rr['xchan_photo_mimetype'], - 'name' => $rr['xchan_name'], - 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'), - 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'), - 'text' => smilies(bbcode($rr['chat_text'])) - ); + $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d", + intval($a->data['chat']['room_id']), + intval($lastseen) + ); + if($r) { + foreach($r as $rr) { + $chats[] = array( + 'id' => $rr['chat_id'], + 'img' => zid($rr['xchan_photo_m']), + 'img_type' => $rr['xchan_photo_mimetype'], + 'name' => $rr['xchan_name'], + 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'), + 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'), + 'text' => smilies(bbcode($rr['chat_text'])) + ); + } } } @@ -137,9 +140,10 @@ function chatsvc_content(&$a) { ); $ret['success'] = true; - $ret['inroom'] = $inroom; - $ret['chats'] = $chats; - + if(! $stopped) { + $ret['inroom'] = $inroom; + $ret['chats'] = $chats; + } json_return_and_die($ret); } diff --git a/view/css/mod_chat.css b/view/css/mod_chat.css index 7f33f2c48..ce6e59af1 100644 --- a/view/css/mod_chat.css +++ b/view/css/mod_chat.css @@ -1,23 +1,23 @@ - .chatContainer { + #chatContainer { height: 100%; width: 100%; } - .chatTopBar { + #chatTopBar { float: left; height: 400px; width: 650px; overflow-y: auto; } - .chatUsers { + #chatUsers { float: right; width: 120px; height: 100%; border: 1px solid #000; } - .chatBottomBar { + #chatBottomBar { position: relative; bottom: 0; height: 150px; diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index eb98063fa..e4cd1d20b 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -47,8 +47,8 @@ $('#chat-form').submit(function(ev) { function load_chats() { - $.get("chatsvc?f=&room_id=" + room_id + '&last=' + last_chat,function(data) { - if(data.success) { + $.get("chatsvc?f=&room_id=" + room_id + '&last=' + last_chat + ((stopped) ? '&stopped=1' : ''),function(data) { + if(data.success && (! stopped)) { update_inroom(data.inroom); update_chats(data.chats); } |