All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [patch 19/20] SMS: introduce sms_msg_cancel and its D-Bus wrapper
Date: Tue, 27 Jul 2010 12:16:46 -0500	[thread overview]
Message-ID: <4C4F147E.5000706@gmail.com> (raw)
In-Reply-To: <6d6f0ad3aacec87f5a6e75fed17e1020bfcddb0a.1279918330.git.inaky.perez-gonzalez@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3368 bytes --]

Hi Inaky,

On 07/23/2010 04:00 PM, Inaky Perez-Gonzalez wrote:
> From: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
> 
> This introduces the ability to cancel a pending SMS message,
> accessible via an internal API and over a D-Bus wrapper.
> 
> Sending a note to the network to cancel an in-transit message is not
> yet implemented.
> 
> Note the test case code requires follow up commits that propagate the
> message's state changes over D-Bus.
> ---
>  src/sms.c                |   63 +++++++++++++++++
>  src/smsutil.h            |   15 ++++
>  test/test-sms-msg-cancel |  173 ++++++++++++++++++++++++++++++++++++++++++++++

Multiple patches please.  One for each directory.

>  3 files changed, 251 insertions(+), 0 deletions(-)
>  create mode 100755 test/test-sms-msg-cancel
> 
> diff --git a/src/sms.c b/src/sms.c
> index c0b2e00..97c9eab 100644
> --- a/src/sms.c
> +++ b/src/sms.c
> @@ -538,6 +538,24 @@ static void __ofono_sms_tx_state_set(struct tx_queue_entry *entry,
>  
>  
>  /*
> + * Note that the D-Bus specific cleanups are taken care by the
> + * sms_msg_dbus_destroy() callback passed in dbus_sms_msg_send().
> + */
> +static DBusMessage *dbus_sms_msg_cancel(
> +	DBusConnection * conn, DBusMessage *msg, void *data)
> +{
> +	gboolean do_network_cancel = FALSE;
> +	struct tx_queue_entry *sms_msg = data;
> +	if (!dbus_message_get_args(msg, NULL,
> +				   DBUS_TYPE_BOOLEAN, &do_network_cancel))
> +		return __ofono_error_invalid_args(msg);
> +	sms_msg_cancel(sms_msg,
> +		       do_network_cancel ? SMS_MSG_CANCEL_IN_NETWORK : 0);
> +	return dbus_message_new_method_return(msg);
> +}
> +
> +

You're ignoring about every part of the coding standard in this chunk...

> +/**
> + * Cancel a pending SMS message
> + *
> + * @sms_msg: message to cancel
> + * @flags: modifies for the action
> + *
> + * This function cancels a message that is pending or being
> + * actively transmitted. Note that after this function returns, the
> + * @sms_msg handle is no longer valid.
> + *
> + * \internal
> + *
> + * There is no need to cancel the calling of tx_next() by
> + * g_timeout_add() scheduled in sms_msg_send(). The rationale behind
> + * this is that the tx_next() function is scheduled to go over the
> + * list of messages in the @sms object, so it might have been
> + * scheduled for other messages also rather than just for this one
> + * @sms_msg. By the time it gets to run, it might see the list empty
> + * or see other messages, but @sms_msg won't be there.
> + */
> +void sms_msg_cancel(struct tx_queue_entry *sms_msg,
> +		    enum sms_msg_cancel_flags flags)
> +{
> +	struct ofono_sms *sms = sms_msg->sms_mgr;
> +	DBG("%s (%p)\n", __func__, sms_msg);
> +	if (sms_msg->state == OFONO_SMS_TX_ST_QUEUED)
> +		g_queue_remove(sms->txq, sms_msg);
> +	else if (sms_msg->state == OFONO_SMS_TX_ST_WSR)
> +		g_queue_remove(sms->tx_wsrq, sms_msg);
> +	ofono_sms_tx_state_set(sms_msg, OFONO_SMS_TX_ST_CANCELING);
> +	if (flags & SMS_MSG_CANCEL_IN_NETWORK)
> +		ofono_warn("%s(): SMS_MSG_CANCEL_IN_NETWORK support "
> +			   "not yet implemented\n", __func__);
> +	ofono_sms_tx_state_set(sms_msg, OFONO_SMS_TX_ST_CANCELLED);
> +	tx_queue_entry_destroy_free(sms_msg, NULL);
> +}
> +
> +

And again ignoring the coding standard...

Regards,
-Denis

  reply	other threads:[~2010-07-27 17:16 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 20:59 [patch 00/20] SMS D-Bus support and misc small patches Inaky Perez-Gonzalez
2010-07-23 20:59 ` [patch 01/20] bug.h: Add BUILD_BUG_ON() and friends for compile-time assert checking Inaky Perez-Gonzalez
2010-07-23 21:41   ` Denis Kenzior
2010-07-23 21:57     ` Inaky Perez-Gonzalez
2010-07-23 21:59       ` Denis Kenzior
2010-07-23 20:59 ` [patch 02/20] write_file: make transaction-safe Inaky Perez-Gonzalez
2010-07-23 21:57   ` Denis Kenzior
2010-07-23 22:31     ` Inaky Perez-Gonzalez
2010-07-23 20:59 ` [patch 03/20] manpage: explain debugging options to -d Inaky Perez-Gonzalez
2010-07-23 22:05   ` Denis Kenzior
2010-07-23 20:59 ` [patch 04/20] SMS: introduce message ID API Inaky Perez-Gonzalez
2010-07-27  0:10   ` Denis Kenzior
2010-07-23 20:59 ` [patch 05/20] introduce DECLARE_SMS_ADDR_STR() Inaky Perez-Gonzalez
2010-07-23 22:30   ` Denis Kenzior
2010-07-23 20:59 ` [patch 06/20] _assembly_encode_address: export and rename Inaky Perez-Gonzalez
2010-07-23 22:31   ` Denis Kenzior
2010-07-23 20:59 ` [patch 07/20] SMS: implement SHA256-based message IDs [incomplete] Inaky Perez-Gonzalez
2010-07-27 17:03   ` Denis Kenzior
2010-07-29 21:26     ` Inaky Perez-Gonzalez
2010-07-29 21:37       ` Denis Kenzior
2010-07-31  0:22         ` Inaky Perez-Gonzalez
2010-07-23 20:59 ` [patch 08/20] sms: document the org.ofono.SMSMessage D-Bus interface Inaky Perez-Gonzalez
2010-07-23 23:11   ` Denis Kenzior
2010-07-26 17:19     ` Inaky Perez-Gonzalez
2010-07-26 18:05       ` Denis Kenzior
2010-07-26 20:41         ` Inaky Perez-Gonzalez
2010-07-23 20:59 ` [patch 09/20] SMS: document handle_sms_status_report() Inaky Perez-Gonzalez
2010-07-23 20:59 ` [patch 10/20] sms_text_prepare: document @use_delivery_reports Inaky Perez-Gonzalez
2010-07-23 23:01   ` Denis Kenzior
2010-07-23 20:59 ` [patch 11/20] SMS: rename create_tx_queue_entry() to tx_queue_entry_new() Inaky Perez-Gonzalez
2010-07-23 23:02   ` Denis Kenzior
2010-07-26 20:49     ` Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 12/20] struct tx_queue_entry: add a destructor Inaky Perez-Gonzalez
2010-07-23 23:06   ` Denis Kenzior
2010-07-23 23:11     ` Inaky Perez-Gonzalez
2010-07-23 23:14       ` Denis Kenzior
2010-07-26 18:48         ` Inaky Perez-Gonzalez
2010-07-26 20:49     ` Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 13/20] SMS: encapsulate D-Bus specific data in 'struct sms_msg_dbus_data' Inaky Perez-Gonzalez
2010-07-27 17:08   ` Denis Kenzior
2010-07-29 21:47     ` Inaky Perez-Gonzalez
2010-07-29 22:17       ` Denis Kenzior
2010-07-29 23:23         ` Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 14/20] SMS: introduce bare state machine and transitions Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 15/20] SMS: introduce Wait-for-Status-Report state and infrastructure Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 16/20] SMS: introduce a state change callback for TX messages Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 17/20] SMS: export outgoing messages over D-Bus Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 18/20] SMS: send D-Bus SMS-MSG::PropertyChanged signals when message changes status Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 19/20] SMS: introduce sms_msg_cancel and its D-Bus wrapper Inaky Perez-Gonzalez
2010-07-27 17:16   ` Denis Kenzior [this message]
2010-07-30 23:12     ` Inaky Perez-Gonzalez
2010-07-23 21:00 ` [patch 20/20] SMS: Implement D-Bus SMS-MSG::GetProperties Inaky Perez-Gonzalez
2010-07-27 17:18   ` Denis Kenzior
2010-08-02 19:14     ` Inaky Perez-Gonzalez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C4F147E.5000706@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.