*/
#include "inspircd.h"
-#include "users.h"
-#include "modules.h"
#include "inspstring.h"
-#include "mode.h"
/* +s (secret) */
#include "modes/cmode_s.h"
void ModeHandler::ChangeCount(int modifier)
{
count += modifier;
+ ServerInstance->Log(DEBUG,"Change count for mode %c is now %d", mode, count);
}
ModeType ModeHandler::GetModeType()
{
}
+void ModeHandler::DisplayEmptyList(userrec* user, chanrec* channel)
+{
+}
+
bool ModeHandler::CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
{
return (ours < theirs);
if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP))
{
user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++);
+ mh->DisplayEmptyList(user, targetchannel);
continue;
}
/* Yerk, invalid! */
if ((parameter.find(':') == 0) || (parameter.rfind(' ') != std::string::npos))
- parameter = "";
+ parameter.clear();
}
else
{
/* Add the mode letter */
output_sequence.push_back(modechar);
+ modehandlers[handler_id]->ChangeCount(adding ? 1 : -1);
+
/* Is there a valid parameter for this mode? If so add it to the parameter list */
if ((modehandlers[handler_id]->GetNumParams(adding)) && (!parameter.empty()))
{
else
{
/* No mode handler? Unknown mode character then. */
- user->WriteServ("472 %s %c :is unknown mode char to me",user->nick, modechar);
+ user->WriteServ("%d %s %c :is unknown mode char to me", type == MODETYPE_CHANNEL ? 472 : 501, user->nick, modechar);
}
break;
}
* If they do that, thats their problem, and if i ever EVER see an
* official InspIRCd developer do that, i'll beat them with a paddle!
*/
- if ((mh->GetModeChar() < 'A') || (mh->GetModeChar() > 'z'))
+ if ((mh->GetModeChar() < 'A') || (mh->GetModeChar() > 'z') || (mh->GetPrefix() > 126))
return false;
/* A mode prefix of ',' is not acceptable, it would fuck up server to server.
for (unsigned char mode = 'A'; mode <= 'z'; mode++)
{
+ if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h'))
+ continue;
+
unsigned char pos = (mode-65) | MASK_CHANNEL;
if (modehandlers[pos])
for (unsigned char mode = 'A'; mode <= 'z'; mode++)
{
+ if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h'))
+ continue;
+
unsigned char pos = (mode-65) | MASK_CHANNEL;
if ((modehandlers[pos]) && (modehandlers[pos]->GetNumParams(true)))
for (unsigned char mode = 'A'; mode <= 'z'; mode++)
{
+ if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h'))
+ continue;
+
unsigned char pos = (mode-65) | MASK_CHANNEL;
/* One parameter when adding */
if (modehandlers[pos])
for (unsigned char mode = 'A'; mode <= 'z'; mode++)
{
+ if ((!ServerInstance->Config->AllowHalfop) && (mode == 'h'))
+ continue;
+
unsigned char pos = (mode-65) | MASK_CHANNEL;
if ((modehandlers[pos]) && (modehandlers[pos]->GetPrefix()))
if (channel->IsModeSet(this->GetModeChar()))
{
- userrec* n = new userrec(ServerInstance);
-
sprintf(moderemove,"-%c",this->GetModeChar());
- n->SetFd(FD_MAGIC_NUMBER);
-
- ServerInstance->SendMode(parameters, 2, n);
-
- delete n;
+ ServerInstance->SendMode(parameters, 2, ServerInstance->FakeClient);
}
}