Changeset edf9657
- Timestamp:
- 2006-01-14T18:25:00Z (19 years ago)
- Branches:
- master
- Children:
- b23c5c7
- Parents:
- c22c210
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
rc22c210 redf9657 573 573 574 574 irc_reply( irc, 366, "%s :End of /NAMES list", channel ); 575 } 576 577 int irc_check_login( irc_t *irc ) 578 { 579 if( irc->user && irc->nick ) 580 { 581 if( global.conf->authmode == AUTHMODE_CLOSED && irc->status < USTATUS_AUTHORIZED ) 582 { 583 irc_reply( irc, 464, ":This server is password-protected." ); 584 return 0; 585 } 586 else 587 { 588 irc_login( irc ); 589 return 1; 590 } 591 } 592 else 593 { 594 /* More information needed. */ 595 return 0; 596 } 575 597 } 576 598 -
irc.h
rc22c210 redf9657 118 118 119 119 void irc_login( irc_t *irc ); 120 int irc_check_login( irc_t *irc ); 120 121 void irc_motd( irc_t *irc ); 121 122 void irc_names( irc_t *irc, char *channel ); -
irc_commands.c
rc22c210 redf9657 29 29 static int irc_cmd_pass( irc_t *irc, char **cmd ) 30 30 { 31 if( strcmp( cmd[1], (global.conf)->auth_pass ) == 0 )31 if( global.conf->auth_pass && strcmp( cmd[1], global.conf->auth_pass ) == 0 ) 32 32 { 33 33 irc->status = USTATUS_AUTHORIZED; 34 irc_check_login(); 34 35 } 35 36 else 36 37 { 37 irc_reply( irc, 464, ": Nope, maybe you should try it again..." );38 irc_reply( irc, 464, ":Incorrect password." ); 38 39 } 39 40 … … 43 44 static int irc_cmd_user( irc_t *irc, char **cmd ) 44 45 { 45 if( irc->user ) 46 { 47 irc_reply( irc, 462, ":You can't change your nick/userinfo" ); 48 } 49 else 50 { 51 irc->user = g_strdup( cmd[1] ); 52 irc->realname = g_strdup( cmd[4] ); 53 if( irc->nick ) irc_login( irc ); 54 } 46 irc->user = g_strdup( cmd[1] ); 47 irc->realname = g_strdup( cmd[4] ); 48 49 irc_check_login( irc ); 55 50 56 51 return( 1 ); … … 76 71 { 77 72 irc->nick = g_strdup( cmd[1] ); 78 if( irc->user ) irc_login( irc ); 73 74 irc_check_login( irc ); 79 75 } 80 76 … … 89 85 return( 0 ); 90 86 } 91 92 /*93 if( !irc->user || !irc->nick )94 {95 irc_reply( irc, 451, ":Register first" );96 return( 1 );97 }98 */99 87 100 88 static int irc_cmd_ping( irc_t *irc, char **cmd ) … … 626 614 if( g_strcasecmp( irc_commands[i].command, cmd[0] ) == 0 ) 627 615 { 628 if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status > USTATUS_AUTHORIZED ) 629 continue; 616 if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status >= USTATUS_LOGGED_IN ) 617 { 618 irc_reply( irc, 462, ":Only allowed before logging in" ); 619 return( 1 ); 620 } 630 621 if( irc_commands[i].flags & IRC_CMD_LOGGED_IN && irc->status < USTATUS_LOGGED_IN ) 631 continue; 622 { 623 irc_reply( irc, 451, ":Register first" ); 624 return( 1 ); 625 } 632 626 if( irc_commands[i].flags & IRC_CMD_OPER_ONLY && !strchr( irc->umode, 'o' ) ) 633 continue; 627 { 628 irc_reply( irc, 481, ":Permission denied - You're not an IRC operator" ); 629 return( 1 ); 630 } 634 631 635 632 for( j = 1; j <= irc_commands[i].required_parameters; j ++ )
Note: See TracChangeset
for help on using the changeset viewer.