]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge pull request #157 from annando/master
authortobiasd <tobias.diekershoff@gmx.net>
Sun, 20 Oct 2013 12:55:45 +0000 (05:55 -0700)
committertobiasd <tobias.diekershoff@gmx.net>
Sun, 20 Oct 2013 12:55:45 +0000 (05:55 -0700)
Bidirectional twitter sync - and some small fixes

1  2 
pumpio/pumpio.php

diff --combined pumpio/pumpio.php
index 63f403c276d842e3622e57170bf03b52a90647da,f7e01dc24f636a0ca6b75e37f7f0e7e8f46109e7..1f76c10085458c6616a1b92aef097a6a2f97a60a
@@@ -484,7 -484,7 +484,7 @@@ function pumpio_send(&$a,&$b) 
                        logger('pumpio_send '.$username.': success '.$post_id);
                        if($post_id AND $iscomment) {
                                logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']);
-                               q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d LIMIT 1",
+                               q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
                                        dbesc($post_id),
                                        intval($b['id'])
                                );
@@@ -925,7 -925,7 +925,7 @@@ function pumpio_get_contact($uid, $cont
                                        `name-date` = '%s',
                                        `uri-date` = '%s',
                                        `avatar-date` = '%s'
-                               WHERE `id` = %d LIMIT 1
+                               WHERE `id` = %d
                        ",
                dbesc($photos[0]),
                dbesc($photos[1]),
                                          `micro` = '%s',
                                          `name-date` = '%s',
                                          `uri-date` = '%s',
-                                         `avatar-date` = '%s'
-                                         WHERE `id` = %d LIMIT 1
+                                         `avatar-date` = '%s',
+                                       `name` = '%s',
+                                       `nick` = '%s'
+                                       WHERE `id` = %d
                                  ",
                        dbesc($photos[0]),
                        dbesc($photos[1]),
                        dbesc(datetime_convert()),
                        dbesc(datetime_convert()),
                        dbesc(datetime_convert()),
+                       dbesc($contact->displayName),
+                       dbesc($contact->preferredUsername),
                        intval($r[0]['id'])
                        );
                }
@@@ -1080,17 -1084,14 +1084,17 @@@ function pumpio_dopost(&$a, $client, $u
                        }
                }
  
 +              $reply = new stdClass;
                $reply->verb = "note";
                $reply->cc = $post->cc;
                $reply->to = $post->to;
 +              $reply->object = new stdClass;
                $reply->object->objectType = $post->object->inReplyTo->objectType;
                $reply->object->content = $post->object->inReplyTo->content;
                $reply->object->id = $post->object->inReplyTo->id;
                $reply->actor = $post->object->inReplyTo->author;
                $reply->url = $post->object->inReplyTo->url;
 +              $reply->generator = new stdClass;
                $reply->generator->displayName = "pumpio";
                $reply->published = $post->object->inReplyTo->published;
                $reply->received = $post->object->inReplyTo->updated;
        }
  
        if ($post->verb == "share") {
-               $postarray['body'] = "[share author='".$post->object->author->displayName.
-                                 "' profile='".$post->object->author->url.
-                                 "' avatar='".$post->object->author->image->url.
-                                 "' link='".$post->links->self->href."']".$postarray['body']."[/share]";
+               if (!intval(get_config('system','wall-to-wall_share'))) {
+                       $postarray['body'] = "[share author='".$post->object->author->displayName.
+                                       "' profile='".$post->object->author->url.
+                                       "' avatar='".$post->object->author->image->url.
+                                       "' link='".$post->links->self->href."']".$postarray['body']."[/share]";
+               } else {
+                       // Let shares look like wall-to-wall posts
+                       $postarray['author-name'] = $post->object->author->displayName;
+                       $postarray['author-link'] = $post->object->author->url;
+                       $postarray['author-avatar'] = $post->object->author->image->url;
+               }
        }
  
        if (trim($postarray['body']) == "")
@@@ -1350,7 -1358,7 +1361,7 @@@ function pumpio_queue_hook(&$a,&$b) 
                                logger('pumpio_queue: send '.$username.': success '.$post_id);
                                if($post_id AND $iscomment) {
                                        logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']);
-                                       q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d LIMIT 1",
+                                       q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
                                                dbesc($post_id),
                                                intval($z['item'])
                                        );