Implement a per-connection-class default usermode option.
[ircu2.10.12-pk.git] / ircd / ircd_parser.y
index c79272ff353605c77befbeb88403186548c24fc3..4aa34881009607999cce85f973ea2663bb0d31b2 100644 (file)
@@ -154,6 +154,7 @@ static void parse_error(char *pattern,...) {
 %token QUARANTINE
 %token PSEUDO
 %token PREPEND
+%token USERMODE
 /* and now a lot of priviledges... */
 %token TPRIV_CHAN_LIMIT TPRIV_MODE_LCHAN TPRIV_DEOP_LCHAN TPRIV_WALK_LCHAN
 %token TPRIV_KILL TPRIV_LOCAL_KILL TPRIV_REHASH TPRIV_RESTART TPRIV_DIE
@@ -328,19 +329,22 @@ classblock: CLASS {
   tconn = 0;
   maxlinks = 0;
   sendq = 0;
+  pass = NULL;
 } '{' classitems '}'
 {
   if (name != NULL)
   {
    add_class(name, tping, tconn, maxlinks, sendq);
+   find_class(name)->default_umode = pass;
   }
   else {
    parse_error("Missing name in class block");
   }
+  pass = NULL;
 } ';';
 classitems: classitem classitems | classitem;
 classitem: classname | classpingfreq | classconnfreq | classmaxlinks |
-           classsendq | error;
+           classsendq | classusermode | error;
 classname: NAME '=' QSTRING ';'
 {
   MyFree(name);
@@ -362,6 +366,12 @@ classsendq: SENDQ '=' sizespec ';'
 {
   sendq = yylval.num;
 };
+classusermode: USERMODE '=' QSTRING ';'
+{
+  if (pass)
+    MyFree(pass);
+  DupString(pass, yylval.text);
+};
 
 connectblock: CONNECT
 {