diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-11 17:12:27 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-11 17:12:27 +0200 |
commit | 1c8e5f7fba87b6096a7fd86508ca1821876abb54 (patch) | |
tree | 4550a2bac9ceb7e7d60f98fdb87242a1a7c036d1 | |
parent | 70ac4771ebf3358d7bec9bd6fe37cde4c23223bc (diff) |
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).
-rw-r--r-- | doc/user-guide/commands.xml | 14 | ||||
-rw-r--r-- | irc.c | 1 | ||||
-rw-r--r-- | irc.h | 7 | ||||
-rw-r--r-- | irc_im.c | 16 |
4 files changed, 34 insertions, 4 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index bba2df73..0989118e 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -483,6 +483,20 @@ </description> </bitlbee-setting> + <bitlbee-setting name="away_reply_timeout" type="integer" scope="global"> + <default>3600</default> + + <description> + <para> + Most IRC servers send a user's away message every time s/he gets a private message, to inform the sender that they may not get a response immediately. With this setting set to 0, BitlBee will also behave like this. + </para> + + <para> + Since not all IRC clients do an excellent job at suppressing these messages, this setting lets BitlBee do it instead. BitlBee will wait this many seconds (or until the away state/message changes) before re-informing you that the person's away. + </para> + </description> + </bitlbee-setting> + <bitlbee-setting name="buddy_sendbuffer" type="boolean" scope="global"> <default>false</default> @@ -100,6 +100,7 @@ irc_t *irc_new( int fd ) b->ui = &irc_ui_funcs; s = set_add( &b->set, "away_devoice", "true", set_eval_away_devoice, irc ); + s = set_add( &b->set, "away_reply_timeout", "3600", set_eval_int, irc ); s = set_add( &b->set, "charset", "utf-8", set_eval_charset, irc ); s = set_add( &b->set, "default_target", "root", NULL, irc ); s = set_add( &b->set, "display_namechanges", "false", set_eval_bool, irc ); @@ -108,8 +108,9 @@ typedef struct irc_user irc_user_flags_t flags; - GString *pastebuf; + GString *pastebuf; /* Paste buffer (combine lines into a multiline msg). */ guint pastebuf_timer; + time_t away_reply_timeout; /* Only send a 301 if this time passed. */ struct bee_user *bu; @@ -145,10 +146,10 @@ typedef struct irc_channel char *topic_who; time_t topic_time; - GSList *users; + GSList *users; /* struct irc_channel_user */ struct set *set; - GString *pastebuf; + GString *pastebuf; /* Paste buffer (combine lines into a multiline msg). */ guint pastebuf_timer; const struct irc_channel_funcs *f; @@ -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; |