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

Re: [hobbit] hobbit-mailack questions



On Tue, Mar 21, 2006 at 11:55:56AM +1100, ZanDAhaR wrote:

> Obviously sms has no subject so I am just wondering how the mailack 
> would work when recieving a message back ? By default does it look for 
> the ACK code only in the subject or does it also look in the body ? If 
> by default it only looks in the subject is it possible for us to bodge 
> up the code and tell it to read from the body & subject, or just the body ?

Currently, it only looks in the subject for the ack code.

You can change that. Try this patch against the hobbit-mailack.c file:
Save it to a file, then run 
   patch hobbitd/hobbit-mailack.c </tmp/ack-body.patch
and re-compile with "make".

With this patch, you should be able to put a line into the message 
body with
   ack 129102
which is the ack code that is normally taken from the subject. You
can also put a
   delay=120
to make the ack valid for 120 minutes.

The first line which does not match either of these is taken a the
ack message which is displayed on the webpage.


Regards,
Henrik

--- hobbitd/hobbit-mailack.c	2005/07/16 09:53:14	1.10
+++ hobbitd/hobbit-mailack.c	2006/03/21 06:40:59
@@ -64,8 +64,14 @@
 				duration = durationvalue(inbuf+6);
 				continue;
 			}
-			/* Save the first line of the message body, but ignore blank lines */
+			else if ((subjectline == NULL) && (strncasecmp(inbuf, "ack ", 4) == 0)) {
+				/* Some systems cannot generate a subject. Allow them to ack
+				 * via text in the message body. */
+				subjectline = (char *)malloc(1024);
+				snprintf(subjectline, 1023, "Subject: Hobbit [%s]", inbuf+4);
+			}
 			else if (*inbuf && !firsttxtline) {
+				/* Save the first line of the message body, but ignore blank lines */
 				firsttxtline = strdup(inbuf);
 			}