]> jfr.im git - irc/atheme/atheme.git/commitdiff
libathemecore/entity: add new entity validator for taking +F (ref #427)
authorWilliam Pitcock <redacted>
Sun, 1 Mar 2015 19:08:03 +0000 (13:08 -0600)
committerWilliam Pitcock <redacted>
Sun, 1 Mar 2015 19:08:03 +0000 (13:08 -0600)
include/entity-validation.h
include/entity.h
libathemecore/entity.c

index b7faf4685fb25ba65610920639d7ac75515bef3d..db2f78f1855e1ce12b25bfbc0d15d676756b1b08 100644 (file)
@@ -10,6 +10,7 @@ struct entity_chanacs_validation_vtable {
        chanacs_t *(*match_user)(chanacs_t *ca, user_t *mt);
 
        bool (*can_register_channel)(myentity_t *mt);
+       bool (*allow_foundership)(myentity_t *mt);
 };
 
 E entity_chanacs_validation_vtable_t *myentity_get_chanacs_validator(myentity_t *mt);
index 5d9cbfcc462587277f74ca154492e4e2f6035487..d28ae2408a2b4b832ba6d78e7ac6417c47e96480 100644 (file)
@@ -62,6 +62,7 @@ E void myentity_stats(void (*cb)(const char *line, void *privdata), void *privda
 /* chanacs */
 E unsigned int myentity_count_channels_with_flagset(myentity_t *mt, unsigned int flagset);
 E bool myentity_can_register_channel(myentity_t *mt);
+E bool myentity_allow_foundership(myentity_t *mt);
 
 typedef struct {
        myentity_t *entity;
index 56cb9fe4fb8119e48aa1773e3126e487909e0166..8cb18d39d1efc0d8c7242364526b55b8f16bc481 100644 (file)
@@ -182,9 +182,15 @@ static bool linear_can_register_channel(myentity_t *mt)
        return has_priv_myuser(mu, PRIV_REG_NOLIMIT);
 }
 
+static bool linear_allow_foundership(myentity_t *mt)
+{
+       return true;
+}
+
 entity_chanacs_validation_vtable_t linear_chanacs_validate = {
        .match_entity = linear_chanacs_match_entity,
        .can_register_channel = linear_can_register_channel,
+       .allow_foundership = linear_allow_foundership,
 };
 
 entity_chanacs_validation_vtable_t *myentity_get_chanacs_validator(myentity_t *mt)
@@ -222,3 +228,15 @@ bool myentity_can_register_channel(myentity_t *mt)
        return (myentity_count_channels_with_flagset(mt, CA_FOUNDER) < chansvs.maxchans);
 }
 
+bool myentity_allow_foundership(myentity_t *mt)
+{
+       entity_chanacs_validation_vtable_t *vt;
+
+       return_val_if_fail(mt != NULL, false);
+
+       vt = myentity_get_chanacs_validator(mt);
+       if (vt->allow_foundership)
+               return vt->allow_foundership(mt);
+
+       return false;
+}