47 jid_t all, msg, jid, smjid;
51 char *resource = (
char *) mod->
private;
81 org_subject =
"(none)";
83 subjectl = strlen(org_subject) + strlen(
jid_full(pkt->
from)) + 8;
84 subject = (
char *) malloc(
sizeof(
char) * subjectl);
85 snprintf(subject, subjectl,
"Fwd[%s]: %s",
jid_full(pkt->
from), org_subject);
93 for(jid = all; jid != NULL; jid = jid->
next)
101 log_write(mod->
mm->
sm->
log, LOG_ERR,
"%s:%d help admin %s is messaging sm for help! packet dropped. (unable to print packet - out of memory?)",
ZONE,
jid_full(jid));
105 log_write(mod->
mm->
sm->
log, LOG_ERR,
"%s:%d help admin %s is messaging sm for help! packet dropped: \"%.*s\"\n",
ZONE,
jid_full(jid), len, xml);
113 for(jid = msg; jid != NULL; jid = jid->
next)
162 for(n = 0; n < elem->
nvalues; n++) {
174 if(mod->
init)
return 0;
pkt_type_t type
packet type
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
int nad_insert_elem(nad_t nad, int parent, int ns, const char *name, const char *cdata)
shove in a new child elem after the given one
#define NAD_CDATA_L(N, E)
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
static mod_ret_t _help_pkt_sm(mod_instance_t mi, pkt_t pkt)
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
void log_write(log_t log, int level, const char *msgfmt,...)
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
int nad_append_elem(nad_t nad, int ns, const char *name, int depth)
create a new elem on the list
void nad_free(nad_t nad)
free that nad
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
jid_t jid_reset_components(jid_t jid, const char *node, const char *domain, const char *resource)
build a jid from components
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
int jid_search(jid_t list, jid_t jid)
util to search through jids
nad_t nad
nad of the entire packet
void jid_free(jid_t jid)
free a jid
static const char * _serverinfo_fields[]
DLLEXPORT int module_init(mod_instance_t mi, const char *arg)
int jid_compare_full(jid_t a, jid_t b)
compare two full jids
void pkt_router(pkt_t pkt)
packet was unhandled, should be passed to the next module
config_elem_t config_get(config_t c, const char *key)
get the config element for this key
packet was handled (and freed)
mod_ret_t(* pkt_sm)(mod_instance_t mi, pkt_t pkt)
pkt-sm handler
void nad_drop_elem(nad_t nad, int elem)
remove an element (and its subelements)
void * xhash_get(xht h, const char *key)
void(* disco_extend)(mod_instance_t mi, pkt_t pkt)
disco-extend handler
xht acls
access control lists (key is list name, value is jid_t list)
static void _help_disco_extend(mod_instance_t mi, pkt_t pkt)
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 nad_print(nad_t nad, int elem, const char **xml, int *len)
create a string representation of the given element (and children), point references to it ...