function Post($p) { // posts and comments have the same basic structure: author, owner and text // if the author is also the owner, we do not need to send a foreign_post message if($p['author']['_key'] == $p['owner']['_key']) { $msg = $this->makePostMessage('post', $p); $msg->broadcast(); } else { $msg = $this->makePostMessage('foreign_post', $p); WriteToFile('log/activity.log', $type.' sending: '.$msg->data['msgid'].' '.dumpArray($msg->data).chr(10)); $res = $msg->sendToOwner(); // if the post was accepted right away: if(sizeof($res['post']) > 0) { $msg->delete(); $msg = new HubbubMessage(); $msg->receive_single($res['post']); } } return($msg->ds); }