Changeset a04705b


Ignore:
Timestamp:
2016-12-26T23:07:56Z (7 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
1882b70
Parents:
d57484d
Message:

jabber: Workaround for servers (like slack) that send echoes without id

Just comparing the body of the last sent message. This isn't foolproof
and sending several messages quickly can make it fail, but it's less
annoying than before. The correct solution is still to fix the server.

In the case of slack I still recommend using the irc gateway instead.

Location:
protocols/jabber
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/conference.c

    rd57484d ra04705b  
    167167        jabber_buddy_remove_bare(c->ic, jc->name);
    168168
     169        g_free(jc->last_sent_message);
    169170        g_free(jc->my_full_jid);
    170171        g_free(jc->name);
     
    187188
    188189        jabber_cache_add(ic, node, jabber_chat_self_message);
     190
     191        g_free(jc->last_sent_message);
     192        jc->last_sent_message = g_strdup(message);
    189193
    190194        return !jabber_write_packet(ic, node);
     
    494498                imcb_chat_log(chat, "From conference server: %s", body->text);
    495499                return;
    496         } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me &&
    497                    (jabber_cache_handle_packet(ic, node) == XT_ABORT)) {
    498                 /* Self message marked by this bitlbee, don't show it */
    499                 return;
     500        } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me) {
     501                if (jabber_cache_handle_packet(ic, node) == XT_ABORT) {
     502                        /* Self message marked by this bitlbee, don't show it */
     503                        return;
     504                } else if (xt_find_attr(node, "id") == NULL &&
     505                           g_strcmp0(body->text, jc->last_sent_message) == 0) {
     506                        /* Some misbehaving servers (like slack) eat the ids and echo anyway.
     507                         * Try to detect those cases by comparing against the last sent message. */
     508                        return;
     509                }
    500510        }
    501511
  • protocols/jabber/jabber.h

    rd57484d ra04705b  
    161161        struct jabber_buddy *me;
    162162        char *invite;
     163        char *last_sent_message;
    163164};
    164165
Note: See TracChangeset for help on using the changeset viewer.