44 char cttl[15], cstamp[18];
50 ret = storage_get(pkt->
sm->
st,
"queue",
jid_user(sess->
jid), NULL, &os);
51 if(ret != st_SUCCESS) {
58 o = os_iter_object(os);
60 if(os_object_get_nad(os, o,
"xml", &nad)) {
79 if(stamp + ttl <= time(NULL)) {
91 }
while(os_iter_next(os));
117 for(scan = user->
sessions; scan != NULL; scan = scan->
next) {
141 ret = storage_count(user->
sm->
st,
"queue",
jid_user(user->
jid), NULL, &queuesize);
143 log_debug(
ZONE,
"storage_count ret is %i queue size is %i", ret, queuesize);
168 o = os_object_new(os);
170 os_object_put(o,
"xml", pkt->
nad, os_type_NAD);
225 char cttl[15], cstamp[18];
231 if(storage_get(mi->
mod->
mm->
sm->
st,
"queue",
jid_user(jid), NULL, &os) == st_SUCCESS) {
232 if(os_iter_first(os))
234 o = os_iter_object(os);
236 if(os_object_get_nad(os, o,
"xml", &nad)) {
255 if(stamp + ttl <= time(NULL)) {
267 }
while(os_iter_next(os));
272 storage_delete(mi->
sm->
st,
"queue",
jid_user(jid), NULL);
283 const char *configval;
286 if(mod->
init)
return 0;
291 if (configval != NULL)
295 if (configval != NULL)
299 if (configval != NULL)
pkt_t pkt_error(pkt_t pkt, int err)
user_t user
user this session belongs to
pkt_type_t type
packet type
jid_t jid
session jid (user@host/res)
data structures and prototypes for the session manager
int pri
current priority of this session
const char * jid_user(jid_t jid)
expand and return the user
const char * jid_full(jid_t jid)
expand and return the full
single instance of a module in a chain
int nad_find_elem(nad_t nad, int elem, int ns, const char *name, int depth)
locate the next elem at a given depth with an optional matching name
void nad_append_cdata(nad_t nad, const char *cdata, int len, int depth)
append new cdata to the last elem
static void _offline_user_delete(mod_instance_t mi, jid_t jid)
config_t config
config context
int init
number of times the module intialiser has been called
int nad_add_namespace(nad_t nad, const char *uri, const char *prefix)
bring a new namespace into scope
static mod_ret_t _offline_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt)
pkt_t pkt_dup(pkt_t pkt, const char *to, const char *from)
duplicate pkt, replacing addresses
int j_atoi(const char *a, int def)
int nad_append_elem(nad_t nad, int ns, const char *name, int depth)
create a new elem on the list
nad_t nad_copy(nad_t nad)
copy a nad
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
sess_t next
next session (in a list of sessions)
pkt_t pkt_new(sm_t sm, nad_t nad)
sess_t top
top priority session
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 * private
module private data
packet summary data wrapper
storage_t st
storage subsystem
nad_t nad
nad of the entire packet
mod_ret_t(* in_sess)(mod_instance_t mi, sess_t sess, pkt_t pkt)
in-sess handler
void pkt_router(pkt_t pkt)
void feature_register(sm_t sm, const char *feature)
register a feature
void(* user_delete)(mod_instance_t mi, jid_t jid)
user-delete handler
packet was unhandled, should be passed to the next module
#define stanza_err_ITEM_NOT_FOUND
packet was handled (and freed)
There is one instance of this struct per user who is logged in to this c2s instance.
time_t datetime_in(char *date)
void(* free)(module_t mod)
called when module is freed
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
int available
true if this session is available
mod_ret_t(* pkt_user)(mod_instance_t mi, user_t user, pkt_t pkt)
pkt-user handler
void pkt_delay(pkt_t pkt, time_t t, const char *from)
add an x:delay stamp
jid_t jid
user jid (user@host)
static mod_ret_t _offline_pkt_user(mod_instance_t mi, user_t user, pkt_t pkt)
const char * config_get_one(config_t c, const char *key, int num)
get config value n for this key
int nad_find_attr(nad_t nad, int elem, int ns, const char *name, const char *val)
get a matching attr on this elem, both name and optional val
static void _offline_free(module_t mod)
struct _mod_offline_st * mod_offline_t
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_SERVICE_UNAVAILABLE
#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