Add patch-hangouts master
authornorly <ny-git@enpas.org>
Tue, 5 Feb 2019 02:42:44 +0000 (03:42 +0100)
committernorly <ny-git@enpas.org>
Tue, 5 Feb 2019 02:50:03 +0000 (03:50 +0100)
README.md
patch-hangouts/prosody-0.9.12-presence_void_hangouts.diff [new file with mode: 0644]

index 1e5ed2364a42ff13f88b839dc29afe3f16f347f2..1cfaf5b52098a532d9940750ee3189d2eb6cf9a6 100644 (file)
--- 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 (file)
index 0000000..c9fddfe
--- /dev/null
@@ -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