[JDEV] setting a user's vcard from within a component

Stefan Strigler steve at zeank.in-berlin.de
Tue Nov 18 04:24:19 CST 2003


Hello,

I'm trying to develop a module for the wcs component which should enable
a user to set his/her vcard. For this I am creating an iq packet like
this:

  iq = xmlnode_new_tag("iq");
  xmlnode_put_attrib(iq,"type","set");

  vcard = xmlnode_insert_tag(iq,"vcard");
  xmlnode_put_attrib(vcard,"xmlns", NS_VCARD);

  // just one attrib for testing
  if ((fn = xmlnode_get_attrib(a->r->body,"FN")) != NULL) {
    xmlnode fnnode = xmlnode_insert_tag(vcard,"FN");
    xmlnode_insert_cdata(fnnode,fn,-1);
  }

So a generated packet looks like this:

 <iq type='set'><vcard xmlns='vcard-temp'><FN>bruno</FN></vcard></iq>

This one gives my an error (to/from missing):

Tue Nov 18 11:10:31 2003  log.c:116 <log type='warn'
from='-internal'>Packet Delivery Failed, invalid packet, dropping &lt;iq
type=&apos;set&apos; from=&apos;wcs&apos;&gt;&lt;vcard
xmlns=&apos;vcard-temp&apos;&gt;&lt;FN&gt;bruno&lt;/FN&gt;&lt;/vcard&gt;&lt;/iq&gt;</log>
Tue Nov 18 11:10:31 2003  deliver.c:474 DELIVER 3:-internal <log
type='warn' from='-internal'>Packet Delivery Failed, invalid packet,
dropping &lt;iq type=&apos;set&apos; from=&apos;wcs&apos;&gt;&lt;vcard
xmlns=&apos;vcard-temp&apos;&gt;&lt;FN&gt;bruno&lt;/FN&gt;&lt;/vcard&gt;&lt;/iq&gt;</log>
Tue Nov 18 11:10:31 2003  deliver.c:678 delivering to instance 'elogger'
20031118T10:10:31: [warn] (-internal): Packet Delivery Failed, invalid
packet, dropping <iq type='set' from='wcs'><vcard
xmlns='vcard-temp'><FN>bruno</FN></vcard></iq>

So I tried to set to/from manually, then the iq packet looks like

<iq type='set' to='bruno at jabber.zeank.in-berlin.de/wcs'
from='bruno at jabber.zeank.in-berlin.de/wcs'><vcard
xmlns='vcard-temp'><FN>bruno</FN></vcard></iq>

Result is:

