Changes in irc_im.c [934db064:d6657ce]
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r934db064 rd6657ce 192 192 } 193 193 194 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg _, time_t sent_at )194 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg, time_t sent_at ) 195 195 { 196 196 irc_t *irc = bee->ui_data; … … 199 199 char *wrapped, *ts = NULL; 200 200 irc_channel_t *ic = NULL; 201 char *msg = g_strdup( msg_ );202 GSList *l;203 201 204 202 if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) ) … … 226 224 } 227 225 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 else241 {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 257 226 wrapped = word_wrap( msg, 425 ); 258 227 irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix ); … … 260 229 g_free( wrapped ); 261 230 g_free( prefix ); 262 g_free( msg );263 231 g_free( ts ); 264 232 … … 381 349 } 382 350 383 if( iu->pastebuf == NULL )384 iu->pastebuf = g_string_new( msg );385 else386 {387 b_event_remove( iu->pastebuf_timer );388 g_string_append_printf( iu->pastebuf, "\n%s", msg );389 }390 391 351 if( set_getbool( &iu->irc->b->set, "paste_buffer" ) ) 392 352 { 393 353 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 } 394 362 395 363 if( ( delay = set_getint( &iu->irc->b->set, "paste_buffer_delay" ) ) <= 5 ) … … 401 369 } 402 370 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 ); 408 372 } 409 373 … … 411 375 { 412 376 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; 442 382 iu->pastebuf_timer = 0; 443 383 … … 590 530 irc_channel_t *ic = c->ui_data; 591 531 592 if( ic == NULL )532 if( ic == NULL || bu == NULL ) 593 533 return FALSE; 594 534 … … 753 693 { 754 694 *s = '\0'; 755 if( ( iu = irc_user_by_name( ic->irc, nick ) ) && 695 if( ( iu = irc_user_by_name( ic->irc, nick ) ) && iu->bu && 756 696 iu->bu->nick && irc_channel_has_user( ic, iu ) ) 757 697 { … … 858 798 c->ic->acc->prpl->chat_topic( c, topic ); 859 799 g_free( topic ); 860 return TRUE;861 }862 800 } 801 802 /* Whatever happened, the IM module should ack the topic change. */ 863 803 return FALSE; 864 804 }
Note: See TracChangeset
for help on using the changeset viewer.