presence update

This commit is contained in:
Anthony Minessale 2010-08-24 11:53:46 -05:00
parent 62206e3d43
commit 0ea84c869c
2 changed files with 8 additions and 4 deletions

View File

@ -522,7 +522,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
alt_event_type = "presence";
}
if ((user = strdup(from))) {
if (from && (user = strdup(from))) {
if ((host = strchr(user, '@'))) {
char *p;
*host++ = '\0';
@ -1065,7 +1065,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
*ct = "application/xpidf+xml";
/* If unknown/none prpid is provided, just show the user as online. */
if (!prpid) {
if (!prpid || !strcasecmp(prpid, "unknown")) {
prpid = "online";
}
@ -1099,10 +1099,13 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
}
if (!strncasecmp(status, "Registered", 10)) {
prpid = NULL;
status = "Available";
}
if (!strcasecmp(status, "Available")) {
prpid = NULL;
}
if (!strcasecmp(status, "Unregistered")) {
prpid = NULL;
@ -1116,6 +1119,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r
if (zstr(status) && !zstr(prpid)) {
status = "Available";
prpid = NULL;
}
if (prpid) {

View File

@ -1336,7 +1336,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host);
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "online");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_fire(&s_event);
}