let CHECK in 'sublists' also autoload lists
authorChristian Thaeter <ct@pipapo.org>
Thu, 8 Nov 2007 06:04:39 +0000 (07:04 +0100)
committerChristian Thaeter <ct@pipapo.org>
Thu, 8 Nov 2007 06:04:39 +0000 (07:04 +0100)
src/rxpd_connection_cmd.c

index b4d3c62..bc95510 100644 (file)
@@ -65,13 +65,19 @@ rxpd_connection_do_CHECK (struct rxpd_connection* self, char* line, struct rxpd_
                   strncat (subname, &rule->string[1], sublen);
 
                   struct rxpd_file* subfile = (struct rxpd_file*) psplay_find (&base->files, subname);
-                  if (subfile)
+                  if (!subfile)
                     {
-                      rxpd_log (base, LOG_DEBUG, "going to sublist '%s'\n", subname);
-                      ret = rxpd_connection_do_CHECK (self, line, subfile);
+                      subfile = rxpd_file_new (base, subname);
+                      if (subfile)
+                        {
+                          rxpd_buffer_printf (&self->out, "#ERROR: illegal filename\n");
+                          break;
+                        }
+                      rxpd_file_load (self->file);
                     }
-                  else
-                    rxpd_log (base, LOG_ERR, "sublist '%s' does not exist\n", subname);
+
+                  rxpd_log (base, LOG_DEBUG, "going to sublist '%s'\n", subname);
+                  ret = rxpd_connection_do_CHECK (self, line, subfile);
                 }
 
               if (ret)