Changeset 6a9d068 for irc_send.c


Ignore:
Timestamp:
2010-05-03T00:39:39Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
f924563
Parents:
e54112f
Message:

Restore away_devoice.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_send.c

    re54112f r6a9d068  
    157157        GSList *l;
    158158        char namelist[385] = "";
    159         //char *ops = set_getstr( &ic->irc->b->set, "ops" );
    160159       
    161160        /* RFCs say there is no error reply allowed on NAMES, so when the
     
    172171                }
    173172               
    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 )
    176178                        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                 */
    181179               
    182180                strcat( namelist, iu->nick );
     
    327325                   iu->nick, iu->user, iu->host, new );
    328326}
     327
     328/* Send an update of a user's mode inside a channel, compared to what it was. */
     329void 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.