From 834ff442d1b413fb4eaabcf03bbf6ab78eafdc1e Mon Sep 17 00:00:00 2001
From: Wilmer van der Gaast
Please note that if you remove a buddy from your list (or if the connection to that user drops) and there's still data in the buffer, this data will be lost. BitlBee will not try to send the message to the user in those cases.
Type: integer |
- Tell BitlBee after how many seconds a buffered message should be sent. + Tell BitlBee after how many (mili)seconds a buffered message should be sent. Values greater than 5 will be interpreted as miliseconds, 5 and lower as seconds.
See also the buddy_sendbuffer setting.
Type: string |
diff --git a/doc/user-guide/user-guide.txt b/doc/user-guide/user-guide.txt index 449dd4de..63d3a67a 100644 --- a/doc/user-guide/user-guide.txt +++ b/doc/user-guide/user-guide.txt @@ -800,7 +800,9 @@ buddy_sendbuffer_delay Type: integer -Tell BitlBee after how many seconds a buffered message should be sent. +Tell BitlBee after how many (mili)seconds a buffered message should be sent. +Values greater than 5 will be interpreted as miliseconds, 5 and lower as +seconds. See also the buddy_sendbuffer setting. diff --git a/irc.c b/irc.c index 1ac277b3..c2199f57 100644 --- a/irc.c +++ b/irc.c @@ -114,7 +114,7 @@ irc_t *irc_new( int fd ) set_add( irc, "auto_reconnect", "false", set_eval_bool ); set_add( irc, "auto_reconnect_delay", "300", set_eval_int ); set_add( irc, "buddy_sendbuffer", "false", set_eval_bool ); - set_add( irc, "buddy_sendbuffer_delay", "1", set_eval_int ); + set_add( irc, "buddy_sendbuffer_delay", "200", set_eval_int ); set_add( irc, "charset", "iso8859-1", set_eval_charset ); set_add( irc, "debug", "false", set_eval_bool ); set_add( irc, "default_target", "root", NULL ); @@ -1427,6 +1427,8 @@ int buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) if( set_getint( irc, "buddy_sendbuffer" ) && set_getint( irc, "buddy_sendbuffer_delay" ) > 0 ) { + int delay; + if( u->sendbuf_len > 0 && u->sendbuf_flags != flags) { //Flush the buffer @@ -1450,10 +1452,13 @@ int buddy_send_handler( irc_t *irc, user_t *u, char *msg, int flags ) strcat( u->sendbuf, msg ); strcat( u->sendbuf, "\n" ); + delay = set_getint( irc, "buddy_sendbuffer_delay" ); + if( delay <= 5 ) + delay *= 1000; + if( u->sendbuf_timer > 0 ) g_source_remove( u->sendbuf_timer ); - u->sendbuf_timer = g_timeout_add( set_getint( irc, "buddy_sendbuffer_delay" ) * 1000, - buddy_send_handler_delayed, u ); + u->sendbuf_timer = g_timeout_add( delay, buddy_send_handler_delayed, u ); return( 1 ); } -- cgit v1.2.3