coder2000 / jabber-net

Automatically exported from code.google.com/p/jabber-net
Other
0 stars 0 forks source link

ProhibitedCharacterException #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is not necessarily a bug, but i would like to understand what causes 
this error. 

My code:

private void _jabberClient_OnAuthError(object sender, XmlElement rp)
{
    _jabberClient.Register(new JID(_username, _chatserver, null));
}

************** Exception Text **************
stringprep.steps.ProhibitedCharacterException: Step XMPP Node prohibits 
string (character U+0040).
   at stringprep.steps.ProhibitStep.Prepare(StringBuilder result)
   at stringprep.Profile.Prepare(StringBuilder result)
   at jabber.JID..ctor(String user, String server, String resource)
   at MyApplication.Main._jabberClient_OnAuthError(Object sender, 
XmlElement rp)
   at jabber.protocol.ProtocolHandler.Invoke(Object sender, XmlElement rp)

Can you identify exactly what is failing? What are allowed characters for 
jabberClient.Register()?

Thanks

Original issue reported on code.google.com by rory.gro...@gmail.com on 3 May 2008 at 5:53

GoogleCodeExporter commented 8 years ago
You have a "@" (which is Unicode 40 hex) in your username.  If you want to just 
let
the JID class do the parsing, use JID(_username). 

Original comment by hil...@gmail.com on 3 May 2008 at 2:37

GoogleCodeExporter commented 8 years ago
Thank you I will try executing:

   _jabberClient.Register(new JID(_username));

PS- is there a smarter way to auto-register first time users with my chat 
server?

Original comment by rory.gro...@gmail.com on 3 May 2008 at 7:32

GoogleCodeExporter commented 8 years ago
How do I deal with conference rooms?

            JID jid = new JID(room,
                Settings.Default.ChatConferenceServer,
                _jabberClient.User);

I am getting prohibited character exceptions when using this fashion.

Original comment by rory.gro...@gmail.com on 6 May 2008 at 12:42

GoogleCodeExporter commented 8 years ago
If you look at the contents of room, you'll probably find an "@" in it.  The 
3-argument version of the JID 
constructor takes a node, a domain, and a resource, with none of the delimiters 
@ or /.  The one-argument 
version takes a full JID as a string, and parses it into its three constituent 
parts.

Original comment by hil...@gmail.com on 6 May 2008 at 2:57