aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/user-guide/commands.xml14
-rw-r--r--irc.c1
-rw-r--r--irc.h7
-rw-r--r--irc_im.c16
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>
diff --git a/irc.c b/irc.c
index 2660e58b..fb720088 100644
--- a/irc.c
+++ b/irc.c
@@ -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 );
diff --git a/irc.h b/irc.h
index f694420d..1bbb564a 100644
--- a/irc.h
+++ b/irc.h
@@ -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;
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;