anchor.diff:  hex_octet(N) ->
       [N - 10 + $a].
   
  --spec(url_encode(string()) -> string()).
  +
   url_encode(Data) ->
       url_encode(Data,"").
   
  
positive.code:     url_encode(R, Acc ++ "&" ++ escape_uri(Key) ++ "=" ++ escape_uri(Value)).
  
  
  send([{Key, Value}|R], API_KEY) ->
  	Header = [{"Authorization", url_encode([{"key", API_KEY}])}],
  	Body = url_encode([{Key, Value}|R]),
  
negative.code: 
  %% TODO: Define some kind of a shaper to prevent floods and the GCM API to burn out :/
  %% Or this could be the limits, like 10 messages/user, 10 messages/hour, etc
  message(From, To, Packet) ->
  	Type = xml:get_tag_attr_s(<<"type">>, Packet),
  	?INFO_MSG("Offline message ~s", [From]),
  	case catch Type of 
  		"normal" -> ok;
  		_ ->
  			%% Strings
  			JFrom = jlib:jid_to_string(From#jid{user = From#jid.user, server = From#jid.server, resource = <<"">>}),
  			JTo = jlib:jid_to_string(To#jid{user = To#jid.user, server = To#jid.server, resource = <<"">>}),
  			ToUser = To#jid.user,
  			ToServer = To#jid.server,
  
  			Body = xml:get_path_s(Packet, [{elem, <<"body">>}, cdata]),
  
  			%% Checking subscription
  			{Subscription, _Groups} = 
  				ejabberd_hooks:run_fold(roster_get_jid_info, ToServer, {none, []}, [ToUser, ToServer, From]),
  			case Subscription of
  				both ->
  					case catch Body of
  						<<>> -> ok; %% There is no body
  						_ ->
  							Result = mnesia:dirty_read(gcm_users, {ToUser, ToServer}),
  							case catch Result of 
  								[] -> ?DEBUG("mod_gcm: No such record found for ~s", [JTo]);
  								[#gcm_users{gcm_key = API_KEY}] ->
  									Args = [{"registration_id", API_KEY}, {"data.message", Body}, {"data.source", JFrom}, {"data.destination", JTo}],
  									send(Args, ejabberd_config:get_global_option(gcm_api_key, fun(V) -> V end))
  							end
  						end;
  					_ -> ok
  			end
  	end.
  
  
  iq(#jid{user = User, server = Server} = From, To, #iq{type = Type, sub_el = SubEl} = IQ) ->
  