aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2012-03-19 21:01:50 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2012-03-19 21:01:50 +0000
commitfda194fe19a3e91b12387aeb9eda544580e48381 (patch)
tree7f0651fc729cdca3dd1bfcfd0c7e347a8d8e06d1
parentd18dee42088f0bef9d09dbc7903590d755d19a50 (diff)
Allow identify -noload/-force without typing a password. (/OPER)
Patch from trac3r, bug #814.
-rw-r--r--irc.h4
-rw-r--r--irc_commands.c13
-rw-r--r--root_commands.c4
3 files changed, 19 insertions, 2 deletions
diff --git a/irc.h b/irc.h
index 930b90b3..97d56ea1 100644
--- a/irc.h
+++ b/irc.h
@@ -56,9 +56,11 @@ typedef enum
to logfiles) is the /OPER command, try to use that command for
stuff that matters. */
OPER_HACK_IDENTIFY = 0x100,
+ OPER_HACK_IDENTIFY_NOLOAD = 0x01100,
+ OPER_HACK_IDENTIFY_FORCE = 0x02100,
OPER_HACK_REGISTER = 0x200,
OPER_HACK_ACCOUNT_ADD = 0x400,
- OPER_HACK_ANY = 0x700, /* To check for them all at once. */
+ OPER_HACK_ANY = 0x3700, /* To check for them all at once. */
} irc_status_t;
struct irc_user;
diff --git a/irc_commands.c b/irc_commands.c
index 18a7acd5..0dbf8ee6 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -447,7 +447,18 @@ static void irc_cmd_oper_hack( irc_t *irc, char **cmd )
}
else if( irc->status & OPER_HACK_IDENTIFY )
{
- char *send_cmd[] = { "identify", password, NULL };
+ char *send_cmd[] = { "identify", password, NULL, NULL };
+ irc->status &= ~OPER_HACK_IDENTIFY;
+ if( irc->status & OPER_HACK_IDENTIFY_NOLOAD )
+ {
+ send_cmd[1] = "-noload";
+ send_cmd[2] = password;
+ }
+ else if( irc->status & OPER_HACK_IDENTIFY_FORCE )
+ {
+ send_cmd[1] = "-force";
+ send_cmd[2] = password;
+ }
irc_send_num( irc, 491, ":Trying to identify" );
root_command( irc, send_cmd );
}
diff --git a/root_commands.c b/root_commands.c
index 41b98a17..b46b076d 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -120,10 +120,14 @@ static void cmd_identify( irc_t *irc, char **cmd )
{
load = FALSE;
password = cmd[2];
+ if( password == NULL )
+ irc->status |= OPER_HACK_IDENTIFY_NOLOAD;
}
else if( strncmp( cmd[1], "-force", 6 ) == 0 )
{
password = cmd[2];
+ if( password == NULL )
+ irc->status |= OPER_HACK_IDENTIFY_FORCE;
}
else if( irc->b->accounts != NULL )
{