gnokii-commit
[Top][All Lists]
Advanced

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

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-41


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-419-gea4ea98
Date: Fri, 07 Dec 2012 12:57:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  ea4ea9811ad12b741c5fef3d11d3300f4c8b5efa (commit)
      from  310b31a4b446ada706719c52b1e31caa66d15b27 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=ea4ea9811ad12b741c5fef3d11d3300f4c8b5efa


commit ea4ea9811ad12b741c5fef3d11d3300f4c8b5efa
Author: Daniele Forsi <address@hidden>
Date:   Fri Dec 7 12:02:13 2012 +0100

    Do not ignore the validity value passed to sms_prepare()
    
    The default value is still 3 days so nothing changes for users not
    explicitely setting a --validity value, other users will see their
    value applied.
    The value for TP-Validity-Period (TP-VP) set by the user was
    overwritten: first sms->validity was set in sms_default() as number of
    minutes corresponding to 3 days, then the value could be overridden by
    a program (eg. gnokii --sendsms --validity n), setting a possibly
    different number of minutes, but sms_prepare() would ignore it and set
    rawsms->validity[0] to a constant encoded value meaning again "3 days",
    so that changing the default value was in fact impossible.

diff --git a/ChangeLog b/ChangeLog
index 5603ebf..cdea1fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,8 @@
                                                    (Gustavo Conrad)
     o remove inline from the local_atoi() function definition and
       add static instead                                (Paweł Kot)
+    o don't overwrite the validity value passed by the caller to
+      sms_prepare() with the default value          (Daniele Forsi)
  * at driver updates
     o in the default case autodetect if PDU SMS starts with SMSC
                                                     (Daniele Forsi)
@@ -35,9 +37,11 @@
  * fake driver updates
     o always autodetect if PDU SMS starts with SMSC (Daniele Forsi)
     o make it usable with gnome-phone-manager       (Daniele Forsi)
- * Documentation updates
+ * documentation updates
     o samples for connect and disconnect scripts for Portech
       devices                                   (Guillermo Benitez)
+    o update man page with allowed values for --validity option of
+      --sendsms                                     (Daniele Forsi)
  * nk6510 driver updates
     o store also the seconds in date fields when reading phonebook
       entries from phone                            (Daniele Forsi)
diff --git a/Docs/man/gnokii.1 b/Docs/man/gnokii.1
index b75a6bc..0cee31d 100644
--- a/Docs/man/gnokii.1
+++ b/Docs/man/gnokii.1
@@ -242,7 +242,12 @@ Meaning of other optional parameters:
 
 \-C | \-\-class \fIn\fR \- Class Message \fIn\fR, where \fIn\fR can be 0..3
 
-\-v | \-\-validity \fIn\fR \- validity in minutes
+\-v | \-\-validity \fIn\fR \- validity in minutes, where \fIn\fR
+must be a multiple of 5 minutes between 5 and 720 (12 hours),
+or a multiple of 30 minutes between 750 (12 hours and half) and 1440 (1 day),
+or a multiple of 1440 minutes (1 day) between 2880 (2 days) and 43200 (30 
days),
+or a multiple of 10080 minutes (1 week) between 50400 (5 weeks) and 635040 (63 
weeks),
+all other values can't be encoded with the relative format and are currently 
unsupported.
 
 \-i | \-\-imelody \- send iMelody within SMS
 
diff --git a/common/gsm-sms.c b/common/gsm-sms.c
index dfe80eb..1430ec4 100644
--- a/common/gsm-sms.c
+++ b/common/gsm-sms.c
@@ -261,6 +261,30 @@ unsigned char *sms_timestamp_pack(gn_timestamp *dt, 
unsigned char *number)
 }
 
 /**
+ * minutes2validity - converts from a number of minutes to the PDU format
+ * @minutes: the number of minutes
+ *
+ * @minutes must be a multiple of 5 minutes between 5 minutes and 12 hours, a 
multiple of 30
+ * minutes between 12 1/2 hours and 24 hours, a multiple of 24 hours between 2 
days and 30 days
+ * and a multiple of 1 week between 5 weeks and 63 weeks, else the return 
value is undefined.
+ *
+ * Returns: the value encoded according to TS 23.040 Section 9.2.3.12.1 TP-VP 
(Relative format)
+ */
+static unsigned char minutes2validity(unsigned int minutes)
+{
+       /* Relative format can encode only some values! */
+       if (minutes <= (143 + 1) * 5)
+               return minutes / 5 - 1;
+       else if (minutes <= 12 * 60 + (167 - 143) * 30)
+               return (minutes - 12 * 60) / 30 + 143;
+       else if (minutes <= (196 - 166) * 60 * 24)
+               return minutes / 24 / 60 + 166;
+       else if (minutes <= (255 - 192) * 60 * 24 * 7)
+               return minutes / 60 / 24 / 7 + 192;
+       else return 255;
+}
+
+/**
  * validity2minutes - converts from the PDU format to a number of minutes
  * @minutes: the value encoded according to TS 23.040 Section 9.2.3.12.1 TP-VP 
(Relative format)
  *
@@ -1577,7 +1601,7 @@ gn_error sms_prepare(gn_sms *sms, gn_sms_raw *rawsms)
                return GN_ERR_ENTRYTOOLONG;
        }
        rawsms->validity_indicator = GN_SMS_VP_RelativeFormat;
-       rawsms->validity[0] = GN_SMS_VP_72H;
+       rawsms->validity[0] = minutes2validity(sms->validity);
 
        for (i = 0; i < sms->udh.number; i++)
                if (sms->udh.udh[i].type == GN_SMS_UDH_ConcatenatedMessages)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    6 +++++-
 Docs/man/gnokii.1 |    7 ++++++-
 common/gsm-sms.c  |   26 +++++++++++++++++++++++++-
 3 files changed, 36 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]