public void logout ( ) throws IOException { if ( this . loggedIn ) { Map < String , String > params = new HashMap <> ( ) ; params . put ( "action" , "logout" ) ; params . put ( "format" , "json" ) ; // reduce the output try { sendJsonRequest ( "POST" , params ) ; } catch ( MediaWikiApiErrorException e ) { throw new IOException ( e . getMessage ( ) , e ) ; //TODO: we should throw a better exception } this . loggedIn = false ; this . username = "" ; this . password = "" ; } }
Logs the current user out .