It looks like the client isn’t connecting because it’s waiting for a response from the server with its exact name, and the server has mutated the name due to an incompatability with “¸”.
I’m guessing this was simply an oversight, but nicknames should really be escaped for XML using the included StringUtils class. (This function filters out “bad” characters like <, >, /, etc. and also handles Unicode characters (like “¸”)).
This is an important bug for english users too, since a very knowledgable user could inject XML into their nickname, and given enough knowledge of the packet structure (obtained from a simple packet capture) they could cause issues.
But, fixing that issue didn’t solve the problem, and it seems the root cause is that the server doesn’t like that character. Here’s an excerpt from my server log with my domain censored:
C2S - RECV (20577663):
C2S - SENT (20577663): <x
As you can see, the server receives the character correctly, but when it sends it out, it’s garbled, and doesn’t match the incoming name (so it’s ignored by the client).
Since I don’t know a sufficient ammount about the server’s packet routing (and don’t feel like tracing this all the way through), I’ll simply suggest a sort of “band-aid” fix to the issue, which is to make the client’s filter more lenient. Instead of requiring that the server respond with their exact nickname, only require that the response contains the room name and a slash (so the response nickname could be ANYTHING).
You’ll need to make these changes to Smackx\muc\multiuserchat.java:
add after line 46: import org.jivesoftware.smack.filter.FromContainsFilter;
now change the following lines:
line 343: new FromContainsFilter(room + “/”),
line 482: new FromContainsFilter(room + “/”),
line 1004: new FromContainsFilter(room + “/”),
Recompile smack. Copy smack.jar, smackx.jar, and smack-debug.jar to your webchat source folder (more specifically, webchat\trunk\src\webapp\WEB-INF\lib) and overwrite the old jar’s. Recompile webchat and deploy it to your app server. (you’ll need to reconfigure your settings, or copy chat-settings.xml from your old deployment).
The clients can now connect, but there are a number of remaining bugs. Clients with “¸” will see double messages but the agent will not (nor will “normal” clients), and the name of the client will be garbled (see results below):
Additionally, the agent’s name got mixed up with the client’s name in the “you are now chatting with” (only for “¸” clients)
You are now chatting with test ̧
test ̧: YES!
test ̧: what?
Ideally, I could find where in the server it is mutating the customer’s name. Can you tell me if agents have this same problem if their name contains “¸”?