]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
- userrec::ProcessNoticeMasks - provide a way to set or unset masks.
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 10 Jul 2006 16:04:06 +0000 (16:04 +0000)
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 10 Jul 2006 16:04:06 +0000 (16:04 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4276 e03df62e-2008-0410-955e-edbf42e46eb7

include/users.h
src/users.cpp

index 6f9c6d2969679cc18ed6867f9c3694b3f2d6b47d..64ebd5fb7ab7dcae2b30c5cbfb681050b768ad7a 100644 (file)
@@ -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);
index b18806016656813e63991fc82b40bd448881197d..f455bb8251e44bc985b2394b4cc5ee3a23e31a2a 100644 (file)
@@ -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]);