Exemplo n.º 1
0
 /**
  * @param  NodeInterface  $node
  * @return MediaInterface
  */
 public function createMedia(NodeInterface $node)
 {
     $media = new Vcard();
     $media->setType($node->getAttribute('type'));
     $media->setName($node->getChild('vcard')->getAttribute('name'));
     $media->setData($node->getChild('vcard')->getData());
     return $media;
 }
Exemplo n.º 2
0
 /**
  * @param  NodeInterface $node
  * @return MessageText
  */
 public function createMessage(NodeInterface $node)
 {
     $message = new MessageText();
     $message->setBody($node->getChild('body')->getData());
     $participant = $node->getAttribute('participant');
     $from = $node->getAttribute('from');
     if ($participant) {
         $message->setFrom(Identity::parseJID($participant));
         $message->setGroupId(Identity::parseJID($from));
     } else {
         $message->setFrom(Identity::parseJID($from));
     }
     $message->setId($node->getAttribute('id'));
     $dateTime = new DateTime();
     $dateTime->setTimestamp((int) $node->getAttribute('t'));
     $message->setDateTime($dateTime);
     $message->setNotify($node->getAttribute('notify'));
     $message->setType($node->getAttribute('type'));
     return $message;
 }
Exemplo n.º 3
0
 /**
  * @param  NodeInterface $node
  * @return Group[]
  */
 protected function getGroupsFromNode(NodeInterface $node)
 {
     $groupList = array();
     if ($node->getChild(0) != null) {
         foreach ($node->getChildren() as $child) {
             $groupList[] = Group::factory($child->getAttributes());
         }
     }
     return $groupList;
 }