Changeset 13c1a9f


Ignore:
Timestamp:
2010-05-09T21:52:17Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
4e608d6
Parents:
3130e70
Message:

/join &groupname and all people in that group will be in that channel.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    r3130e70 r13c1a9f  
    261261char *irc_format_timestamp( irc_t *irc, time_t msg_ts );
    262262
     263/* irc_im.c */
     264void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu );
     265
    263266#endif
  • irc_channel.c

    r3130e70 r13c1a9f  
    263263        icc->type = IRC_CC_TYPE_DEFAULT;
    264264       
     265        if( ( icc->group = bee_group_by_name( ic->irc->b, ic->name + 1, FALSE ) ) )
     266                icc->type = IRC_CC_TYPE_GROUP;
     267       
     268        bee_irc_channel_update( ic->irc, ic, NULL );
     269       
    265270        return TRUE;
    266271}
  • irc_im.c

    r3130e70 r13c1a9f  
    8181        irc_t *irc = bee->ui_data;
    8282        irc_user_t *iu = bu->ui_data;
    83         irc_channel_t *ic = irc->default_channel;
    8483       
    8584        /* Do this outside the if below since away state can change without
     
    9695                                irc_send_num( irc, 600, "%s %s %s %d :%s", iu->nick, iu->user,
    9796                                              iu->host, (int) time( NULL ), "logged online" );
    98                        
    99                         irc_channel_add_user( ic, iu );
    100                        
    101                         if( set_getbool( &bee->set, "away_devoice" ) )
    102                                 irc_channel_user_set_mode( ic, iu, ( bu->flags & BEE_USER_AWAY ) ?
    103                                                            0 : IRC_CHANNEL_USER_VOICE );
    10497                }
    10598                else
     
    108101                                irc_send_num( irc, 601, "%s %s %s %d :%s", iu->nick, iu->user,
    109102                                              iu->host, (int) time( NULL ), "logged offline" );
    110                        
    111                         irc_channel_del_user( ic, iu );
    112                 }
    113         }
    114        
    115         return TRUE;
     103                }
     104        }
     105       
     106        bee_irc_channel_update( irc, NULL, iu );
     107       
     108        return TRUE;
     109}
     110
     111void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu )
     112{
     113        struct irc_control_channel *icc;
     114        GSList *l;
     115        gboolean show;
     116       
     117        if( ic == NULL )
     118        {
     119                for( l = irc->channels; l; l = l->next )
     120                {
     121                        ic = l->data;
     122                        /* TODO: Just add a type flag or so.. */
     123                        if( ic->f == irc->default_channel->f )
     124                                bee_irc_channel_update( irc, ic, iu );
     125                }
     126                return;
     127        }
     128        if( iu == NULL )
     129        {
     130                for( l = irc->users; l; l = l->next )
     131                {
     132                        iu = l->data;
     133                        if( iu->bu )
     134                                bee_irc_channel_update( irc, ic, l->data );
     135                }
     136                return;
     137        }
     138       
     139        icc = ic->data;
     140       
     141        if( !( iu->bu->flags & BEE_USER_ONLINE ) )
     142                show = FALSE;
     143        else if( icc->type == IRC_CC_TYPE_DEFAULT )
     144                show = TRUE;
     145        else if( icc->type == IRC_CC_TYPE_GROUP )
     146                show = iu->bu->group == icc->group;
     147       
     148        if( !show )
     149        {
     150                irc_channel_del_user( ic, iu );
     151        }
     152        else
     153        {
     154                irc_channel_add_user( ic, iu );
     155               
     156                if( set_getbool( &irc->b->set, "away_devoice" ) )
     157                        irc_channel_user_set_mode( ic, iu, ( iu->bu->flags & BEE_USER_AWAY ) ?
     158                                                   0 : IRC_CHANNEL_USER_VOICE );
     159        }
    116160}
    117161
Note: See TracChangeset for help on using the changeset viewer.