Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r934db064 rd6657ce  
    192192}
    193193
    194 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at )
     194static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, time_t sent_at )
    195195{
    196196        irc_t *irc = bee->ui_data;
     
    199199        char *wrapped, *ts = NULL;
    200200        irc_channel_t *ic = NULL;
    201         char *msg = g_strdup( msg_ );
    202         GSList *l;
    203201       
    204202        if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) )
     
    226224        }
    227225       
    228         for( l = irc_plugins; l; l = l->next )
    229         {
    230                 irc_plugin_t *p = l->data;
    231                 if( p->filter_msg_in )
    232                 {
    233                         char *s = p->filter_msg_in( iu, msg, 0 );
    234                         if( s )
    235                         {
    236                                 if( s != msg )
    237                                         g_free( msg );
    238                                 msg = s;
    239                         }
    240                         else
    241                         {
    242                                 /* Modules can swallow messages. */
    243                                 return TRUE;
    244                         }
    245                 }
    246         }
    247        
    248         if( ( g_strcasecmp( set_getstr( &bee->set, "strip_html" ), "always" ) == 0 ) ||
    249             ( ( bu->ic->flags & OPT_DOES_HTML ) && set_getbool( &bee->set, "strip_html" ) ) )
    250         {
    251                 char *s = g_strdup( msg );
    252                 strip_html( s );
    253                 g_free( msg );
    254                 msg = s;
    255         }
    256        
    257226        wrapped = word_wrap( msg, 425 );
    258227        irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
     
    260229        g_free( wrapped );
    261230        g_free( prefix );
    262         g_free( msg );
    263231        g_free( ts );
    264232       
     
    381349        }
    382350       
    383         if( iu->pastebuf == NULL )
    384                 iu->pastebuf = g_string_new( msg );
    385         else
    386         {
    387                 b_event_remove( iu->pastebuf_timer );
    388                 g_string_append_printf( iu->pastebuf, "\n%s", msg );
    389         }
    390        
    391351        if( set_getbool( &iu->irc->b->set, "paste_buffer" ) )
    392352        {
    393353                int delay;
     354               
     355                if( iu->pastebuf == NULL )
     356                        iu->pastebuf = g_string_new( msg );
     357                else
     358                {
     359                        b_event_remove( iu->pastebuf_timer );
     360                        g_string_append_printf( iu->pastebuf, "\n%s", msg );
     361                }
    394362               
    395363                if( ( delay = set_getint( &iu->irc->b->set, "paste_buffer_delay" ) ) <= 5 )
     
    401369        }
    402370        else
    403         {
    404                 bee_irc_user_privmsg_cb( iu, 0, 0 );
    405                
    406                 return TRUE;
    407         }
     371                return bee_user_msg( iu->irc->b, iu->bu, msg, 0 );
    408372}
    409373
     
    411375{
    412376        irc_user_t *iu = data;
    413         char *msg = g_string_free( iu->pastebuf, FALSE );
    414         GSList *l;
    415        
    416         for( l = irc_plugins; l; l = l->next )
    417         {
    418                 irc_plugin_t *p = l->data;
    419                 if( p->filter_msg_out )
    420                 {
    421                         char *s = p->filter_msg_out( iu, msg, 0 );
    422                         if( s )
    423                         {
    424                                 if( s != msg )
    425                                         g_free( msg );
    426                                 msg = s;
    427                         }
    428                         else
    429                         {
    430                                 /* Modules can swallow messages. */
    431                                 iu->pastebuf = NULL;
    432                                 g_free( msg );
    433                                 return FALSE;
    434                         }
    435                 }
    436         }
    437        
    438         bee_user_msg( iu->irc->b, iu->bu, msg, 0 );
    439        
    440         g_free( msg );
    441         iu->pastebuf = NULL;
     377       
     378        bee_user_msg( iu->irc->b, iu->bu, iu->pastebuf->str, 0 );
     379       
     380        g_string_free( iu->pastebuf, TRUE );
     381        iu->pastebuf = 0;
    442382        iu->pastebuf_timer = 0;
    443383       
     
    590530        irc_channel_t *ic = c->ui_data;
    591531       
    592         if( ic == NULL )
     532        if( ic == NULL || bu == NULL )
    593533                return FALSE;
    594534       
     
    753693                {
    754694                        *s = '\0';
    755                         if( ( iu = irc_user_by_name( ic->irc, nick ) ) &&
     695                        if( ( iu = irc_user_by_name( ic->irc, nick ) ) && iu->bu &&
    756696                            iu->bu->nick && irc_channel_has_user( ic, iu ) )
    757697                        {
     
    858798                c->ic->acc->prpl->chat_topic( c, topic );
    859799                g_free( topic );
    860                 return TRUE;
    861         }
    862                
     800        }
     801               
     802        /* Whatever happened, the IM module should ack the topic change. */
    863803        return FALSE;
    864804}
Note: See TracChangeset for help on using the changeset viewer.