#include "users.h"
#include "channels.h"
#include "modules.h"
-
#include "inspircd.h"
/* $ModDesc: Forces opers to join the specified channel(s) on oper-up */
-
-
class ModuleOperjoin : public Module
{
private:
std::string operChan;
+ std::vector<std::string> operChans;
ConfigReader* conf;
conf = new ConfigReader(ServerInstance);
operChan = conf->ReadValue("operjoin", "channel", 0);
+ operChans.clear();
+ if (!operChan.empty())
+ tokenize(operChan,operChans);
}
void Implements(char* List)
{
DELETE(conf);
conf = new ConfigReader(ServerInstance);
+ operChan = conf->ReadValue("operjoin", "channel", 0);
+ operChans.clear();
+ if (!operChan.empty())
+ tokenize(operChan,operChans);
}
virtual ~ModuleOperjoin()
virtual void OnPostOper(userrec* user, const std::string &opertype)
{
- if(operChan != "")
- {
- std::vector<std::string> operChans;
- tokenize(operChan,operChans);
- for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
- chanrec::JoinUser(ServerInstance, user, it->c_str(), false);
- }
+ if (!IS_LOCAL(user))
+ return;
+ for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
+ if (ServerInstance->IsChannel(it->c_str()))
+ chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "");
}
};