[sr-dev] git:3.1: imc: fix announcing attepts to join private rooms

Daniel-Constantin Mierla miconda at gmail.com
Fri Jun 3 10:30:51 CEST 2011


Module: sip-router
Branch: 3.1
Commit: 1127790f97fd37767fa3e4439fb9daf67e5ec465
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1127790f97fd37767fa3e4439fb9daf67e5ec465

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jun  3 10:25:19 2011 +0200

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
(cherry picked from commit f375eef5e2559847bb42381fdb6a9727692004b4)

---

 modules_k/imc/imc_cmd.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules_k/imc/imc_cmd.c b/modules_k/imc/imc_cmd.c
index 0bf8e50..6c1e3bc 100644
--- a/modules_k/imc/imc_cmd.c
+++ b/modules_k/imc/imc_cmd.c
@@ -326,13 +326,22 @@ int imc_handle_join(struct sip_msg* msg, imc_cmd_t *cmd,
 build_inform:
 	/* send info message */
 	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)
 		imc_room_broadcast(room, &all_hdrs, &body);
-
 	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:
 	if(room!=NULL)




More information about the sr-dev mailing list