Changeset 58646d9
- Timestamp:
- 2010-06-28T09:37:11Z (14 years ago)
- Branches:
- master
- Children:
- 7a6ba50
- Parents:
- a670aeb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_commands.c
ra670aeb r58646d9 128 128 static void irc_cmd_join( irc_t *irc, char **cmd ) 129 129 { 130 irc_channel_t *ic; 131 132 if( ( ic = irc_channel_by_name( irc, cmd[1] ) ) == NULL ) 133 ic = irc_channel_new( irc, cmd[1] ); 134 135 if( ic == NULL ) 136 { 137 irc_send_num( irc, 479, "%s :Invalid channel name", cmd[1] ); 138 return; 139 } 140 141 if( ic->flags & IRC_CHANNEL_JOINED ) 142 return; /* Dude, you're already there... 143 RFC doesn't have any reply for that though? */ 144 145 if( ic->f->join && !ic->f->join( ic ) ) 146 /* The story is: FALSE either means the handler showed an error 147 message, or is doing some work before the join should be 148 confirmed. (In the latter case, the caller should take care 149 of that confirmation.) 150 TRUE means all's good, let the user join the channel right away. */ 151 return; 152 153 irc_channel_add_user( ic, irc->user ); 130 char *comma, *s = cmd[1]; 131 132 while( s ) 133 { 134 irc_channel_t *ic; 135 136 if( ( comma = strchr( s, ',' ) ) ) 137 *comma = '\0'; 138 139 if( ( ic = irc_channel_by_name( irc, s ) ) == NULL ) 140 ic = irc_channel_new( irc, s ); 141 142 if( ic == NULL ) 143 { 144 irc_send_num( irc, 479, "%s :Invalid channel name", s ); 145 goto next; 146 } 147 148 if( ic->flags & IRC_CHANNEL_JOINED ) 149 /* Dude, you're already there... 150 RFC doesn't have any reply for that though? */ 151 goto next; 152 153 if( ic->f->join && !ic->f->join( ic ) ) 154 /* The story is: FALSE either means the handler 155 showed an error message, or is doing some work 156 before the join should be confirmed. (In the 157 latter case, the caller should take care of that 158 confirmation.) TRUE means all's good, let the 159 user join the channel right away. */ 160 goto next; 161 162 irc_channel_add_user( ic, irc->user ); 163 164 next: 165 if( comma ) 166 { 167 s = comma + 1; 168 *comma = ','; 169 } 170 else 171 break; 172 } 154 173 } 155 174
Note: See TracChangeset
for help on using the changeset viewer.