Changeset 6a9d068
- Timestamp:
- 2010-05-03T00:39:39Z (15 years ago)
- Branches:
- master
- Children:
- f924563
- Parents:
- e54112f
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
re54112f r6a9d068 640 640 irc_channel_add_user( ic, irc->user ); 641 641 642 if( strcmp( set_getstr( &irc->b->set, "ops" ), "both" ) == 0 || 643 strcmp( set_getstr( &irc->b->set, "ops" ), "user" ) == 0 ) 644 irc_channel_user_set_mode( ic, irc->user, IRC_CHANNEL_USER_OP ); 645 642 646 irc->last_root_cmd = g_strdup( ROOT_CHAN ); 643 647 -
irc.h
re54112f r6a9d068 196 196 irc_channel_user_t *irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu ); 197 197 int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who ); 198 void irc_channel_user_set_mode( irc_channel_t *ic, irc_user_t *iu, irc_channel_user_flags_t flags ); 198 199 gboolean irc_channel_name_ok( const char *name ); 199 200 … … 216 217 void irc_send_msg_f( irc_user_t *iu, const char *type, const char *dst, const char *format, ... ) G_GNUC_PRINTF( 4, 5 ); 217 218 void irc_send_nick( irc_user_t *iu, const char *new ); 219 void irc_send_channel_user_mode_diff( irc_channel_t *ic, irc_user_t *iu, 220 irc_channel_user_flags_t old, irc_channel_user_flags_t new ); 218 221 219 222 /* irc_user.c */ -
irc_channel.c
re54112f r6a9d068 43 43 44 44 irc_channel_add_user( ic, irc->root ); 45 if( strcmp( set_getstr( &irc->b->set, "ops" ), "both" ) == 0 || 46 strcmp( set_getstr( &irc->b->set, "ops" ), "root" ) == 0 ) 47 irc_channel_user_set_mode( ic, irc->root, IRC_CHANNEL_USER_OP ); 45 48 46 49 irc->channels = g_slist_prepend( irc->channels, ic ); … … 157 160 158 161 return 1; 162 } 163 164 void irc_channel_user_set_mode( irc_channel_t *ic, irc_user_t *iu, irc_channel_user_flags_t flags ) 165 { 166 irc_channel_user_t *icu = irc_channel_has_user( ic, iu ); 167 168 if( icu->flags == flags ) 169 return; 170 171 if( ic->flags & IRC_CHANNEL_JOINED ) 172 irc_send_channel_user_mode_diff( ic, iu, icu->flags, flags ); 173 174 icu->flags = flags; 159 175 } 160 176 -
irc_im.c
re54112f r6a9d068 92 92 93 93 irc_channel_add_user( ic, iu ); 94 95 if( set_getbool( &bee->set, "away_devoice" ) ) 96 irc_channel_user_set_mode( ic, iu, ( bu->flags & BEE_USER_AWAY ) ? 97 0 : IRC_CHANNEL_USER_VOICE ); 94 98 } 95 99 else -
irc_send.c
re54112f r6a9d068 157 157 GSList *l; 158 158 char namelist[385] = ""; 159 //char *ops = set_getstr( &ic->irc->b->set, "ops" );160 159 161 160 /* RFCs say there is no error reply allowed on NAMES, so when the … … 172 171 } 173 172 174 /* 175 if( u->ic && !u->away && set_getbool( &irc->set, "away_devoice" ) ) 173 if( icu->flags & IRC_CHANNEL_USER_OP ) 174 strcat( namelist, "@" ); 175 else if( icu->flags & IRC_CHANNEL_USER_HALFOP ) 176 strcat( namelist, "%" ); 177 else if( icu->flags & IRC_CHANNEL_USER_VOICE ) 176 178 strcat( namelist, "+" ); 177 else if( ( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( ops, "root" ) == 0 || strcmp( ops, "both" ) == 0 ) ) ||178 ( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( ops, "user" ) == 0 || strcmp( ops, "both" ) == 0 ) ) )179 strcat( namelist, "@" );180 */181 179 182 180 strcat( namelist, iu->nick ); … … 327 325 iu->nick, iu->user, iu->host, new ); 328 326 } 327 328 /* Send an update of a user's mode inside a channel, compared to what it was. */ 329 void irc_send_channel_user_mode_diff( irc_channel_t *ic, irc_user_t *iu, 330 irc_channel_user_flags_t old, irc_channel_user_flags_t new ) 331 { 332 char changes[3*(5+strlen(iu->nick))]; 333 char from[strlen(ic->irc->root->nick)+strlen(ic->irc->root->user)+strlen(ic->irc->root->host)+3]; 334 int n; 335 336 *changes = '\0'; n = 0; 337 if( ( old & IRC_CHANNEL_USER_OP ) != ( new & IRC_CHANNEL_USER_OP ) ) 338 { 339 n ++; 340 if( new & IRC_CHANNEL_USER_OP ) 341 strcat( changes, "+o" ); 342 else 343 strcat( changes, "-o" ); 344 } 345 if( ( old & IRC_CHANNEL_USER_HALFOP ) != ( new & IRC_CHANNEL_USER_HALFOP ) ) 346 { 347 n ++; 348 if( new & IRC_CHANNEL_USER_HALFOP ) 349 strcat( changes, "+h" ); 350 else 351 strcat( changes, "-h" ); 352 } 353 if( ( old & IRC_CHANNEL_USER_VOICE ) != ( new & IRC_CHANNEL_USER_VOICE ) ) 354 { 355 n ++; 356 if( new & IRC_CHANNEL_USER_VOICE ) 357 strcat( changes, "+v" ); 358 else 359 strcat( changes, "-v" ); 360 } 361 while( n ) 362 { 363 strcat( changes, " " ); 364 strcat( changes, iu->nick ); 365 n --; 366 } 367 368 if( set_getbool( &ic->irc->b->set, "simulate_netsplit" ) ) 369 g_snprintf( from, sizeof( from ), "%s", ic->irc->root->host ); 370 else 371 g_snprintf( from, sizeof( from ), "%s!%s@%s", ic->irc->root->nick, 372 ic->irc->root->user, ic->irc->root->host ); 373 374 irc_write( ic->irc, ":%s MODE %s %s", from, ic->name, changes ); 375 }
Note: See TracChangeset
for help on using the changeset viewer.