mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 15:42:26 +02:00
use starttls
This commit is contained in:
parent
9b02424f30
commit
51508ff1d3
13 changed files with 324 additions and 116 deletions
|
|
@ -71,8 +71,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
|||
if (chatnet == NULL)
|
||||
chatnet = g_hash_table_lookup(optlist, "network");
|
||||
|
||||
conn = server_create_conn(proto != NULL ? proto->id : -1, addr,
|
||||
atoi(portstr), chatnet, password, nick);
|
||||
conn = server_create_conn_opt(proto != NULL ? proto->id : -1, addr, atoi(portstr), chatnet,
|
||||
password, nick, optlist);
|
||||
if (conn == NULL) {
|
||||
signal_emit("error command", 1,
|
||||
GINT_TO_POINTER(CMDERR_NO_SERVER_DEFINED));
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ void server_setup_fill_reconn(SERVER_CONNECT_REC *conn,
|
|||
signal_emit("server setup fill reconn", 2, conn, sserver);
|
||||
}
|
||||
|
||||
static void server_setup_fill(SERVER_CONNECT_REC *conn,
|
||||
const char *address, int port)
|
||||
static void server_setup_fill(SERVER_CONNECT_REC *conn, const char *address, int port,
|
||||
GHashTable *optlist)
|
||||
{
|
||||
g_return_if_fail(conn != NULL);
|
||||
g_return_if_fail(address != NULL);
|
||||
|
|
@ -177,7 +177,7 @@ static void server_setup_fill(SERVER_CONNECT_REC *conn,
|
|||
memcpy(conn->own_ip6, source_host_ip6, sizeof(IPADDR));
|
||||
}
|
||||
|
||||
signal_emit("server setup fill connect", 1, conn);
|
||||
signal_emit("server setup fill connect", 2, conn, optlist);
|
||||
}
|
||||
|
||||
static void server_setup_fill_server(SERVER_CONNECT_REC *conn,
|
||||
|
|
@ -219,10 +219,9 @@ static void server_setup_fill_chatnet(SERVER_CONNECT_REC *conn,
|
|||
signal_emit("server setup fill chatnet", 2, conn, chatnet);
|
||||
}
|
||||
|
||||
static SERVER_CONNECT_REC *
|
||||
create_addr_conn(int chat_type, const char *address, int port,
|
||||
const char *chatnet, const char *password,
|
||||
const char *nick)
|
||||
static SERVER_CONNECT_REC *create_addr_conn(int chat_type, const char *address, int port,
|
||||
const char *chatnet, const char *password,
|
||||
const char *nick, GHashTable *optlist)
|
||||
{
|
||||
CHAT_PROTOCOL_REC *proto;
|
||||
SERVER_CONNECT_REC *conn;
|
||||
|
|
@ -250,7 +249,7 @@ create_addr_conn(int chat_type, const char *address, int port,
|
|||
conn->chatnet = g_strdup(chatnet);
|
||||
|
||||
/* fill in the defaults */
|
||||
server_setup_fill(conn, address, port);
|
||||
server_setup_fill(conn, address, port, optlist);
|
||||
|
||||
/* fill the rest from chat network settings */
|
||||
chatnetrec = chatnet != NULL ? chatnet_find(chatnet) :
|
||||
|
|
@ -279,9 +278,8 @@ create_addr_conn(int chat_type, const char *address, int port,
|
|||
/* Connect to server where last connect succeeded (or we haven't tried to
|
||||
connect yet). If there's no such server, connect to server where we
|
||||
haven't connected for the longest time */
|
||||
static SERVER_CONNECT_REC *
|
||||
create_chatnet_conn(const char *dest, int port,
|
||||
const char *password, const char *nick)
|
||||
static SERVER_CONNECT_REC *create_chatnet_conn(const char *dest, int port, const char *password,
|
||||
const char *nick, GHashTable *optlist)
|
||||
{
|
||||
SERVER_SETUP_REC *bestrec;
|
||||
GSList *tmp;
|
||||
|
|
@ -308,16 +306,15 @@ create_chatnet_conn(const char *dest, int port,
|
|||
}
|
||||
|
||||
return bestrec == NULL ? NULL :
|
||||
create_addr_conn(bestrec->chat_type, bestrec->address, 0,
|
||||
dest, NULL, nick);
|
||||
create_addr_conn(bestrec->chat_type, bestrec->address, 0, dest,
|
||||
NULL, nick, optlist);
|
||||
}
|
||||
|
||||
/* Create server connection record. `dest' is required, rest can be NULL.
|
||||
`dest' is either a server address or chat network */
|
||||
SERVER_CONNECT_REC *
|
||||
server_create_conn(int chat_type, const char *dest, int port,
|
||||
const char *chatnet, const char *password,
|
||||
const char *nick)
|
||||
SERVER_CONNECT_REC *server_create_conn_opt(int chat_type, const char *dest, int port,
|
||||
const char *chatnet, const char *password,
|
||||
const char *nick, GHashTable *optlist)
|
||||
{
|
||||
SERVER_CONNECT_REC *rec;
|
||||
CHATNET_REC *chatrec;
|
||||
|
|
@ -326,7 +323,7 @@ server_create_conn(int chat_type, const char *dest, int port,
|
|||
|
||||
chatrec = chatnet_find(dest);
|
||||
if (chatrec != NULL) {
|
||||
rec = create_chatnet_conn(chatrec->name, port, password, nick);
|
||||
rec = create_chatnet_conn(chatrec->name, port, password, nick, optlist);
|
||||
/* If rec is NULL the chatnet has no url to connect to */
|
||||
return rec;
|
||||
}
|
||||
|
|
@ -335,8 +332,13 @@ server_create_conn(int chat_type, const char *dest, int port,
|
|||
if (chatrec != NULL)
|
||||
chatnet = chatrec->name;
|
||||
|
||||
return create_addr_conn(chat_type, dest, port,
|
||||
chatnet, password, nick);
|
||||
return create_addr_conn(chat_type, dest, port, chatnet, password, nick, optlist);
|
||||
}
|
||||
|
||||
SERVER_CONNECT_REC *server_create_conn(int chat_type, const char *dest, int port,
|
||||
const char *chatnet, const char *password, const char *nick)
|
||||
{
|
||||
return server_create_conn_opt(chat_type, dest, port, chatnet, password, nick, NULL);
|
||||
}
|
||||
|
||||
/* Find matching server from setup. Try to find record with a same port,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ server_create_conn(int chat_type, const char *dest, int port,
|
|||
const char *chatnet, const char *password,
|
||||
const char *nick);
|
||||
|
||||
SERVER_CONNECT_REC *server_create_conn_opt(int chat_type, const char *dest, int port,
|
||||
const char *chatnet, const char *password,
|
||||
const char *nick, GHashTable *optlist);
|
||||
|
||||
/* Find matching server from setup. Try to find record with a same port,
|
||||
but fallback to any server with the same address. */
|
||||
SERVER_SETUP_REC *server_setup_find(const char *address, int port,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue