From 104e47cb3e5106a19f64478673c228ae449f7f9d Mon Sep 17 00:00:00 2001 From: Matt Tucker Date: Sat, 27 Sep 2003 17:27:40 +0000 Subject: [PATCH] Fixed registration packet parsing (SMACK-88) git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2109 b35dd754-fafc-0310-a699-88a17e54d16e --- .../org/jivesoftware/smack/PacketReader.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/source/org/jivesoftware/smack/PacketReader.java b/source/org/jivesoftware/smack/PacketReader.java index 73b9a10a5..55d31476b 100644 --- a/source/org/jivesoftware/smack/PacketReader.java +++ b/source/org/jivesoftware/smack/PacketReader.java @@ -500,15 +500,22 @@ class PacketReader { else if (parser.getName().equals("password")) { registration.setPassword(parser.nextText()); } - else { + // Else if any other element that's in the jabber:iq:register namespace, + // attempt to parse it if it's in the form value. + else if (parser.getNamespace().equals("jabber:iq:register")) { String name = parser.getName(); - String value = parser.nextText(); - // Ignore instructions, but anything else should be added to the map. - if (!name.equals("instructions")) { - if (fields == null) { - fields = new HashMap(); + if (parser.next() == XmlPullParser.TEXT) { + String value = parser.getText(); + // Ignore instructions, but anything else should be added to the map. + if (!name.equals("instructions")) { + if (fields == null) { + fields = new HashMap(); + } + fields.put(name, value); + } + else { + registration.setInstructions(value); } - fields.put(name, value); } } }