projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use mutt_multi_choice in flags.c
[apps/madmutt.git]
/
lib-sys
/
mutt_socket.c
diff --git
a/lib-sys/mutt_socket.c
b/lib-sys/mutt_socket.c
index
f71b789
..
8616440
100644
(file)
--- a/
lib-sys/mutt_socket.c
+++ b/
lib-sys/mutt_socket.c
@@
-15,7
+15,7
@@
#include <netdb.h>
#include <sys/socket.h>
#include <netdb.h>
#include <sys/socket.h>
-#include <lib-ui/
curses
.h>
+#include <lib-ui/
lib-ui
.h>
#include "mutt.h"
#include "globals.h"
#include "mutt.h"
#include "globals.h"
@@
-33,18
+33,21
@@
/* support for multiple socket connections */
static CONNECTION *Connections = NULL;
/* support for multiple socket connections */
static CONNECTION *Connections = NULL;
-/* forward declarations */
-static int socket_preconnect (void);
-static int socket_connect (int fd, struct sockaddr *sa);
-static CONNECTION *socket_new_conn (void);
-
/* Wrappers */
int mutt_socket_open (CONNECTION * conn)
{
/* Wrappers */
int mutt_socket_open (CONNECTION * conn)
{
- if (socket_preconnect ())
- return -1;
+ int rc;
- return conn->conn_open (conn);
+ if (m_strlen(Preconnect)) {
+ rc = mutt_system (Preconnect);
+ if (rc) {
+ mutt_perror (_("Preconnect command failed."));
+ mutt_sleep (1);
+ return -1;
+ }
+ }
+
+ return conn->conn_open(conn);
}
int mutt_socket_close (CONNECTION * conn)
}
int mutt_socket_close (CONNECTION * conn)
@@
-214,10
+217,10
@@
CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account)
conn = conn->next;
}
conn = conn->next;
}
- conn =
socket_new_conn (
);
-
memcpy (&conn->account, account, sizeof (ACCOUNT))
;
-
- conn->next = Connections;
+ conn =
p_new(CONNECTION, 1
);
+
conn->fd = -1
;
+ conn->account = *account;
+ conn->next
= Connections;
Connections = conn;
if (Tunnel && *Tunnel)
Connections = conn;
if (Tunnel && *Tunnel)
@@
-237,25
+240,6
@@
CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account)
return conn;
}
return conn;
}
-static int socket_preconnect (void)
-{
- int rc;
- int save_errno;
-
- if (m_strlen(Preconnect)) {
- rc = mutt_system (Preconnect);
- if (rc) {
- save_errno = errno;
- mutt_perror (_("Preconnect command failed."));
- mutt_sleep (1);
-
- return save_errno;
- }
- }
-
- return 0;
-}
-
/* socket_connect: set up to connect to a socket fd. */
static int socket_connect (int fd, struct sockaddr *sa)
{
/* socket_connect: set up to connect to a socket fd. */
static int socket_connect (int fd, struct sockaddr *sa)
{
@@
-289,17
+273,6
@@
static int socket_connect (int fd, struct sockaddr *sa)
return save_errno;
}
return save_errno;
}
-/* socket_new_conn: allocate and initialise a new connection. */
-static CONNECTION *socket_new_conn (void)
-{
- CONNECTION *conn;
-
- conn = p_new(CONNECTION, 1);
- conn->fd = -1;
-
- return conn;
-}
-
int raw_socket_close (CONNECTION * conn)
{
return close (conn->fd);
int raw_socket_close (CONNECTION * conn)
{
return close (conn->fd);
@@
-347,11
+320,7
@@
int raw_socket_open (CONNECTION * conn)
/* we accept v4 or v6 STREAM sockets */
p_clear(&hints, 1);
/* we accept v4 or v6 STREAM sockets */
p_clear(&hints, 1);
- if (option (OPTUSEIPV6))
- hints.ai_family = AF_UNSPEC;
- else
- hints.ai_family = AF_INET;
-
+ hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf (port, sizeof (port), "%d", conn->account.port);
hints.ai_socktype = SOCK_STREAM;
snprintf (port, sizeof (port), "%d", conn->account.port);