From 70da67160e72daba25b13e5bb949b335011c7b26 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Mon, 18 Nov 2013 14:04:22 +0200 Subject: [PATCH] Fix #214: Typing notification does not always work (II) Some servers don't accept that we sent MESSAGE then INFO without waiting for the response to the MESSAGE. This is another case where SIPE is missing a correct SIP layer implementation :-( Work around this problem by filtering out PURPLE_NOT_TYPING events in the purple backend, like it was done in previous SIPE versions. (cherry picked from commit 23e888cf5072e80027823a95c232e94b7ea017e8) --- src/purple/purple-plugin.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/purple/purple-plugin.c b/src/purple/purple-plugin.c index cfba3f41..76079595 100644 --- a/src/purple/purple-plugin.c +++ b/src/purple/purple-plugin.c @@ -499,9 +499,23 @@ static unsigned int sipe_purple_send_typing(PurpleConnection *gc, /* only enable this debug output while testing SIPE_DEBUG_INFO("sipe_purple_send_typing: '%s' state %d", who, state); */ - sipe_core_user_feedback_typing(PURPLE_GC_TO_SIPE_CORE_PUBLIC, - who, - typing); + /* + * libpurple calls this function with PURPLE_NOT_TYPING *after* + * calling sipe_purple_send_im() with the message. This causes + * SIPE core to send out two SIP messages to the same dialog in + * short succession without waiting for the response to the first + * one. Some servers then reject the first one with + * + * SIP/2.0 500 Stale CSeq Value + * + * which triggers a "message not delivered" error for the user. + * + * Work around this by filtering out PURPLE_NOT_TYPING events. + */ + if (state != PURPLE_NOT_TYPING) + sipe_core_user_feedback_typing(PURPLE_GC_TO_SIPE_CORE_PUBLIC, + who, + typing); /* tell libpurple to send typing indications every 4 seconds */ return(typing ? 4 : 0); -- 2.11.4.GIT