Skip to content

Commit

Permalink
Merge pull request #738 from SikiFn/patch-3
Browse files Browse the repository at this point in the history
Add Send vCard In Broadcast Functionality
  • Loading branch information
shirioko committed May 22, 2014
2 parents bdee064 + 7ef0ddc commit 6bd271e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/php/whatsprot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,29 @@ public function sendVcard($to, $name, $vCard)
$mediaNode = new ProtocolNode("media", $mediaAttribs, array($vCardNode), "");
$this->sendMessageNode($to, $mediaNode);
}

/**
* Send a vCard to the user/group as Broadcast.
*
* @param $targets
* Array of recipients to send.
* @param $name
* The vCard contact name.
* @param $vCard
* The contact vCard to send.
*/
public function sendBroadcastVcard($targets, $name, $vCard)
{
$vCardAttribs = array();
$vCardAttribs['name'] = $name;
$vCardNode = new ProtocolNode("vcard", $vCardAttribs, null, $vCard);

$mediaAttribs = array();
$mediaAttribs["type"] = "vcard";

$mediaNode = new ProtocolNode("media", $mediaAttribs, array($vCardNode), "");
$this->sendBroadcast($targets, $mediaNode, "media");
}

/**
* Sets the bind of the new message.
Expand Down

0 comments on commit 6bd271e

Please sign in to comment.