Index: gw/dlr.c
===================================================================
RCS file: /home/cvs/gateway/gw/dlr.c,v
retrieving revision 1.8
diff -u -r1.8 dlr.c
--- gw/dlr.c	8 Mar 2002 17:27:40 -0000	1.8
+++ gw/dlr.c	17 Mar 2002 18:51:24 -0000
@@ -338,9 +338,12 @@
     {
     	debug("dlr.dlr",0,"ignoring DLR message because of mask");
     }
- 
-    if((typ & DLR_BUFFERED) &&
-    	((dlr_mask & DLR_SUCCESS) || (dlr_mask & DLR_FAIL)))
+
+    if (
+	( (typ & DLR_SMSC_SUCCESS) && (dlr_mask & (DLR_SUCCESS | DLR_BUFFERED | DLR_FAIL)) )
+	||
+	( (typ & DLR_BUFFERED) && (dlr_mask & (DLR_SUCCESS | DLR_FAIL)) )
+	)
     {
     	debug("dlr.mysql",0,"dlr not deleted because we wait on more reports");
     }
@@ -414,8 +417,11 @@
 	   	octstr_destroy(text);
 		msg=NULL;
 	   }
-	    if ((typ & DLR_BUFFERED) && 
-	       ((dlr_mask & DLR_SUCCESS) || (dlr_mask & DLR_FAIL))) {
+	    if (
+		( (typ & DLR_SMSC_SUCCESS) && (dlr_mask & (DLR_SUCCESS | DLR_BUFFERED | DLR_FAIL)) )
+		||
+		( (typ & DLR_BUFFERED) && (dlr_mask & (DLR_SUCCESS | DLR_FAIL)) )
+		)
 	        info(0,"dlr not destroyed, still waiting for other delivery report"); 
 	    } else {
 		list_delete(dlr_waiting_list,i,1);
