]> git.mxchange.org Git - friendica-addons.git/commitdiff
facebook comment notifications
authorfriendica <info@friendica.com>
Sat, 17 Mar 2012 08:21:38 +0000 (01:21 -0700)
committerfriendica <info@friendica.com>
Sat, 17 Mar 2012 08:21:38 +0000 (01:21 -0700)
adult_smile.tgz
facebook.tgz
facebook/facebook.php

index 59d7437cff70b489c78be6cfa9650e47cf2d99ea..67e2a31ef81ce94d43c433106ac65c3960da4a43 100644 (file)
Binary files a/adult_smile.tgz and b/adult_smile.tgz differ
index 3039b11d01af983d5daaf6d07a0009885626ff91..783425cedb897604f662a7b1261b797dc0e28e49 100644 (file)
Binary files a/facebook.tgz and b/facebook.tgz differ
index b2f21b93ed291abb84d56dcb696b72fe9df76f76..4524a4865b18773b868257bcb073081347b4ec7f 100755 (executable)
@@ -1051,7 +1051,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
        $a = get_app();
 
 
-       $user = q("SELECT `nickname`, `blockwall` FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
+       $user = q("SELECT * FROM `user` WHERE `uid` = %d AND `account_expired` = 0 LIMIT 1",
                intval($uid)
        );
        if(! count($user))
@@ -1313,6 +1313,47 @@ function fb_consume_stream($uid,$j,$wall = false) {
                                $cmntdata['author-avatar'] = 'https://graph.facebook.com/' . $cmnt->from->id . '/picture';
                                $cmntdata['body'] = $cmnt->message;
                                $item = item_store($cmntdata);                  
+                               
+                               $myconv = q("SELECT `author-link`, `author-avatar`, `parent` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 ",
+                                       dbesc($orig_post['uri']),
+                                       intval($uid)
+                               );
+
+                               if(count($myconv)) {
+                                       $importer_url = $a->get_baseurl() . '/profile/' . $user[0]['nickname'];
+
+                                       foreach($myconv as $conv) {
+
+                                               // now if we find a match, it means we're in this conversation
+       
+                                               if(! link_compare($conv['author-link'],$importer_url))
+                                                       continue;
+
+                                               require_once('include/enotify.php');
+                                                               
+                                               $conv_parent = $conv['parent'];
+
+                                               notification(array(
+                                                       'type'         => NOTIFY_COMMENT,
+                                                       'notify_flags' => $user[0]['notify-flags'],
+                                                       'language'     => $user[0]['language'],
+                                                       'to_name'      => $user[0]['username'],
+                                                       'to_email'     => $user[0]['email'],
+                                                       'uid'          => $user[0]['uid'],
+                                                       'item'         => $cmntdata,
+                                                       'link'             => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $item,
+                                                       'source_name'  => $cmntdata['author-name'],
+                                                       'source_link'  => $cmntdata['author-link'],
+                                                       'source_photo' => $cmntdata['author-avatar'],
+                                                       'verb'         => ACTIVITY_POST,
+                                                       'otype'        => 'item',
+                                                       'parent'       => $conv_parent,
+                                               ));
+
+                                               // only send one notification
+                                               break;
+                                       }
+                               }
                        }
                }
        }