gnokii-users
[Top][All Lists]
Advanced

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

Introduce --concat option to sendsms


From: Pavel Machek
Subject: Introduce --concat option to sendsms
Date: Tue, 4 Jun 2002 13:47:06 +0200
User-agent: Mutt/1.3.28i

Hi!

This allows user to manually add concatenated message header. If there
are no big complains, I'll commit it.
                                                                Pavel

Index: common/gsm-sms.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-sms.c,v
retrieving revision 1.90
diff -u -u -r1.90 gsm-sms.c
--- common/gsm-sms.c    4 Jun 2002 11:13:17 -0000       1.90
+++ common/gsm-sms.c    4 Jun 2002 11:44:23 -0000
@@ -1185,6 +1185,13 @@
                        rawsms->DCS = 0xf5;
                        break;
 
+               case SMS_Concat:
+                       printf("Encoding concat header\n");
+                       al = SMS_8bit;
+                       rawsms->DCS = 0xf5;
+                       EncodeConcatHeader(rawsms, 
sms->UserData[i].u.Concat.this, sms->UserData[i].u.Concat.total);
+                       break;
+
                case SMS_NoData:
                        return GE_NONE;
 
Index: gnokii/gnokii.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii.c,v
retrieving revision 1.249
diff -u -u -r1.249 gnokii.c
--- gnokii/gnokii.c     4 Jun 2002 11:13:17 -0000       1.249
+++ gnokii/gnokii.c     4 Jun 2002 11:44:56 -0000
@@ -397,7 +397,8 @@
 {
        fprintf(stderr, _(" usage: gnokii --sendsms destination\n"
                          "               [--smsc message_center_number | 
--smscno message_center_index]\n"
-                         "               [-r] [-C n] [-v n] [--long n]\n"
+                         "               [-r] [-C n] [-v n] [--long n] 
[--animation file;file;file;file]\n"
+                         "               [--concat this;total;serial]\n"
                          " Give the text of the message to the standard 
input.\n"
                          "   destination - phone number where to send SMS\n"
                          "   --smsc      - phone number of the SMSC\n"
@@ -474,6 +475,7 @@
                { "8bit",    0,                 NULL, '8'},
                { "imelody", 0,                 NULL, 'i'},
                { "animation",required_argument,NULL, 'a'},
+               { "concat",  required_argument, NULL, 'c'},
                { NULL,      0,                 NULL, 0}
        };
 
@@ -490,8 +492,6 @@
        optarg = NULL;
        optind = 0;
 
-       sms.UserData[0].Type = SMS_PlainText;
-       sms.UserData[1].Type = SMS_NoData;
        while ((i = getopt_long(argc, argv, "r8cC:v:i", options, NULL)) != -1) {
                switch (i) {       /* -8 is for 8-bit data, -c for compression. 
both are not yet implemented. */
                case '1': /* SMSC number */
@@ -555,12 +555,22 @@
                case 'v':
                        sms.Validity = atoi(optarg);
                        break;
+
                case '8':
                        sms.DCS.u.General.Alphabet = SMS_8bit;
                        input_len = GSM_MAX_8BIT_SMS_LENGTH;
                        break;
+
                case 'i':
                        sms.UserData[0].Type = SMS_iMelodyText;
+                       sms.UserData[1].Type = SMS_NoData;
+                       error = readtext(&sms.UserData[0], input_len);
+                       if (error != GE_NONE) return -1;
+                       if (sms.UserData[0].Length < 1) {
+                               fprintf(stderr, _("Empty message. 
Quitting.\n"));
+                               return -1;
+                       }
+                       curpos = -1;
                        break;
                default:
                        sendsms_usage();
@@ -574,6 +584,8 @@
                        fprintf(stderr, _("Empty message. Quitting.\n"));
                        return -1;
                }
+               sms.UserData[curpos++].Type = SMS_PlainText;
+               sms.UserData[curpos].Type = SMS_NoData;
        }
 
        data.SMS = &sms;
Index: include/gsm-sms.h
===================================================================
RCS file: /cvsroot/gnokii/gnokii/include/gsm-sms.h,v
retrieving revision 1.42
diff -u -u -r1.42 gsm-sms.h
--- include/gsm-sms.h   3 Jun 2002 20:30:43 -0000       1.42
+++ include/gsm-sms.h   4 Jun 2002 11:45:01 -0000
@@ -307,7 +307,8 @@
        SMS_MultiData    = 0x05,
        SMS_NokiaText    = 0x06,
        SMS_AnimationData= 0x07,
-       SMS_OtherData    = 0x08
+       SMS_Concat       = 0x08,
+       SMS_OtherData    = 0x09
 } SMS_DataType;
 
 /*** FOLDER INFO ***/
@@ -341,6 +342,10 @@
 } GSM_Multi;
 
 typedef struct {
+       int this, total, serial;
+} GSM_Concat;
+
+typedef struct {
        SMS_DataType Type;
        unsigned int Length;
        union {
@@ -349,6 +354,7 @@
                GSM_Bitmap Bitmap;
                GSM_Ringtone Ringtone;
                GSM_Bitmap Animation[4];
+               GSM_Concat Concat;
        } u;
 } SMS_UserData;
 

-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa



reply via email to

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