Next: , Previous: Owned Lists, Up: Tutorial


7.4 Dealing with List Headers

With listserv_getfile you can get a file from listserv. One very special kind of files are the .list files. liblistserv gives you the possibility to read and store list headers as well as to parse them to get the active values of the keywords.

       char* list_header = listserv_getheader (l, "ABC-L", 0);

The last parameter says if the list header must be locked.

Now list_header contains something like

     * Address Book Coordination
     *
     * Owner = nichts@aegee.org

You can store the list header back to the server with

     listserv_putheader (l, "ABC-L", list_header);

Or you can install a new list with:

       listserv_putheader (l, "DEF-L", "\
     * This Effective Liblistserv!\r\n\
     * \r\n\
     * Owner = nichts@example.org\r\n\
     * Owner = Quiet:, invalid-address@example.org");

If you want to check the values of some keyword, you can use listserv_getlist_keyword:

     char **owner = listserv_getlist_keyword (l, "DEF-L", "Owner");

Now owner[0] contains "nichts@example.org" , owner[1] contains "Quiet:", owner[2] is "invalid-address@example.org", and owner[3] is NULL.

If some keyword is not presented in the list header, you get its default value:

     char **ack = listserv_getlist_keyword(l, "DEF-L", "Ack");

ack[0] is "No" and ack[1] is NULL.