+struct rxpd_rule*
+rxpd_rule_activate (struct rxpd_rule* self)
+{
+ if (self)
+ {
+ char* buf;
+ if (self->string[0] == '#' && (buf = strstr (self->string, ": ")+2) && *buf)
+ {
+ if (*buf != '#')
+ {
+ char* namestart = strchr (buf, ':');
+ char* rxstart = namestart? strchr (namestart+1, ':') : NULL;
+
+ if (!rxstart)
+ return NULL;
+
+ // TODO regflags from base
+ if (regcomp (&self->rx, rxstart+1, REG_EXTENDED|REG_ICASE|REG_NOSUB))
+ return NULL;
+
+ free (self->string);
+ self->string = rxpd_strdup (namestart+1);
+
+ if (namestart != buf)
+ {
+ /* atime given */
+ self->atime = atoi (buf);
+ if (!self->atime)
+ /* atime was zero or not set */
+ self->atime = time (NULL)-1;
+ }
+ }
+ else
+ self->string = rxpd_strdup (buf);
+ }
+ else
+ return NULL;
+ }
+ return self;
+}
+