]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
presence update
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 24 Aug 2010 16:53:46 +0000 (11:53 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 24 Aug 2010 16:54:32 +0000 (11:54 -0500)
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index de5e8d49d9a2266a95faa0aac0ebc731ab88156b..775451db5413cced672920d1a60198b2dba243b3 100644 (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) {
index 8ac765aa4269b555033832f7b0033c62be72d055..2ded7ee4c4a01c1ea712c446e26f796f3c123ed9 100644 (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);
                        }