Changeset fb11647a


Ignore:
Timestamp:
2011-10-01T14:55:24Z (13 years ago)
Author:
unknown <pesco@…>
Branches:
master
Children:
3231485
Parents:
da44b08
Message:

factor making a message appear from a specific nick out of bee_irc_user_msg

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    rda44b08 rfb11647a  
    350350void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu );
    351351void bee_irc_user_nick_reset( irc_user_t *iu );
     352void bee_irc_msg_from_user( irc_user_t *iu, const char *msg, time_t sent_at );
    352353
    353354#endif
  • irc_im.c

    rda44b08 rfb11647a  
    193193}
    194194
    195 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at )
    196 {
    197         irc_t *irc = bee->ui_data;
    198         irc_user_t *iu = (irc_user_t *) bu->ui_data;
     195void bee_irc_msg_from_user( irc_user_t *iu, const char *msg, time_t sent_at )
     196{
     197    irc_t *irc = iu->irc;
     198        bee_t *bee = irc->b;
     199        irc_channel_t *ic = NULL;
    199200        char *dst, *prefix = NULL;
    200201        char *wrapped, *ts = NULL;
    201         irc_channel_t *ic = NULL;
    202         char *msg = g_strdup( msg_ );
    203         GSList *l;
    204        
     202
    205203        if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) )
    206204                ts = irc_format_timestamp( irc, sent_at );
     
    226224                ts = NULL;
    227225        }
     226       
     227        wrapped = word_wrap( msg, 425 );
     228        irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
     229       
     230        g_free( wrapped );
     231        g_free( prefix );
     232        g_free( ts );
     233}
     234
     235static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at )
     236{
     237        irc_user_t *iu = (irc_user_t *) bu->ui_data;
     238        char *msg = g_strdup( msg_ );
     239        GSList *l;
    228240       
    229241        for( l = irc_plugins; l; l = l->next )
     
    256268        }
    257269       
    258         wrapped = word_wrap( msg, 425 );
    259         irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
    260        
    261         g_free( wrapped );
    262         g_free( prefix );
     270    bee_irc_msg_from_user( iu, msg, sent_at );
     271
    263272        g_free( msg );
    264         g_free( ts );
    265        
    266273        return TRUE;
    267274}
Note: See TracChangeset for help on using the changeset viewer.