Skip to content

Instantly share code, notes, and snippets.

@santiago26
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santiago26/49ca26d4eb0e23975e81 to your computer and use it in GitHub Desktop.
Save santiago26/49ca26d4eb0e23975e81 to your computer and use it in GitHub Desktop.
Popup in the regular XMPP clients each time somebody tries to start a new chat with a user @gmail.com and doesn't receive a response in 2 minutes. Warning: the person you have tried to contact uses gmail.com. It is possible that their account has been migrated to the Hangouts platform and that Google has silently discarded chats you send them. P…
% Popup in the regular XMPP clients each time somebody tries to start a new chat with a user @gmail.com and doesn't receive a response in 2 minutes. Warning: the person you have tried to contact uses gmail.com. It is possible that their account has been migrated to the Hangouts platform and that Google has silently discarded chats you send them. Please click here for a help page you can email to your contact to fix their account.
% The broken resources start with "Messaging".
% by Holger Weiß holger@zedat.fu-berlin.de
-module(mod_hangouts).
-behaviour(gen_mod).
-export([start/2, stop/1, block_hangouts/1]).
-include("ejabberd.hrl").
-include("jlib.hrl").
-define(HANGOUTS_JID, #jid{
lserver = <<"gmail.com">>,
resource = <<"Messaging", _Rest/binary>>
}).
start(_Host, _Opts) ->
ejabberd_hooks:add(filter_packet, global, ?MODULE, block_hangouts, 10),
ok.
stop(_Host) ->
ejabberd_hooks:delete(filter_packet, global, ?MODULE, block_hangouts, 10),
ok.
block_hangouts({From,
To = ?HANGOUTS_JID,
Packet = #xmlel{name = <<"message">>}}) ->
Reply = jlib:make_error_reply(Packet, ?ERR_NOT_ALLOWED),
ejabberd_router:route(To, From, Reply),
drop;
block_hangouts({?HANGOUTS_JID, _To, #xmlel{name = <<"presence">>}}) -> drop;
block_hangouts({From, To, Packet}) -> {From, To, Packet}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment