30 #define ACTIVE_SESSIONS_NAME "Active sessions"
125 if(svc->
name[0] !=
'\0')
187 if(svc->
name[0] !=
'\0') {
204 if(strcmp(svc->
category,
"conference") == 0)
236 int ns, qelem, elem, attr;
290 strcpy(svc->category,
"unknown");
296 strcpy(svc->type,
"unknown");
613 int items, item, jid, name, category, type, ns;
616 if(mod->
init)
return 0;
632 if(d->
name == NULL) d->
name =
"Jabber IM server";
698 strcpy(svc->
type,
"unknown");
mod_ret_t(* pkt_sm)(mod_instance_t mi, pkt_t pkt)
pkt-sm handler
#define ACTIVE_SESSIONS_NAME
pkt_type_t type
packet type
jid_t jid
session jid (user@host/res)
int nad_append_attr(nad_t nad, int ns, const char *name, const char *val)
attach new attr to the last elem
data structures and prototypes for the session manager
static void _disco_sessions_result(module_t mod, disco_t d, pkt_t pkt)
build a disco items result, active sessions
#define NAD_CDATA_L(N, E)
const char * id
component id
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
pkt_t pkt_tofrom(pkt_t pkt)
swap a packet's to and from attributes
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
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
pkt_t pkt_dup(pkt_t pkt, const char *to, const char *from)
duplicate pkt, replacing addresses
const char * category
identity
void pkt_id_new(pkt_t pkt)
create an id value for new iq packets
void mm_disco_extend(mm_t mm, pkt_t pkt)
disco extend
static mod_ret_t _disco_pkt_sm(mod_instance_t mi, pkt_t pkt)
catch responses and populate the table; respond to requests
int nad_append_elem(nad_t nad, int ns, const char *name, int depth)
create a new elem on the list
int xhash_iter_next(xht h)
static mod_ret_t _disco_in_sess(mod_instance_t mi, sess_t sess, pkt_t pkt)
legacy support for agents requests from sessions
xht sessions
pointers to all connected sessions (key is random sm id)
static pkt_t _disco_items_result(module_t mod, disco_t d)
build a disco items result, known services
static void _disco_free_walker(const char *key, int keylen, void *val, void *arg)
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
struct disco_st * disco_t
all the current disco data
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
char * pstrdupx(pool_t p, const char *src, int len)
use given size
nad_t nad
nad of the entire packet
void jid_free(jid_t jid)
free a jid
int aci_check(xht aci, const char *type, const char *name)
see if a username is in an acl
advertisement (available)
mod_ret_t(* in_sess)(mod_instance_t mi, sess_t sess, pkt_t pkt)
in-sess handler
static mod_ret_t _disco_pkt_sm_populate(mod_instance_t mi, pkt_t pkt)
catch responses and populate the table
void xhash_put(xht h, const char *key, void *val)
#define stanza_err_BAD_REQUEST
int xhash_iter_get(xht h, const char **key, int *keylen, void **val)
void pkt_id(pkt_t src, pkt_t dest)
convenience - copy the packet id from src to dest
void pkt_router(pkt_t pkt)
void xhash_zap(xht h, const char *key)
#define stanza_err_NOT_ALLOWED
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
void feature_register(sm_t sm, const char *feature)
register a feature
packet was unhandled, should be passed to the next module
#define stanza_err_ITEM_NOT_FOUND
config_elem_t config_get(config_t c, const char *key)
get the config element for this key
packet was handled (and freed)
static mod_ret_t _disco_pkt_router(mod_instance_t mi, pkt_t pkt)
update the table for component changes
There is one instance of this struct per user who is logged in to this c2s instance.
static mod_ret_t _disco_in_sess_result(mod_instance_t mi, sess_t sess, pkt_t pkt)
respond to user quering its JID
static void _disco_unify_walker(const char *key, int keylen, void *val, void *arg)
put val into arg
int xhash_iter_first(xht h)
iteration
struct service_st * service_t
holder for a single service
void xhash_walk(xht h, xhash_walker w, void *arg)
static void _disco_generate_packets(module_t mod, disco_t d)
generate cached result packets
static pkt_t _disco_info_result(module_t mod, disco_t d)
build a disco info result
void(* free)(module_t mod)
called when module is freed
pkt_t disco_info_result
cached result packets
static void _disco_free(module_t mod)
pool_t xhash_pool(xht h)
get our pool
jid_t jid_dup(jid_t jid)
duplicate a jid
void * xhash_get(xht h, const char *key)
xht acls
access control lists (key is list name, value is jid_t list)
static pkt_t _disco_agents_result(module_t mod, disco_t d)
build an agents result
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
mod_ret_t(* pkt_router)(mod_instance_t mi, pkt_t pkt)
pkt-router handler
static void _disco_unify_lists(disco_t d)
unify the contents of dyn and stat
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 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
route_type_t rtype
type of enclosing route
xht features
feature index (key is feature string