--- gateway/gw/smsbox.c.orig	Mon Dec 31 18:46:00 2001
+++ gateway/gw/smsbox.c	Wed Jan  2 11:47:29 2002
@@ -1371,7 +1373,9 @@
     Octstr *account;
     int dlr_mask = 0;
     int mclass, mwi, coding, compress, validity, deferred;
- 
+    List *list_to;
+    Octstr *mto;
+
     from = to = user = pass = udh = smsc = dlr_url = account = NULL;
    
     get_x_kannel_from_headers(headers, &from, &to, &udh,
@@ -1418,11 +1422,19 @@
 	    ret = octstr_create("Unsupported content-type, rejected");
 	}
 
-	if (ret == NULL)
-	    ret = smsbox_req_handle(t, client_ip, from, to, body, charset,
-				    udh, smsc, mclass, mwi, coding, compress, 
-				    validity, deferred, status, 
-				    dlr_mask, dlr_url, account);
+	/* multi-cast support: checks if <to> has several receivers separated
+	 * by a white character and request a smsbox handler for each one */	
+	if (ret == NULL) {
+	    list_to = octstr_split_words(to);
+	    mto = NULL;
+	    while ((mto = list_extract_first(list_to)) != NULL) {	
+		ret = smsbox_req_handle(t, client_ip, from, mto, body, charset,
+					udh, smsc, mclass, mwi, coding, compress, 
+					validity, deferred, status, 
+					dlr_mask, dlr_url, account);
+	    }
+	    list_destroy(list_to, NULL);
+	}
 
 	octstr_destroy(type);
 	octstr_destroy(charset);
