Parcourir la source

imc: fix announcing attepts to join private rooms

- if an user cannot join a private room, the announcement was wrong,
  using invalid structure
- reported by Ozren Lapcevic
Daniel-Constantin Mierla il y a 14 ans
Parent
commit
f375eef5e2
1 fichiers modifiés avec 13 ajouts et 4 suppressions
  1. 13 4
      modules_k/imc/imc_cmd.c

+ 13 - 4
modules_k/imc/imc_cmd.c

@@ -326,13 +326,22 @@ int imc_handle_join(struct sip_msg* msg, imc_cmd_t *cmd,
 build_inform:
 build_inform:
 	/* send info message */
 	/* send info message */
 	body.s = imc_body_buf;
 	body.s = imc_body_buf;
-	body.len = snprintf(body.s, IMC_BUF_SIZE, "*** <%.*s> has joined the room",
-					member->uri.len, member->uri.s);
+	if(member!=NULL)
+	{
+		body.len = snprintf(body.s, IMC_BUF_SIZE,
+				"*** <%.*s@%.*s> has joined the room",
+				src->user.len, src->user.s, src->host.len, src->host.s);
+
+	} else {
+		body.len = snprintf(body.s, IMC_BUF_SIZE,
+				"*** <%.*s@%.*s> attempted to join the room",
+				src->user.len, src->user.s, src->host.len, src->host.s);
+	}
 	if(body.len>0)
 	if(body.len>0)
 		imc_room_broadcast(room, &all_hdrs, &body);
 		imc_room_broadcast(room, &all_hdrs, &body);
-
 	if(body.len>=IMC_BUF_SIZE)
 	if(body.len>=IMC_BUF_SIZE)
-		LM_ERR("member name %.*s truncated\n", member->uri.len, member->uri.s);
+		LM_ERR("member name %.*s@%.*s truncated\n",
+				src->user.len, src->user.s, src->host.len, src->host.s);
 
 
 done:
 done:
 	if(room!=NULL)
 	if(room!=NULL)