From 7b0b86c9f7841217d4156503fbe004fdea54caeb Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 11 May 2013 02:40:08 +0200 Subject: Nuke nickserv password field and some cosmetics --- src/common/inbound.c | 47 +++++++++++++++++++++++++++++++++++------------ src/common/plugin.c | 5 ----- src/common/proto-irc.c | 2 ++ src/common/servlist.c | 7 ------- src/common/servlist.h | 1 - 5 files changed, 37 insertions(+), 25 deletions(-) (limited to 'src/common') diff --git a/src/common/inbound.c b/src/common/inbound.c index 29eaf754..2383955e 100644 --- a/src/common/inbound.c +++ b/src/common/inbound.c @@ -1367,6 +1367,20 @@ inbound_exec_eom_cmd (char *str, void *sess) return 1; } +static int +inbound_nickserv_login (server *serv) +{ + /* this could grow ugly, but let's hope there won't be new NickServ types */ + if (serv->loginmethod >= 1 && serv->loginmethod <= 5) + { + return 1; + } + else + { + return 0; + } +} + void inbound_login_end (session *sess, char *text) { @@ -1385,34 +1399,43 @@ inbound_login_end (session *sess, char *text) { /* there may be more than 1, separated by \n */ if (((ircnet *)serv->network)->command) - token_foreach (((ircnet *)serv->network)->command, '\n', - inbound_exec_eom_cmd, sess); + { + token_foreach (((ircnet *)serv->network)->command, '\n', inbound_exec_eom_cmd, sess); + } /* send nickserv password */ - if (((ircnet *)serv->network)->nickserv) - serv->p_ns_identify (serv, ((ircnet *)serv->network)->nickserv); + if (((ircnet *)serv->network)->pass && inbound_nickserv_login (serv)) + { + serv->p_ns_identify (serv, ((ircnet *)serv->network)->pass); + } } /* send JOIN now or wait? */ - if (serv->network && ((ircnet *)serv->network)->nickserv && - prefs.hex_irc_join_delay) - serv->joindelay_tag = fe_timeout_add (prefs.hex_irc_join_delay * 1000, - check_autojoin_channels, serv); + if (serv->network && ((ircnet *)serv->network)->pass && prefs.hex_irc_join_delay && inbound_nickserv_login (serv)) + { + serv->joindelay_tag = fe_timeout_add (prefs.hex_irc_join_delay * 1000, check_autojoin_channels, serv); + } else + { check_autojoin_channels (serv); + } + if (serv->supports_watch || serv->supports_monitor) + { notify_send_watches (serv); + } + serv->end_of_motd = TRUE; } + if (prefs.hex_irc_skip_motd && !serv->motd_skipped) { serv->motd_skipped = TRUE; - EMIT_SIGNAL (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL, - NULL, NULL, 0); + EMIT_SIGNAL (XP_TE_MOTDSKIP, serv->server_session, NULL, NULL, NULL, NULL, 0); return; } - EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL, - NULL, NULL, 0); + + EMIT_SIGNAL (XP_TE_MOTD, serv->server_session, text, NULL, NULL, NULL, 0); } void diff --git a/src/common/plugin.c b/src/common/plugin.c index 686f9749..61d5cb40 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -1111,11 +1111,6 @@ hexchat_get_info (hexchat_plugin *ph, const char *id) case 0x339763: /* nick */ return sess->server->nick; - case 0x438fdf9: /* nickserv */ - if (sess->server->network) - return ((ircnet *)sess->server->network)->nickserv; - return NULL; - case 0xca022f43: /* server */ if (!sess->server->connected) return NULL; diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 5ea2c75c..7c73b5ab 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -102,7 +102,9 @@ static void irc_ns_ghost (server *serv, char *usname, char *pass) { if (serv->loginmethod != 5) + { irc_nickserv (serv, "GHOST", usname, " ", pass); + } } static void diff --git a/src/common/servlist.c b/src/common/servlist.c index 9386bf16..f30dcf48 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -925,7 +925,6 @@ servlist_cleanup (void) { net = list->data; free_and_clear (net->pass); - free_and_clear (net->nickserv); } } @@ -951,7 +950,6 @@ servlist_net_remove (ircnet *net) free (net->autojoin); if (net->command) free (net->command); - free_and_clear (net->nickserv); if (net->comment) free (net->comment); if (net->encoding) @@ -1110,9 +1108,6 @@ servlist_load (void) case 'S': /* new server/hostname for this network */ servlist_server_add (net, buf + 2); break; - case 'B': - net->nickserv = strdup (buf + 2); - break; case 'L': net->logintype = atoi (buf + 2); break; @@ -1225,8 +1220,6 @@ servlist_save (void) fprintf (fp, "P=%s\n", net->pass); if (net->autojoin) fprintf (fp, "J=%s\n", net->autojoin); - if (net->nickserv) - fprintf (fp, "B=%s\n", net->nickserv); if (net->logintype) fprintf (fp, "L=%d\n", net->logintype); if (net->encoding && g_ascii_strcasecmp (net->encoding, "System") && diff --git a/src/common/servlist.h b/src/common/servlist.h index c70c3871..c38c5129 100644 --- a/src/common/servlist.h +++ b/src/common/servlist.h @@ -35,7 +35,6 @@ typedef struct ircnet char *pass; char *autojoin; char *command; - char *nickserv; int logintype; char *comment; char *encoding; -- cgit 1.4.1