@@ -1,7 +1,7 @@ /* - * Copyright (c) 2011, 2012, 2013, 2019, Jonathan Schleifer + * Copyright (c) 2011, 2012, 2013, 2019, 2021, Jonathan Schleifer * Copyright (c) 2011, Florian Zeitz * * https://heap.zone/objxmpp/ * * Permission to use, copy, modify, and/or distribute this software for any @@ -34,22 +34,18 @@ + (instancetype)stanzaWithName: (OFString *)name { return [[[self alloc] initWithName: name] autorelease]; } -+ (instancetype)stanzaWithName: (OFString *)name - type: (OFString *)type ++ (instancetype)stanzaWithName: (OFString *)name type: (OFString *)type { - return [[[self alloc] initWithName: name - type: type] autorelease]; + return [[[self alloc] initWithName: name type: type] autorelease]; } -+ (instancetype)stanzaWithName: (OFString *)name - ID: (OFString *)ID ++ (instancetype)stanzaWithName: (OFString *)name ID: (OFString *)ID { - return [[[self alloc] initWithName: name - ID: ID] autorelease]; + return [[[self alloc] initWithName: name ID: ID] autorelease]; } + (instancetype)stanzaWithName: (OFString *)name type: (OFString *)type ID: (OFString *)ID @@ -68,12 +64,11 @@ stringValue: (OFString *)stringValue { OF_INVALID_INIT_METHOD } -- (instancetype)initWithName: (OFString *)name - namespace: (OFString *)namespace +- (instancetype)initWithName: (OFString *)name namespace: (OFString *)namespace { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name @@ -93,47 +88,39 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name { - return [self initWithName: name - type: nil - ID: nil]; + return [self initWithName: name type: nil ID: nil]; } -- (instancetype)initWithName: (OFString *)name - type: (OFString *)type +- (instancetype)initWithName: (OFString *)name type: (OFString *)type { - return [self initWithName: name - type: type - ID: nil]; + return [self initWithName: name type: type ID: nil]; } - (instancetype)initWithName: (OFString *)name ID: (OFString *)ID { - return [self initWithName: name - type: nil - ID: ID]; + return [self initWithName: name type: nil ID: ID]; } - (instancetype)initWithName: (OFString *)name type: (OFString *)type ID: (OFString *)ID { self = [super initWithName: name - namespace: XMPP_NS_CLIENT + namespace: XMPPClientNS stringValue: nil]; @try { if (![name isEqual: @"iq"] && ![name isEqual: @"message"] && ![name isEqual: @"presence"]) @throw [OFInvalidArgumentException exception]; - self.defaultNamespace = XMPP_NS_CLIENT; - [self setPrefix: @"stream" - forNamespace: XMPP_NS_STREAM]; + self.defaultNamespace = XMPPClientNS; + [self setPrefix: @"stream" forNamespace: XMPPStreamNS]; if (type != nil) self.type = type; if (ID != nil) @@ -191,12 +178,11 @@ [old release]; [self removeAttributeForName: @"from"]; if (from != nil) - [self addAttributeWithName: @"from" - stringValue: from.fullJID]; + [self addAttributeWithName: @"from" stringValue: from.fullJID]; } - (void)setTo: (XMPPJID *)to { XMPPJID *old = _to; @@ -204,12 +190,11 @@ [old release]; [self removeAttributeForName: @"to"]; if (to != nil) - [self addAttributeWithName: @"to" - stringValue: to.fullJID]; + [self addAttributeWithName: @"to" stringValue: to.fullJID]; } - (void)setType: (OFString *)type { OFString *old = _type; @@ -217,12 +202,11 @@ [old release]; [self removeAttributeForName: @"type"]; if (type != nil) - [self addAttributeWithName: @"type" - stringValue: type]; + [self addAttributeWithName: @"type" stringValue: type]; } - (void)setID: (OFString *)ID { OFString *old = _ID; @@ -230,12 +214,11 @@ [old release]; [self removeAttributeForName: @"id"]; if (ID != nil) - [self addAttributeWithName: @"id" - stringValue: ID]; + [self addAttributeWithName: @"id" stringValue: ID]; } - (void)setLanguage: (OFString *)language { OFString *old = _language;