- if (user->chans[i].channel->name)
- {
- cmp = std::string(user->chans[i].channel->name) + " ";
- if (!strstr(lst.c_str(),cmp.c_str()))
+ /* XXX - Why does this check need to be here at all? :< */
+ /* Commenting this out until someone finds a case where we need it */
+ //if (lst.find(rec->channel->name) == std::string::npos)
+ //{
+
+ /*
+ * If the target is the same as the sender, let them see all their channels.
+ * If the channel is NOT private/secret AND the user is not invisible.
+ * If the user is an oper, and the <options:operspywhois> option is set.
+ */
+ if ((source == user) || (*source->oper && Config->OperSpyWhois) || (((!rec->channel->modes[CM_PRIVATE]) && (!rec->channel->modes[CM_SECRET]) && !(user->modebits & UM_INVISIBLE)) || (rec->channel->HasUser(source))))