[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] mailack question
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] mailack question
- From: "Ralph Mitchell" <ralphmitchell (at) gmail.com>
- Date: Wed, 9 Jul 2008 12:04:23 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=SPWeoYzwII9CHniQ6WCFdNQC28+fTR3DnhDlSUtuRnY=; b=LJUrkNF7R0vgj/w5ymQSC25JFFuCSDkGkUtbqswFRkTTk3b0uTFeIdkq+63Wy3j3pC B/GlS9rvlwRi0z22PmkFsYJs7bbGSnYgN1zVvogPqHrFd9eCmCmB7M4NhPmyD5mOzGMB OTIKEZDO2AlqC3Iy+pdw+PJ0emFDqIEOMbrEs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=K1IpC3DflE73vEtLeRcb1d2uh564Vw98cC+eAdbdTrenWLm/gqyE89m7pOZtHRgaIj sZV++37hbPWrCz1Kuf40ROG91xl2gvEpJuB4ssfKmnT1CxZeM7s6tGC5DyqlvRN6gPFU 0G6W29syBQ5mR9uHZpJVf5gciop7EuG4XrPZ0=
- References: <4862E66C.6090700 (at) zandahar.net>
On Wed, Jun 25, 2008 at 7:44 PM, Allan Spencer <allan (at) zandahar.net> wrote:
> HI all
>
> A LONG time ago I asked about ack'ing an alert via email (or via
> sms-to-email) and to be able to do so without a subject. A patch was written
> at the time and it was included into the main codebase but unfortunately I
> did not get a chance to imeplement what I wanted to and never ended up
> testing it. Thats has just changed recently and now I am having issues
> acking an alert via text in the body.
>
> If i reply to an email and maintain the subject it works fine, if I try cut
> the subject and paste it as the body nothing happens. I havent gone as far
> as testing it via the sms-to-email app yet as I cant get it working from a
> normal email.
The hobbit-mailack.c program loops through the incoming email, looking for
interesting stuff. Here's where it finds the subject line:
else if (strncasecmp(STRBUF(inbuf), "subject:", 8) == 0)
subjectline = strdup(skipwhitespace(STRBUF(inbuf)+8));
Once the headers are done with, it goes on to look for some things in the
email body, such as "delay=" and "ack=":
else if ((strncasecmp(STRBUF(inbuf), "ack=", 4) == 0) ||
(strncasecmp(STRBUF(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]", STRBUF(inbuf)+4);
}
So, does the email body contain a line that starts with "ack=NNNNNN" or "ack
NNNNN"?? If not, it won't match the above code fragment. It looks like it
should be *just* the number, as that gets filled in between the square
brackets in the faked subject line.
I noticed something else interesting in the code. The last thing it does is
call sendmessage, handing it a buffer loaded like this:
p += sprintf(p, "hobbitdack %s %d %s", cookie, duration, firsttxtline);
if (fromline) {
p += sprintf(p, "\nAcked by: %s", fromline);
}
I figured it wouldn't hurt to try doing this:
server/bin/bb localhost "hobbitdack NNNNNN 60 this thing is broken
Acked by: me (at) this.domain.com"
where NNNNNN came from a real, current warning message. Note the placement
of the double-quotes - there needs to be a newline between the message and
"Acked by". And now, just below the "Status unchanged in...." message at
the bottom of the page I find this:
Current acknowledgment: this thing is broken
Acked by: me (at) this.domain.com
Next update at: 12:54 2008-07-09
and there's a nice yellow check mark on the all-non-green page. So it looks
like an ACK *can* be sent via the command line...
Ralph