summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-08 17:53:03 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-08 17:53:03 +0000
commit3f389a4bd951cbf6f8ca139473647eaae0447322 (patch)
tree916fe4d48aa33f0fdb090e860fb4659c792d132d
parent33ed72a1dfae595132dd50c760b6a312ef2ce8fe (diff)
Convert new +isw modes to new mode format
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4176 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/users.h5
-rw-r--r--src/modes/umode_i.cpp13
-rw-r--r--src/modes/umode_s.cpp13
-rw-r--r--src/modes/umode_w.cpp13
-rw-r--r--src/users.cpp13
5 files changed, 39 insertions, 18 deletions
diff --git a/include/users.h b/include/users.h
index 30e524e85..383439c0b 100644
--- a/include/users.h
+++ b/include/users.h
@@ -263,6 +263,11 @@ class userrec : public connection
* e.g. through a module, then this method will ignore it and return the true hostname.
*/
virtual char* GetFullRealHost();
+
+ /*
+ * Create a displayable mode string for this users umodes
+ */
+ const char* FormatModes();
/** Returns true if a user is invited to a channel.
*/
diff --git a/src/modes/umode_i.cpp b/src/modes/umode_i.cpp
index 08af105ca..584a12ff5 100644
--- a/src/modes/umode_i.cpp
+++ b/src/modes/umode_i.cpp
@@ -12,14 +12,15 @@ ModeAction ModeUserInvisible::OnModeChange(userrec* source, userrec* dest, chanr
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))
- return MODEACTION_ALLOW;
+ return MODEACTION_DENY;
/* Set the bitfields */
- adding ? dest->modebits |= UM_INVISIBLE : dest->modebits &= ~UM_INVISIBLE;
-
- /* Use the bitfields to build the user's mode string */
- ModeParser::BuildModeString(dest);
+ if (dest->modes[UM_INVISIBLE] != adding)
+ {
+ dest->modes[UM_INVISIBLE] = adding;
+ return MODEACTION_ALLOW;
+ }
/* Allow the change */
- return MODEACTION_ALLOW;
+ return MODEACTION_DENY;
}
diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp
index a56e29034..0c005f56a 100644
--- a/src/modes/umode_s.cpp
+++ b/src/modes/umode_s.cpp
@@ -12,14 +12,15 @@ ModeAction ModeUserServerNotice::OnModeChange(userrec* source, userrec* dest, ch
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))
- return MODEACTION_ALLOW;
+ return MODEACTION_DENY;
/* Set the bitfields */
- adding ? dest->modebits |= UM_SERVERNOTICE : dest->modebits &= ~UM_SERVERNOTICE;
-
- /* Use the bitfields to build the user's mode string */
- ModeParser::BuildModeString(dest);
+ if (dest->modes[UM_SERVERNOTICE] != adding)
+ {
+ dest->modes[UM_SERVERNOTICE] = adding;
+ return MODEACTION_ALLOW;
+ }
/* Allow the change */
- return MODEACTION_ALLOW;
+ return MODEACTION_DENY;
}
diff --git a/src/modes/umode_w.cpp b/src/modes/umode_w.cpp
index 9115a6786..8cfbf8fd2 100644
--- a/src/modes/umode_w.cpp
+++ b/src/modes/umode_w.cpp
@@ -12,14 +12,15 @@ ModeAction ModeUserWallops::OnModeChange(userrec* source, userrec* dest, chanrec
{
/* Only opers can change other users modes */
if ((source != dest) && (!*source->oper))
- return MODEACTION_ALLOW;
+ return MODEACTION_DENY;
/* Set the bitfields */
- adding ? dest->modebits |= UM_WALLOPS : dest->modebits &= ~UM_WALLOPS;
-
- /* Use the bitfields to build the user's mode string */
- ModeParser::BuildModeString(dest);
+ if (dest->modes[UM_WALLOPS] != adding)
+ {
+ dest->modes[UM_WALLOPS] = adding;
+ return MODEACTION_ALLOW;
+ }
/* Allow the change */
- return MODEACTION_ALLOW;
+ return MODEACTION_DENY;
}
diff --git a/src/users.cpp b/src/users.cpp
index 78409dc6f..48ce0054b 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -110,6 +110,19 @@ bool DoneClassesAndTypes(const char* tag)
return true;
}
+const char* userrec::FormatModes()
+{
+ static char data[MAXBUF];
+ int offset = 0;
+ for (int n = 0; n < 64; n++)
+ {
+ if (modes[n])
+ data[offset++] = n+65;
+ }
+ data[offset] = 0;
+ return data;
+}
+
userrec::userrec()
{
// the PROPER way to do it, AVOID bzero at *ALL* costs