Commit fdd05823 authored by TAKAHASHI Tamotsu's avatar TAKAHASHI Tamotsu

Add mutt_socket_write_n to write binary data. Use this function in

imap_append_message. Closes: #2244.
parent 29f2685b
......@@ -223,7 +223,7 @@ int imap_exec (IMAP_DATA* idata, const char* cmdstr, int flags)
if (idata->cmdbuf->dptr == idata->cmdbuf->data)
return IMAP_CMD_BAD;
rc = mutt_socket_write_d (idata->conn, idata->cmdbuf->data,
rc = mutt_socket_write_d (idata->conn, idata->cmdbuf->data, -1,
flags & IMAP_CMD_PASS ? IMAP_LOG_PASS : IMAP_LOG_CMD);
idata->cmdbuf->dptr = idata->cmdbuf->data;
......
......@@ -1232,6 +1232,6 @@ static char* msg_parse_flags (IMAP_HEADER* h, char* s)
static void flush_buffer(char *buf, size_t *len, CONNECTION *conn)
{
buf[*len] = '\0';
mutt_socket_write(conn, buf);
mutt_socket_write_n(conn, buf, *len);
*len = 0;
}
......@@ -100,10 +100,9 @@ int mutt_socket_read (CONNECTION* conn, char* buf, size_t len)
return rc;
}
int mutt_socket_write_d (CONNECTION *conn, const char *buf, int dbg)
int mutt_socket_write_d (CONNECTION *conn, const char *buf, int len, int dbg)
{
int rc;
int len;
dprint (dbg, (debugfile,"> %s", buf));
......@@ -113,7 +112,8 @@ int mutt_socket_write_d (CONNECTION *conn, const char *buf, int dbg)
return -1;
}
len = mutt_strlen (buf);
if (len < 0)
len = mutt_strlen (buf);
if ((rc = conn->conn_write (conn, buf, len)) < 0)
{
dprint (1, (debugfile,
......
......@@ -58,8 +58,9 @@ int mutt_socket_poll (CONNECTION* conn);
int mutt_socket_readchar (CONNECTION *conn, char *c);
#define mutt_socket_readln(A,B,C) mutt_socket_readln_d(A,B,C,M_SOCK_LOG_CMD)
int mutt_socket_readln_d (char *buf, size_t buflen, CONNECTION *conn, int dbg);
#define mutt_socket_write(A,B) mutt_socket_write_d(A,B,M_SOCK_LOG_CMD)
int mutt_socket_write_d (CONNECTION *conn, const char *buf, int dbg);
#define mutt_socket_write(A,B) mutt_socket_write_d(A,B,-1,M_SOCK_LOG_CMD)
#define mutt_socket_write_n(A,B,C) mutt_socket_write_d(A,B,C,M_SOCK_LOG_CMD)
int mutt_socket_write_d (CONNECTION *conn, const char *buf, int len, int dbg);
/* stupid hack for imap_logout_all */
CONNECTION* mutt_socket_head (void);
......
......@@ -424,7 +424,7 @@ int pop_query_d (POP_DATA *pop_data, char *buf, size_t buflen, char *msg)
}
#endif
mutt_socket_write_d (pop_data->conn, buf, dbg);
mutt_socket_write_d (pop_data->conn, buf, -1, dbg);
c = strpbrk (buf, " \r\n");
*c = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment