From b1021df485fb6129acda5bba616bac10aea75a45 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 24 Feb 2014 21:34:49 -0800 Subject: provide ability to bookmark chatrooms using rbmark --- mod/chat.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index a960f4f37..0f2b94b9d 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -1,6 +1,7 @@ get_channel(); + $ob = $a->get_observer(); $observer = get_observer_hash(); if(! $observer) { notice( t('Permission denied.') . EOL); @@ -144,6 +146,8 @@ function chat_content(&$a) { if(argc() > 2 && intval(argv(2))) { $room_id = intval(argv(2)); + $bookmark_link = get_bookmark_link($ob); + $x = chatroom_enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']); if(! $x) return; @@ -152,8 +156,16 @@ function chat_content(&$a) { intval($a->profile['profile_uid']) ); if($x) { + $private = ((($x[0]['allow_cid']) || ($x[0]['allow_gid']) || ($x[0]['deny_cid']) || ($x[0]['deny_gid'])) ? true : false); $room_name = $x[0]['cr_name']; + if($bookmark_link) + $bookmark_link .= '&url=' . z_root() . '/chat/' . argv(1) . '/' . argv(2) . '&title=' . urlencode($x[0]['cr_name']) . (($private) ? '&private=1' : '') . '&ischat=1'; + } + else { + notice( t('Room not found') . EOL); + return; } + $o = replace_macros(get_markup_template('chat.tpl'),array( '$room_name' => $room_name, '$room_id' => $room_id, @@ -162,7 +174,9 @@ function chat_content(&$a) { '$submit' => t('Submit'), '$leave' => t('Leave Room'), '$away' => t('I am away right now'), - '$online' => t('I am online') + '$online' => t('I am online'), + '$bookmark_link' => $bookmark_link, + '$bookmark' => t('Bookmark this room') )); return $o; -- cgit v1.2.3