ObjXMPP  Check-in [d0ef8af167]

Overview
Comment:Add support for SRV records
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d0ef8af16747ff9b29f69430591a42b321875b2cb17db860e684f43a6edd2385
User & Date: florob@babelmonkeys.de on 2011-05-24 01:01:47
Other Links: manifest | tags
Context
2011-05-24
10:18
Add files added in last commit to .xcodeproj. check-in: 33e02f170b user: js tags: trunk
01:01
Add support for SRV records check-in: d0ef8af167 user: florob@babelmonkeys.de tags: trunk
2011-05-22
21:50
Add dealloc for XMPPJID check-in: 4854b771a9 user: florob@babelmonkeys.de tags: trunk
Changes

Modified configure.ac from [e73fb2f584] to [7ac5f3f225].

28
29
30
31
32
33
34































35
36
37
38
39
40
41
])
AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [build static library]))
AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [
	AC_PATH_TOOL(AR, ar)
	AC_PROG_RANLIB
	AC_SUBST(OBJXMPP_STATIC_LIB, "libobjxmpp.a")
])
































AC_CHECK_LIB(objopenssl, main, [
	LIBS="$LIBS -lobjopenssl -lcrypto"
], [
	AC_MSG_ERROR(You need ObjOpenSSL installed!)
])








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







28
29
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
])
AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [build static library]))
AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [
	AC_PATH_TOOL(AR, ar)
	AC_PROG_RANLIB
	AC_SUBST(OBJXMPP_STATIC_LIB, "libobjxmpp.a")
])

# This is an adapted version of what glib does for res_query
# It should recognize the correct library on (at least) Linux,
# NetBSD, FreeBSD, Mac OS X and Haiku
AC_MSG_CHECKING([for res_nsearch])
AC_TRY_LINK([#include <sys/types.h>
	     #include <netinet/in.h>
	     #include <arpa/nameser.h>
	     #include <resolv.h>],
	     [res_nsearch(&_res, "test", 0, 0, (void *)0, 0);],
	     [AC_MSG_RESULT([yes])],
	     [save_libs="$LIBS"
	      LIBS="$LIBS -lresolv"
	      AC_TRY_LINK([#include <sys/types.h>
			   #include <netinet/in.h>
			   #include <arpa/nameser.h>
			   #include <resolv.h>],
			   [res_nsearch(&_res, "test", 0, 0, (void *)0, 0);],
			   [AC_MSG_RESULT([in -lresolv])],
			   [LIBS="$save_libs -lnetwork"
			    AC_TRY_LINK([#include <sys/types.h>
					 #include <netinet/in.h>
					 #include <arpa/nameser.h>
					 #include <resolv.h>],
					[res_nsearch(&_res, "test", 0, 0, (void *)0, 0);],
					[AC_MSG_RESULT([in -lnetwork])],
					[LIBS="$save_libs -lbind"
					 AC_TRY_LINK([#include <resolv.h>],
						     [res_nsearch(&_res, "test", 0, 0, (void *)0, 0);],
						     [AC_MSG_RESULT([in -lbind])],
						     [AC_MSG_ERROR(not found)])])])])

AC_CHECK_LIB(objopenssl, main, [
	LIBS="$LIBS -lobjopenssl -lcrypto"
], [
	AC_MSG_ERROR(You need ObjOpenSSL installed!)
])

Modified src/Makefile from [a2d4863fd2] to [e16ddb2283].

12
13
14
15
16
17
18

19
20
21
22
23
24
25
       XMPPJID.m		\
       XMPPMessage.m		\
       XMPPPLAINAuth.m		\
       XMPPPresence.m		\
       XMPPRoster.m		\
       XMPPRosterItem.m		\
       XMPPSCRAMAuth.m		\

       XMPPStanza.m

INCLUDES = ${SRCS:.m=.h}	\
	   namespaces.h		\
	   ObjXMPP.h

include ../buildsys.mk







>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
       XMPPJID.m		\
       XMPPMessage.m		\
       XMPPPLAINAuth.m		\
       XMPPPresence.m		\
       XMPPRoster.m		\
       XMPPRosterItem.m		\
       XMPPSCRAMAuth.m		\
       XMPPSRVEnumerator.m	\
       XMPPStanza.m

INCLUDES = ${SRCS:.m=.h}	\
	   namespaces.h		\
	   ObjXMPP.h

include ../buildsys.mk

Modified src/XMPPConnection.m from [f2b85b75c9] to [ad06d62613].

27
28
29
30
31
32
33

34
35
36
37
38
39
40

#include <stringprep.h>
#include <idna.h>

#import <ObjOpenSSL/SSLSocket.h>

#import "XMPPConnection.h"

#import "XMPPSCRAMAuth.h"
#import "XMPPPLAINAuth.h"
#import "XMPPStanza.h"
#import "XMPPJID.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"







>







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#include <stringprep.h>
#include <idna.h>

#import <ObjOpenSSL/SSLSocket.h>

#import "XMPPConnection.h"
#import "XMPPSRVEnumerator.h"
#import "XMPPSCRAMAuth.h"
#import "XMPPPLAINAuth.h"
#import "XMPPStanza.h"
#import "XMPPJID.h"
#import "XMPPIQ.h"
#import "XMPPMessage.h"
#import "XMPPPresence.h"
192
193
194
195
196
197
198



199















200
201
202
203
204
205
206
207
208
{
	return [[password copy] autorelease];
}

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];



















	[sock connectToHost: server
		     onPort: port];
	[self XMPP_startStream];

	[pool release];
}

- (void)handleConnection
{







>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|







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
{
	return [[password copy] autorelease];
}

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	XMPPSRVEnumerator *SRVEnumerator =
		[XMPPSRVEnumerator enumeratorWithDomain: server];
	XMPPSRVEntry *candidate;

	while ((candidate = [SRVEnumerator nextObject])) {
		@try {
			[sock connectToHost: [candidate target]
				     onPort: [candidate port]];
			break;
		} @catch (id e) {
			if (([e class] == [OFAddressTranslationFailedException
					class]) || ([e class] ==
					[OFConnectionFailedException class]))
				continue;
			else
				@throw e;
		}
	}
	if (!candidate)
		[sock connectToHost: server
			     onPort: port];
	[self XMPP_startStream];

	[pool release];
}

- (void)handleConnection
{

Added src/XMPPSRVEnumerator.h version [f1ada3cf65].

Added src/XMPPSRVEnumerator.m version [4fe9779194].

Modified tests/test.m from [f856f65516] to [4642dd9fd4].

98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
	}

	[conn setServer: [arguments objectAtIndex: 0]];
	[conn setUsername: [arguments objectAtIndex: 1]];
	[conn setPassword: [arguments objectAtIndex: 2]];
	[conn setResource: @"ObjXMPP"];

	[conn connect];
	@try {

		[conn handleConnection];
	} @catch (id e) {
		of_log(@"%@", e);
	}
}

- (void)connectionWasAuthenticated: (XMPPConnection*)conn







<

>







98
99
100
101
102
103
104

105
106
107
108
109
110
111
112
113
	}

	[conn setServer: [arguments objectAtIndex: 0]];
	[conn setUsername: [arguments objectAtIndex: 1]];
	[conn setPassword: [arguments objectAtIndex: 2]];
	[conn setResource: @"ObjXMPP"];


	@try {
		[conn connect];
		[conn handleConnection];
	} @catch (id e) {
		of_log(@"%@", e);
	}
}

- (void)connectionWasAuthenticated: (XMPPConnection*)conn