[JDEV] mod_mymod.c

Rodolphe Duge de Bernonville rod at idealx.com
Mon Dec 11 04:28:42 CST 2000


> 3 - It stores the original message in the default offline storage.
> 
> The only way for the instance to do no. 3 is to send out the proper XML
> packet to jabber (it is not part of the jabber code, also not written in C
> yet and therefore can not use the default functions available, it has to
> create the proper XML packet itself).
> 
> My question is, what does that XML packet look like?
> 


Okey Dookey !
Due to xdb interface, ie xdb_set and xdb_get ... 

(it would be really interesting to add new features such as 
xdb_add, or xdb_remove, ...
or to change behaviour of xdb_file, xdb_sql for namespace like 'offline
messages' 
so you dont have to do a xdb_get to retrieve all the offline messages
for a user, add your new message and do your xdb_set !)

So, first, you must do an xdb_get to have all the message for a user
(if you dont do that you will destroy the old messages)

<xdb type='get' to='stress1 at grosquick/jabber:x:offline'
from='your_instance_name' />

you have an xdb result : 


<xdb type='result' to='your_instance_name'
from='stress1 at grosquick/jabber:x:offline'>
<offline xmlns='jabber:x:offline'>
<message to='stress1 at grosquick' from='stress0 at grosquick/stress0'>
	<x xmlns='jabber:x:delay' stamp='20001211T10:00:20'/>
	<body>OFFLINE1</body><priority>0</priority>
</message>
</offline>
</xdb>


just add your new message to this xmlnode : 

<xdb type='set' to='stress1 at grosquick/jabber:x:offline'
from='your_instance_name' id='15'>
<offline xmlns='jabber:x:offline'>
	<message to='stress1 at grosquick' from='stress0 at grosquick/stress0'>	
	<body>OFFLINE1</body><x xmlns='jabber:x:delay'
stamp='20001211T10:00:20'/>
	</message>

	<message to='stress1 at grosquick' from='stress0 at grosquick/stress0'>
	<body>OFFLINE2</body><x xmlns='jabber:x:delay'
stamp='20001211T10:00:20'/>
	</message>
</offline>
</xdb>

and send it to jabberd 
You should receive a xdb type='result'




More information about the JDev mailing list