emacs-jabber
emacs-jabber copied to clipboard
args-out-of-range error when reading timestamps on Jabber messages
when I look in the fsm-debug buffer, I see errors like this:
Thu Jul 5 14:39:40 2018: Error (args-out-of-range "54Z" 4 6) while processing (message ((from . "some-channel/Dead Parrot") (id . "SudSN-250898") (notify . "1") (to . "[email protected]/d33849931a3de90d1e43545a5fba396051b58454") (type . "groupchat") (xml:lang . "en")) (body nil "⛔🔁 [Alert still_alerting")]
I'm using the latest version of jabber.el, and Emacs 26.1 on the Mac.
Thanks!
I hunted this down to jabber-util.el, line 498, where jabber-parse-time is trying to parse timezones.
It looks like jabber.el expects the indexes 23 to 27 to be timezone information, but it's not true.
What I'm seeing here looks like the fraction is from index 20 to 25 (and not 20 to 22), and index 26 is just Z, and this is throwing the timezone calculation off.
Do you know why the Jabber server could be providing timestamps like this, with no timezone information, and with longer fractions than jabber.el expects?
Did you had a look at https://xmpp.org/extensions/xep-0082.html (if it applies) to determine if it's a valid format?
Excellent, thanks for the link. Now I know where to look for standards like this!
Yes. It appears that fractions can be any number of digits:
sss: fractional second addendum to Time (MAY contain any number of digits)
It's weird. I can see how having sss as the fraction identifier can lead one to think that it has to be 3 digits.
The way I understand this is that fractions of a second are any character between the . and either a +, - or Z. In other words, as long as you are reading a digit, it's a fraction, and it's done only when a +, - or Z are reached.
If you reach Z, great, the timezone is UTC. If you don't, now you have to parse the timezone from the index of the + or - the way it's being parsed now.