[OGo-Developer] stuffing an NSArray into a NSMutableDictionary
Sebastian Reitenbach
developer@opengroupware.org
Mon, 16 Apr 2007 09:04:29 +0200
Hi,
I am trying to create a NSMutableDictionary. I want to store the information
about Asterisk queues in it. It should look like the following:
dict = {
queue1 = {
key1=value1;
key2=value2;
Agents = (
{
key1=value1;
key2=value2;
},
{
key1=value1;
key2=value2;
};
);
}
}
Adding the list of queues to the dict is no problem. but when I try to add
the Agents array to each Queue, it is just doing working. I tried a lot of
variations, one is shown below, but I do not get it to store it in there,
must be some stupid thing I am just doing wrong ;)
else {
/* need to sort the output in multiple */
NSEnumerator *e;
NSMutableDictionary *tmpdict;
id event;
tmpdict = [[NSMutableDictionary alloc] init];
e = [self->multipleReturn objectEnumerator];
while ((event = [e nextObject])) {
if ([[event objectForKey:@"Event"] hasSuffix:@" QueueParams"]) {
/* the queue description, their parameters */
[tmpdict takeValue:event forKey:[event objectForKey:@"Queue"]];
} else {
/* queue members */
if ([[tmpdict objectForKey:[event objectForKey:@"Queue"]]
objectForKey:@"Agents"] == nil) {
[[tmpdict objectForKey:[event objectForKey:@"Queue"]] takeValue:
[[NSMutableArray alloc] init] forKey:@"Agents"];
}
[[[tmpdict objectForKey:[event objectForKey:@"Queue"]]
objectForKey:@"Agents"]
addObject:event];
}
}
any hint is very appreciated.
kind regards
Sebastian