libgmime messages

Scott Lenser slenser at cs.cmu.edu
Fri Dec 13 06:01:49 CET 2002


Hi all,

  As promised, I've looked into trapping of libgmime messages to keep them
from spewing out over any of the normal channels.  I've determined that
these messages can easily be trapped.  Here is the code that is required
to suppress all libgmime messages:

void EatGMimeMessages(const gchar *log_domain,
                      GLogLevelFlags log_level,
                      const gchar *message,
                      gpointer user_data) {
  return;
}

and then after gmime_init but before using gmime for processing:

    g_log_set_handler("gmime",
                     G_LOG_LEVEL_MASK,
                     EatGMimeMessages,
                     NULL);

That's it.  Something intelligent can be done with the messages by changing the
code of EatGMimeMessages.  log_domain is always "gmime" for libgmime messages
(other glib messages will also come to this function).  log_level indicates the
severity of the problem (error, critcal, warning, message, info, debug).  message
is the message.  user_data is user data (the NULL entry in the example).

- Scott






More information about the bogofilter-dev mailing list