summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-10 16:04:06 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-10 16:04:06 +0000
commit91436d31a4ab6657012743285a1e635073e8966f (patch)
treecd00d97b826a57f4b8cec30572fa82d3c9750287
parent13f2f363bd9a3493030a6008774deb7bf4ef6e96 (diff)
- userrec::ProcessNoticeMasks - provide a way to set or unset masks.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4276 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/users.h2
-rw-r--r--src/users.cpp27
2 files changed, 29 insertions, 0 deletions
diff --git a/include/users.h b/include/users.h
index 6f9c6d296..64ebd5fb7 100644
--- a/include/users.h
+++ b/include/users.h
@@ -274,6 +274,8 @@ class userrec : public connection
*/
const char* FormatNoticeMasks();
+ bool userrec::ProcessNoticeMasks(const char *sm);
+
bool IsNoticeMaskSet(unsigned char sm);
void SetNoticeMask(unsigned char sm, bool value);
diff --git a/src/users.cpp b/src/users.cpp
index b18806016..f455bb825 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -110,6 +110,33 @@ bool DoneClassesAndTypes(const char* tag)
return true;
}
+bool userrec::ProcessNoticeMasks(const char *sm)
+{
+ bool adding = true;
+ const char *c = sm;
+
+ while (c && *c)
+ {
+ switch (*c)
+ {
+ case '+':
+ adding = true;
+ break;
+ case '-':
+ adding = false;
+ break;
+ default:
+ if ((*c >= 'A') && (*c <= 'z'))
+ this->SetNoticeMask(*c, adding);
+ break;
+ }
+
+ *c++;
+ }
+
+ return true;
+}
+
bool userrec::IsNoticeMaskSet(unsigned char sm)
{
return (snomasks[sm-65]);