Changeset b919363 for irc_commands.c
- Timestamp:
- 2010-03-27T14:31:03Z (15 years ago)
- Branches:
- master
- Children:
- 2f53ada
- Parents:
- 9b69eb7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_commands.c
r9b69eb7 rb919363 184 184 } 185 185 186 static void irc_cmd_mode( irc_t *irc, char **cmd ) 187 { 188 if( irc_channel_name_ok( cmd[1] ) ) 189 { 190 irc_channel_t *ic; 191 192 if( ( ic = irc_channel_by_name( irc, cmd[1] ) ) == NULL ) 193 irc_send_num( irc, 403, "%s :No such channel", cmd[1] ); 194 else if( cmd[2] ) 195 { 196 if( *cmd[2] == '+' || *cmd[2] == '-' ) 197 irc_send_num( irc, 477, "%s :Can't change channel modes", cmd[1] ); 198 else if( *cmd[2] == 'b' ) 199 irc_send_num( irc, 368, "%s :No bans possible", cmd[1] ); 200 } 201 else 202 irc_send_num( irc, 324, "%s +%s", cmd[1], ic->mode ); 203 } 204 else 205 { 206 if( nick_cmp( cmd[1], irc->user->nick ) == 0 ) 207 { 208 if( cmd[2] ) 209 irc_umode_set( irc, cmd[2], 0 ); 210 else 211 irc_send_num( irc, 221, "+%s", irc->umode ); 212 } 213 else 214 irc_send_num( irc, 502, ":Don't touch their modes" ); 215 } 216 } 217 186 218 #if 0 187 219 //#if 0 … … 199 231 { 200 232 irc_send_num( irc, 432, ":Incorrect password" ); 201 }202 }203 204 static void irc_cmd_mode( irc_t *irc, char **cmd )205 {206 if( strchr( CTYPES, *cmd[1] ) )207 {208 if( cmd[2] )209 {210 if( *cmd[2] == '+' || *cmd[2] == '-' )211 irc_send_num( irc, 477, "%s :Can't change channel modes", cmd[1] );212 else if( *cmd[2] == 'b' )213 irc_send_num( irc, 368, "%s :No bans possible", cmd[1] );214 }215 else216 irc_send_num( irc, 324, "%s +%s", cmd[1], CMODE );217 }218 else219 {220 if( nick_cmp( cmd[1], irc->nick ) == 0 )221 {222 if( cmd[2] )223 irc_umode_set( irc, cmd[2], 0 );224 else225 irc_send_num( irc, 221, "+%s", irc->umode );226 }227 else228 irc_send_num( irc, 502, ":Don't touch their modes" );229 233 } 230 234 } … … 566 570 { "whowas", 1, irc_cmd_whowas, IRC_CMD_LOGGED_IN }, 567 571 { "motd", 0, irc_cmd_motd, IRC_CMD_LOGGED_IN }, 572 { "mode", 1, irc_cmd_mode, IRC_CMD_LOGGED_IN }, 568 573 #if 0 569 574 { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, 570 { "mode", 1, irc_cmd_mode, IRC_CMD_LOGGED_IN },571 575 { "invite", 2, irc_cmd_invite, IRC_CMD_LOGGED_IN }, 572 576 { "privmsg", 1, irc_cmd_privmsg, IRC_CMD_LOGGED_IN },
Note: See TracChangeset
for help on using the changeset viewer.