--- ../org/gateway-1.0.3/gw/urltrans.c	Wed Oct 25 14:26:05 2000
+++ ../gateway-1.0.3/gw/urltrans.c	Wed Feb  6 10:03:57 2002
@@ -208,10 +208,14 @@
 	len = strlen(pattern);
 	len += count_occurences(pattern, "%s") * maxword * ENCODED_LEN;
 	len += count_occurences(pattern, "%S") * maxword * ENCODED_LEN;
+	len += count_occurences(pattern, "%A") * 
+			(maxword + 1) * n * ENCODED_LEN;
 	len += count_occurences(pattern, "%a") * 
 			(maxword + 1) * n * ENCODED_LEN;
 	len += count_occurences(pattern, "%r") * 
 			(maxword + 1) * n * ENCODED_LEN;
+	len += count_occurences(pattern, "%R") * 
+			(maxword + 1) * n * ENCODED_LEN;
 	len += count_occurences(pattern, "%p") * 
 			octstr_len(request->smart_sms.receiver) * ENCODED_LEN;
 	len += count_occurences(pattern, "%P") * 
@@ -239,6 +243,7 @@
 		sprintf(s, "%.*s", (int) (p - pattern), pattern);
 		s = strchr(s, '\0');
 		switch (p[1]) {
+		case 'z': break; /* skip a word */
 		case 's':
 			encode_for_url(enc, words[nextarg]);
 			sprintf(s, "%s", enc);
@@ -262,6 +267,15 @@
 				s = strchr(s, '\0');
 			}
 			break;
+		case 'R': /* like %r but without url formatting */
+			for (j = nextarg; j < n; ++j) {
+				if (j == nextarg)
+					sprintf(s, "%s", words[j]);
+				else
+					sprintf(s, " %s", words[j]);
+				s = strchr(s, '\0');
+			}
+			break;
 
 			/* NOTE: the sender and receiver is already switched in
 			 *    message, so that's why we must use 'sender' when
@@ -306,6 +320,15 @@
 				s = strchr(s, '\0');
 			}
 			break;
+		case 'A': /* like %a but without url formatting */
+			for (j = 0; j < n; ++j) {
+				if (j > 0)
+					sprintf(s, " %s", words[j]);
+				else
+					sprintf(s, "%s", words[j]);
+				s = strchr(s, '\0');
+			}
+			break;
 		case 't':
 			tm = gw_gmtime(request->smart_sms.time);
 			sprintf(s, "%04d-%02d-%02d+%02d:%02d",
@@ -412,7 +435,7 @@
 static URLTranslation *create_onetrans(ConfigGroup *grp)
 {
     URLTranslation *ot;
-    char *keyword, *aliases, *url, *text, *file;
+    char *keyword, *aliases, *url, *text, *file, *execute;
     char *prefix, *suffix, *faked_sender, *max_msgs, *concatenation;
     char *split_chars, *split_suffix, *omit_empty;
     char *username, *password;
@@ -435,6 +458,7 @@
     aliases = config_get(grp, "aliases");
     url = config_get(grp, "url");
     text = config_get(grp, "text");
+    execute = config_get(grp, "execute");
     file = config_get(grp, "file");
     prefix = config_get(grp, "prefix");
     suffix = config_get(grp, "suffix");
@@ -465,6 +489,9 @@
     } else if (text) {
 	ot->type = TRANSTYPE_TEXT;
 	ot->pattern = gw_strdup(text);
+    } else if (execute) {
+	ot->type = TRANSTYPE_EXECUTE;
+	ot->pattern = gw_strdup(execute);
     } else if (username) {
 	ot->type = TRANSTYPE_SENDSMS;
 	ot->pattern = gw_strdup("");
@@ -518,7 +545,9 @@
 	ot->args = count_occurences(ot->pattern, "%s");
 	ot->args += count_occurences(ot->pattern, "%S");
 	ot->has_catchall_arg = (count_occurences(ot->pattern, "%r") > 0) ||
-	    (count_occurences(ot->pattern, "%a") > 0);
+	    (count_occurences(ot->pattern, "%a") > 0) ||
+	    (count_occurences(ot->pattern, "%A") > 0) ||
+	    (count_occurences(ot->pattern, "%R") > 0);
     }
     else { 		/* send-sms user */
 	ot->args = 0;
