mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 10:49:41 +02:00
Phase 1 of large refactoring. Removing dead code, bug fixes, updates to JDK 1.5.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4511 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
1a08715f67
commit
bbbfe09c31
62 changed files with 291 additions and 3524 deletions
|
@ -131,7 +131,16 @@ public class PacketParserUtils {
|
|||
* @throws Exception if an exception occurs while parsing the packet.
|
||||
*/
|
||||
public static Presence parsePresence(XmlPullParser parser) throws Exception {
|
||||
Presence.Type type = Presence.Type.fromString(parser.getAttributeValue("", "type"));
|
||||
Presence.Type type = Presence.Type.available;
|
||||
String typeString = parser.getAttributeValue("", "type");
|
||||
if (typeString != null && !typeString.equals("")) {
|
||||
try {
|
||||
type = Presence.Type.valueOf(typeString);
|
||||
}
|
||||
catch (IllegalArgumentException iae) {
|
||||
System.err.println("Found invalid presence type " + typeString);
|
||||
}
|
||||
}
|
||||
|
||||
Presence presence = new Presence(type);
|
||||
presence.setTo(parser.getAttributeValue("", "to"));
|
||||
|
@ -154,14 +163,22 @@ public class PacketParserUtils {
|
|||
int priority = Integer.parseInt(parser.nextText());
|
||||
presence.setPriority(priority);
|
||||
}
|
||||
catch (NumberFormatException nfe) { }
|
||||
catch (NumberFormatException nfe) {
|
||||
// Ignore.
|
||||
}
|
||||
catch (IllegalArgumentException iae) {
|
||||
// Presence priority is out of range so assume priority to be zero
|
||||
presence.setPriority(0);
|
||||
}
|
||||
}
|
||||
else if (elementName.equals("show")) {
|
||||
presence.setMode(Presence.Mode.fromString(parser.nextText()));
|
||||
String modeText = parser.nextText();
|
||||
try {
|
||||
presence.setMode(Presence.Mode.valueOf(modeText));
|
||||
}
|
||||
catch (IllegalArgumentException iae) {
|
||||
System.err.println("Found invalid presence mode " + modeText);
|
||||
}
|
||||
}
|
||||
else if (elementName.equals("error")) {
|
||||
presence.setError(parseError(parser));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue