From 1c8e5f7fba87b6096a7fd86508ca1821876abb54 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 11 Jun 2010 17:12:27 +0200 Subject: Added away_reply_timeout setting so BitlBee will suppress away messages sent in response to PRIVMSG if one was sent recently - some IRC clients including irssi don't do this very well (when talking to >1 people who are away for example). --- irc_im.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'irc_im.c') diff --git a/irc_im.c b/irc_im.c index 3dca5c3d..ee86d4b1 100644 --- a/irc_im.c +++ b/irc_im.c @@ -113,6 +113,9 @@ static gboolean bee_irc_user_status( bee_t *bee, bee_user_t *bu, bee_user_t *old } } + /* Reset this one since the info may have changed. */ + iu->away_reply_timeout = 0; + bee_irc_channel_update( irc, NULL, iu ); return TRUE; @@ -319,9 +322,20 @@ static gboolean bee_irc_user_privmsg_cb( gpointer data, gint fd, b_input_conditi static gboolean bee_irc_user_privmsg( irc_user_t *iu, const char *msg ) { + const char *away; + if( iu->bu == NULL ) return FALSE; - else if( set_getbool( &iu->irc->b->set, "paste_buffer" ) ) + + if( ( away = irc_user_get_away( iu ) ) && + time( NULL ) >= iu->away_reply_timeout ) + { + irc_send_num( iu->irc, 301, "%s :%s", iu->nick, away ); + iu->away_reply_timeout = time( NULL ) + + set_getint( &iu->irc->b->set, "away_reply_timeout" ); + } + + if( set_getbool( &iu->irc->b->set, "paste_buffer" ) ) { int delay; -- cgit v1.2.3