]> git.mxchange.org Git - friendica.git/blobdiff - mod/ping.php
Revert the rename of <groups>
[friendica.git] / mod / ping.php
index e87ed985534bd0eaeccfc0a482857dd53f2ffc90..a7a2755c5ed1712fbba664bf81dc56850fb74472 100644 (file)
@@ -33,6 +33,7 @@ function ping_init(&$a) {
 
                $home = 0;
                $network = 0;
+               $network_group = array();
 
                $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`,
                                `item`.`contact-id`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`,
@@ -84,6 +85,22 @@ function ping_init(&$a) {
                        }
                }
 
+               if ( $network )
+               {
+                       # Find out how unseen network posts are spread across groups
+                       $sql = "SELECT g.id, g.name, count(i.id) count " .
+                               "FROM `group` g, group_member gm, item i " .
+                               "WHERE g.uid = %d " .
+                               "AND i.uid = %d " .
+                               "AND i.unseen AND i.visible " .
+                               "AND NOT i.deleted " .
+                               "AND i.`contact-id` = gm.`contact-id` " .
+                               "AND gm.gid = g.id GROUP BY g.id";
+                       #echo '<SQL id="' . intval(local_user()) . '">' . $sql . '</SQL>';
+                       $network_group = q($sql, intval(local_user()), intval(local_user()));
+                       #echo '<COUNT R="' . count($network_group) . '"/>';
+               }
+
                $intros1 = q("SELECT  `intro`.`id`, `intro`.`datetime`,
                        `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo`
                        FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id`
@@ -173,7 +190,7 @@ function ping_init(&$a) {
                 *              'message' => notification message. "{0}" will be replaced by subject name
                 **/
                function xmlize($n){
-                       $n['photo'] = proxy_url($n['photo']);
+                       $n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO);
 
                        $n['message'] = html_entity_decode($n['message'], ENT_COMPAT | ENT_HTML401, "UTF-8");
                        $n['name'] = html_entity_decode($n['name'], ENT_COMPAT | ENT_HTML401, "UTF-8");
@@ -202,6 +219,13 @@ function ping_init(&$a) {
                                <net>$network</net>
                                <home>$home</home>\r\n";
                if ($register!=0) echo "<register>$register</register>";
+               if ( count($network_group) ) {
+                       echo '<groups>';
+                       foreach ($network_group as $it) {
+                               echo '<group id="' . $it['id'] . '">' . $it['count'] . "</group>";
+                       }
+                       echo "</groups>";
+               }
 
                echo "<all-events>$all_events</all-events>
                        <all-events-today>$all_events_today</all-events-today>