src/lib/message.c
void add_msg_dest(MSGS *msg, int dest_code, int msg_type, char *where, char *mail_cmd)
{
   DEST *d;
   /*
    * First search the existing chain and see if we
    * can simply add this msg_type to an existing entry.
    */
   for (d=msg->dest_chain; d; d=d->next) {
      if (dest_code == d->dest_code && ((where == NULL && d->where == NULL) ||
                     bstrcmp(where, d->where))) {
         Dmsg4(850, "Add to existing d=%p msgtype=%d destcode=%d where=%s\n",
             d, msg_type, dest_code, NPRT(where));
         set_bit(msg_type, d->msg_types);
         set_bit(msg_type, msg->send_msg);  /* set msg_type bit in our local */
         return;
      }
   }
   /* Not found, create a new entry */
   d = (DEST *)malloc(sizeof(DEST));
   memset(d, 0, sizeof(DEST));
   d->next = msg->dest_chain;
   d->dest_code = dest_code;
   set_bit(msg_type, d->msg_types);      /* set type bit in structure */
   set_bit(msg_type, msg->send_msg);     /* set type bit in our local */
   if (where) {
      d->where = bstrdup(where);
   }
   if (mail_cmd) {
      d->mail_cmd = bstrdup(mail_cmd);
   }
   Dmsg5(850, "add new d=%p msgtype=%d destcode=%d where=%s mailcmd=%s\n",
          d, msg_type, dest_code, NPRT(where), NPRT(d->mail_cmd));
   msg->dest_chain = d;
}
/*
 * Called only during parsing of the config file.
 *
 * Add a message destination. I.e. associate a message type with
 *  a destination (code).
 * Note, where in the case of dest_code FILE is a filename,
 *  but in the case of MAIL is a space separated list of
 *  email addresses, ...
 */
Called only during parsing of the config file.
Add a message destination.
Called only during parsing of the config file . Add a message destination .
void add_msg_dest(MSGS *msg, int dest_code, int msg_type, char *where, char *mail_cmd)
{
   DEST *d;
   for (d=msg->dest_chain; d; d=d->next) {
      if (dest_code == d->dest_code && ((where == NULL && d->where == NULL) ||
                     bstrcmp(where, d->where))) {
         Dmsg4(850, "Add to existing d=%p msgtype=%d destcode=%d where=%s\n",
             d, msg_type, dest_code, NPRT(where));
         set_bit(msg_type, d->msg_types);
         set_bit(msg_type, msg->send_msg);  
         return;
      }
   }
   d = (DEST *)malloc(sizeof(DEST));
   memset(d, 0, sizeof(DEST));
   d->next = msg->dest_chain;
   d->dest_code = dest_code;
   set_bit(msg_type, d->msg_types);      
   set_bit(msg_type, msg->send_msg);     
   if (where) {
      d->where = bstrdup(where);
   }
   if (mail_cmd) {
      d->mail_cmd = bstrdup(mail_cmd);
   }
   Dmsg5(850, "add new d=%p msgtype=%d destcode=%d where=%s mailcmd=%s\n",
          d, msg_type, dest_code, NPRT(where), NPRT(d->mail_cmd));
   msg->dest_chain = d;
}
void add_msg_dest ( MSGS * msg , int dest_code , int msg_type , char * where , char * mail_cmd ) { DEST * d ; for ( d = msg -> dest_chain ; d ; d = d -> next ) { if ( dest_code == d -> dest_code && ( ( where == NULL && d -> where == NULL ) || bstrcmp ( where , d -> where ) ) ) { Dmsg4 ( 850 , " \n " , d , msg_type , dest_code , NPRT ( where ) ) ; set_bit ( msg_type , d -> msg_types ) ; set_bit ( msg_type , msg -> send_msg ) ; return ; } } d = ( DEST * ) malloc ( sizeof ( DEST ) ) ; memset ( d , 0 , sizeof ( DEST ) ) ; d -> next = msg -> dest_chain ; d -> dest_code = dest_code ; set_bit ( msg_type , d -> msg_types ) ; set_bit ( msg_type , msg -> send_msg ) ; if ( where ) { d -> where = bstrdup ( where ) ; } if ( mail_cmd ) { d -> mail_cmd = bstrdup ( mail_cmd ) ; } Dmsg5 ( 850 , " \n " , d , msg_type , dest_code , NPRT ( where ) , NPRT ( d -> mail_cmd ) ) ; msg -> dest_chain = d ; }
Called only during parsing of the config file.
Called only during parsing of the config file .
/*
    * First search the existing chain and see if we
    * can simply add this msg_type to an existing entry.
    */ /* set msg_type bit in our local */ /* Not found, create a new entry */ /* set type bit in structure */ /* set type bit in our local */