Re: [PATCH obexd 2/3] MAP: Add set read status function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sunil,

On Thu, Sep 13, 2012 at 9:06 AM, Sunil Kumar Behera
<sunil.behera@xxxxxxxxxxx> wrote:
> This function will inform MAP server to modify the
> read status of a given message.
> ---
>  plugins/mas.c              |   25 +++++++++++++++++++++++++
>  plugins/messages-dummy.c   |    8 ++++++++
>  plugins/messages-tracker.c |    8 ++++++++
>  plugins/messages.h         |   17 +++++++++++++++++
>  4 files changed, 58 insertions(+)
>
> diff --git a/plugins/mas.c b/plugins/mas.c
> index f2ff9e6..182dc6b 100644
> --- a/plugins/mas.c
> +++ b/plugins/mas.c
> @@ -46,6 +46,8 @@
>
>  #include "messages.h"
>
> +#define READ_STATUS_REQ 0
> +
>  /* Channel number according to bluez doc/assigned-numbers.txt */
>  #define MAS_CHANNEL    16
>
> @@ -499,6 +501,20 @@ static void update_inbox_cb(void *session, int err, void *user_data)
>                 obex_object_set_io_flags(mas, G_IO_OUT, 0);
>  }
>
> +static void set_read_status_cb(void *session, int err, void *user_data)
> +{
> +       struct mas_session *mas = user_data;
> +
> +       DBG("");
> +
> +       mas->finished = TRUE;
> +
> +       if (err < 0)
> +               obex_object_set_io_flags(mas, G_IO_ERR, err);
> +       else
> +               obex_object_set_io_flags(mas, G_IO_OUT, 0);
> +}
> +
>  static int mas_setpath(struct obex_session *os, void *user_data)
>  {
>         const char *name;
> @@ -677,6 +693,15 @@ static void *message_set_status_open(const char *name, int oflag, mode_t mode,
>                 return NULL;
>         }
>
> +       if (indicator == READ_STATUS_REQ)
> +               *err = messages_set_read_status(mas->backend_data, name,
> +                                       value, set_read_status_cb, mas);
> +       else
> +               *err = -EBADR;
> +
> +       if (*err < 0)
> +               return NULL;
> +
>         return mas;
>  }
>
> diff --git a/plugins/messages-dummy.c b/plugins/messages-dummy.c
> index a47f143..627f87a 100644
> --- a/plugins/messages-dummy.c
> +++ b/plugins/messages-dummy.c
> @@ -353,6 +353,14 @@ int messages_update_inbox(void *session, messages_update_inbox_cb callback,
>         return -ENOSYS;
>  }
>
> +int messages_set_read_status(void *session, const char *handle,
> +                                       uint8_t value,
> +                                       messages_set_read_status_cb callback,
> +                                       void *user_data)
> +{
> +       return -ENOSYS;
> +}
> +
>  void messages_abort(void *s)
>  {
>         struct session *session = s;
> diff --git a/plugins/messages-tracker.c b/plugins/messages-tracker.c
> index 92c1767..13c113e 100644
> --- a/plugins/messages-tracker.c
> +++ b/plugins/messages-tracker.c
> @@ -327,6 +327,14 @@ int messages_update_inbox(void *session, messages_update_inbox_cb callback,
>         return -ENOSYS;
>  }
>
> +int messages_set_read_status(void *session, const char *handle,
> +                                       uint8_t value,
> +                                       messages_set_read_status_cb callback,
> +                                       void *user_data)
> +{
> +       return -ENOSYS;
> +}
> +
>  void messages_abort(void *session)
>  {
>  }
> diff --git a/plugins/messages.h b/plugins/messages.h
> index 669f7c2..02d4f37 100644
> --- a/plugins/messages.h
> +++ b/plugins/messages.h
> @@ -280,6 +280,23 @@ typedef void (*messages_update_inbox_cb)(void *session, int err,
>  int messages_update_inbox(void *session, messages_update_inbox_cb callback,
>                                                         void *user_data);
>
> +/* Informs Message Server to modify read status of a given message.
> + *
> + * session: Backend session.
> + * handle: Unique identifier to the message.
> + * value: Indicates the new value of the read status for a given message.
> + * Callback shall be called for every read status update request
> + *     recieved from MCE.
> + * user_data: User data if any to be sent.
> + */
> +typedef void (*messages_set_read_status_cb)(void *session, int err,
> +               void *user_data);
> +
> +int messages_set_read_status(void *session, const char *handle,
> +                                       uint8_t value,
> +                                       messages_set_read_status_cb callback,
> +                                       void *user_data);

We can simplify here and just name this function messages_set_read and
messages_set_read_cb for the callbackl. Also I noticed that you are
not aligning to the right when you need to split due to 80 columns,
can you fix that as well?


-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux