Changeset a1f17d4 for commands.c
- Timestamp:
- 2005-12-08T14:14:28Z (19 years ago)
- Branches:
- master
- Children:
- 7989fcf3
- Parents:
- 1ee6c18
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r1ee6c18 ra1f17d4 116 116 } 117 117 118 if( !global.storage->exists( irc->nick )) 119 { 120 setpassnc( irc, cmd[1] ); 121 root_command_string( irc, user_find( irc, irc->mynick ), "save", 0 ); 122 irc->status = USTATUS_IDENTIFIED; 123 } 124 else 125 { 126 irc_usermsg( irc, "Nick is already registered" ); 118 setpassnc( irc, cmd[1] ); 119 switch( global.storage->save( irc, FALSE )) { 120 case STORAGE_ALREADY_EXISTS: 121 irc_usermsg( irc, "Nick is already registered" ); 122 break; 123 124 case STORAGE_OK: 125 irc->status = USTATUS_IDENTIFIED; 126 break; 127 128 default: 129 irc_usermsg( irc, "Error registering" ); 130 break; 127 131 } 128 132 … … 132 136 int cmd_drop( irc_t *irc, char **cmd ) 133 137 { 134 if( ! global.storage->exists (irc->nick) ) 135 { 138 storage_status_t status; 139 140 status = global.storage->remove (irc->nick, cmd[1]); 141 switch (status) { 142 case STORAGE_NO_SUCH_USER: 136 143 irc_usermsg( irc, "That account does not exist" ); 137 144 return( 0 ); 138 } 139 140 if ( global.storage->check_pass (irc->nick, cmd[1]) ) 141 { 145 case STORAGE_INVALID_PASSWORD: 142 146 irc_usermsg( irc, "Password invalid" ); 143 147 return( 0 ); 144 }145 146 global.storage->remove (irc->nick);147 148 setpassnc( irc, NULL );149 irc_usermsg( irc, "Files belonging to account `%s' removed", irc->nick);150 151 return( 0 );148 case STORAGE_OK: 149 setpassnc( irc, NULL ); 150 irc_usermsg( irc, "Account `%s' removed", irc->nick ); 151 return( 0 ); 152 default: 153 irc_usermsg( irc, "Error: '%d'", status ); 154 return( 0 ); 155 } 152 156 } 153 157 … … 614 618 int cmd_save( irc_t *irc, char **cmd ) 615 619 { 616 if( global.storage->save( irc ) )620 if( global.storage->save( irc, TRUE ) ) 617 621 irc_usermsg( irc, "Configuration saved" ); 618 622 else
Note: See TracChangeset
for help on using the changeset viewer.