- while (go_again)
- {
- go_again = false;
- for (UserList::iterator iter = listusers.begin(); iter != listusers.end(); iter++)
- {
- /*
- * What we do here:
- * - Get where they are up to
- * - If it's > GetChannelCount, erase them from the iterator, set go_again to true
- * - If not, spool the next 20 channels
- */
- userrec* u = (userrec*)(*iter);
- ListData* ld = (ListData*)u->GetExt("safelist_cache");
- if (ld->list_position > Srv->GetChannelCount())
- {
- u->Shrink("safelist_cache");
- delete ld;
- listusers.erase(iter);
- go_again = true;
- break;
- }
+ while (go_again)
+ {
+ go_again = false;
+ for (UserList::iterator iter = listusers.begin(); iter != listusers.end(); iter++)
+ {
+ /*
+ * What we do here:
+ * - Get where they are up to
+ * - If it's more than total number of channels, erase
+ * them from the iterator, set go_again to true
+ * - If not, spool more channels
+ */
+ userrec* u = (userrec*)(*iter);
+ ListData* ld;
+ u->GetExt("safelist_cache", ld);
+ if ((size_t)ld->list_position > ServerInstance->chanlist.size())
+ {
+ u->Shrink("safelist_cache");
+ DELETE(ld);
+ listusers.erase(iter);
+ go_again = true;
+ break;
+ }