]> andersk Git - moira.git/blobdiff - gen/mailhub.dc
only on people who have or ever had poboxes
[moira.git] / gen / mailhub.dc
index 2d00e65de848c0a2c95296ec80741f07e18875b3..e5f420d4f483cb0fc6f4d22afca9b7de9e7b62e9 100644 (file)
@@ -123,6 +123,7 @@ struct member {
 struct list {
     char *name;
     char maillist;
+    char *description;
     char acl_t;
     int acl_id;
     struct member *m;
@@ -247,17 +248,18 @@ get_info()
     lists = create_hash(15000);
 
     EXEC SQL DECLARE l_cursor CURSOR FOR
-      SELECT list_id, name, maillist, acl_type, acl_id
+      SELECT list_id, name, maillist, description, acl_type, acl_id
       FROM list
       WHERE active != 0
       ORDER BY list_id;
     EXEC SQL OPEN l_cursor;
     while (1) {
-        EXEC SQL FETCH l_cursor INTO :id, :name, :maillistp, :type, :acl;
+        EXEC SQL FETCH l_cursor INTO :id, :name, :maillistp, :buf, :type, :acl;
         if (sqlca.sqlcode != 0) break;
        l = (struct list *) perm_malloc(sizeof(struct list));
        l->name = pstrsave(strtrim(name));
        l->maillist = maillistp;
+       l->description = pstrsave(strtrim(buf));
        l->acl_t = type[0];
        l->acl_id = acl;
        l->m = (struct member *) NULL;
@@ -535,6 +537,7 @@ register struct list *l;
     register struct member *m;
     register struct user *u;
 
+    put_fill(out, l->description);
     if (l->acl_t ==  'L' &&
        (l1 = (struct list *) hash_lookup(lists, l->acl_id)))
       fprintf(out, "owner-%s: %s\n%s: ", l->name, l1->name, l->name);
@@ -594,6 +597,53 @@ register char *s;
 }
 
 
+put_fill(aliases, string)
+FILE *aliases;
+register char *string;
+{
+    register char *c;
+    register int lwid;
+    register int wwid;
+
+    if (string == 0 || *string == 0) return;
+    fputs("#  ", aliases);
+    lwid = 3;
+
+    while (1) {
+       while (*string && *string == ' ') string++;
+       c = (char *)index(string, ' ');
+       if (c == 0) {
+           wwid = strlen(string);
+       } else {
+           wwid = c - string;
+           *c = 0;
+       }
+
+       if ((lwid + wwid) > ML_WID) {
+           fputs("\n#  ", aliases);
+           lwid = 3;
+           fputs(string, aliases);
+       } else {
+           fputs(string, aliases);
+       }
+
+       if (c == (char *)0) break;
+       /* add a space after the word */
+       (void) fputc(' ', aliases);
+       wwid++;
+       lwid += wwid;
+       string += wwid;
+       /* add another if after a period */
+       if (*--c == '.') {
+           (void) fputc(' ', aliases);
+           lwid++;
+       }
+    }
+
+    (void) fputc('\n', aliases);
+}
+
+
 do_people()
 {
     incount = 0;
This page took 0.39043 seconds and 4 git commands to generate.