Page 1 of 1

setUserVariables can't update client

Posted: 31 Aug 2010, 10:12
by haha0738
This is my server code

Code: Select all

user.setVariable("nick_name", request.nick_name, UserVariable.TYPE_STRING);
ExtensionHelper.instance().setUserVariables(user, user.getVariables(), true);


This is what I receive in client

Code: Select all

[ RECEIVED ]: <msg t='sys'><body action='uVarsUpdate' r='1'><vars></vars><user id='0' /></body></msg>


I print the length of Hashtable in SFSEvent.onUserVariablesUpdate.
the length is zero

Have anyone can tell me what is the problem? please..[/code]

Posted: 01 Sep 2010, 05:31
by BigFIsh
Does this work for you?

Code: Select all

HashMap vars = new HashMap();                           
vars.put("nick_name", request.nick_name);
ExtensionHelper.instance().setUserVariables(user, vars, true);


No need to use user.setVariable of you use helper.setUserVariables to set the user's variables.

Posted: 01 Sep 2010, 07:29
by haha0738
BigFIsh wrote:Does this work for you?

Code: Select all

HashMap vars = new HashMap();                           
vars.put("nick_name", request.nick_name);
ExtensionHelper.instance().setUserVariables(user, vars, true);


No need to use user.setVariable of you use helper.setUserVariables to set the user's variables.


Thank you.
It works now ^^.