mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Added -rawlog <file> option to /CONNECT and /SERVER, so you can get the
rawlog from servers that disconnect you too fast. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2346 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
e00877e89b
commit
0f1550dbf8
@ -32,8 +32,10 @@
|
||||
#include "channels.h"
|
||||
#include "queries.h"
|
||||
#include "window-item-def.h"
|
||||
#include "rawlog.h"
|
||||
|
||||
static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr)
|
||||
static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
|
||||
char **rawlog_file)
|
||||
{
|
||||
CHAT_PROTOCOL_REC *proto;
|
||||
SERVER_CONNECT_REC *conn;
|
||||
@ -89,6 +91,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr)
|
||||
if (g_hash_table_lookup(optlist, "noproxy") != NULL)
|
||||
g_free_and_null(conn->proxy);
|
||||
|
||||
*rawlog_file = g_strdup(g_hash_table_lookup(optlist, "rawlog"));
|
||||
|
||||
host = g_hash_table_lookup(optlist, "host");
|
||||
if (host != NULL && *host != '\0') {
|
||||
IPADDR ip4, ip6;
|
||||
@ -106,12 +110,19 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr)
|
||||
static void cmd_connect(const char *data)
|
||||
{
|
||||
SERVER_CONNECT_REC *conn;
|
||||
SERVER_REC *server;
|
||||
char *rawlog_file;
|
||||
|
||||
conn = get_server_connect(data, NULL);
|
||||
conn = get_server_connect(data, NULL, &rawlog_file);
|
||||
if (conn != NULL) {
|
||||
CHAT_PROTOCOL(conn)->server_connect(conn);
|
||||
server = CHAT_PROTOCOL(conn)->server_connect(conn);
|
||||
server_connect_unref(conn);
|
||||
|
||||
if (server != NULL && rawlog_file != NULL)
|
||||
rawlog_open(server->rawlog, rawlog_file);
|
||||
}
|
||||
|
||||
g_free(rawlog_file);
|
||||
}
|
||||
|
||||
static RECONNECT_REC *find_reconnect_server(int chat_type,
|
||||
@ -200,18 +211,24 @@ static void sig_default_command_server(const char *data, SERVER_REC *server,
|
||||
static void cmd_server_connect(const char *data, SERVER_REC *server)
|
||||
{
|
||||
SERVER_CONNECT_REC *conn;
|
||||
char *rawlog_file;
|
||||
int plus_addr;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
/* create connection record */
|
||||
conn = get_server_connect(data, &plus_addr);
|
||||
conn = get_server_connect(data, &plus_addr, &rawlog_file);
|
||||
if (conn != NULL) {
|
||||
if (!plus_addr)
|
||||
update_reconnection(conn, server);
|
||||
CHAT_PROTOCOL(conn)->server_connect(conn);
|
||||
server = CHAT_PROTOCOL(conn)->server_connect(conn);
|
||||
server_connect_unref(conn);
|
||||
|
||||
if (server != NULL && rawlog_file != NULL)
|
||||
rawlog_open(server->rawlog, rawlog_file);
|
||||
}
|
||||
|
||||
g_free(rawlog_file);
|
||||
}
|
||||
|
||||
/* SYNTAX: DISCONNECT *|<tag> [<message>] */
|
||||
@ -400,7 +417,7 @@ void chat_commands_init(void)
|
||||
|
||||
signal_add("default command server", (SIGNAL_FUNC) sig_default_command_server);
|
||||
|
||||
command_set_options("connect", "4 6 !! +host noproxy");
|
||||
command_set_options("connect", "4 6 !! +host noproxy -rawlog");
|
||||
command_set_options("join", "invite");
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,6 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn)
|
||||
void server_connect_finished(SERVER_REC *server)
|
||||
{
|
||||
server->connect_time = time(NULL);
|
||||
server->rawlog = rawlog_create();
|
||||
|
||||
servers = g_slist_append(servers, server);
|
||||
signal_emit("server connected", 1, server);
|
||||
@ -296,6 +295,7 @@ int server_start_connect(SERVER_REC *server)
|
||||
g_input_add(server->connect_pipe[0], G_INPUT_READ,
|
||||
(GInputFunction) server_connect_callback_readpipe,
|
||||
server);
|
||||
server->rawlog = rawlog_create();
|
||||
|
||||
lookup_servers = g_slist_append(lookup_servers, server);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user