* Eric Smith <[EMAIL PROTECTED]> [2002-10-01 10:18]:
> Some suggested hacks for this but IMHO, this is sufficicently
> useful (especially for those who deal with many companies /
> organisations) to be native functionality.

This seems like a good learning excersize, so I was looking into this,
trying to implement save_domain and force_domain that behave identically
to save_name and force_name. However, I cannot figure out how to access
the RHS of the address from within mutt_save_fcc (in hook.c):

/* Within mutt_save_fcc, lines 401 - 427 */

    void mutt_select_fcc (char *path, size_t pathlen, HEADER *hdr)
    {
      ADDRESS *adr;
      char buf[_POSIX_PATH_MAX];
      ENVELOPE *env = hdr->env;
    
      if (mutt_addr_hook (path, pathlen, M_FCCHOOK, NULL, hdr) != 0)
      {
        if ((option (OPTSAVENAME) || option (OPTFORCENAME)) &&
            (env->to || env->cc || env->bcc))
        {
          adr = env->to ? env->to : (env->cc ? env->cc : env->bcc);
          mutt_safe_path (buf, sizeof (buf), adr);
          snprintf (path, pathlen, "%s/%s", NONULL (Maildir), buf);
          if (!option (OPTFORCENAME) && mx_access (path, W_OK) != 0)
            strfcpy (path, NONULL (Outbox), pathlen);
        }
        else if ((option (OPTSAVEDOMAIN) || option (OPTFORCEDOMAIN)) &&
            (env->to || env->cc || env->bcc))
        {
          /* XXX how to access domain portion of address? */
        }
        else
          strfcpy (path, NONULL (Outbox), pathlen);
      }
      mutt_pretty_mailbox (path);
    }


I've already defined OPTSAVEDOMAIN and OPTFORCEDOMAIN in init.h and
mutt.h; if I duplicate the code for OPTSAVENAME and OPTFORCENAME in the
XXX'ed area, I get the correct results.  I'm a little stumped, and I'm
sure I'm missing something simple.  Any pointers?

(darren)

-- 
Morality works best when chosen, not when mandated.
    -- Larry Wall

Reply via email to