1:- module(bc_mail_unsubscribe, []).

HTTP handlers for mail unsubscription */

    5:- use_module(library(arouter)).    6:- use_module(library(dict_schema)).    7
    8:- use_module(bc_data_mail).    9
   10% Unsubscribes from single entry
   11% comments.
   12
   13:-  route_get(mail/unsubscribe/entry/CommentId,
   14    mail_unsubscribe_entry(CommentId)).   15
   16mail_unsubscribe_entry(CommentId):-
   17    bc_mail_unsubscribe_entry(CommentId),
   18    write_response.
   19
   20% Unsubscribes from all comments.
   21
   22:-  route_get(mail/unsubscribe/all/CommentId,
   23    mail_unsubscribe_all(CommentId)).   24
   25mail_unsubscribe_all(CommentId):-
   26    bc_mail_unsubscribe_all(CommentId),
   27    write_response.
   28
   29% FIXME use bc_view.
   30
   31write_response:-
   32    write('Content-type: text/plain; charset=UTF-8\r\n\r\n'),
   33    write('You have been unsubscribed.')