diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2013-02-22 08:31:18 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2013-02-22 08:33:14 +0000 |
commit | fa8be7c05185ce92696a5771b556e70b8eb99a00 (patch) | |
tree | 7f6111c6735bf414a11fb926b24061fde5eb29e8 /src/muc-channel.c | |
parent | f843f499be4c16683a4a5b054a5bf747254b2050 (diff) | |
download | telepathy-gabble-fa8be7c05185ce92696a5771b556e70b8eb99a00.tar.gz |
MUC: stop sending chat states after <error type=wait>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=43166#c0
Diffstat (limited to 'src/muc-channel.c')
-rw-r--r-- | src/muc-channel.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/muc-channel.c b/src/muc-channel.c index 47ab9d5b9..15c337b07 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -214,6 +214,8 @@ struct _GabbleMucChannelPrivate GPtrArray *initial_channels; GArray *initial_handles; char **initial_ids; + + gboolean have_received_error_type_wait; }; typedef struct { @@ -2885,9 +2887,25 @@ handle_errmsg (GObject *source, } if (etype == WOCKY_XMPP_ERROR_TYPE_WAIT) - ds = TP_DELIVERY_STATUS_TEMPORARILY_FAILED; + { + ds = TP_DELIVERY_STATUS_TEMPORARILY_FAILED; + /* Some MUCs have very strict rate limiting like "at most one stanza per + * second". Since chat state notifications count towards this, if the + * user types a message very quickly then the typing notification is + * accepted but then the stanza containing the actual message is + * rejected. + * + * So: if we ever get rate-limited, let's just stop sending chat states. + * + * https://bugs.freedesktop.org/show_bug.cgi?id=43166 + */ + DEBUG ("got <error type='wait'>, disabling chat state notifications"); + priv->have_received_error_type_wait = TRUE; + } else - ds = TP_DELIVERY_STATUS_PERMANENTLY_FAILED; + { + ds = TP_DELIVERY_STATUS_PERMANENTLY_FAILED; + } if (text != NULL) _gabble_muc_channel_receive (gmuc, TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE, @@ -3831,6 +3849,9 @@ gabble_muc_channel_send_chat_state (GObject *object, GabbleMucChannelPrivate *priv = self->priv; TpBaseChannel *base = TP_BASE_CHANNEL (self); + if (priv->have_received_error_type_wait) + return TRUE; + return gabble_message_util_send_chat_state (G_OBJECT (self), GABBLE_CONNECTION (tp_base_channel_get_connection (base)), WOCKY_STANZA_SUB_TYPE_GROUPCHAT, state, priv->jid, error); |