ObjXMPP  Check-in [0d43c61dbc]

Overview
Comment:Add support for calculating caps hashes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0d43c61dbcb0b898258dd12c636d3f78aab297b322871968019f0a5b2725709e
User & Date: florob@babelmonkeys.de on 2013-03-23 18:59:26
Other Links: manifest | tags
Context
2013-03-23
22:06
Add XMPPDisco*.h to ObjXMPP.h, remove debug code check-in: 479c1259df user: florob@babelmonkeys.de tags: trunk
18:59
Add support for calculating caps hashes check-in: 0d43c61dbc user: florob@babelmonkeys.de tags: trunk
17:21
Add classes to support Service Discovery check-in: db8adef472 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/XMPPDiscoEntity.h from [50bb8252e5] to [a569874688].

70
71
72
73
74
75
76







77
78
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85







+
+
+
+
+
+
+


/**
 * \brief Adds a XMPPDiscoNode to provide responses for.
 *
 * \param node The XMPPDiscoNode to provide responses for
 */
- (void)addDiscoNode: (XMPPDiscoNode*)node;

/**
 * \brief Calculates the Entity Capabilities Hash of the entity
 *
 * \return A OFString containing the capabilities hash
 */
- (OFString*)capsHash;

- (OFDictionary*)discoNodes;
@end

Modified src/XMPPDiscoEntity.m from [ada5800aa3] to [8157f6bcb0].

17
18
19
20
21
22
23

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







+







 * 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.
 */

#import "XMPPDiscoEntity.h"
#import "XMPPDiscoIdentity.h"
#import "XMPPIQ.h"
#import "namespaces.h"

@implementation XMPPDiscoEntity
+ discoEntityWithConnection: (XMPPConnection*)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
62
63
64
65
66
67
68



















69
70
71
72
73
74
75
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







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







}

- (void)addDiscoNode: (XMPPDiscoNode*)node
{
	[_discoNodes setObject: node
			forKey: [node node]];
}

- (OFString*)capsHash
{
	OFMutableString *caps = [OFMutableString string];
	OFEnumerator *enumerator;
	XMPPDiscoIdentity *identity;
	OFString *feature;

	enumerator = [_identities objectEnumerator];
	while ((identity = [enumerator nextObject]) != nil)
		[caps appendFormat: @"%@/%@//%@<", [identity category],
		    [identity type], [identity name]];

	enumerator = [_features objectEnumerator];
	while ((feature = [enumerator nextObject]) != nil)
		[caps appendFormat: @"%@<", feature];

	return [caps SHA1Hash];
}

- (BOOL)connection: (XMPPConnection*)connection
      didReceiveIQ: (XMPPIQ*)IQ
{
	of_log(@"Called connection:didReceiveIQ:... %@ %@", [IQ to], _JID);
	if (![[IQ to] isEqual: _JID])
		return NO;