48 for(scan = user->
sessions; scan != NULL; scan = scan->
next) {
64 if(user->
top == NULL) {
65 log_debug(
ZONE,
"no priority >= 0 sessions, so no top session");
83 if(sess->
pres != NULL)
106 if(item->from && !
jid_search(sess->
E, item->jid)) {
141 if(sess->
pres != NULL) {
154 if(item->from && !
jid_search(sess->
E, item->jid)) {
162 for(scan = sess->
A; scan != NULL; scan = scan->
next)
178 while(scan != NULL) {
186 while(scan != NULL) {
210 log_write(sess->
user->
sm->
log, LOG_ERR,
"pres_update got packet type 0x%X, this shouldn't happen - dropping it", pkt->
type);
244 if(storage_get(user->
sm->
st,
"status",
jid_user(user->
jid), NULL, &os) == st_SUCCESS && os_iter_first(os)) {
245 o = os_iter_object(os);
246 os_object_get_nad(os, o,
"xml", &nad);
264 for(scan = user->
sessions; scan != NULL; scan = scan->
next) {
367 if(item != NULL && item->
from)
user_t user
user this session belongs to
xht roster
roster for this user (key is full jid of item, value is item_t)
pkt_type_t type
packet type
jid_t jid
session jid (user@host/res)
jid_t jid_reset(jid_t jid, const char *id, int len)
build a jid from an id
data structures and prototypes for the session manager
pkt_t pres
copy of the last presence packet we received
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
jid_t jid_new(const char *id, int len)
make a new jid
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
void log_write(log_t log, int level, const char *msgfmt,...)
jid_t A
list of jids that this session has sent directed presence to
pkt_t pkt_dup(pkt_t pkt, const char *to, const char *from)
duplicate pkt, replacing addresses
jid_t jid_zap(jid_t list, jid_t jid)
remove a jid_t from a list, returning the new list
nad_t nad_copy(nad_t nad)
copy a nad
int xhash_iter_next(xht h)
int pres_trust(user_t user, jid_t jid)
see if the jid is trusted (ie in the roster with s10n="from" or "both")
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
jid_t from
packet addressing (not used for routing)
packet summary data wrapper
int jid_search(jid_t list, jid_t jid)
util to search through jids
storage_t st
storage subsystem
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
int xhash_iter_get(xht h, const char **key, int *keylen, void **val)
int jid_compare_full(jid_t a, jid_t b)
compare two full jids
void pkt_router(pkt_t pkt)
jid_t jid_append(jid_t list, jid_t jid)
make a copy of jid, link into list (avoiding dups)
static void _pres_top(user_t user)
select a new top session based on current session presence
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)
int xhash_iter_first(xht h)
iteration
int fake
true if session is fake (ie.
int available
true if this session is available
int from
subscription to this item (they get presence FROM us, they send presence TO us)
void pres_roster(sess_t sess, item_t item)
send presence based on roster changes
void pkt_delay(pkt_t pkt, time_t t, const char *from)
add an x:delay stamp
jid_t jid
user jid (user@host)
void * xhash_get(xht h, const char *key)
jid_t E
list of jids that bounced presence updates we sent them
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)
void pres_probe(user_t user)
void pres_deliver(sess_t sess, pkt_t pkt)
outgoing directed presence
void pkt_sess(pkt_t pkt, sess_t sess)
int available
true if this user has any available session