Tue Nov 18 11:15:18 2003  deliver.c:474 DELIVER
1:jabber.zeank.in-berlin.de <iq type='set'
to='bruno at jabber.zeank.in-berlin.de/wcs'
from='bruno at jabber.zeank.in-berlin.de/wcs'><vcard
xmlns='vcard-temp'><FN>bruno</FN></vcard></iq>
Tue Nov 18 11:15:18 2003  deliver.c:678 delivering to instance
'sessions'
Tue Nov 18 11:15:18 2003  deliver.c:94 (80CFAB0)incoming packet <iq
type='set' to='bruno at jabber.zeank.in-berlin.de/wcs'
from='bruno at jabber.zeank.in-berlin.de/wcs'><vcard
xmlns='vcard-temp'><FN>bruno</FN></vcard></iq>
Tue Nov 18 11:15:18 2003  users.c:143
js_user(bruno at jabber.zeank.in-berlin.de,8112928)
Tue Nov 18 11:15:18 2003  deliver.c:55 delivering locally to
bruno at jabber.zeank.in-berlin.de/wcs
Tue Nov 18 11:15:18 2003  modules.c:135 mapi_call 3
Tue Nov 18 11:15:18 2003  modules.c:158 MAPI 80D4DB8
Tue Nov 18 11:15:18 2003  modules.c:158 MAPI 80D5198
Tue Nov 18 11:15:18 2003  deliver.c:474 DELIVER
2:jabber.zeank.in-berlin.de <xdb type='get'
to='bruno at jabber.zeank.in-berlin.de' from='sessions'
ns='jabber:iq:filter' id='9'/>
Tue Nov 18 11:15:18 2003  deliver.c:678 delivering to instance 'xdb'
Tue Nov 18 11:15:18 2003  xdb_file.c:172 handling xdb request <xdb
type='get' to='bruno at jabber.zeank.in-berlin.de' from='sessions'
ns='jabber:iq:filter' id='9'/>
Tue Nov 18 11:15:18 2003  xdb_file.c:109 loading
./spool/jabber.zeank.in-berlin.de/bruno.xml
Tue Nov 18 11:15:18 2003  xdb_file.c:129 caching
./spool/jabber.zeank.in-berlin.de/bruno.xml
Tue Nov 18 11:15:18 2003  deliver.c:474 DELIVER 1:sessions <xdb
type='result' to='sessions' from='bruno at jabber.zeank.in-berlin.de'
ns='jabber:iq:filter' id='9'/>
Tue Nov 18 11:15:18 2003  deliver.c:678 delivering to instance
'sessions'
Tue Nov 18 11:15:18 2003  xdb.c:52 xdb_results checking xdb packet <xdb
type='result' to='sessions' from='bruno at jabber.zeank.in-berlin.de'
ns='jabber:iq:filter' id='9'/>
Tue Nov 18 11:15:18 2003  xdb_file.c:272 decaching
./spool/jabber.zeank.in-berlin.de/bruno.xml
Tue Nov 18 11:15:18 2003  mod_filter.c:364 Looking at rules: <query
xmlns='jabber:iq:filter'/>
Tue Nov 18 11:15:18 2003  modules.c:158 MAPI 80D5698
Tue Nov 18 11:15:18 2003  modules.c:175 mapi_call returning unhandled
Tue Nov 18 11:15:18 2003  deliver.c:474 DELIVER 4:http <route
to='8112718 at http' from='wcs' type='result'><http status='200 Ok'><head
Content-type='text/html'/><body>&lt;script&gt;var jabber=new
Object();&lt;/script&gt;</body></http></route>Tue Nov 18 11:15:18 2003 
deliver.c:678 delivering to instance 'http'
Tue Nov 18 11:15:18 2003  http_in.c:286 handling http response: <route
to='8112718 at http' from='wcs' type='result'><http status='200 Ok'><head
Content-type='text/html'/><body>&lt;script&gt;var jabber=new
Object();&lt;/script&gt;</body></http></route>

[ ... http debugging output snipped ... ]

Tue Nov 18 11:15:18 2003  mio.c:366 freed MIO socket
Tue Nov 18 11:15:18 2003  mtq 8124400 entering from pth
Tue Nov 18 11:15:18 2003  mtq 8124400 queue call 81C7EA0
Tue Nov 18 11:15:18 2003  sessions.c:301 THREAD:SESSION:TO received data
from bruno at jabber.zeank.in-berlin.de/wcs!
Tue Nov 18 11:15:18 2003  modules.c:135 mapi_call 0
Tue Nov 18 11:15:18 2003  modules.c:158 MAPI 81C7240
Tue Nov 18 11:15:18 2003  deliver.c:257
deliver(to[bruno at jabber.zeank.in-berlin.de/wcs],from[bruno at jabber.zeank.in-berlin.de/wcs],type[4],packet[<iq type='error' to='bruno at jabber.zeank.in-berlin.de/wcs' from='bruno at jabber.zeank.in-berlin.de/wcs'><vcard xmlns='vcard-temp'><FN>bruno</FN></vcard><error code='405'>Not Allowed</error></iq>])
Tue Nov 18 11:15:18 2003  users.c:143
js_user(bruno at jabber.zeank.in-berlin.de,8112928)
Tue Nov 18 11:15:18 2003  deliver.c:55 delivering locally to
bruno at jabber.zeank.in-berlin.de/wcs



Same result if I only set one of to or from. Is there any way to set a
user's vcard from within a component?

Thanks in advance,

Steve




More information about the JDev mailing list