X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=muttlib.c;h=efb991bc35805474589648939802fe1ef5f6590d;hp=2cf42eb8229aee6b372bf17c3ff4fd2462e0c90f;hb=f288d1771c814e6104da83e6f0f1761a40de1224;hpb=98cf5779d8184a74541be1bc61d15c5f35efd310 diff --git a/muttlib.c b/muttlib.c index 2cf42eb..efb991b 100644 --- a/muttlib.c +++ b/muttlib.c @@ -150,29 +150,6 @@ int mutt_matches_ignore (const char *s, string_list_t * t) return 0; } -/* prepend the path part of *path to *lnk */ -void mutt_expand_link (char *newpath, const char *path, const char *lnk) -{ - const char *lb = NULL; - ssize_t len; - - /* lnk is full path */ - if (*lnk == '/') { - m_strcpy(newpath, _POSIX_PATH_MAX, lnk); - return; - } - - if ((lb = strrchr (path, '/')) == NULL) { - /* no path in lnk */ - m_strcpy(newpath, _POSIX_PATH_MAX, lnk); - return; - } - - len = lb - path + 1; - memcpy (newpath, path, len); - m_strcpy(newpath + len, _POSIX_PATH_MAX - len, lnk); -} - char *mutt_expand_path (char *s, ssize_t slen) { return _mutt_expand_path (s, slen, 0); @@ -325,50 +302,6 @@ char *_mutt_expand_path (char *s, ssize_t slen, int rx) return (s); } -/* move all the headers from extra not present in base into base */ -void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra) -{ - /* copies each existing element if necessary, and sets the element - * to NULL in the source so that envelope_delete doesn't leave us - * with dangling pointers. */ -#define MOVE_ELEM(h) if (!base->h) { base->h = (*extra)->h; (*extra)->h = NULL; } - MOVE_ELEM(return_path); - MOVE_ELEM(from); - MOVE_ELEM(to); - MOVE_ELEM(cc); - MOVE_ELEM(bcc); - MOVE_ELEM(sender); - MOVE_ELEM(reply_to); - MOVE_ELEM(mail_followup_to); - MOVE_ELEM(list_post); - MOVE_ELEM(message_id); - MOVE_ELEM(supersedes); - MOVE_ELEM(date); - MOVE_ELEM(x_label); - if (!base->refs_changed) { - MOVE_ELEM(references); - } - if (!base->irt_changed) { - MOVE_ELEM(in_reply_to); - } - /* real_subj is subordinate to subject */ - if (!base->subject) { - base->subject = (*extra)->subject; - base->real_subj = (*extra)->real_subj; - (*extra)->subject = NULL; - (*extra)->real_subj = NULL; - } - /* spam and user headers should never be hashed, and the new envelope may - * have better values. Use new versions regardless. */ - mutt_buffer_free (&base->spam); - string_list_wipe(&base->userhdrs); - MOVE_ELEM(spam); - MOVE_ELEM(userhdrs); -#undef MOVE_ELEM - - envelope_delete(extra); -} - void mutt_mktemp (char *s) { @@ -899,18 +832,6 @@ time_t mutt_decrease_mtime (const char *f, struct stat *st) return mtime; } -/* sets mtime of 'to' to mtime of 'from' */ -void mutt_set_mtime (const char* from, const char* to) { - struct utimbuf utim; - struct stat st; - - if (stat (from, &st) != -1) { - utim.actime = st.st_mtime; - utim.modtime = st.st_mtime; - utime (to, &utim); - } -} - const char *mutt_make_version (int full) { static char vstring[STRING]; @@ -983,32 +904,8 @@ int mutt_match_spam_list (const char *s, SPAM_LIST * l, char *text, int x) return 0; } -int mutt_cmp_header (const HEADER * h1, const HEADER * h2) { - if (h1 && h2) { - if (h1->received != h2->received || - h1->date_sent != h2->date_sent || - h1->content->length != h2->content->length || - h1->lines != h2->lines || - h1->zhours != h2->zhours || - h1->zminutes != h2->zminutes || - h1->zoccident != h2->zoccident || - h1->mime != h2->mime || - !mutt_cmp_env (h1->env, h2->env) || - !mutt_cmp_body (h1->content, h2->content)) - return (0); - else - return (1); - } - else { - if (h1 == NULL && h2 == NULL) - return (1); - else - return (0); - } -} - /* return 1 if address lists are strictly identical */ -int mutt_cmp_addr (const address_t * a, const address_t * b) +static int mutt_cmp_addr (const address_t * a, const address_t * b) { while (a && b) { if (m_strcmp(a->mailbox, b->mailbox) || @@ -1024,7 +921,7 @@ int mutt_cmp_addr (const address_t * a, const address_t * b) return (1); } -int mutt_cmp_list (const string_list_t * a, const string_list_t * b) +static int mutt_cmp_list (const string_list_t * a, const string_list_t * b) { while (a && b) { if (m_strcmp(a->data, b->data)) @@ -1039,7 +936,7 @@ int mutt_cmp_list (const string_list_t * a, const string_list_t * b) return (1); } -int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2) +static int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2) { if (e1 && e2) { if (m_strcmp(e1->message_id, e2->message_id) || @@ -1063,7 +960,7 @@ int mutt_cmp_env (const ENVELOPE * e1, const ENVELOPE * e2) } } -int mutt_cmp_body (const BODY * b1, const BODY * b2) +static int mutt_cmp_body (const BODY * b1, const BODY * b2) { if (b1->type != b2->type || b1->encoding != b2->encoding || @@ -1074,6 +971,30 @@ int mutt_cmp_body (const BODY * b1, const BODY * b2) return (0); return (1); } +int mutt_cmp_header (const HEADER * h1, const HEADER * h2) { + if (h1 && h2) { + if (h1->received != h2->received || + h1->date_sent != h2->date_sent || + h1->content->length != h2->content->length || + h1->lines != h2->lines || + h1->zhours != h2->zhours || + h1->zminutes != h2->zminutes || + h1->zoccident != h2->zoccident || + h1->mime != h2->mime || + !mutt_cmp_env (h1->env, h2->env) || + !mutt_cmp_body (h1->content, h2->content)) + return (0); + else + return (1); + } + else { + if (h1 == NULL && h2 == NULL) + return (1); + else + return (0); + } +} + int mutt_extract_token(BUFFER *dest, BUFFER *tok, int flags) {