- bool display = (match(chan->name, ld->glob.c_str()) || (*chan->topic && match(chan->topic, ld->glob.c_str())));
- if ((users) && (display))
+ bool display = (InspIRCd::Match(chan->name, ld->glob) || (!chan->topic.empty() && InspIRCd::Match(chan->topic, ld->glob)));
+
+ if (!users || !display)
+ {
+ ld->list_position++;
+ continue;
+ }
+
+ /* +s, not in chan / not got channels/auspex */
+ if (chan->IsModeSet('s') && !is_special)
+ {
+ ld->list_position++;
+ continue;
+ }
+
+ if (chan->IsModeSet('p') && !is_special)