From ce199b726735374aca84b2111bb19ec103478ebc Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 21 Dec 2011 12:21:04 +0100 Subject: Make it easier to add OAuth-authenticated accounts without having to type a bogus password. --- root_commands.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'root_commands.c') 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; } -- cgit v1.2.3