/[mailutils]/mailutils/mailbox/mailer.c
ViewVC logotype

Diff of /mailutils/mailbox/mailer.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.25 by polak, Sun Feb 9 20:39:58 2003 UTC revision 1.26 by gray, Sat Feb 22 22:25:19 2003 UTC
# Line 34  Line 34 
34  #include <mailutils/registrar.h>  #include <mailutils/registrar.h>
35  #include <mailutils/stream.h>  #include <mailutils/stream.h>
36  #include <mailutils/url.h>  #include <mailutils/url.h>
37    #include <mailutils/header.h>
38    #include <mailutils/mailbox.h>
39    #include <mailutils/message.h>
40    
41  #include <mailer0.h>  #include <mailer0.h>
42    
# Line 259  mailer_check_to (address_t to) Line 262  mailer_check_to (address_t to)
262    return 0;    return 0;
263  }  }
264    
265    static void
266    save_fcc (message_t msg)
267    {
268      header_t hdr;
269      size_t count = 0, i;
270      char buf[512];
271      
272      if (message_get_header (msg, &hdr))
273        return;
274    
275      if (header_get_value (hdr, MU_HEADER_FCC, NULL, 0, NULL))
276        return;
277      
278      header_get_field_count (hdr, &count);
279      for (i = 1; i <= count; i++)
280        {
281          mailbox_t mbox;
282          
283          header_get_field_name (hdr, i, buf, sizeof buf, NULL);
284          if (strcasecmp (buf, MU_HEADER_FCC) == 0)
285            {
286              if (header_get_field_value (hdr, i, buf, sizeof buf, NULL))
287                continue;
288              if (mailbox_create_default (&mbox, buf))
289                continue; /*FIXME: error message?? */
290              if (mailbox_open (mbox, MU_STREAM_RDWR|MU_STREAM_CREAT|MU_STREAM_APPEND) == 0)
291                {
292                  mailbox_append_message (mbox, msg);
293                  mailbox_flush (mbox, 0);
294                }
295              mailbox_close (mbox);
296              mailbox_destroy (&mbox);
297            }
298        }
299    }
300    
301  int  int
302  mailer_send_message (mailer_t mailer, message_t msg, address_t from, address_t to)  mailer_send_message (mailer_t mailer, message_t msg,
303                         address_t from, address_t to)
304  {  {
305    int status;    int status;
306    
# Line 282  mailer_send_message (mailer_t mailer, me Line 322  mailer_send_message (mailer_t mailer, me
322        if ((status = mailer_check_to (to)) != 0)        if ((status = mailer_check_to (to)) != 0)
323          return status;          return status;
324      }      }
325      
326      save_fcc (msg);
327    return mailer->_send_message (mailer, msg, from, to);    return mailer->_send_message (mailer, msg, from, to);
328  }  }
329    

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26