Changeset 934db064 for irc_im.c


Ignore:
Timestamp:
2010-09-01T22:09:27Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
2dcaf9a
Parents:
0c85c08
Message:

Do encryption and decryption. Somehow SMP and other things aren't working
so well yet, at least when testing with Pidgin on the other side. Not sure
where the bug is.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r0c85c08 r934db064  
    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;
    201203       
    202204        if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) )
     
    224226        }
    225227       
     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       
    226257        wrapped = word_wrap( msg, 425 );
    227258        irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
     
    229260        g_free( wrapped );
    230261        g_free( prefix );
     262        g_free( msg );
    231263        g_free( ts );
    232264       
     
    349381        }
    350382       
     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       
    351391        if( set_getbool( &iu->irc->b->set, "paste_buffer" ) )
    352392        {
    353393                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                 }
    362394               
    363395                if( ( delay = set_getint( &iu->irc->b->set, "paste_buffer_delay" ) ) <= 5 )
     
    369401        }
    370402        else
    371                 return bee_user_msg( iu->irc->b, iu->bu, msg, 0 );
     403        {
     404                bee_irc_user_privmsg_cb( iu, 0, 0 );
     405               
     406                return TRUE;
     407        }
    372408}
    373409
     
    375411{
    376412        irc_user_t *iu = data;
    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;
     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;
    382442        iu->pastebuf_timer = 0;
    383443       
Note: See TracChangeset for help on using the changeset viewer.