Changeset 65016a6 for irc_channel.c
- Timestamp:
- 2010-08-04T19:45:18Z (15 years ago)
- Branches:
- master
- Children:
- 23d6165
- Parents:
- bce2014
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_channel.c
rbce2014 r65016a6 322 322 323 323 icu->flags = flags; 324 } 325 326 void irc_channel_set_mode( irc_channel_t *ic, const char *s ) 327 { 328 irc_t *irc = ic->irc; 329 char m[128], st = 1; 330 const char *t; 331 int i; 332 char changes[512], *p, st2 = 2; 333 334 memset( m, 0, sizeof( m ) ); 335 336 for( t = ic->mode; *t; t ++ ) 337 if( *t < sizeof( m ) ) 338 m[(int)*t] = 1; 339 340 p = changes; 341 for( t = s; *t; t ++ ) 342 { 343 if( *t == '+' || *t == '-' ) 344 st = *t == '+'; 345 else if( strchr( CMODES, *t ) ) 346 { 347 if( m[(int)*t] != st) 348 { 349 if( st != st2 ) 350 st2 = st, *p++ = st ? '+' : '-'; 351 *p++ = *t; 352 } 353 m[(int)*t] = st; 354 } 355 } 356 *p = '\0'; 357 358 memset( ic->mode, 0, sizeof( ic->mode ) ); 359 360 for( i = 'A'; i <= 'z' && strlen( ic->mode ) < ( sizeof( ic->mode ) - 1 ); i ++ ) 361 if( m[i] ) 362 ic->mode[strlen(ic->mode)] = i; 363 364 if( *changes && ( ic->flags & IRC_CHANNEL_JOINED ) ) 365 irc_write( irc, ":%s!%s@%s MODE %s :%s", irc->root->nick, 366 irc->root->user, irc->root->host, ic->name, 367 changes ); 324 368 } 325 369 … … 560 604 set_setstr( &ic->set, "show_users", "online+,away" ); 561 605 606 /* For scripts that care. */ 607 irc_channel_set_mode( ic, "+C" ); 608 562 609 return TRUE; 563 610 } … … 691 738 ic->data = NULL; 692 739 740 /* For scripts that care. */ 741 irc_channel_set_mode( ic, "-C" ); 742 693 743 return TRUE; 694 744 }
Note: See TracChangeset
for help on using the changeset viewer.