WIP: Added last activity request and response

This commit is contained in:
James Booth
2015-09-29 00:01:38 +01:00
parent a12624ea75
commit 26d160cae8
11 changed files with 211 additions and 2 deletions

View File

@@ -730,3 +730,28 @@ sv_ev_certfail(const char * const errormsg, const char * const certname, const c
return 0;
}
}
void
sv_ev_lastactivity_response(const char * const from, const int seconds, const char * const msg)
{
Jid *jidp = jid_create(from);
if (!jidp) {
return;
}
// full jid or bare jid
if (jidp->resourcepart || jidp->localpart) {
if (msg) {
cons_show("%s last active %d, status: %s", from, seconds, msg);
} else {
cons_show("%s last active %d", from, seconds);
}
// domain only
} else {
cons_show("%s uptime %d seconds", from, seconds);
}
jid_destroy(jidp);
}

View File

@@ -88,5 +88,6 @@ void sv_ev_roster_update(const char * const barejid, const char * const name,
void sv_ev_roster_received(void);
int sv_ev_certfail(const char * const errormsg, const char * const certname, const char * const certfp,
const char * const notbefore, const char * const notafter);
void sv_ev_lastactivity_response(const char * const from, const int seconds, const char * const msg);
#endif