You don't need to find any code in the ejabberd sources. Ejabberd will
just route a full-jid addressed stanza to a xmpp-client and IT will
answer your query. Ejabberd just has no idea of timezones of it's clients.

This code is responsible only to ejabberd's self time, no more, no less.
Anyway, it seems to be a bug that it answers this to a query that
addressed to bare client's jid. But this bug shall not affect you, just
use full JIDs in your queries and you'll be fine.

On 05/22/2013 08:07 PM, Noah Schwartz wrote:
> Its possible theres another IQ handler elsewhere in the code but, that
> seems really unlikely. For those of you that know Erlang, see below. 
> 
> process_local_iq(_From, _To, #iq{type = Type, sub_el = SubEl} = IQ) ->
>     case Type of
> set ->
>    IQ#iq{type = error, sub_el = [SubEl, ?ERR_NOT_ALLOWED]};
> get ->
>    Now = now(),
>    Now_universal = calendar:now_to_universal_time(Now),
>    Now_local = calendar:now_to_local_time(Now),
>    {UTC, UTC_diff} = jlib:timestamp_to_iso(Now_universal, utc),
>    Seconds_diff = calendar:datetime_to_gregorian_seconds(Now_local)
>     - calendar:datetime_to_gregorian_seconds(Now_universal),
>    {Hd, Md, _} = calendar:seconds_to_time(abs(Seconds_diff)),
>    {_, TZO_diff} = jlib:timestamp_to_iso({{0, 0, 0}, {0, 0, 0}},
> {sign(Seconds_diff), {Hd, Md}}),
>    IQ#iq{type = result,
>  sub_el = [{xmlelement, "time",
>     [{"xmlns", ?NS_TIME}],
>     [{xmlelement, "tzo", [],
>       [{xmlcdata, TZO_diff}]},
>      {xmlelement, "utc", [],
>       [{xmlcdata, UTC ++ UTC_diff}]}]}]}
>     end.
> 
> 
> 
> On Wed, May 22, 2013 at 8:25 AM, Sergey Dobrov <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     On 05/22/2013 07:22 PM, Ralph Meijer wrote:
>     > Version 2.1.12 ignores to in the IQ
>     It sounds like smth impossible. I use ejabberd and iq:time works just
>     fine when addressing stanza appropriately.
> 
>     --
>     With best regards,
>     Sergey Dobrov,
>     XMPP Developer and JRuDevels.org founder.
> 
> 
> 
> 
> -- 
> Noah


-- 
With best regards,
Sergey Dobrov,
XMPP Developer and JRuDevels.org founder.

Reply via email to