diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_botmode.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_cban.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_censor.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_check.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_park.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_services.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_services_account.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_showwhois.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 27 | ||||
-rw-r--r-- | src/modules/m_stripcolor.cpp | 2 |
12 files changed, 23 insertions, 40 deletions
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 08ac72bcf..f39be098c 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -145,9 +145,9 @@ class ModuleSQLOper : public Module strlcpy(user->oper,rowresult->GetField("type").c_str(),NICKMAX-1); WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,rowresult->GetField("type").c_str()); WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,rowresult->GetField("type").c_str()); - if(!strchr(user->modes,'o')) + if(user->modes[UM_OPERATOR]) { - strcat(user->modes,"o"); + user->modes[UM_OPERATOR] = 1; WriteServ(user->fd,"MODE %s :+o",user->nick); FOREACH_MOD(I_OnOper,OnOper(user,rowresult->GetField("type"))); AddOper(user); diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 04204b42e..612eb3b9c 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -68,7 +68,7 @@ class ModuleBotMode : public Module virtual void OnWhois(userrec* src, userrec* dst) { - if (strchr(dst->modes,'B')) + if (dst->modes['B'-65]) { Srv->SendTo(NULL,src,"335 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is a \2bot\2 on "+Srv->GetNetworkName()); } diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 06284a964..fd6a92c22 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -164,7 +164,7 @@ class ModuleCBan : public Module /* check cbans in here, and apply as necessary. */ for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++) { - if(iter->chname == cname && !strchr(user->modes, 'o')) + if(iter->chname == cname && !user->modes[UM_OPERATOR]) { // Channel is banned. WriteServ(user->fd, "384 %s %s :Cannot join channel, CBANed (%s)", user->nick, cname, iter->reason.c_str()); diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 6a5acb54c..8c8bfc001 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -119,12 +119,12 @@ class ModuleCensor : public Module if (target_type == TYPE_USER) { userrec* t = (userrec*)dest; - active = (strchr(t->modes,'G') > 0); + active = t->modes['G'-65]; } else if (target_type == TYPE_CHANNEL) { chanrec* t = (chanrec*)dest; - active = (t->IsModeSet('G')); + active = t->IsModeSet('G'); } if (active) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 3ab31ebbc..5e7b4847c 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -70,7 +70,7 @@ class cmd_check : public command_t Srv->SendTo(NULL, user, checkstr + " nuh " + targuser->GetFullHost()); Srv->SendTo(NULL, user, checkstr + " realnuh " + targuser->GetFullRealHost()); Srv->SendTo(NULL, user, checkstr + " realname " + targuser->fullname); - Srv->SendTo(NULL, user, checkstr + " modes +" + targuser->modes); + Srv->SendTo(NULL, user, checkstr + " modes +" + targuser->FormatModes()); Srv->SendTo(NULL, user, checkstr + " server " + targuser->server); if (targuser->awaymsg[0] != 0) { diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index b6c723ca7..9a7124dda 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -234,7 +234,7 @@ class ModuleHelpop : public Module virtual void OnWhois(userrec* src, userrec* dst) { - if (strchr(dst->modes,'h')) + if (dst->modes['h'-65]) { Srv->SendTo(NULL,src,"310 "+std::string(src->nick)+" "+std::string(dst->nick)+" :is available for help."); } diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 7abe31baf..a5c62da19 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -161,11 +161,11 @@ class cmd_unpark : public command_t } } // remove all their old modes - WriteServ(user->fd,"MODE %s -%s",user->nick,user->modes); + WriteServ(user->fd,"MODE %s -%s",user->nick,user->FormatModes()); // now, map them to the parked user, while nobody can see :p Srv->PseudoToUser(user,unpark,"Unparked to "+std::string(parameters[0])); // set all their new modes - WriteServ(unpark->fd,"MODE %s +%s",unpark->nick,unpark->modes); + WriteServ(unpark->fd,"MODE %s +%s",unpark->nick,unpark->FormatModes()); // spool their away log to them WriteServ(unpark->fd,"NOTICE %s :*** You are now unparked. You have successfully taken back the nickname and privilages of %s.",unpark->nick,unpark->nick); for (awaylog::iterator i = awy->begin(); i != awy->end(); i++) diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 4d5183841..c868eefef 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -54,7 +54,7 @@ class ModuleServices : public Module /* <- :stitch.chatspike.net 307 w00t w00t :is a registered nick */ virtual void OnWhois(userrec* source, userrec* dest) { - if (strchr(dest->modes, 'r')) + if (dest->modes['r'-65]) { /* user is registered */ WriteServ(source->fd, "307 %s %s :is a registered nick", source->nick, dest->nick); @@ -69,7 +69,7 @@ class ModuleServices : public Module virtual void OnUserPostNick(userrec* user, const std::string &oldnick) { /* On nickchange, if they have +r, remove it */ - if (strchr(user->modes,'r')) + if (user->modes['r'-65]) { char* modechange[2]; modechange[0] = user->nick; @@ -133,7 +133,7 @@ class ModuleServices : public Module if (target_type == TYPE_CHANNEL) { chanrec* c = (chanrec*)dest; - if ((c->IsModeSet('M')) && (!strchr(user->modes,'r'))) + if ((c->IsModeSet('M')) && (!user->modes['r'-65])) { if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server)) || (!strcmp(user->server,""))) { @@ -148,7 +148,7 @@ class ModuleServices : public Module if (target_type == TYPE_USER) { userrec* u = (userrec*)dest; - if ((strchr(u->modes,'R')) && (!strchr(user->modes,'r'))) + if ((u->modes['R'-65]) && (user->modes['r'-65])) { if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server))) { @@ -174,7 +174,7 @@ class ModuleServices : public Module { if (chan->IsModeSet('R')) { - if (!strchr(user->modes,'r')) + if (user->modes['r'-65]) { if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server))) { diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 62e9baf17..c27e103b7 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -105,7 +105,7 @@ class ModuleServicesAccount : public Module { userrec* u = (userrec*)dest; - if ((strchr(u->modes,'R')) && (!account)) + if ((u->modes['R'-65]) && (!account)) { if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server))) { diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index dddd29406..519b13352 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -48,7 +48,7 @@ class ModuleShowwhois : public Module virtual void OnWhois(userrec* source, userrec* dest) { - if((strchr(dest->modes,'W')) && (source != dest)) + if ((dest->modes['W'-65]) && (source != dest)) { WriteServ(dest->fd,"NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host); } diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 841206b8f..076241dea 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1176,24 +1176,10 @@ class TreeSocket : public InspSocket strlcpy(clientlist[tempnick]->fullname, params[7].c_str(),MAXGECOS); clientlist[tempnick]->registered = 7; clientlist[tempnick]->signon = age; - strlcpy(clientlist[tempnick]->modes, params[5].c_str(),53); - for (char *v = clientlist[tempnick]->modes; *v; v++) + for (std::string::iterator v = params[5].begin(); v != params[5].end(); v++) { - switch (*v) - { - case 'i': - clientlist[tempnick]->modebits |= UM_INVISIBLE; - break; - case 'w': - clientlist[tempnick]->modebits |= UM_WALLOPS; - break; - case 's': - clientlist[tempnick]->modebits |= UM_SERVERNOTICE; - break; - default: - break; - } + clientlist[tempnick]->modes[(*v)-65] = 1; } inet_aton(params[6].c_str(),&clientlist[tempnick]->ip4); @@ -1391,7 +1377,7 @@ class TreeSocket : public InspSocket { if (u->second->registered == 7) { - snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->modes,inet_ntoa(u->second->ip4),u->second->fullname); + snprintf(data,MAXBUF,":%s NICK %lu %s %s %s %s +%s %s :%s",u->second->server,(unsigned long)u->second->age,u->second->nick,u->second->host,u->second->dhost,u->second->ident,u->second->FormatModes(),inet_ntoa(u->second->ip4),u->second->fullname); this->WriteLine(data); if (*u->second->oper) { @@ -1555,11 +1541,8 @@ class TreeSocket : public InspSocket userrec* u = Srv->FindNick(prefix); if (u) { + u->modes[UM_OPERATOR] = 1; strlcpy(u->oper,opertype.c_str(),NICKMAX-1); - if (!strchr(u->modes,'o')) - { - strcat(u->modes,"o"); - } DoOneToAllButSender(u->nick,"OPERTYPE",params,u->server); } return true; @@ -3667,7 +3650,7 @@ class ModuleSpanningTree : public Module params.push_back(user->host); params.push_back(user->dhost); params.push_back(user->ident); - params.push_back("+"+std::string(user->modes)); + params.push_back("+"+std::string(user->FormatModes())); params.push_back((char*)inet_ntoa(user->ip4)); params.push_back(":"+std::string(user->fullname)); DoOneToMany(Srv->GetServerName(),"NICK",params); diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 0875399b8..1b8f8c72d 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -128,7 +128,7 @@ class ModuleStripColor : public Module if (target_type == TYPE_USER) { userrec* t = (userrec*)dest; - active = (strchr(t->modes,'S') > 0); + active = t->modes['S'-65]; } else if (target_type == TYPE_CHANNEL) { |