ObjXMPP  Diff

Differences From Artifact [5fedee525e]:

To Artifact [3d98a688a4]:


1
2
3
4
5
6
7
8
9
/*
 * Copyright (c) 2011, 2012, 2013, 2019, Jonathan Schleifer <js@heap.zone>
 * 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.

|







1
2
3
4
5
6
7
8
9
/*
 * 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.
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
}

+ (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];
}

- (instancetype)init
{
	return [self initWithType: nil
			       ID: nil];
}

- (instancetype)initWithID: (OFString *)ID
{
	return [self initWithType: nil
			       ID: ID];
}

- (instancetype)initWithType: (OFString *)type
{
	return [self initWithType: type
			       ID: nil];
}

- (instancetype)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







|
<

|
<




|
<




|
<




|
<


|
<

|
<
<





|






|






|


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
}

+ (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];

}

- (instancetype)init
{
	return [self initWithType: nil ID: nil];

}

- (instancetype)initWithID: (OFString *)ID
{
	return [self initWithType: nil ID: ID];

}

- (instancetype)initWithType: (OFString *)type
{
	return [self initWithType: type ID: nil];

}

- (instancetype)initWithType: (OFString *)type ID: (OFString *)ID

{
	return [super initWithName: @"message" type: type ID: ID];


}

- (void)setBody: (OFString *)body
{
	OFXMLElement *oldBody = [self elementForName: @"body"
					   namespace: XMPPClientNS];

	if (oldBody != nil)
		[self removeChild: oldBody];

	if (body != nil)
		[self addChild: [OFXMLElement elementWithName: @"body"
						    namespace: XMPPClientNS
						  stringValue: body]];
}

- (OFString *)body
{
	return [self elementForName: @"body"
			  namespace: XMPPClientNS].stringValue;
}
@end