From: norly Date: Tue, 5 Feb 2019 02:42:44 +0000 (+0100) Subject: Add patch-hangouts X-Git-Url: https://git.enpas.org/?p=prosody-hacks.git;a=commitdiff_plain;h=f247358ca541073e9f1262b98f7ba390fc22b9c5 Add patch-hangouts --- diff --git a/README.md b/README.md index 1e5ed23..1cfaf5b 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,21 @@ drop messages with the same message ID, or no message ID at all. To avoid silent message loss at the receiving end when sending messages to a Monal user, this plugin generates a random message ID (a UUID) for every message stanza. + + + +Patches +-------- + +### `patch-hangouts` + +This is now obsolete. + +It was used to hide users who were online online via Google Hangouts, +as Hangouts would report presence via XMPP S2S, but silently drop +incoming messages. It was useless to see these people online unless +they ever used a proper XMPP client to log into Hangouts, at which +point S2S worked just like GTalk did before. + +This has become obsolete now that Google has ended the XMPP S2S +support altogether. diff --git a/patch-hangouts/prosody-0.9.12-presence_void_hangouts.diff b/patch-hangouts/prosody-0.9.12-presence_void_hangouts.diff new file mode 100644 index 0000000..c9fddfe --- /dev/null +++ b/patch-hangouts/prosody-0.9.12-presence_void_hangouts.diff @@ -0,0 +1,42 @@ +--- a/usr/lib/prosody/modules/mod_presence.lua ++++ b/usr/lib/prosody/modules/mod_presence.lua +@@ -313,6 +312,19 @@ + if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes sent to bare JID + return handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to)); + end ++ ++ local from_resource = string.gsub(stanza.attr.from, "^[^/]*/", "", 1); ++ if from_resource ~= stanza.attr.from then ++ if string.match(from_resource, "^Messaging%x%x%x%x%x%x%x%x?%x?") ++ or string.match(from_resource, "^messaging%-smgmailw%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-AChromeExtensionw%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-TalkGadgetw%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-lcsw_hangouts%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-lcsw_hangouts_%x%x%x%x%x%x%x%x") then ++ log("debug", "Voiding presence from: "..stanza.attr.from); ++ stanza.attr.type = "unavailable"; ++ end ++ end + + local user = bare_sessions[to]; + if user then +@@ -338,6 +350,19 @@ + return handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to)); + end + ++ local from_resource = string.gsub(stanza.attr.from, "^[^/]*/", "", 1); ++ if from_resource ~= stanza.attr.from then ++ if string.match(from_resource, "^Messaging%x%x%x%x%x%x%x%x?%x?") ++ or string.match(from_resource, "^messaging%-smgmailw%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-AChromeExtensionw%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-TalkGadgetw%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-lcsw_hangouts%x%x%x%x%x%x%x%x") ++ or string.match(from_resource, "^messaging%-lcsw_hangouts_%x%x%x%x%x%x%x%x") then ++ log("debug", "Voiding presence from: "..stanza.attr.from); ++ stanza.attr.type = "unavailable"; ++ end ++ end ++ + local session = full_sessions[stanza.attr.to]; + if session then + -- TODO fire post processing event