- (BOOL)primaryIsInternetAutoresponderEnabledForUser:(NSString *)_uid;
- (BOOL)primaryIsIntranetAutoresponderEnabledForUser:(NSString *)_uid;
-- (id)primaryGetMailAutoresponderAttribute:(NSString *)_uid;
+- (NGLdapAttribute *)primaryGetMailAutoresponderAttribute:(NSString *)_uid;
+- (BOOL)isAutoresponderEnabledForAttribute:(NGLdapAttribute *)_attr
+ matchingPrefix:(NSString *)_prefix;
@end
// TODO: add a timer to flush LRU caches every some hours
}
- (BOOL)primaryIsInternetAutoresponderEnabledForUser:(NSString *)_uid {
- return NO;
+ NGLdapAttribute *attr;
+
+ attr = [self primaryGetMailAutoresponderAttribute:_uid];
+ if (!attr) return NO;
+ return [self isAutoresponderEnabledForAttribute:attr matchingPrefix:@"60~"];
}
- (BOOL)isIntranetAutoresponderEnabledForUser:(NSString *)_uid {
}
- (BOOL)primaryIsIntranetAutoresponderEnabledForUser:(NSString *)_uid {
+ NGLdapAttribute *attr;
+
+ attr = [self primaryGetMailAutoresponderAttribute:_uid];
+ if (!attr) return NO;
+ return [self isAutoresponderEnabledForAttribute:attr matchingPrefix:@"50~"];
+}
+
+- (BOOL)isAutoresponderEnabledForAttribute:(NGLdapAttribute *)_attr
+ matchingPrefix:(NSString *)_prefix
+{
+ unsigned i, count;
+
+ count = [_attr count];
+ for (i = 0; i < count; i++) {
+ NSString *value;
+
+ value = [_attr stringValueAtIndex:i];
+ if ([value hasPrefix:_prefix]) {
+ if ([value rangeOfString:@"DFIN:0"].length > 0)
+ return NO;
+ return YES;
+ }
+ }
return NO;
}
-- (id)primaryGetMailAutoresponderAttribute:(NSString *)_uid {
+- (NGLdapAttribute *)primaryGetMailAutoresponderAttribute:(NSString *)_uid {
static NSArray *attrs = nil;
NGLdapConnection *conn;
EOQualifier *q;
return nil;
}
attr = [entry attributeWithName:mailAutoresponderAttrName];
- if(attr == nil) {
- return nil; /* nothing we can do about it */
- }
- /* ZNeK: TODO
- * ... we need to have the proper specs before we can do anything about it
- */
- [self warnWithFormat:@"%s TODO", __PRETTY_FUNCTION__];
- return nil;
+ return attr;
}
/* debugging */