Re: the use of DLR_IS_ENABLED macro on smsbox.c

adi <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
On Fri, Sep 26, 2003 at 11:32:01AM +0200, Alexander Malysh wrote:
> sounds resonable for me... Can you please send clean unified patch against 
> cvs? Thanks... (like: cvs diff -Nau )

We have to make sure that trans != NULL while calling
strip_prefix_and_suffix().

The new diff output attached.

Regards,

P.Y. Adi Prasaja
x_kannel_dlr_mask-2.diff (text/plain, 2.4 KB)
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.231
diff -a -u -r1.231 smsbox.c
--- gw/smsbox.c	23 Aug 2003 22:30:11 -0000	1.231
+++ gw/smsbox.c	27 Sep 2003 04:17:51 -0000
@@ -302,6 +302,7 @@
    	/* to remember if it's a DLR http get */
     
     receiver->trans = trans;
+    receiver->msg->sms.sms_type = msg->sms.sms_type;
 
     /* remember the HTTP request if we need to queue this */
     receiver->method = method;
@@ -1002,7 +1003,8 @@
             http_header_get_content_type(reply_headers, &type, &charset);
             if (octstr_case_compare(type, text_html) == 0 ||
                 octstr_case_compare(type, text_wml) == 0) {
-                strip_prefix_and_suffix(reply_body, urltrans_prefix(trans), 
+		if (trans != NULL)
+                    strip_prefix_and_suffix(reply_body, urltrans_prefix(trans), 
                                         urltrans_suffix(trans));
                 replytext = html_to_sms(reply_body);
                 octstr_strip_blanks(replytext);
@@ -1068,14 +1070,12 @@
         if (reply_body == NULL)
             reply_body = octstr_imm("");
 
-        if (!DLR_IS_ENABLED(msg->sms.dlr_mask)) {
-            alog("SMS HTTP-request sender:%s request: '%s' "
-                 "url: '%s' reply: %d '%s'",
-                 octstr_get_cstr(msg->sms.receiver),
-                 (msg->sms.msgdata != NULL) ? octstr_get_cstr(msg->sms.msgdata) : "",
-                 octstr_get_cstr(final_url), status,	
-                 (status == HTTP_OK) ? "<< successful >>" : octstr_get_cstr(reply_body));
-        }
+        alog("SMS HTTP-request sender:%s request: '%s' "
+            "url: '%s' reply: %d '%s'",
+            octstr_get_cstr(msg->sms.receiver),
+            (msg->sms.msgdata != NULL) ? octstr_get_cstr(msg->sms.msgdata) : "",
+            octstr_get_cstr(final_url), status,	
+            (status == HTTP_OK) ? "<< successful >>" : octstr_get_cstr(reply_body));
 
 requeued:
         octstr_destroy(final_url);
@@ -1085,7 +1085,7 @@
         http_destroy_headers(req_headers);
         octstr_destroy(req_body);
     
-        if (!DLR_IS_ENABLED(msg->sms.dlr_mask) && !queued) {
+        if (msg->sms.sms_type != report && !queued) {
             if (send_message(trans, msg) < 0)
                 error(0, "failed to send message to phone");
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.