Properly handle roster items which are in multiple groups.
This commit is contained in:
parent
08e9104a17
commit
a972fe397e
1 changed files with 26 additions and 12 deletions
|
@ -638,27 +638,41 @@
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
||||||
for (OFXMLElement *elem in rosterElem.children) {
|
for (OFXMLElement *elem in rosterElem.children) {
|
||||||
OFString *group;
|
OFArray *groups;
|
||||||
OFMutableArray *rosterGroup;
|
|
||||||
|
|
||||||
if (![elem.name isEqual: @"item"] ||
|
if (![elem.name isEqual: @"item"] ||
|
||||||
![elem.ns isEqual: NS_ROSTER])
|
![elem.ns isEqual: NS_ROSTER])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
group = [[elem
|
groups = [elem elementsForName: @"group"
|
||||||
elementsForName: @"group"
|
namespace: NS_ROSTER];
|
||||||
namespace: NS_ROSTER].firstObject stringValue];
|
|
||||||
|
|
||||||
if (group == nil)
|
for (OFXMLElement *groupElem in groups) {
|
||||||
group = @"";
|
OFString *group = groupElem.stringValue;
|
||||||
|
OFMutableArray *rosterGroup =
|
||||||
|
[roster objectForKey: group];
|
||||||
|
|
||||||
if ((rosterGroup = [roster objectForKey: group]) == nil) {
|
if (rosterGroup == nil) {
|
||||||
rosterGroup = [OFMutableArray array];
|
rosterGroup = [OFMutableArray array];
|
||||||
[roster setObject: rosterGroup
|
[roster setObject: rosterGroup
|
||||||
forKey: group];
|
forKey: group];
|
||||||
|
}
|
||||||
|
|
||||||
|
[rosterGroup addObject: elem];
|
||||||
}
|
}
|
||||||
|
|
||||||
[rosterGroup addObject: elem];
|
if (groups.count == 0) {
|
||||||
|
OFMutableArray *rosterGroup =
|
||||||
|
[roster objectForKey: @""];
|
||||||
|
|
||||||
|
if (rosterGroup == nil) {
|
||||||
|
rosterGroup = [OFMutableArray array];
|
||||||
|
[roster setObject: rosterGroup
|
||||||
|
forKey: @""];
|
||||||
|
}
|
||||||
|
|
||||||
|
[rosterGroup addObject: elem];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([delegate respondsToSelector:
|
if ([delegate respondsToSelector:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue