- UserCategoryItem *categoryItem;
- int categoryId = UserCategoryItem::categoryFromModes(_ircChannel->userModes(ircUser));
- if(!(categoryItem = qobject_cast<UserCategoryItem *>(childById(qHash(categoryId))))) {
- categoryItem = new UserCategoryItem(categoryId, this);
- newChild(categoryItem);
+ QHash<UserCategoryItem *, QList<IrcUser *> > categories;
+ foreach(IrcUser *ircUser, ircUsers) {
+ UserCategoryItem *categoryItem;
+ int categoryId = UserCategoryItem::categoryFromModes(_ircChannel->userModes(ircUser));
+ if(!(categoryItem = qobject_cast<UserCategoryItem *>(childById(qHash(categoryId))))) {
+ categoryItem = new UserCategoryItem(categoryId, this);
+ categories[categoryItem] = QList<IrcUser *>();
+ newChild(categoryItem);
+ }
+ categories[categoryItem] << ircUser;