30
31
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
@implementation XMPPMessage
+ (instancetype)message
{
return [[[self alloc] init] autorelease];
}
+ (instancetype)messageWithID: (OFString*)ID
{
return [[[self alloc] initWithID: ID] autorelease];
}
+ (instancetype)messageWithType: (OFString*)type
{
return [[[self alloc] initWithType: type] autorelease];
}
+ (instancetype)messageWithType: (OFString*)type
ID: (OFString*)ID
{
return [[[self alloc] initWithType: type
ID: ID] autorelease];
}
- init
{
return [self initWithType: nil
ID: nil];
}
- initWithID: (OFString*)ID
{
return [self initWithType: nil
ID: ID];
}
- initWithType: (OFString*)type
{
return [self initWithType: type
ID: nil];
}
- initWithType: (OFString*)type
ID: (OFString*)ID
{
return [super initWithName: @"message"
type: type
ID: ID];
}
- (void)setBody: (OFString*)body
{
OFXMLElement *oldBody = [self elementForName: @"body"
namespace: XMPP_NS_CLIENT];
if (oldBody != nil)
[self removeChild: oldBody];
if (body != nil)
[self addChild: [OFXMLElement elementWithName: @"body"
namespace: XMPP_NS_CLIENT
stringValue: body]];
}
- (OFString*)body
{
return [[self elementForName: @"body"
namespace: XMPP_NS_CLIENT] stringValue];
}
@end
|
|
|
|
|
|
|
|
|
|
|
|
30
31
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
@implementation XMPPMessage
+ (instancetype)message
{
return [[[self alloc] init] autorelease];
}
+ (instancetype)messageWithID: (OFString *)ID
{
return [[[self alloc] initWithID: ID] autorelease];
}
+ (instancetype)messageWithType: (OFString *)type
{
return [[[self alloc] initWithType: type] autorelease];
}
+ (instancetype)messageWithType: (OFString *)type
ID: (OFString *)ID
{
return [[[self alloc] initWithType: type
ID: ID] autorelease];
}
- init
{
return [self initWithType: nil
ID: nil];
}
- initWithID: (OFString *)ID
{
return [self initWithType: nil
ID: ID];
}
- initWithType: (OFString *)type
{
return [self initWithType: type
ID: nil];
}
- initWithType: (OFString *)type
ID: (OFString *)ID
{
return [super initWithName: @"message"
type: type
ID: ID];
}
- (void)setBody: (OFString *)body
{
OFXMLElement *oldBody = [self elementForName: @"body"
namespace: XMPP_NS_CLIENT];
if (oldBody != nil)
[self removeChild: oldBody];
if (body != nil)
[self addChild: [OFXMLElement elementWithName: @"body"
namespace: XMPP_NS_CLIENT
stringValue: body]];
}
- (OFString *)body
{
return [[self elementForName: @"body"
namespace: XMPP_NS_CLIENT] stringValue];
}
@end
|