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