set_vcard multiple

Hello!

I'm trying to fill user vcard and I have a question

Is there any way to make structure like this:

<TEL>
<NUMBER>1234673</NUBMER>
<WORk/>
</TEL>
<TEL>
<NUMBER>4758845</NUBMER>
<WORk/>
</TEL>

I tried to use command set_vacrd2_multi, but it generates structure like this:

<TEL>
<WORk>1234673</WORK>
<WORk>4758845</WORK>
</TEL>

This format is not standart and such programs like PSI or Miranda doesn't show it.

Thanks for helping/

Maybe you can use the command

Maybe you can use the command send_stanza_c2s to send a full XMPP stanza with exactly what you want.

Another solution is to add another command to insert exactly what you want in the vcard.

Thank you for advice. But I

Thank you for advice.

But I have some problems using send_stanza_c2s

When I make command

ejabberdctl send_stanza_c2s user localhost Bahama '<message id="1" type="chat"><body>How goes?</body></message>'

There is an error Error: the command "send_stanza_c2s" requires 3 less argument.

When I tried such command

ejabberdctl send_stanza_c2s user localhost Bahama \'<message id="1" type="chat"><body>How goes?</body></message>\'

Another error: -bash: syntax error near unexpected token `<'

I want to use php script to control ejabberd server via xmlrpc module, maybe there is easier way to set user vcard?

Yes, it's difficult to escape

Yes, it's difficult to escape some characters when using the shell.

star_ wrote:

I want to use php script to control ejabberd server via xmlrpc module, maybe there is easier way to set user vcard?

If you install ejabberd_xmlrpc, you can execute the ejabberd commands using XMLRPC calls.

When I try to use XMLRPC call

When I try to use XMLRPC call with this command, there is an error too.

file_get_contents(http://localhost:4560/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error

the request for XMLRPC call

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>send_stanza_c2s</methodName>
<params>
<param>
  <value>
   <struct>
    <member>
     <name>user</name>
     <value>

      <string>admin</string>
     </value>
    </member>
    <member>
     <name>server</name>
     <value>
      <string>localhost</string>

     </value>
    </member>
    <member>
     <name>password</name>
     <value>
      <string>password</string>
     </value>
    </member>

   </struct>
  </value>
</param>
<param>
  <value>
   <struct>
    <member>
     <name>user</name>

     <value>
      <string>admin</string>
     </value>
    </member>
    <member>
     <name>host</name>
     <value>
      <string>localhost</string>

     </value>
    </member>
    <member>
     <name>resource</name>
     <value>
      <string>XMLRPC</string>
     </value>
    </member>

    <member>
     <name>stanza</name>
     <value>
      <string>&#60;iq id=&#34;v2&#34; type=&#34;set&#34;&#62;&#13;&#10;  &#60;vCard xmlns=&#34;vcard-temp&#34;&#62;&#13;&#10;    &#60;FN&#62;Peter Saint-Andre&#60;/FN&#62;&#13;&#10; &#60;/vCard&#62;&#60;/iq&#62;</string>

     </value>
    </member>
   </struct>
  </value>
</param>
</params>
</methodCall>

With other commands, such as set_vcard it works good.

I think that problem is with stanza format.
How can I fix it?

And there is an error in log

And there is an error in log file

=INFO REPORT==== 2011-08-26 22:55:42 ===
D(<0.428.0>:ejabberd_commands:314) : Executing command mod_admin_extra:send_stanza_c2s with Args=["admin",
                                                                                                  "localhost",
                                                                                                  "XMLRPC",
                                                                                                  "<iq type='set'><vCard xmlns='vcard-temp'><FN /><N><GIVEN>NAME<GIVEN /><MIDDLE /><FAMILY /></N><NICKNAME>admin</NICKNAME><BDAY /><GENDER /><ADR><HOME /><STREET /><EXTADR /><EXTADD /><LOCALITY /><REGION /><PCODE /><CTRY /><COUNTRY /></ADR><ADR><WORK /><STREET /><EXTADR /><EXTADD /><LOCALITY /><REGION /><PCODE /><CTRY /><COUNTRY /></ADR><ORG><ORGNAME /><ORGUNIT /></ORG><TITLE /><ROLE /><URL /><DESC /><TEL><NUMBER>12345</NUMBER><HOME /></TEL></vCard></iq>"]

=ERROR REPORT==== 2011-08-26 22:55:42 ===
{xmlrpc_http,153,
    {ejabberd_xmlrpc,handler,
        {'EXIT',
            {badarg,
                [{p1_fsm,send_event,2},
                 {ejabberd_xmlrpc,do_command,6},
                 {ejabberd_xmlrpc,try_do_command,6},
                 {xmlrpc_http,eval_payload,6},
                 {tcp_serv,start_session,3},
                 {proc_lib,init_p_do_apply,3}]}}}}

You must login with a Jabber

You must login with a Jabber client to the JID admin@localhost/XMLRPC and then run the command.

Is there another way? I want

Is there another way?

I want to control it using XMLRPC, so user may be not logged in.

At the first reply you wrote, that I can write my own command. Where can I find more detailed information how to do it?

Thank you.

Syndicate content