projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
warning fixes
[apps/madmutt.git]
/
imap
/
util.c
diff --git
a/imap/util.c
b/imap/util.c
index
5163da7
..
fa54de6
100644
(file)
--- a/
imap/util.c
+++ b/
imap/util.c
@@
-15,6
+15,7
@@
#include "mutt.h"
#include "mx.h" /* for M_IMAP */
#include "mutt.h"
#include "mx.h" /* for M_IMAP */
+#include "ascii.h"
#include "url.h"
#include "imap_private.h"
#include "mutt_ssl.h"
#include "url.h"
#include "imap_private.h"
#include "mutt_ssl.h"
@@
-56,7
+57,7
@@
int imap_expand_path (char *path, size_t len)
url.path = mx.mbox;
rc = url_ciss_tostring (&url, path, len, U_DECODE_PASSWD);
url.path = mx.mbox;
rc = url_ciss_tostring (&url, path, len, U_DECODE_PASSWD);
-
FREE
(&mx.mbox);
+
mem_free
(&mx.mbox);
return rc;
}
return rc;
}
@@
-94,21
+95,21
@@
int imap_parse_path (const char *path, IMAP_MBOX * mx)
mx->account.port = ImapPort;
mx->account.type = M_ACCT_TYPE_IMAP;
mx->account.port = ImapPort;
mx->account.type = M_ACCT_TYPE_IMAP;
- c = s
afe_str
dup (path);
+ c = s
tr_
dup (path);
url_parse_ciss (&url, c);
if (!(url.scheme == U_IMAP || url.scheme == U_IMAPS) ||
url_parse_ciss (&url, c);
if (!(url.scheme == U_IMAP || url.scheme == U_IMAPS) ||
- mutt_account_fromurl (&mx->account, &url) < 0) {
-
FREE
(&c);
+ mutt_account_fromurl (&mx->account, &url) < 0
|| !*mx->account.host
) {
+
mem_free
(&c);
return -1;
}
return -1;
}
- mx->mbox = s
afe_str
dup (url.path);
+ mx->mbox = s
tr_
dup (url.path);
if (url.scheme == U_IMAPS)
mx->account.flags |= M_ACCT_SSL;
if (url.scheme == U_IMAPS)
mx->account.flags |= M_ACCT_SSL;
-
FREE
(&c);
+
mem_free
(&c);
if ((mx->account.flags & M_ACCT_SSL) && !(mx->account.flags & M_ACCT_PORT))
mx->account.port = ImapsPort;
if ((mx->account.flags & M_ACCT_SSL) && !(mx->account.flags & M_ACCT_PORT))
mx->account.port = ImapsPort;
@@
-130,12
+131,12
@@
void imap_pretty_mailbox (char *path)
if (imap_parse_path (path, &target) < 0)
return;
if (imap_parse_path (path, &target) < 0)
return;
- tlen =
mutt_str
len (target.mbox);
+ tlen =
str_
len (target.mbox);
/* check whether we can do '=' substitution */
if (mx_get_magic (Maildir) == M_IMAP && !imap_parse_path (Maildir, &home)) {
/* check whether we can do '=' substitution */
if (mx_get_magic (Maildir) == M_IMAP && !imap_parse_path (Maildir, &home)) {
- hlen =
mutt_str
len (home.mbox);
+ hlen =
str_
len (home.mbox);
if (tlen && mutt_account_match (&home.account, &target.account) &&
if (tlen && mutt_account_match (&home.account, &target.account) &&
- !s
afe_str
ncmp (home.mbox, target.mbox, hlen)) {
+ !s
tr_
ncmp (home.mbox, target.mbox, hlen)) {
if (!hlen)
home_match = 1;
else
if (!hlen)
home_match = 1;
else
@@
-143,7
+144,7
@@
void imap_pretty_mailbox (char *path)
if (target.mbox[hlen] == *delim)
home_match = 1;
}
if (target.mbox[hlen] == *delim)
home_match = 1;
}
-
FREE
(&home.mbox);
+
mem_free
(&home.mbox);
}
/* do the '=' substitution */
}
/* do the '=' substitution */
@@
-164,7
+165,7
@@
void imap_pretty_mailbox (char *path)
url_ciss_tostring (&url, path, 1024, 0);
}
url_ciss_tostring (&url, path, 1024, 0);
}
-
FREE
(&target.mbox);
+
mem_free
(&target.mbox);
}
/* -- library functions -- */
}
/* -- library functions -- */
@@
-188,7
+189,7
@@
void imap_error (const char *where, const char *msg)
* Returns NULL on failure (no mem) */
IMAP_DATA *imap_new_idata (void)
{
* Returns NULL on failure (no mem) */
IMAP_DATA *imap_new_idata (void)
{
- return
safe
_calloc (1, sizeof (IMAP_DATA));
+ return
mem
_calloc (1, sizeof (IMAP_DATA));
}
/* imap_free_idata: Release and clear storage in an IMAP_DATA structure. */
}
/* imap_free_idata: Release and clear storage in an IMAP_DATA structure. */
@@
-197,10
+198,10
@@
void imap_free_idata (IMAP_DATA ** idata)
if (!idata)
return;
if (!idata)
return;
-
FREE
(&(*idata)->capstr);
+
mem_free
(&(*idata)->capstr);
mutt_free_list (&(*idata)->flags);
mutt_free_list (&(*idata)->flags);
-
FREE
(&((*idata)->cmd.buf));
-
FREE
(idata);
+
mem_free
(&((*idata)->cmd.buf));
+
mem_free
(idata);
}
/*
}
/*
@@
-424,12
+425,12
@@
void imap_munge_mbox_name (char *dest, size_t dlen, const char *src)
{
char *buf;
{
char *buf;
- buf = s
afe_str
dup (src);
+ buf = s
tr_
dup (src);
imap_utf7_encode (&buf);
imap_quote_string (dest, dlen, buf);
imap_utf7_encode (&buf);
imap_quote_string (dest, dlen, buf);
-
FREE
(&buf);
+
mem_free
(&buf);
}
void imap_unmunge_mbox_name (char *s)
}
void imap_unmunge_mbox_name (char *s)
@@
-438,13
+439,13
@@
void imap_unmunge_mbox_name (char *s)
imap_unquote_string (s);
imap_unquote_string (s);
- buf = s
afe_str
dup (s);
+ buf = s
tr_
dup (s);
if (buf) {
imap_utf7_decode (&buf);
if (buf) {
imap_utf7_decode (&buf);
- strncpy (s, buf,
mutt_str
len (s));
+ strncpy (s, buf,
str_
len (s));
}
}
-
FREE
(&buf);
+
mem_free
(&buf);
}
/* imap_wordcasecmp: find word a in word list b */
}
/* imap_wordcasecmp: find word a in word list b */
@@
-494,12
+495,12
@@
void imap_keepalive (void)
if (idata->ctx)
ctx = idata->ctx;
else {
if (idata->ctx)
ctx = idata->ctx;
else {
- ctx =
safe
_calloc (1, sizeof (CONTEXT));
+ ctx =
mem
_calloc (1, sizeof (CONTEXT));
ctx->data = idata;
}
imap_check_mailbox (ctx, NULL, 1);
if (!idata->ctx)
ctx->data = idata;
}
imap_check_mailbox (ctx, NULL, 1);
if (!idata->ctx)
-
FREE
(&ctx);
+
mem_free
(&ctx);
}
}
}
}
@@
-515,9
+516,11
@@
int imap_wait_keepalive (pid_t pid)
int rc;
short imap_passive = option (OPTIMAPPASSIVE);
int rc;
short imap_passive = option (OPTIMAPPASSIVE);
+ int imap_askreconnect = quadoption (OPT_IMAPRECONNECT);
set_option (OPTIMAPPASSIVE);
set_option (OPTKEEPQUIET);
set_option (OPTIMAPPASSIVE);
set_option (OPTKEEPQUIET);
+ set_quadoption (OPT_IMAPRECONNECT, M_NO);
sigprocmask (SIG_SETMASK, NULL, &oldmask);
sigprocmask (SIG_SETMASK, NULL, &oldmask);
@@
-546,6
+549,7
@@
int imap_wait_keepalive (pid_t pid)
unset_option (OPTKEEPQUIET);
if (!imap_passive)
unset_option (OPTIMAPPASSIVE);
unset_option (OPTKEEPQUIET);
if (!imap_passive)
unset_option (OPTIMAPPASSIVE);
+ set_quadoption (OPT_IMAPRECONNECT, imap_askreconnect);
return rc;
}
return rc;
}