ObjXMPP  Check-in [9f1add690a]

Overview
Comment:Use more exceptions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9f1add690a475d497516a56b45ff74cf1bcf3eee0a8da4a3010bddec4a84b5e3
User & Date: js on 2011-02-16 22:42:18
Other Links: manifest | tags
Context
2011-02-16
22:52
Add missing -[description] to XMPPStringPrepFailedException. check-in: 806244a355 user: js tags: trunk
22:42
Use more exceptions. check-in: 9f1add690a user: js tags: trunk
22:37
Add .hgignore. check-in: 176cd44f7d user: js tags: trunk
Changes

Modified src/XMPPJID.m from [6945afcb5e] to [bf0bb104ef].

17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <assert.h>

#include <stringprep.h>

#import "XMPPJID.h"


@implementation XMPPJID
@synthesize node;
@synthesize domain;
@synthesize resource;

+ JID







<
<



>







17
18
19
20
21
22
23


24
25
26
27
28
29
30
31
32
33
34
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */



#include <stringprep.h>

#import "XMPPJID.h"
#import "XMPPExceptions.h"

@implementation XMPPJID
@synthesize node;
@synthesize domain;
@synthesize resource;

+ JID
78
79
80
81
82
83
84
85


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
	if (node_ == nil) {
		[old release];
		node = nil;
		return;
	}

	if ((rc = stringprep_profile([node_ cString], &nodepart,
	    "Nodeprep", 0)) != STRINGPREP_OK) {


		of_log(@"Nodeprep failed: %s", stringprep_strerror(rc));
		assert(0);
	}


	@try {
		node = [[OFString alloc] initWithCString: nodepart];
	} @finally {
		free(nodepart);
	}

	[old release];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *old = domain;
	char *srv;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ cString], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK) {


		of_log(@"Nameprep failed: %s", stringprep_strerror(rc));
		assert(0);
	}


	@try {
		domain = [[OFString alloc] initWithCString: srv];
	} @finally {
		free(srv);
	}








|
>
>
|
<
<
>

















|
>
>
|
<
<
>







77
78
79
80
81
82
83
84
85
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
	if (node_ == nil) {
		[old release];
		node = nil;
		return;
	}

	if ((rc = stringprep_profile([node_ cString], &nodepart,
	    "Nodeprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: nil
							   profile: @"Nodeprep"


							    string: node_];

	@try {
		node = [[OFString alloc] initWithCString: nodepart];
	} @finally {
		free(nodepart);
	}

	[old release];
}

- (void)setDomain: (OFString*)domain_
{
	OFString *old = domain;
	char *srv;
	Stringprep_rc rc;

	if ((rc = stringprep_profile([domain_ cString], &srv,
	    "Nameprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException newWithClass: isa
							connection: nil
							   profile: @"Nameprep"


							    string: domain_];

	@try {
		domain = [[OFString alloc] initWithCString: srv];
	} @finally {
		free(srv);
	}

126
127
128
129
130
131
132
133
134
135
136



137
138
139
140
141
142
143
	if (resource_ == nil) {
		[old release];
		resource = nil;
		return;
	}

	if ((rc = stringprep_profile([resource_ cString], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK) {
		of_log(@"Resourceprep failed: %s", stringprep_strerror(rc));
		assert(0);
	}




	@try {
		resource = [[OFString alloc] initWithCString: res];
	} @finally {
		free(res);
	}








|
|
|
<
>
>
>







127
128
129
130
131
132
133
134
135
136

137
138
139
140
141
142
143
144
145
146
	if (resource_ == nil) {
		[old release];
		resource = nil;
		return;
	}

	if ((rc = stringprep_profile([resource_ cString], &res,
	    "Resourceprep", 0)) != STRINGPREP_OK)
		@throw [XMPPStringPrepFailedException
		    newWithClass: isa

		      connection: nil
			 profile: @"Resourceprep"
			  string: resource_];

	@try {
		resource = [[OFString alloc] initWithCString: res];
	} @finally {
		free(res);
	}