コード例 #1
0
ファイル: friends.model.php プロジェクト: hcopr/Hubbub
	function friend_request($toEntity, $msgtype = 'friend_request')
	{
    $fr = new HubbubMessage($msgtype);
    $fr->to($toEntity->ds);
    $fr->from(object('user')->entity);
    $res = $fr->sendToUrl($toEntity->ds['server']);
		return($res);
	}
コード例 #2
0
ファイル: api.model.php プロジェクト: hcopr/Hubbub
 function pollFeed($serverObj, $time)
 {
   $pollMsg = new HubbubMessage('feed_poll');
   $pollMsg->author(HubbubServer::localEntity());
   $pollMsg->data['last'] = $time;
   $pollMsg->sendToUrl($serverObj->ds['s_url']);
   return($pollMsg->responseData);
 }
コード例 #3
0
ファイル: test.message.php プロジェクト: hcopr/Hubbub
  tlog($post->data['deleted'] == 'yes', 'Author: "deleted" property set', 'OK', 'fail');  
  tlog($post->isDeleted, '"deleted" internal property set', 'OK', 'fail');  
	$streamPosts1 = $this->msg->getStream($ne2->key());
	$wallPosts1 = $this->msg->getPostList($ne1->key());
  $postFound9 = -1; $postFound10 = -1;
  foreach($streamPosts1['list'] as $pds)
    if($pds['m_id'] == $post->data['msgid']) $postFound9 = $pds['m_id']; 
  tlog($postFound9 == -1, 'Message gone from author stream', 'OK', 'fail (#'.$postFound9.')');
	foreach($wallPosts1['list'] as $pds)
	  if($pds['m_id'] == $post->data['msgid']) $postFound10 = $pds['m_id']; 
	tlog($postFound10 == -1, 'Message gone from owner profile', 'OK', 'fail ('.$postFound10.')');  
  
  // next, we'll try an invalid update where the author has suddenly changed
  $post->data['text'] = 'This update should not have happened.';
  $post->author($ne1->ds);
  $post->sendToUrl($ne1->ds['server']);
  tlog($post->responseData['result'] != 'OK', 'Rejection policy', 'OK ('.$post->responseData['reason'].')', 'fail');

  tsection_end();
?>










コード例 #4
0
ファイル: hubbub2.php プロジェクト: hcopr/Hubbub
 function msg_trust_sendkey1()
 {
     // make a trust_sendkey1 message
     $msg = new HubbubMessage('trust_sendkey1');
     $msg->to($this->entity());
     $msg->data['author'] = $this->localEntity();
     $this->save();
     // make new key if there is none
     $this->ds['s_key_in'] = getDefault($this->ds['s_key_in'], randomHashId());
     if ($this->ds['s_url'] != '') {
         DB_UpdateField('servers', $this->ds['s_key'], 's_key_in', $this->ds['s_key_in']);
     }
     $msg->data['mykey'] = $this->ds['s_key_in'];
     // we need to save at this point because the other server will try to make a trust_sendkey2-request in the meantime
     // send message to other server
     $responseData = $msg->sendToUrl($this->ds['s_url']);
     if ($responseData['result'] == 'OK') {
         $this->ds['s_status'] = 'OK';
         $ret = result_ok();
     } else {
         $this->ds['s_status'] = 'fail';
         $this->ds['s_key_in'] = '';
         logError('notrace', '[OUT] trust_sendkey1 failed, server ' . $this->ds['s_url'] . ' says: ' . getDefault($responseData['reason'], $responseData['result']));
         $ret = result_fail('trust_sendkey1 failed: ' . getDefault($responseData['reason'], $responseData['result']));
     }
     return $ret;
 }