How to send extra parameters in jaxl xmpp ejabberd?

123 views Asked by At

I want to send some extra parameters to xmpp server. but not getting those extra parameters in msg. using https://github.com/jaxl/JAXL , https://www.ejabberd.im/

I'm trying with this method which is inside jaxl.php.

public function send_msg($to,$body,$sender_id,$id,$xmpp_msg_attribute,$thread=null, $subject=null) {
    $msg = new XMPPMsg(
        array(
            'id'=>$id,
            'sender_id'=>$sender_id,
            'type'=>'normal', 
            'to'=>$to, 
            'from'=>$this->full_jid->to_string(),
            'attributes'=> 'extra information',
        ), 
        $body,
        $thread,
        $subject
    );
    $this->send($msg);
}

but output sending without extra parameters:

<message xml:lang='en'
         to='[email protected]'
         from='[email protected]/jaxl#3090b93066351b9a90ebad79bb208745'
         id='5b6137010b0bc'
         xmlns='jabber:client'>
  <body><p>check me</p></body>
</message>

I didn't found attributes , sender_id . i also tried changing attributes -> attrs.

source http://jaxl.readthedocs.io/en/latest/users/xml_objects.html#xmppstanza

1

There are 1 answers

2
Badlop On BEST ANSWER

The Message and Body elements are already defined by XMPP protocols, so you can't add attributes to them.

But you can add new elements, for example a client can send this, and will be received by the destination:

<message id='46:941386'
    xml:lang='es'
    type='chat'
    to='user2@localhost'>
  <body>hola</body>
  <xxx aa='asd' bb='qwe'/>
</message>