70 if(user == NULL || user->
sessions == NULL) {
76 for(sess = user->
sessions; sess != NULL; sess = sess->
next)
99 log_debug(
ZONE,
"bounced presence, but no corresponding session anymore, dropping");
186 if(mod->
init)
return 0;
pkt_type_t type
packet type
jid_t jid
session jid (user@host/res)
data structures and prototypes for the session manager
const char * jid_user(jid_t jid)
expand and return the user
const char * jid_full(jid_t jid)
expand and return the full
jid_t jid_new(const char *id, int len)
make a new jid
single instance of a module in a chain
int init
number of times the module intialiser has been called
mod_ret_t(* in_router)(mod_instance_t mi, pkt_t pkt)
in-router handler
static void _presence_free(module_t mod)
xht users
pointers to currently loaded users (key is user@domain)
static mod_ret_t _presence_pkt_user(mod_instance_t mi, user_t user, pkt_t pkt)
presence to a user
sess_t next
next session (in a list of sessions)
void nad_set_attr(nad_t nad, int elem, int ns, const char *name, const char *val, int vallen)
create, update, or zap any matching attr on this elem
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
static mod_ret_t _presence_pkt_sm(mod_instance_t mi, pkt_t pkt)
nad_t nad
nad of the entire packet
void pres_in(user_t user, pkt_t pkt)
presence updates from a remote jid - RFC 3921bis 4.3.2.
void jid_free(jid_t jid)
free a jid
mod_ret_t(* pkt_user)(mod_instance_t mi, user_t user, pkt_t pkt)
pkt-user handler
void pkt_router(pkt_t pkt)
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
void feature_register(sm_t sm, const char *feature)
register a feature
sess_t sess_match(user_t user, const char *resource)
match a session by resource
packet was unhandled, should be passed to the next module
mod_ret_t _presence_in_router(mod_instance_t mi, pkt_t pkt)
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
void pres_error(sess_t sess, jid_t jid)
mod_ret_t(* pkt_sm)(mod_instance_t mi, pkt_t pkt)
pkt-sm handler
int available
true if this session is available
static mod_ret_t _presence_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt)
presence from the session
jid_t jid_dup(jid_t jid)
duplicate a jid
void * xhash_get(xht h, const char *key)
void(* free)(module_t mod)
called when module is freed
void pres_update(sess_t sess, pkt_t pkt)
presence updates from a session
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
void pres_deliver(sess_t sess, pkt_t pkt)
outgoing directed presence
void pkt_sess(pkt_t pkt, sess_t sess)