]> git.mxchange.org Git - friendica-addons.git/blobdiff - pumpio/pumpio.php
The "id" field is now filled in the notifications. This is needed for the new condens...
[friendica-addons.git] / pumpio / pumpio.php
index 0e6c9c91c8477cebadd19a2a9c9f757bf397f518..dc4a6a420ed376c2b24d94c7ce1c2a17825222bc 100644 (file)
@@ -68,8 +68,10 @@ function pumpio_registerclient(&$a, $host) {
        if ($application_name == "")
                $application_name = $a->get_hostname();
 
+       $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
+
        $params["type"] = "client_associate";
-       $params["contacts"] = $a->config['admin_email'];
+       $params["contacts"] = $adminlist[0];
        $params["application_type"] = "native";
        $params["application_name"] = $application_name;
        $params["logo_url"] = $a->get_baseurl()."/images/friendica-256.png";
@@ -302,6 +304,7 @@ function pumpio_settings_post(&$a,&$b) {
                        set_pconfig(local_user(),'pumpio','mirror',false);
                        set_pconfig(local_user(),'pumpio','post_by_default',false);
                        set_pconfig(local_user(),'pumpio','lastdate', 0);
+                       set_pconfig(local_user(),'pumpio','last_id', '');
                } else {
                        // filtering the username if it is filled wrong
                        $user = $_POST['pumpio_user'];
@@ -433,9 +436,6 @@ function pumpio_send(&$a,&$b) {
 
                $title = trim($b['title']);
 
-               //if ($title != '')
-               //      $title = "<h4>".$title."</h4>";
-
                $content = bbcode($b['body'], false, false, 4);
 
                // Enhance the way, videos are displayed
@@ -502,6 +502,10 @@ function pumpio_send(&$a,&$b) {
                $success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
 
                if($success) {
+
+                       if ($user->generator->displayName)
+                               set_pconfig($b["uid"], "pumpio", "application_name", $user->generator->displayName);
+
                        $post_id = $user->object->id;
                        logger('pumpio_send '.$username.': success '.$post_id);
                        if($post_id AND $iscomment) {
@@ -672,8 +676,12 @@ function pumpio_fetchtimeline(&$a, $uid) {
        $hostname = get_pconfig($uid, 'pumpio','host');
        $username = get_pconfig($uid, "pumpio", "user");
 
-       $application_name  = get_config('pumpio', 'application_name');
-
+       //  get the application name for the pump.io app
+       //  1st try personal config, then system config and fallback to the
+       //  hostname of the node if neither one is set.
+       $application_name  = get_pconfig( $uid, 'pumpio', 'application_name');
+       if ($application_name == "")
+               $application_name  = get_config('pumpio', 'application_name');
        if ($application_name == "")
                $application_name = $a->get_hostname();
 
@@ -1228,6 +1236,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                        $postarray['body'] = "[share author='".$post->object->author->displayName.
                                        "' profile='".$post->object->author->url.
                                        "' avatar='".$post->object->author->image->url.
+                                       "' posted='".datetime_convert('UTC','UTC',$post->object->created).
                                        "' link='".$post->links->self->href."']".$postarray['body']."[/share]";
                } else {
                        // Let shares look like wall-to-wall posts
@@ -1241,6 +1250,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
                return false;
 
        $top_item = item_store($postarray);
+       $postarray["id"] = $top_item;
 
        if (($top_item == 0) AND ($post->verb == "update")) {
                $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s' , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",