Next: , Previous: Dealing with List Headers, Up: Tutorial


7.5 Working with Subscriptions

liblistserv provides you with three functions to get the subscribers with their options from lists:

listserv_getsubscriber
returns options for one subscriber on one list
listserv_getsubscribers
returns options for one subscriber on many lists
listserv_getsubscriptions
returns options for all subscibers on one list

Example:

     struct listserv_subscriber *subscriber =
        listserv_getsubscriber (l, "ABC-L", "nichts@aegee.org");
     if (subscriber == NULL)
         printf ("nichts@aegee.org is not subscribed to ABC-L.\n");
     else
         printf ("nichts@aegee.org is subscribed on ABC-L since %s.\n",
                subscriber->date);

The other two functions return NULL terminated array of struct listserv_subscribers:

     struct listserv_subscribers **subscribers;
     // get the lists where nichts@aegee.org is subscribed
     subscribers = listserv_getsubscriptions (l, "nichts@aegee.org");
     // get all subscribers of the list ABC-L
     subscribers = listserv_getsubscribers (l, "ABC-L");