Kunal Kerkar bio photo

Kunal Kerkar

I throw caution to the wind, dance terribly, live in Delhi, believe in cynical kinda love and spend time watching the moonlit sky!

Twitter Google+ Github Stackoverflow

About stanzas' and origins' (Prosody)

11 Jun 2011 - Manipal

Here is a structure of the stanza property of an event,

stanza =  {name = "message";  
attr = {  from = "...";  to = "..."; };  };

A basic event I’m using to test my script has a stanza and a origin property. The origin property looks like this.

origin =  { ip = "...";  
    send = function(stanza) 

We must now define the stanza property, doing it manually would require you to set the metatables manually too. So heres an easy way of doing it. Use the stanza util module.

st = require "util.stanza";
event.stanza = st.stanza("message", {