From b7d92694baa6a4b1aaaf69ca9d0d681a812e67e7 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Tue, 29 Jan 2013 20:46:58 +0100 Subject: [PATCH] Implement -initWithElement: for XMPPPresence --- src/XMPPPresence.m | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/XMPPPresence.m b/src/XMPPPresence.m index 7c5850d..51be8c1 100644 --- a/src/XMPPPresence.m +++ b/src/XMPPPresence.m @@ -91,6 +91,35 @@ static int show_to_int(OFString *show) ID: ID_]; } +- initWithElement: (OFXMLElement*)element +{ + self = [super initWithElement: element]; + + @try { + OFXMLElement *subElement; + + if ((subElement = [element elementForName: @"show" + namespace: XMPP_NS_CLIENT])) + [self setShow: [subElement stringValue]]; + + if ((subElement = [element elementForName: @"status" + namespace: XMPP_NS_CLIENT])) + [self setStatus: [subElement stringValue]]; + + if ((subElement = [element elementForName: @"priority" + namespace: XMPP_NS_CLIENT])) + [self setPriority: + [OFNumber numberWithIntMax: + [[subElement stringValue] decimalValue]]]; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + + - (void)dealloc { [status release];