From 0b44194981ecdb966bda19aac4cbf8d6609b5695 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 21 Dec 2009 22:58:59 +0100 Subject: [PATCH] Implement isds_mark_message_read() --- doc/user_web_services | 9 +++++++++ src/isds.c | 33 +++++++++++++++++++++++++++++++++ src/isds.h | 7 +++++++ 3 files changed, 49 insertions(+) diff --git a/doc/user_web_services b/doc/user_web_services index 1a49454..b68170c 100644 --- a/doc/user_web_services +++ b/doc/user_web_services @@ -217,6 +217,15 @@ Returend hash and timestamp are computed from whole message. You must get complete message inluding documents to be able to verify them. +MarkMessageAsDownloaded +======================= + +Change status of a message identidied by its ID as read. + +That means next GetListOfRecievedMessages service can exclude such message if +only unread messages requested. + + FindDataBox (*) =========== diff --git a/src/isds.c b/src/isds.c index 920932a..f5a5054 100644 --- a/src/isds.c +++ b/src/isds.c @@ -4363,6 +4363,39 @@ leave: } +/* Mark message as read. This is a transactional commit function to acknoledge + * to ISDS the message has been downloaded and processed by client properly. + * @context is session context + * @message_id is message identifier. */ +isds_error isds_mark_message_read(struct isds_ctx *context, + const char *message_id) { + /* ???: XSD allows list of @message_id's, but + * documentation talks only about `a message' */ + + isds_error err = IE_SUCCESS; + xmlDocPtr response = NULL; + xmlChar *code = NULL, *status_message = NULL; + + if (!context) return IE_INVALID_CONTEXT; + + /* Do request and check for success */ + err = build_send_check_message_request(context, SERVICE_DM_INFO, + BAD_CAST "MarkMessageAsDownloaded", message_id, + &response, &code, &status_message); + + free(code); + free(status_message); + xmlFreeDoc(response); + + if (!err) + isds_log(ILF_ISDS, ILL_DEBUG, + _("MarkMessageAsDownloaded request processed by server " + "successfully.\n") + ); + return err; +} + + #undef INSERT_STRING_ATTRIBUTE #undef INSERT_ULONGINTNOPTR #undef INSERT_ULONGINT diff --git a/src/isds.h b/src/isds.h index a7134dd..f1efe4f 100644 --- a/src/isds.h +++ b/src/isds.h @@ -579,6 +579,13 @@ isds_error isds_download_message_hash(struct isds_ctx *context, isds_error isds_compute_message_hash(struct isds_ctx *context, struct isds_message *message, const isds_hash_algorithm algorithm); +/* Mark message as read. This is a transactional commit function to acknoledge + * to ISDS the message has been downloaded and processed by client properly. + * @context is session context + * @message_id is message identifier. */ +isds_error isds_mark_message_read(struct isds_ctx *context, + const char *message_id); + /* Send bogus request to ISDS. * Just for test purposes */ isds_error isds_bogus_request(struct isds_ctx *context); -- 2.11.4.GIT