Is x4m a little bit slow to load ? Method .isDown() for example...
Hello, I'm coding a basic Jabber client for x4m, so I read a lot of Hyperstruct wiki pages, and I test...
I found something weird, here is my code to connect and change Presence :
function setPresence()
{
// Récupération du Statut (<show>)
var Status = $("status"
// Récupération du Mood (<status>)
var Mood = $("mood").value;
// Comme on ne sait pas si c'est le Status qui a changé, dans le doute, on affiche la nouvelle icône
showStatusIcon
// On MAJ la Présence sur Internet
if (Status == 'available' && XMPP.isDown(
{
XMPP.up(account, function() { XMPP.send(account, <presence>
}
else if (Status == 'unavailable' && XMPP.isUp(account))
XMPP.
else if (Status == "available")
XMPP.
else
XMPP.
}
This Code is launched on a Menulist Select Event.
Problem, the value of : XMPP.isDown(
I've got a button that displays this value... When my app starts, I click on it and it returns : false ! It should be true because I'm offline....
I click again : false, again... idem.
Until 5/6 seconds... and then when I click, it returns : True !
So, if I try to connect my account with my menulist before 5/6 seconds... There is no connection... probably because I don't enter in the good "if"...
And I'm also wondering : I thought that XMPP.up() was an obligation but When I test with my menulist to put : Away, DND, Away, DND... with XMPP.send(
What do you think about it ? is these comportments normal ? If yes, how to proceed to wait for XMPP.isDown to get the right value ?
Is my algorithm good and in adequation with x4m or should I modify it ? After the connection problem, my code seems to work very well...
Thanks.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SamePlace Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- R. Rigaud
- Solved:
- Last query:
- Last reply: