alt_event_type = "presence";
}
- if ((user = strdup(from))) {
+ if (from && (user = strdup(from))) {
if ((host = strchr(user, '@'))) {
char *p;
*host++ = '\0';
*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";
}
}
if (!strncasecmp(status, "Registered", 10)) {
- prpid = NULL;
status = "Available";
}
+ if (!strcasecmp(status, "Available")) {
+ prpid = NULL;
+ }
+
if (!strcasecmp(status, "Unregistered")) {
prpid = NULL;
if (zstr(status) && !zstr(prpid)) {
status = "Available";
+ prpid = NULL;
}
if (prpid) {
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);
}