diff options
-rw-r--r-- | src/core/servers-setup.c | 2 | ||||
-rw-r--r-- | src/core/servers.c | 17 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-server.c | 4 | ||||
-rw-r--r-- | src/irc/core/irc-channels.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-channels.h | 3 | ||||
-rw-r--r-- | src/irc/core/irc-commands.c | 8 | ||||
-rw-r--r-- | src/irc/core/irc-nicklist.h | 2 | ||||
-rw-r--r-- | src/irc/core/irc-servers-setup.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-servers.c | 19 |
9 files changed, 30 insertions, 29 deletions
diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index b314ca95..526854f3 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -173,7 +173,7 @@ create_addr_conn(const char *address, int port, g_return_val_if_fail(address != NULL, NULL); sserver = server_setup_find(address, port); - chatnet = sserver->chatnet == NULL ? NULL : + chatnet = sserver == NULL || sserver->chatnet == NULL ? NULL : chatnet_find(sserver->chatnet); conn = NULL; signal_emit("server setup connect", 2, &conn, chatnet); diff --git a/src/core/servers.c b/src/core/servers.c index f6f353d6..b8168f05 100644 --- a/src/core/servers.c +++ b/src/core/servers.c @@ -206,6 +206,23 @@ int server_start_connect(SERVER_REC *server) MODULE_DATA_INIT(server); server->type = module_get_uniq_id("SERVER", 0); + server->nick = g_strdup(server->connrec->nick); + if (server->connrec->port <= 0) server->connrec->port = 6667; + if (server->connrec->username == NULL || *server->connrec->username == '\0') { + g_free_not_null(server->connrec->username); + + server->connrec->username = g_get_user_name(); + if (*server->connrec->username == '\0') server->connrec->username = "-"; + server->connrec->username = g_strdup(server->connrec->username); + } + if (server->connrec->realname == NULL || *server->connrec->realname == '\0') { + g_free_not_null(server->connrec->realname); + + server->connrec->realname = g_get_real_name(); + if (*server->connrec->realname == '\0') server->connrec->realname = "-"; + server->connrec->realname = g_strdup(server->connrec->realname); + } + if (pipe(server->connect_pipe) != 0) { g_warning("server_connect(): pipe() failed."); return FALSE; diff --git a/src/fe-common/irc/fe-irc-server.c b/src/fe-common/irc/fe-irc-server.c index 18093737..85e40afd 100644 --- a/src/fe-common/irc/fe-irc-server.c +++ b/src/fe-common/irc/fe-irc-server.c @@ -38,7 +38,7 @@ static void print_servers(void) GSList *tmp; for (tmp = servers; tmp != NULL; tmp = tmp->next) { - IRC_SERVER_REC *rec = tmp->data; + SERVER_REC *rec = tmp->data; printformat(NULL, NULL, MSGLEVEL_CRAP, IRCTXT_SERVER_LIST, rec->tag, rec->connrec->address, rec->connrec->port, @@ -50,7 +50,7 @@ static void print_lookup_servers(void) { GSList *tmp; for (tmp = lookup_servers; tmp != NULL; tmp = tmp->next) { - IRC_SERVER_REC *rec = tmp->data; + SERVER_REC *rec = tmp->data; printformat(NULL, NULL, MSGLEVEL_CRAP, IRCTXT_SERVER_LOOKUP_LIST, rec->tag, rec->connrec->address, rec->connrec->port, diff --git a/src/irc/core/irc-channels.c b/src/irc/core/irc-channels.c index 72a5d8ec..ba44a7d5 100644 --- a/src/irc/core/irc-channels.c +++ b/src/irc/core/irc-channels.c @@ -61,7 +61,7 @@ IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server, return rec; } -void sig_channel_destroyed(IRC_CHANNEL_REC *channel) +static void sig_channel_destroyed(IRC_CHANNEL_REC *channel) { if (!IS_IRC_CHANNEL(channel)) return; diff --git a/src/irc/core/irc-channels.h b/src/irc/core/irc-channels.h index aaaf73a7..9a331082 100644 --- a/src/irc/core/irc-channels.h +++ b/src/irc/core/irc-channels.h @@ -37,6 +37,7 @@ IRC_CHANNEL_REC *irc_channel_create(IRC_SERVER_REC *server, IRC_CHANNEL(channel_find(SERVER(server), name)) /* Join to channels. `data' contains channels and channel keys */ -void irc_channels_join(IRC_SERVER_REC *server, const char *data, int automatic); +void irc_channels_join(IRC_SERVER_REC *server, + const char *data, int automatic); #endif diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 4b75e24e..860e4737 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -86,10 +86,10 @@ IRC_SERVER_REC *irccmd_options_get_server(const char *cmd, return (IRC_SERVER_REC *) server; } -static IRC_SERVER_REC *connect_server(const char *data) +static SERVER_REC *connect_server(const char *data) { SERVER_CONNECT_REC *conn; - IRC_SERVER_REC *server; + SERVER_REC *server; GHashTable *optlist; char *addr, *portstr, *password, *nick, *ircnet, *host; void *free_arg; @@ -126,7 +126,7 @@ static IRC_SERVER_REC *connect_server(const char *data) memcpy(conn->own_ip, &ip, sizeof(IPADDR)); } } - server = irc_server_connect(IRC_SERVER_CONNECT(conn)); + server = server_connect(conn); cmd_params_free(free_arg); return server; @@ -202,7 +202,7 @@ static void cmd_server(const char *data, IRC_SERVER_REC *server) cmd_disconnect("* Changing server", server); } - server = connect_server(data); + server = IRC_SERVER(connect_server(data)); if (*addr == '+' || server == NULL || (ircnet != NULL && server->connrec->chatnet != NULL && g_strcasecmp(ircnet, server->connrec->chatnet) != 0)) { diff --git a/src/irc/core/irc-nicklist.h b/src/irc/core/irc-nicklist.h index d5cf78d3..e4172b89 100644 --- a/src/irc/core/irc-nicklist.h +++ b/src/irc/core/irc-nicklist.h @@ -9,7 +9,7 @@ void irc_nicklist_deinit(void); /* Remove all "extra" characters from `nick'. Like _nick_ -> nick */ char *irc_nick_strip(const char *nick); -/* Check is `msg' is meant for `nick'. */ +/* Check if `msg' is meant for `nick'. */ int irc_nick_match(const char *nick, const char *msg); #endif diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index 7ccf29e3..73a3fa9b 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -1,5 +1,5 @@ /* - servers-setup.c : irssi + irc-servers-setup.c : irssi Copyright (C) 1999-2000 Timo Sirainen diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index aeb3070d..3f9593b8 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -113,25 +113,8 @@ IRC_SERVER_REC *irc_server_connect(IRC_SERVER_CONNECT_REC *conn) server = g_new0(IRC_SERVER_REC, 1); server->chat_type = module_get_uniq_id("IRC SERVER", 0); - server->connrec = conn; - if (conn->port <= 0) conn->port = 6667; - if (conn->username == NULL || *conn->username == '\0') { - g_free_not_null(conn->username); - - conn->username = g_get_user_name(); - if (*conn->username == '\0') conn->username = "-"; - conn->username = g_strdup(conn->username); - } - if (conn->realname == NULL || *conn->realname == '\0') { - g_free_not_null(conn->realname); - - conn->realname = g_get_real_name(); - if (*conn->realname == '\0') conn->realname = "-"; - conn->realname = g_strdup(conn->realname); - } - - server->nick = g_strdup(conn->nick); + if (server->connrec->port <= 0) server->connrec->port = 6667; server->cmd_queue_speed = conn->cmd_queue_speed > 0 ? conn->cmd_queue_speed : settings_get_int("cmd_queue_speed"); |