From 7ef0ddccbcefc7919ef75ba5cf6a64dd53045f83 Mon Sep 17 00:00:00 2001 From: SikiFn Date: Wed, 21 May 2014 03:20:05 -0700 Subject: [PATCH] Add Send vCard In Broadcast Functionality --- src/php/whatsprot.class.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index c5e49ebc..4c1c372a 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -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.