[hobbit] Icon Keywords
Henrik Stoerner
henrik at hswn.dk
Fri Mar 16 08:00:13 CET 2007
On Thu, Mar 15, 2007 at 04:19:55PM -0400, Aiello, Steve (GE, Corporate, consultant) wrote:
> Are there &keywords to access the other hobbit icons in reports ? I
> know &red will provide the red.gif. But is there a & keyword that I can
> get the red-recent.gif or red-ack.gif icons ?
No, but this patch should do it. Applies to 4.2.0 and current snapshots.
You can then use "&red-ack bla bla" or "&red-recent bla bla" in your
status messages.
Regards
Henrik
-------------- next part --------------
--- lib/htmllog.c 2006/11/17 14:50:01 1.53
+++ lib/htmllog.c 2007/03/16 06:58:57
@@ -93,26 +93,38 @@
restofmsg = msg;
do {
- int color;
+ int color, acked, recent;
+ color = -1; acked = recent = 0;
p = strchr(restofmsg, '&');
if (p) {
*p = '\0';
fprintf(output, "%s", restofmsg);
*p = '&';
- color = parse_color(p+1);
+ if (strncmp(p, "&red", 4) == 0) color = COL_RED;
+ else if (strncmp(p, "&yellow", 7) == 0) color = COL_YELLOW;
+ else if (strncmp(p, "&green", 6) == 0) color = COL_GREEN;
+ else if (strncmp(p, "&clear", 6) == 0) color = COL_CLEAR;
+ else if (strncmp(p, "&blue", 5) == 0) color = COL_BLUE;
+ else if (strncmp(p, "&purple", 7) == 0) color = COL_PURPLE;
+
if (color == -1) {
fprintf(output, "&");
restofmsg = p+1;
}
else {
+ acked = (strncmp(p + 1 + strlen(colorname(color)), "-acked", 6) == 0);
+ recent = (strncmp(p + 1 + strlen(colorname(color)), "-recent", 7) == 0);
+
fprintf(output, "<IMG SRC=\"%s/%s\" ALT=\"%s\" HEIGHT=\"%s\" WIDTH=\"%s\" BORDER=0>",
- xgetenv("BBSKIN"), dotgiffilename(color, 0, 0),
+ xgetenv("BBSKIN"), dotgiffilename(color, acked, !recent),
colorname(color),
xgetenv("DOTHEIGHT"), xgetenv("DOTWIDTH"));
restofmsg = p+1+strlen(colorname(color));
+ if (acked) restofmsg += 6;
+ if (recent) restofmsg += 7;
}
}
else {
More information about the Xymon
mailing list