bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enhancement of ticket_t API.


From: Sam Roberts
Subject: Re: Enhancement of ticket_t API.
Date: Thu, 15 Nov 2001 00:51:17 -0500
User-agent: Mutt/1.3.16i

Bon soir!

Produtive night for me :-)

--

Ok, I tried to integrate it.

However, what would make me blissful is to be able to do:

(sieve.c)
int
mu_save_to (const char *toname, message_t mesg, const char **errmsg)
{
  int res = 0;
  mailbox_t to = 0;
  mailbox_t from = 0;

  wicket_t wicket = NULL;

  res = mailbox_create_default (&to, toname);

  if (res == ENOENT)
    *errmsg = "no handler for this type of mailbox";

  /* if we can't create it, we'll just do without */
  wicket_create (&wicket, "~/.tickets");

  if (wicket)
    {
      ticket_t ticket = NULL;
      folder_t folder = NULL;
      authority_t auth = NULL;

      wicket_to_ticket (wicket, &ticket);

      /* if we get a wicket, this must succeed */
      if ((res = mailbox_get_folder (to, &folder)) == 0)
        if ((res = folder_get_authority (folder, &auth)) == 0)
          res = authority_set_ticket (auth, ticket);

    }
  if (!res)
    {
      if (message_get_mailbox (mesg, &from) == 0)
        mu_copy_debug_level (from, to);
    }
  if (!res)
    {
      *errmsg = "mailbox_open";
      res = mailbox_open (to, MU_STREAM_WRITE | MU_STREAM_CREAT);
    }
  if (!res)
    {
      *errmsg = "mailbox_open";
      res = mailbox_append_message (to, mesg);

      if (!res)
        {
          *errmsg = "mailbox_close";
          res = mailbox_close (to);
        }
      else
        {
          mailbox_close (to);
        }
    }
  mailbox_destroy (&to);

  wicket_destroy (&wicket);

  return res;
}

The mailbox url had ticket material, or it didn't, there was a
~/.tickets, or there wasn't, either way, not my problem!

The alternative is to do a url_parse() on toname, see if it is missing
all the auth stuff it needs, and see if there is enough for me to call the
wicket_get_ticket().

I've attached a hack to your wicket, note that it can't work because
the ticket doesn't know what url it is being asked about.

There's a comment to that effect.

Do you think you could get it to work?

Thanks!

I've got to call it a night,
Sam

Quoting Alain Magloire <address@hidden>, who wrote:
> > 
> > I will have something for you later.
> 
> 
> Use a wicket_t:
> {
>       wicket_t wicket = NULL;
>       ticket_t ticket = NULL;
>       mailbox_t mbox = NULL;
>       folder_t folder = NULL;
>       authority_t auth = NULL;
> 
>       wicket_create (&wicket, "/home/alain/.tickets");
>       wicket_get_ticket (wicket, "alain", NULL, &ticket);
> 
>       mailbox_create (&mbox, "imap://localhost");
>       mailbox_get_folder (mbox, &folder);
>       folder_get_authority (folder, &auth);
>       authority_set_ticket (auth, ticket);
> }
> 
> It does not solve all, but it is a start.
> 
> 
> _______________________________________________
> Bug-mailutils mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-mailutils

-- 
Sam Roberts <address@hidden> (Vivez sans temps mort!)

Attachment: sieve.c
Description: Text document

Attachment: auth.h
Description: Text document

Attachment: wicket.c
Description: Text document

Attachment: auth0.h
Description: Text document

Attachment: wicket.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]