contrib/collection.cgi: Added meta graph handlers for nfs_procedure, ps_state, swap...
[collectd.git] / src / email.c
index 5d011d3..594ef96 100644 (file)
@@ -4,8 +4,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
+ * Free Software Foundation; only version 2 of the License is applicable.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -780,7 +779,8 @@ static int email_read (void)
 {
        type_t *ptr;
 
-       double sc;
+       double score_old;
+       int score_count_old;
 
        static type_list_t *cnt;
        static type_list_t *sz;
@@ -829,13 +829,15 @@ static int email_read (void)
        /* spam score */
        pthread_mutex_lock (&score_mutex);
 
-       sc = score;
+       score_old = score;
+       score_count_old = score_count;
        score = 0.0;
        score_count = 0;
 
        pthread_mutex_unlock (&score_mutex);
 
-       email_submit ("spam_score", "", sc);
+       if (score_count_old > 0)
+               email_submit ("spam_score", "", score_old);
 
        /* spam checks */
        pthread_mutex_lock (&check_mutex);