30 #define uri_PRIVATE "jabber:iq:private" 35 int ns, elem, target, targetns;
57 while(target < pkt->nad->
ecur)
94 if(os_iter_first(os)) {
95 o = os_iter_object(os);
96 if(os_object_get_nad(os, o,
"xml", &nad)) {
117 log_debug(
ZONE,
"storage_get succeeded, but couldn't make packet, faking st_NOTFOUND");
143 o = os_object_new(os);
146 os_object_put(o,
"ns", filter, os_type_STRING);
147 os_object_put(o,
"xml", pkt->
nad, os_type_NAD);
177 if(result->
from != NULL) {
198 storage_delete(mi->
sm->
st,
"private",
jid_user(jid), NULL);
209 if (mod->
init)
return 0;
user_t user
user this session belongs to
pkt_type_t type
packet type
int sm_register_ns(sm_t sm, const char *uri)
register a new global ns
jid_t jid
session jid (user@host/res)
struct nad_elem_st * elems
data structures and prototypes for the session manager
void sm_unregister_ns(sm_t sm, const char *uri)
unregister a global ns
static void _iq_private_user_delete(mod_instance_t mi, jid_t jid)
const char * jid_user(jid_t jid)
expand and return the user
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
const char * jid_full(jid_t jid)
expand and return the full
pkt_t pkt_tofrom(pkt_t pkt)
swap a packet's to and from attributes
single instance of a module in a chain
void nad_set_attr(nad_t nad, unsigned int elem, int ns, const char *name, const char *val, int vallen)
create, update, or zap any matching attr on this elem
int init
number of times the module intialiser has been called
void ** module_data
per-session module data
#define stanza_err_FEATURE_NOT_IMPLEMENTED
pkt_t pkt_dup(pkt_t pkt, const char *to, const char *from)
duplicate pkt, replacing addresses
void pkt_id_new(pkt_t pkt)
create an id value for new iq packets
nad_t nad_copy(nad_t nad)
copy a nad
pool_t p
memory pool this session is allocated off
sess_t next
next session (in a list of sessions)
pkt_t pkt_new(sm_t sm, nad_t nad)
void pool_cleanup(pool_t p, pool_cleanup_t f, void *arg)
public cleanup utils, insert in a way that they are run FIFO, before mem frees
mod_ret_t(* in_sess)(mod_instance_t mi, sess_t sess, pkt_t pkt)
in-sess handler
sess_t sessions
list of action sessions
module_t mod
module that this is an instance of
jid_t from
packet addressing (not used for routing)
void feature_unregister(sm_t sm, const char *feature)
unregister feature
packet summary data wrapper
char * pstrdupx(pool_t p, const char *src, int len)
use given size
#define NAD_NURI_L(N, NS)
storage_t st
storage subsystem
nad_t nad
nad of the entire packet
void jid_free(jid_t jid)
free a jid
void xhash_put(xht h, const char *key, void *val)
#define stanza_err_BAD_REQUEST
void pkt_id(pkt_t src, pkt_t dest)
convenience - copy the packet id from src to dest
void feature_register(sm_t sm, const char *feature)
register a feature
packet was unhandled, should be passed to the next module
static void _iq_private_free(module_t mod)
packet was handled (and freed)
There is one instance of this struct per user who is logged in to this c2s instance.
int jid_compare_user(jid_t a, jid_t b)
compare the user portion of two jids
int nad_find_elem(nad_t nad, unsigned int elem, int ns, const char *name, int depth)
locate the next elem at a given depth with an optional matching name
void(* user_delete)(mod_instance_t mi, jid_t jid)
user-delete handler
void * xhash_get(xht h, const char *key)
static mod_ret_t _iq_private_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt)
void(* free)(module_t mod)
called when module is freed
pkt_t pkt_create(sm_t sm, const char *elem, const char *type, const char *to, const char *from)
mod_ret_t
module return values
#define stanza_err_INTERNAL_SERVER_ERROR
void pkt_sess(pkt_t pkt, sess_t sess)
int nad_find_scoped_namespace(nad_t nad, const char *uri, const char *prefix)
find a namespace in scope