- don't add @ when username is missing while building URI from username and domain...
authorDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 1 Aug 2008 21:07:04 +0000 (21:07 +0000)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Fri, 1 Aug 2008 21:07:04 +0000 (21:07 +0000)
git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4540 689a6050-402a-0410-94f2-e92a70836424

modules_k/presence/utils_func.h

index 9444f7a..a4dfee3 100644 (file)
@@ -62,13 +62,15 @@ static inline int uandd_to_uri(str user,  str domain, str *out)
                LM_ERR("no more memory\n");
                return -1;
        }
-       out->len = 0;
        strcpy(out->s,"sip:");
        out->len = 4;
-       strncpy(out->s+out->len, user.s, user.len);
-       out->len += user.len;
-       out->s[out->len] = '@';
-       out->len+= 1;
+       if(user.s!=NULL && user.len>0)
+       {
+               strncpy(out->s+out->len, user.s, user.len);
+               out->len += user.len;
+               out->s[out->len] = '@';
+               out->len+= 1;
+       }
        strncpy(out->s + out->len, domain.s, domain.len);
        out->len += domain.len;