Last active
August 29, 2015 14:05
-
-
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…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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ß [email protected] | |
-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