aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-12-21 12:21:04 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2011-12-21 12:21:04 +0100
commitce199b726735374aca84b2111bb19ec103478ebc (patch)
treed3fa4dcf151398b064a8aef9d7bdde8cbf3f329b /root_commands.c
parente14b47b826594772e4f3d0dbec1bf17153aa92b1 (diff)
Make it easier to add OAuth-authenticated accounts without having to type
a bogus password.
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/root_commands.c b/root_commands.c
index 734cb0e8..f8f2e578 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -442,9 +442,27 @@ static void cmd_account( irc_t *irc, char **cmd )
set_setstr( &a->set, "server", cmd[5] );
}
- irc_rootmsg( irc, "Account successfully added with tag %s%s",
- a->tag, cmd[4] ? "" :
- ", now use /OPER to enter the password" );
+ irc_rootmsg( irc, "Account successfully added with tag %s", a->tag );
+
+ if( cmd[4] == NULL )
+ {
+ set_t *oauth = set_find( &a->set, "oauth" );
+ if( oauth && bool2int( set_value( oauth ) ) )
+ {
+ *a->pass = '\0';
+ irc_rootmsg( irc, "No need to enter a password for this "
+ "account since it's using OAuth" );
+ }
+ else
+ {
+ irc_rootmsg( irc, "You can now use the /OPER command to "
+ "enter the password" );
+ if( oauth )
+ irc_rootmsg( irc, "Alternatively, enable oauth if "
+ "the account supports it: account %s "
+ "set oauth on", a->tag );
+ }
+ }
return;
}