Xymon Mailing List Archive search

hobbit-mailack questions

6 messages in this thread

list Allan Spencer · Tue, 21 Mar 2006 11:55:56 +1100 ·
Hey guys

Previously we have only use email to pager and pure email for alerts out of hobbit but recently have been fiddling with some email to sms software and am wanting to integrate it into hobbit. We've never used the mailack before so I set it up before and got it all working with a mail reply. After playing with the sms software some more it has raised a few more questions so here goes.

The sms software uses a phone connected via serial and collects mail messages from a pop3 account and then sends them via them phone itself. 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 ?

The SMS comes into the phone, the software sucks it out of the phone and sends it via smtp to a user via a relay host. When it does this you get 2 choices...leave the subject blank...or put some text in there such as 'SMS Message' so theres no way of being able to have a subject with the ACK code in there.

The software we are currently testing is from http://www.winsms.com and its actually the Linux version even tho the Windows version is exactly the same.

I know the SMS bit is a little beyond the default operation but I'm sure you can see why we would want to achieve something like this.

Any help would be greatly appreciated

Allan
list Henrik Størner · Tue, 21 Mar 2006 07:46:05 +0100 ·
quoted from Allan Spencer
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

-------------- next part --------------
--- 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);
 			}
list Allan Spencer · Wed, 22 Mar 2006 09:19:07 +1100 ·
quoted from Henrik Størner
Henrik Stoerner wrote:
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);
 			}
 
Henrik I'm guessing by the timestamp on the patch file that you only 
just created this patch after I mailed about it ?

If so I cannot thank you enough and I'm sure many others will also. Your 
constant work effort and dedication to hobbit is excellent :)

Allan Spencer
Corporate Learning Systems
list Asif Iqbal · Tue, 21 Mar 2006 19:16:15 -0500 ·
quoted from Allan Spencer
On Wed, Mar 22, 2006 at 09:19:07AM, ZanDAhaR wrote:
Henrik I'm guessing by the timestamp on the patch file that you only 
just created this patch after I mailed about it ?

If so I cannot thank you enough and I'm sure many others will also. Your 
constant work effort and dedication to hobbit is excellent :)
Can't agree more. Never seen any other developer/coder so dedicated to
his users.

Kudos Henrik
Allan Spencer
Corporate Learning Systems
-- 
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
"..there are two kinds of people: those who work and those who take the credit...try
 to be in the first group;...less competition there."  - Indira Gandhi
list Allan Spencer · Wed, 22 Mar 2006 13:01:19 +1100 ·
quoted from Allan Spencer
ZanDAhaR wrote:
Henrik Stoerner wrote:
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);
 			}
 
Henrik I'm guessing by the timestamp on the patch file that you only 
just created this patch after I mailed about it ?

If so I cannot thank you enough and I'm sure many others will also. 
Your constant work effort and dedication to hobbit is excellent :)

Allan Spencer
Corporate Learning Systems
Replying back to my own mail here but anyway

Henrik will the contents of this patch be included in future releases of 
hobbit ?

Cheers

Allan
list Henrik Størner · Wed, 22 Mar 2006 14:02:06 +0100 ·
quoted from Allan Spencer
On Wed, Mar 22, 2006 at 01:01:19PM +1100, ZanDAhaR wrote:
Henrik I'm guessing by the timestamp on the patch file that you only >just created this patch after I mailed about it ?
You're right. When I get a good suggestion like that, I often
put it in right away so I won't forget.
quoted from Allan Spencer
If so I cannot thank you enough and I'm sure many others will also. >Your constant work effort and dedication to hobbit is excellent :)
Henrik will the contents of this patch be included in future releases of hobbit ?
Yes. In fact, it's already in todays snapshot.


Regards,
Henrik