]> git.mxchange.org Git - friendica.git/commitdiff
We now send the participation message as well.
authorMichael <heluecht@pirati.ca>
Fri, 30 Dec 2016 22:31:21 +0000 (22:31 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 30 Dec 2016 22:31:21 +0000 (22:31 +0000)
include/delivery.php
include/diaspora.php

index f7245942a9e329c03a98f655086926884d293420..e9f426464106a8fd90474fe73ccb5054a2ca39de 100644 (file)
@@ -518,15 +518,6 @@ function delivery_run(&$argv, &$argc){
                                if (!$contact['pubkey'] && !$public_message)
                                        break;
 
-                               $unsupported_activities = array(ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
-
-                               //don't transmit activities which are not supported by diaspora
-                               foreach($unsupported_activities as $act) {
-                                       if (activity_match($target_item['verb'],$act)) {
-                                               break 2;
-                                       }
-                               }
-
                                if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
                                        // top-level retraction
                                        logger('diaspora retract: '.$loc);
index 72b953741669cb281257a22b06d56c0d701faca4..a6e6e5cf76bc4d6c770811fca463c00744614f8d 100644 (file)
@@ -3160,6 +3160,45 @@ class Diaspora {
                                "diaspora_handle" => self::my_handle($owner)));
        }
 
+       /**
+        * @brief Creates an "EventParticipation" object
+        *
+        * @param array $item The item that will be exported
+        * @param array $owner the array of the item owner
+        *
+        * @return array The data for an "EventParticipation"
+        */
+       private static function construct_attend($item, $owner) {
+
+               $p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
+                       dbesc($item["thr-parent"]));
+               if (!dbm::is_result($p))
+                       return false;
+
+               $parent = $p[0];
+
+               switch ($item['verb']) {
+                       case ACTIVITY_ATTEND:
+                               $attend_answer = 'accepted';
+                               break;
+                       case ACTIVITY_ATTENDNO:
+                               $attend_answer = 'declined';
+                               break;
+                       case ACTIVITY_ATTENDMAYBE:
+                               $attend_answer = 'tentative';
+                               break;
+                       default:
+                               logger('Unknown verb '.$item['verb'].' in item '.$item['guid']);
+                               return false;
+               }
+
+               return(array("author" => self::my_handle($owner),
+                               "guid" => $item["guid"],
+                               "parent_guid" => $parent["guid"],
+                               "status" => $attend_answer,
+                               "author_signature" => ""));
+       }
+
        /**
         * @brief Creates the object for a comment
         *
@@ -3209,7 +3248,10 @@ class Diaspora {
         */
        public static function send_followup($item,$owner,$contact,$public_batch = false) {
 
-               if($item['verb'] === ACTIVITY_LIKE) {
+               if (in_array($item['verb'], array(ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE))) {
+                       $message = self::construct_attend($item, $owner);
+                       $type = "event_participation";
+               } elseif($item['verb'] === ACTIVITY_LIKE) {
                        $message = self::construct_like($item, $owner);
                        $type = "like";
                } else {