From 91b508866ec1923d735981489dd9d4356f9f3237 Mon Sep 17 00:00:00 2001 From: Junker Date: Sat, 25 Feb 2017 18:06:15 +0700 Subject: [PATCH 1/2] fix Event/Call handler from some client Event/Call come without partlist type argument --- skypeweb/skypeweb_messages.c | 70 ++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/skypeweb/skypeweb_messages.c b/skypeweb/skypeweb_messages.c index d61ef1cf..e802ff6e 100644 --- a/skypeweb/skypeweb_messages.c +++ b/skypeweb/skypeweb_messages.c @@ -437,44 +437,52 @@ process_message_resource(SkypeWebAccount *sa, JsonObject *resource) (void) incoming; from = convbuddyname; } - if (partlisttype && from != NULL) { - imconv = purple_conversations_find_im_with_account(from, sa->account); - if (imconv == NULL) - { - imconv = purple_im_conversation_new(sa->account, from); - } - - conv = PURPLE_CONVERSATION(imconv); - if (g_str_equal(partlisttype, "started")) { - message = _("Call started"); - } else if (g_str_equal(partlisttype, "ended")) { - PurpleXmlNode *part; - gint duration_int = -1; - - for(part = purple_xmlnode_get_child(partlist, "part"); - part; - part = purple_xmlnode_get_next_twin(part)) + + if (from != NULL) { + if (partlisttype) { + imconv = purple_conversations_find_im_with_account(from, sa->account); + if (imconv == NULL) { - const gchar *identity = purple_xmlnode_get_attrib(part, "identity"); - if (identity && skypeweb_is_user_self(sa, identity)) { - PurpleXmlNode *duration = purple_xmlnode_get_child(part, "duration"); - if (duration != NULL) { - gchar *duration_str; - duration_str = purple_xmlnode_get_data(duration); - duration_int = atoi(duration_str); - break; + imconv = purple_im_conversation_new(sa->account, from); + } + + conv = PURPLE_CONVERSATION(imconv); + if (g_str_equal(partlisttype, "started")) { + message = _("Call started"); + } else if (g_str_equal(partlisttype, "ended")) { + PurpleXmlNode *part; + gint duration_int = -1; + + for(part = purple_xmlnode_get_child(partlist, "part"); + part; + part = purple_xmlnode_get_next_twin(part)) + { + const gchar *identity = purple_xmlnode_get_attrib(part, "identity"); + if (identity && skypeweb_is_user_self(sa, identity)) { + PurpleXmlNode *duration = purple_xmlnode_get_child(part, "duration"); + if (duration != NULL) { + gchar *duration_str; + duration_str = purple_xmlnode_get_data(duration); + duration_int = atoi(duration_str); + break; + } } } + if (duration_int < 0) { + message = _("Call missed"); + } else { + //TODO report how long the call was + message = _("Call ended"); + } } - if (duration_int < 0) { - message = _("Call missed"); - } else { - //TODO report how long the call was - message = _("Call ended"); - } } + else { + message = _("Unsupported call received"); + } + purple_serv_got_im(sa->pc, from, message, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM, composetimestamp); } + purple_xmlnode_free(partlist); } else if (g_str_equal(messagetype, "RichText/Files")) { purple_serv_got_im(sa->pc, convbuddyname, _("The user sent files in an unsupported way"), PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ERROR, composetimestamp); From 5406f1f9cc360ebb65b9d3785ea3e8bcbc244602 Mon Sep 17 00:00:00 2001 From: Junker Date: Sat, 25 Feb 2017 18:07:07 +0700 Subject: [PATCH 2/2] add Signal/Flamingo event handler --- skypeweb/skypeweb_messages.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/skypeweb/skypeweb_messages.c b/skypeweb/skypeweb_messages.c index e802ff6e..1cfc9126 100644 --- a/skypeweb/skypeweb_messages.c +++ b/skypeweb/skypeweb_messages.c @@ -484,6 +484,18 @@ process_message_resource(SkypeWebAccount *sa, JsonObject *resource) } purple_xmlnode_free(partlist); + } else if (g_str_equal(messagetype, "Signal/Flamingo")) { + const gchar *message = NULL; + + if (skypeweb_is_user_self(sa, from)) { + from = convbuddyname; + } + + if (from != NULL) { + message = _("Unsupported call received"); + + purple_serv_got_im(sa->pc, from, message, PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM, composetimestamp); + } } else if (g_str_equal(messagetype, "RichText/Files")) { purple_serv_got_im(sa->pc, convbuddyname, _("The user sent files in an unsupported way"), PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_ERROR, composetimestamp); } else {