--- pidgin-2.5.4/libpurple/protocols/oscar/flap_connection.c.orig 2009-01-23 00:09:41.000000000 +0500 +++ pidgin-2.5.4/libpurple/protocols/oscar/flap_connection.c 2009-01-23 16:12:00.000000000 +0500 @@ -1052,10 +1052,27 @@ byte_stream_destroy(&bs); } +guint16 +generate_flap_sequence() +{ + guint32 n = g_random_int(), s = 0, i; + for (i = n; i >>= 3; s += i); + return (((0 - s) ^ (guint)n) & 7 ^ n) + 3; +} + void flap_connection_send(FlapConnection *conn, FlapFrame *frame) { - frame->seqnum = ++(conn->seqnum_out); + if (frame->channel == 0x01) + { + frame->seqnum = generate_flap_sequence(); + conn->seqnum_out = frame->seqnum; + } else + frame->seqnum = ++(conn->seqnum_out); + + purple_debug_info("oscar", "Sent FLAP seqid=%d\n", + frame->seqnum); + sendframe_flap(conn, frame); flap_frame_destroy(frame); }