1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
/*
* Copyright (c) 2011, 2012, 2013, 2019, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2011, 2012, 2013, 2019, 2021, Jonathan Schleifer <js@nil.im>
* Copyright (c) 2011, Florian Zeitz <florob@babelmonkeys.de>
*
* https://heap.zone/objxmpp/
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
|
︙ | | |
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
-
+
-
-
+
-
-
+
-
-
+
-
|
@synthesize language = _language;
+ (instancetype)stanzaWithName: (OFString *)name
{
return [[[self alloc] initWithName: name] autorelease];
}
+ (instancetype)stanzaWithName: (OFString *)name
+ (instancetype)stanzaWithName: (OFString *)name type: (OFString *)type
type: (OFString *)type
{
return [[[self alloc] initWithName: name
return [[[self alloc] initWithName: name type: type] autorelease];
type: type] autorelease];
}
+ (instancetype)stanzaWithName: (OFString *)name
+ (instancetype)stanzaWithName: (OFString *)name ID: (OFString *)ID
ID: (OFString *)ID
{
return [[[self alloc] initWithName: name
return [[[self alloc] initWithName: name ID: ID] autorelease];
ID: ID] autorelease];
}
+ (instancetype)stanzaWithName: (OFString *)name
type: (OFString *)type
ID: (OFString *)ID
{
return [[[self alloc] initWithName: name
|
︙ | | |
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
-
+
-
|
- (instancetype)initWithName: (OFString *)name
stringValue: (OFString *)stringValue
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
- (instancetype)initWithName: (OFString *)name namespace: (OFString *)namespace
namespace: (OFString *)namespace
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
namespace: (nullable OFString *)namespace
stringValue: (nullable OFString *)stringValue
|
︙ | | |
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
-
+
-
-
-
+
-
-
+
-
-
-
+
-
-
-
+
-
-
+
+
-
|
- (instancetype)initWithFile: (OFString *)path
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
{
return [self initWithName: name
return [self initWithName: name type: nil ID: nil];
type: nil
ID: nil];
}
- (instancetype)initWithName: (OFString *)name
- (instancetype)initWithName: (OFString *)name type: (OFString *)type
type: (OFString *)type
{
return [self initWithName: name
return [self initWithName: name type: type ID: nil];
type: type
ID: nil];
}
- (instancetype)initWithName: (OFString *)name
ID: (OFString *)ID
{
return [self initWithName: name
return [self initWithName: name type: nil ID: ID];
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"
self.defaultNamespace = XMPPClientNS;
[self setPrefix: @"stream" forNamespace: XMPPStreamNS];
forNamespace: XMPP_NS_STREAM];
if (type != nil)
self.type = type;
if (ID != nil)
self.ID = ID;
} @catch (id e) {
|
︙ | | |
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
-
+
-
-
+
-
-
+
-
-
+
-
|
XMPPJID *old = _from;
_from = [from copy];
[old release];
[self removeAttributeForName: @"from"];
if (from != nil)
[self addAttributeWithName: @"from"
[self addAttributeWithName: @"from" stringValue: from.fullJID];
stringValue: from.fullJID];
}
- (void)setTo: (XMPPJID *)to
{
XMPPJID *old = _to;
_to = [to copy];
[old release];
[self removeAttributeForName: @"to"];
if (to != nil)
[self addAttributeWithName: @"to"
[self addAttributeWithName: @"to" stringValue: to.fullJID];
stringValue: to.fullJID];
}
- (void)setType: (OFString *)type
{
OFString *old = _type;
_type = [type copy];
[old release];
[self removeAttributeForName: @"type"];
if (type != nil)
[self addAttributeWithName: @"type"
[self addAttributeWithName: @"type" stringValue: type];
stringValue: type];
}
- (void)setID: (OFString *)ID
{
OFString *old = _ID;
_ID = [ID copy];
[old release];
[self removeAttributeForName: @"id"];
if (ID != nil)
[self addAttributeWithName: @"id"
[self addAttributeWithName: @"id" stringValue: ID];
stringValue: ID];
}
- (void)setLanguage: (OFString *)language
{
OFString *old = _language;
_language = [language copy];
[old release];
|
︙ | | |