Changeset 65016a6
- Timestamp:
- 2010-08-04T19:45:18Z (14 years ago)
- Branches:
- master
- Children:
- 23d6165
- Parents:
- bce2014
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
rbce2014 r65016a6 764 764 } 765 765 766 /* TODO: This is a mess, but this function is a bit too complicated to be 767 converted to something more generic. */ 766 768 void irc_umode_set( irc_t *irc, const char *s, gboolean allow_priv ) 767 769 { -
irc.h
rbce2014 r65016a6 36 36 #define UMODES_PRIV "Ro" /* Allowed, but not by user directly */ 37 37 #define UMODES_KEEP "R" /* Don't allow unsetting using /MODE */ 38 #define CMODES "nt "/* Allowed modes */38 #define CMODES "ntC" /* Allowed modes */ 39 39 #define CMODE "t" /* Default mode */ 40 40 #define UMODE "s" /* Default mode */ … … 250 250 int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who ); 251 251 void irc_channel_user_set_mode( irc_channel_t *ic, irc_user_t *iu, irc_channel_user_flags_t flags ); 252 void irc_channel_set_mode( irc_channel_t *ic, const char *s ); 252 253 void irc_channel_auto_joins( irc_t *irc, struct account *acc ); 253 254 void irc_channel_printf( irc_channel_t *ic, char *format, ... ); -
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.