]> git.mxchange.org Git - friendica-addons.git/blobdiff - pumpio/pumpio.php
Fix formatting
[friendica-addons.git] / pumpio / pumpio.php
index 4873d73df4041d32b517e699a5663bc65d83310a..96883826521d1e31b120be2c9dfa0903297a520e 100644 (file)
@@ -5,16 +5,15 @@
  * Version: 0.2
  * Author: Michael Vogel <http://pirati.ca/profile/heluecht>
  */
-
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
 use Friendica\Model\GlobalContact;
+use Friendica\Object\Contact;
 
 require 'addon/pumpio/oauth/http.php';
 require 'addon/pumpio/oauth/oauth_client.php';
 require_once 'include/enotify.php';
-require_once "include/Photo.php";
 require_once "mod/share.php";
 
 define('PUMPIO_DEFAULT_POLL_INTERVAL', 5); // given in minutes
@@ -414,6 +413,13 @@ function pumpio_send(&$a,&$b) {
 
                if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio')))
                        return;
+
+               // Dont't post if the post doesn't belong to us.
+               // This is a check for forum postings
+               $self = dba::select('contact', array('id'), array('uid' => $b['uid'], 'self' => true), array('limit' => 1));
+               if ($b['contact-id'] != $self['id']) {
+                       return;
+               }
        }
 
        if($b['verb'] == ACTIVITY_LIKE) {
@@ -972,7 +978,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
                        "photo" => $contact->image->url, "name" => $contact->displayName,  "hide" => true,
                        "nick" => $contact->preferredUsername, "location" => $contact->location->displayName,
                        "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)));
-       $cid = get_contact($contact->url, $uid);
+       $cid = Contact::getIdForURL($contact->url, $uid);
 
        if ($no_insert)
                return($cid);
@@ -1038,8 +1044,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) {
                */
        }
 
-       if (function_exists("update_contact_avatar"))
-               update_contact_avatar($contact->image->url, $uid, $contact_id);
+       Contact::updateAvatar($contact->image->url, $uid, $contact_id);
 
        return($contact_id);
 }