ObjXMPP  Check-in [c74a473e92]

Overview
Comment:XMPPDiscoEntity: Caps hash must be Base64 encoded SHA1
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c74a473e92d9ffa1026f1ad70df6c034728d7c4c8c4d3c6fc9b57bb8996be1c6
User & Date: florob@babelmonkeys.de on 2013-06-12 12:53:05
Other Links: manifest | tags
Context
2013-06-23
14:19
Adjust to reworked exception API. check-in: 543fb8b84d user: js tags: trunk
2013-06-12
12:53
XMPPDiscoEntity: Caps hash must be Base64 encoded SHA1 check-in: c74a473e92 user: florob@babelmonkeys.de tags: trunk
2013-06-09
18:26
XMPPContactManager: Support for handling subscription requests check-in: 9d9f036640 user: florob@babelmonkeys.de tags: trunk
Changes

Modified src/XMPPDiscoEntity.m from [f2cbe0aedb] to [3e8f059c34].

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
- (OFString*)capsNode
{
	OF_GETTER(_capsNode, YES);
}

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




}

- (void)connection: (XMPPConnection*)connection
     wasBoundToJID: (XMPPJID*)JID
{
	_JID = [JID copy];
}







<



>
>
>










>
>
|
>
>
>
>







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
118
119
120
121
122
- (OFString*)capsNode
{
	OF_GETTER(_capsNode, YES);
}

- (OFString*)capsHash
{

	OFEnumerator *enumerator;
	XMPPDiscoIdentity *identity;
	OFString *feature;
	OFMutableString *caps = [OFMutableString string];
	OFSHA1Hash *hash = [OFSHA1Hash hash];
	OFDataArray *digest = [OFDataArray dataArray];

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

	[hash updateWithBuffer: [caps UTF8String]
			length: [caps UTF8StringLength]];

	[digest addItems: [hash digest]
		   count: [OFSHA1Hash digestSize]];

	return [digest stringByBase64Encoding];
}

- (void)connection: (XMPPConnection*)connection
     wasBoundToJID: (XMPPJID*)JID
{
	_JID = [JID copy];
}