1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-12-22 23:58:52 -05:00

Nuke nickserv password field and some cosmetics

This commit is contained in:
Berke Viktor 2013-05-11 02:40:08 +02:00
parent a98b95923b
commit 7b0b86c9f7
6 changed files with 41 additions and 33 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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") &&

View File

@ -35,7 +35,6 @@ typedef struct ircnet
char *pass;
char *autojoin;
char *command;
char *nickserv;
int logintype;
char *comment;
char *encoding;

View File

@ -65,7 +65,6 @@ static GtkWidget *edit_entry_real;
static GtkWidget *edit_entry_join;
static GtkWidget *edit_entry_pass;
static GtkWidget *edit_entry_cmd;
static GtkWidget *edit_entry_nickserv;
static GtkWidget *edit_label_nick;
static GtkWidget *edit_label_nick2;
static GtkWidget *edit_label_real;
@ -105,6 +104,10 @@ static const char *pages[]=
/* This is our dictionary for authentication types. Keep these in sync with
* login_types[]! This allows us to re-order the login type dropdown in the
* network list without breaking config compatibility.
*
* Also make sure inbound_nickserv_login() won't break, i.e. if you add a new
* type that is NickServ-based, add it there as well so that HexChat knows to
* treat it as such.
*/
static int login_types_conf[] =
{
@ -526,7 +529,6 @@ servlist_edit_update (ircnet *net)
servlist_update_from_entry (&net->autojoin, edit_entry_join);
servlist_update_from_entry (&net->command, edit_entry_cmd);
servlist_update_from_entry (&net->nickserv, edit_entry_nickserv);
servlist_update_from_entry (&net->pass, edit_entry_pass);
}
@ -1542,12 +1544,6 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
net->command, 0,
_("Extra command to execute after connecting. If you need more than one, set this to LOAD -e <filename>, where <filename> is a text-file full of commands to execute."));
edit_entry_nickserv =
servlist_create_entry (table3, _("NickServ password:"), 14,
net->nickserv, 0,
_("If your nickname requires a password, enter it here. Not all IRC networks support this."));
gtk_entry_set_visibility (GTK_ENTRY (edit_entry_nickserv), FALSE);
label_logintype = gtk_label_new (_("Login method:"));
gtk_widget_show (label_logintype);
gtk_table_attach (GTK_TABLE (table3), label_logintype, 1, 2, 15, 16,