diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-21 07:31:36 +0200 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-21 07:31:36 +0200 |
commit | 7834274bff5e86a7a0eb646f1319b5b9e4bac96f (patch) | |
tree | 5d0317e3aa203471f152f6ec2533150c5406906a | |
parent | 4f6506657208ebf3eadce3109d1bcd8407c7bdaf (diff) | |
parent | d2565d0f61c139df6536ec9d90c10d7af29ef9e5 (diff) | |
download | volse-hubzilla-7834274bff5e86a7a0eb646f1319b5b9e4bac96f.tar.gz volse-hubzilla-7834274bff5e86a7a0eb646f1319b5b9e4bac96f.tar.bz2 volse-hubzilla-7834274bff5e86a7a0eb646f1319b5b9e4bac96f.zip |
Merge remote-tracking branch 'upstream/master'
-rw-r--r-- | include/DReport.php | 9 | ||||
-rw-r--r-- | include/chat.php | 2 | ||||
-rw-r--r-- | include/nav.php | 5 | ||||
-rw-r--r-- | include/zot.php | 64 | ||||
-rw-r--r-- | mod/chat.php | 2 | ||||
-rw-r--r-- | view/php/default.php | 2 | ||||
-rw-r--r-- | view/tpl/bookmarkedchats.tpl | 2 | ||||
-rw-r--r-- | view/tpl/chatroom_new.tpl | 2 | ||||
-rw-r--r-- | view/tpl/chatrooms.tpl | 2 |
9 files changed, 63 insertions, 27 deletions
diff --git a/include/DReport.php b/include/DReport.php index 6c7bf354a..ef86c8cbc 100644 --- a/include/DReport.php +++ b/include/DReport.php @@ -24,6 +24,15 @@ class DReport { $this->date = datetime_convert(); } + function addto_recipient($name) { + $this->recipient = $this->recipient . ' ' . $name; + } + + function addto_update($status) { + $this->status = $this->status . ' ' . $status; + } + + function set($arr) { $this->location = $arr['location']; $this->sender = $arr['sender']; diff --git a/include/chat.php b/include/chat.php index a0646265a..81c5c5d62 100644 --- a/include/chat.php +++ b/include/chat.php @@ -91,7 +91,7 @@ function chatroom_destroy($channel,$arr) { return $ret; } - create_sync_packet($channel['channel_id'],array('chatroom' => $r)); + build_sync_packet($channel['channel_id'],array('chatroom' => $r)); q("delete from chatroom where cr_id = %d", intval($r[0]['cr_id']) diff --git a/include/nav.php b/include/nav.php index 59a7c83a3..972795e83 100644 --- a/include/nav.php +++ b/include/nav.php @@ -94,9 +94,8 @@ EOT; require_once('include/chat.php'); $has_chats = chatroom_list_count(local_channel()); - if($has_chats) { - $nav['usermenu'][] = Array('chat/' . $channel['channel_address'],t('Chat'),"",t('Your chatrooms'),'chat_nav_btn'); - } + $nav['usermenu'][] = Array('chat/' . $channel['channel_address'] . (($has_chats) ? '' : '/new'), t('Chat'),"",t('Your chatrooms'),'chat_nav_btn'); + require_once('include/menu.php'); $has_bookmarks = menu_list_count(local_channel(),'',MENU_BOOKMARK) + menu_list_count(local_channel(),'',MENU_SYSTEM|MENU_BOOKMARK); diff --git a/include/zot.php b/include/zot.php index f6816ee7c..767abae38 100644 --- a/include/zot.php +++ b/include/zot.php @@ -490,7 +490,7 @@ function zot_refresh($them, $channel = null, $force = false) { // Send a clone sync packet and a permissions update if permissions have changed - $new_connection = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and abook_self = 0 order by abook_created desc limit 1", + $new_connection = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and abook_self = 0 order by abook_created desc limit 1", dbesc($x['hash']), intval($channel['channel_id']) ); @@ -1532,6 +1532,7 @@ function allowed_public_recips($msg) { function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $request = false) { $result = array(); + require_once('include/DReport.php'); $result['site'] = z_root(); @@ -1546,16 +1547,22 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ foreach($deliveries as $d) { $local_public = $public; + + $DR = new DReport(z_root(),$sender['hash'],$d['hash'],$arr['mid']); + $r = q("select * from channel where channel_hash = '%s' limit 1", dbesc($d['hash']) ); if(! $r) { - $result[] = array($d['hash'], 'recipients not found'); + $DR->update('recipient not found'); + $result[] = $DR->get(); continue; } $channel = $r[0]; + $DR->addto_recipient($channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>'); + // allow public postings to the sys channel regardless of permissions, but not // for comments travelling upstream. Wait and catch them on the way down. @@ -1591,7 +1598,8 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $local_public)) { logger("permission denied for delivery to channel {$channel['channel_id']} {$channel['channel_address']}"); - $result[] = array($d['hash'],'permission denied',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('permission denied'); + $result[] = $DR->get(); continue; } @@ -1608,7 +1616,8 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ intval($channel['channel_id']) ); if(! $r) { - $result[] = array($d['hash'],'comment parent not found',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('comment parent not found'); + $result[] = $DR->get(); // We don't seem to have a copy of this conversation or at least the parent // - so request a copy of the entire conversation to date. @@ -1663,7 +1672,8 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ if($last_hop && $last_hop != $sender['hash']) { logger('comment route mismatch: parent route = ' . $r[0]['route'] . ' expected = ' . $current_route, LOGGER_DEBUG); logger('comment route mismatch: parent msg = ' . $r[0]['id'],LOGGER_DEBUG); - $result[] = array($d['hash'],'comment route mismatch',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('comment route mismatch'); + $result[] = $DR->get(); continue; } @@ -1692,12 +1702,14 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ $arr['uid'] = $channel['channel_id']; $item_id = delete_imported_item($sender,$arr,$channel['channel_id'],$relay); - $result[] = array($d['hash'],(($item_id) ? 'deleted' : 'delete_failed'),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update(($item_id) ? 'deleted' : 'delete_failed'); + $result[] = $DR->get(); if($relay && $item_id) { logger('process_delivery: invoking relay'); proc_run('php','include/notifier.php','relay',intval($item_id)); - $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('relayed'); + $result[] = $DR->get(); } continue; @@ -1713,7 +1725,9 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ if(intval($r[0]['item_deleted'])) { // It was deleted locally. - $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('update ignored'); + $result[] = $DR->get(); + continue; } // Maybe it has been edited? @@ -1721,17 +1735,21 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ $arr['id'] = $r[0]['id']; $arr['uid'] = $channel['channel_id']; if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) { - $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('update ignored'); + $result[] = $DR->get(); } else { update_imported_item($sender,$arr,$r[0],$channel['channel_id']); - $result[] = array($d['hash'],'updated',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('updated'); + $result[] = $DR->get(); if(! $relay) add_source_route($item_id,$sender['hash']); } } else { - $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('update ignored'); + $result[] = $DR->get(); + // We need this line to ensure wall-to-wall comments are relayed (by falling through to the relay bit), // and at the same time not relay any other relayable posts more than once, because to do so is very wasteful. @@ -1752,7 +1770,8 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ $item_id = 0; if(($arr['mid'] == $arr['parent_mid']) && (! post_is_importable($arr,$abook))) { - $result[] = array($d['hash'],'post ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update('post ignored'); + $result[] = $DR->get(); } else { $item_result = item_store($arr); @@ -1764,14 +1783,16 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ if(! $relay) add_source_route($item_id,$sender['hash']); } - $result[] = array($d['hash'],(($item_id) ? 'posted' : 'storage failed:' . $item_result['message']),$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->update(($item_id) ? 'posted' : 'storage failed: ' . $item_result['message']); + $result[] = $DR->get(); } } if($relay && $item_id) { logger('process_delivery: invoking relay'); proc_run('php','include/notifier.php','relay',intval($item_id)); - $result[] = array($d['hash'],'relayed',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); + $DR->addto_update('relayed'); + $result[] = $DR->get(); } } @@ -2940,12 +2961,19 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { sync_menus($channel,$arr['menu']); if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) { - if(array_key_exists('channel_page_flags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) { - $arr['channel']['channel_removed'] = (($arr['channel']['channel_pageflags'] & 0x8000) ? 1 : 0); - $arr['channel']['channel_system'] = (($arr['channel']['channel_pageflags'] & 0x1000) ? 1 : 0); + + if(array_key_exists('channel_pageflags',$arr['channel']) && intval($arr['channel']['channel_pageflags'])) { + // These flags cannot be sync'd. + // remove the bits from the incoming flags. + + if($arr['channel_pageflags'] & 0x8000) + $arr['channel_pageflags'] = $arr['channel_pageflags'] - 0x8000; + if($arr['channel_pageflags'] & 0x1000) + $arr['channel_pageflags'] = $arr['channel_pageflags'] - 0x1000; + } - $disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags'); + $disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted', 'channel_system'); $clean = array(); foreach($arr['channel'] as $k => $v) { diff --git a/mod/chat.php b/mod/chat.php index 9ad58bc32..ef9089b6f 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -67,7 +67,7 @@ function chat_post(&$a) { intval(local_channel()) ); - create_sync_packet(0, array('chatroom' => $x)); + build_sync_packet(0, array('chatroom' => $x)); if($x) goaway(z_root() . '/chat/' . $channel['channel_address'] . '/' . $x[0]['cr_id']); diff --git a/view/php/default.php b/view/php/default.php index 4c8311ef0..6a9cc5517 100644 --- a/view/php/default.php +++ b/view/php/default.php @@ -14,7 +14,7 @@ <div id="page-footer"></div> <div id="pause"></div> </section> - <aside id="region_3" class="hidden-sm hidden-xs"><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></aside> + <aside id="region_3" class="hidden-sm hidden-xs hidden-md"><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></aside> </main> <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer> </body> diff --git a/view/tpl/bookmarkedchats.tpl b/view/tpl/bookmarkedchats.tpl index 7635bb826..ab4372c25 100644 --- a/view/tpl/bookmarkedchats.tpl +++ b/view/tpl/bookmarkedchats.tpl @@ -1,7 +1,7 @@ {{if $rooms}} <div class="widget"> <h3>{{$header}}</h3> -<ul class="bookmarkchat"> +<ul class="bookmarkchat nav nav-pills nav-stacked"> {{foreach $rooms as $room}} <li><a href="{{$room.xchat_url}}">{{$room.xchat_desc}}</a></li> {{/foreach}} diff --git a/view/tpl/chatroom_new.tpl b/view/tpl/chatroom_new.tpl index a559dba54..c02e55c25 100644 --- a/view/tpl/chatroom_new.tpl +++ b/view/tpl/chatroom_new.tpl @@ -2,7 +2,7 @@ <form action="chat" method="post" > {{include file="field_input.tpl" field=$name}} -<button id="dbtn-acl" class="btn btn-default btn-xs" data-toggle="modal" data-target="#aclModal" onclick="return false;" >{{$permissions}}</button> +<button id="dbtn-acl" class="btn btn-default" data-toggle="modal" data-target="#aclModal" onclick="return false;" >{{$permissions}}</button> {{$acl}} <div class="clear"></div> <br /> diff --git a/view/tpl/chatrooms.tpl b/view/tpl/chatrooms.tpl index c3dae6627..836923231 100644 --- a/view/tpl/chatrooms.tpl +++ b/view/tpl/chatrooms.tpl @@ -2,7 +2,7 @@ {{if $is_owner}} <p> -<a href="{{$baseurl}}/chat/{{$nickname}}/new">{{$newroom}}</a> +<span class="btn btn-default"><a href="{{$baseurl}}/chat/{{$nickname}}/new">{{$newroom}}</a></span> </p> {{/if}} |