projects
/
gnucomo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f629153
)
Extract the hostname out of the 'From:' or 'Message-Id:' line
author
arjen
<arjen>
Sat, 29 Mar 2003 09:04:10 +0000
(09:04 +0000)
committer
arjen
<arjen>
Sat, 29 Mar 2003 09:04:10 +0000
(09:04 +0000)
of an email header.
src/gcm_input/message.cpp
patch
|
blob
|
history
diff --git
a/src/gcm_input/message.cpp
b/src/gcm_input/message.cpp
index
0e9dca9
..
55c1d1a
100644
(file)
--- a/
src/gcm_input/message.cpp
+++ b/
src/gcm_input/message.cpp
@@
-8,7
+8,7
@@
***********************
** FILE NAME : message.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
***********************
** FILE NAME : message.cpp
** SYSTEM NAME : Gnucomo - Gnu Computer Monitoring
-** VERSION NUMBER : $Revision: 1.
8
$
+** VERSION NUMBER : $Revision: 1.
9
$
**
** DESCRIPTION : Implementation of the message handling classes
**
**
** DESCRIPTION : Implementation of the message handling classes
**
@@
-20,13
+20,17
@@
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Sep 16, 2002
********************************
** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
** CREATION DATE : Sep 16, 2002
-** LAST UPDATE :
Feb
28, 2003
+** LAST UPDATE :
Mar
28, 2003
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: message.cpp,v $
** MODIFICATIONS :
**************************************************************************/
/*****************************
$Log: message.cpp,v $
- Revision 1.8 2003-03-16 09:42:40 arjen
+ Revision 1.9 2003-03-29 09:04:10 arjen
+ Extract the hostname out of the 'From:' or 'Message-Id:' line
+ of an email header.
+
+ Revision 1.8 2003/03/16 09:42:40 arjen
Read IRIX system logs.
Revision 1.7 2003/02/21 08:08:05 arjen
Read IRIX system logs.
Revision 1.7 2003/02/21 08:08:05 arjen
@@
-57,7
+61,7
@@
*****************************/
*****************************/
-static const char *RCSID = "$Id: message.cpp,v 1.
8 2003-03-16 09:42:4
0 arjen Exp $";
+static const char *RCSID = "$Id: message.cpp,v 1.
9 2003-03-29 09:04:1
0 arjen Exp $";
#include <algorithm>
#include "message.h"
#include <algorithm>
#include "message.h"
@@
-127,6
+131,7
@@
client_message::client_message(std::istream *in, gnucomo_database db)
static const String syslog_date_re("[[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2}");
static const String mail_date_re("[[:alpha:]]{3}, [ 123]?[0-9] [[:alpha:]]{3} [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} [+-][0-9]{4}");
static const String unix_date_re("[[:alpha:]]{3} [[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}");
static const String syslog_date_re("[[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2}");
static const String mail_date_re("[[:alpha:]]{3}, [ 123]?[0-9] [[:alpha:]]{3} [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} [+-][0-9]{4}");
static const String unix_date_re("[[:alpha:]]{3} [[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}");
+static const String email_address_re("[[:alnum:]_.-]+@[[:alnum:]_.-]+");
static const regex re_syslog(syslog_date_re + " [[:alnum:]]+ [[:alpha:]]+.*:.+");
static const regex re_syslog_irix(syslog_date_re + " [0-7][A-T]:[[:alnum:]]+ [[:alpha:]]+.*:.+");
static const regex re_syslog(syslog_date_re + " [[:alnum:]]+ [[:alpha:]]+.*:.+");
static const regex re_syslog_irix(syslog_date_re + " [0-7][A-T]:[[:alnum:]]+ [[:alpha:]]+.*:.+");
@@
-137,9
+142,10
@@
static const regex re_errorlog("^\\[" + unix_date_re + "\\] \\[(error|notice)\\]
static const regex re_rpm("[[:alnum:]+-]+-[0-9][[:alnum:].-]");
static const regex re_syslog_date("[[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2}");
static const regex re_rpm("[[:alnum:]+-]+-[0-9][[:alnum:].-]");
static const regex re_syslog_date("[[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2}");
-static const regex re_uxmail_from("^From
-
" + unix_date_re);
+static const regex re_uxmail_from("^From
[^ \t]+[ ]+
" + unix_date_re);
static const regex re_mail_From("^From:[[:blank:]]+");
static const regex re_mail_Date("^Date:[[:blank:]]+" + mail_date_re);
static const regex re_mail_From("^From:[[:blank:]]+");
static const regex re_mail_Date("^Date:[[:blank:]]+" + mail_date_re);
+static const regex re_mail_MsId("^Message-Id:[[:blank:]]+");
static const regex re_email_address("[[:alnum:]_.-]+@[[:alnum:]_.-]+");
static const regex re_email_user("[[:alnum:]_.-]+@");
static const regex re_email_address("[[:alnum:]_.-]+@[[:alnum:]_.-]+");
static const regex re_email_user("[[:alnum:]_.-]+@");
@@
-155,7
+161,7
@@
static const regex re_email_user("[[:alnum:]_.-]+@");
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
-** LAST MODIFIED :
Nov 16, 2002
+** LAST MODIFIED :
Mar 28, 2003
**=========================================================================
*/
**=========================================================================
*/
@@
-183,7
+189,19
@@
double client_message::classify(String host, UTC arriv, String serv)
{
from_address = line(re_email_address);
from_address(re_email_user) = ""; // Remove the user part;
{
from_address = line(re_email_address);
from_address(re_email_user) = ""; // Remove the user part;
- hostname = from_address;
+ if (from_address != "")
+ {
+ hostname = from_address;
+ }
+ }
+ if (line == re_mail_MsId)
+ {
+ from_address = line(re_email_address);
+ from_address(re_email_user) = ""; // Remove the user part;
+ if (from_address != "")
+ {
+ hostname = from_address;
+ }
}
if (line == re_mail_Date)
{
}
if (line == re_mail_Date)
{
@@
-195,6
+213,7
@@
double client_message::classify(String host, UTC arriv, String serv)
{
// Push the first line back, we need to read it again.
--input;
{
// Push the first line back, we need to read it again.
--input;
+
}
/*
}
/*
@@
-301,7
+320,7
@@
double client_message::classify(String host, UTC arriv, String serv)
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
** VARS CHANGED :
** FUNCTIONS USED :
** SEE ALSO :
-** LAST MODIFIED :
Feb 19
, 2003
+** LAST MODIFIED :
Mar 28
, 2003
**=========================================================================
*/
**=========================================================================
*/
@@
-651,6
+670,10
@@
int client_message::enter()
i++;
}
i++;
}
+ if (!isdigit(line[version_start + 1]))
+ {
+ version_start = next_version_start;
+ }
String package(line(0,version_start));
String version(line(version_start + 1, ~line));
String paramid;
String package(line(0,version_start));
String version(line(version_start + 1, ~line));
String paramid;