problem using UPC ----SET_CLIENT_ATTR

Added by syed hayder 375 days ago

here to set an attr the last parameter attrOptions what is its structure any example will be more helpful.

I realy want is to create a list of users as every client's persistence attr which will made by sending friend request.
So if there is a good way to do that it will be very helpful.
I am using JS as client side.


Replies

RE: problem using UPC ----SET_CLIENT_ATTR - Added by colin moock 375 days ago

hi syed,
attrOptions is an integer whose bits have the meanings listed in the specification. here's an example setClientAttribute() function:

var msgManager = yourOrbiter.getMessageManager();

var AttributeOptions = new Object();
AttributeOptions.FLAG_SHARED     = 1 << 2;
AttributeOptions.FLAG_EVALUATE   = 1 << 8;

function setClientAttribute (clientID,
                             attrName, 
                             attrValue, 
                             attrScope, 
                             isShared, 
                             evaluate) {
  isShared = isShared == undefined ? true : isShared;
  isUnique = isUnique == undefined ? false : isUnique;
  evaluate = evaluate == undefined ? false : evaluate;
  var attrOptions = (isShared ? AttributeOptions.FLAG_SHARED     : 0) 
                  | (evaluate ? AttributeOptions.FLAG_EVALUATE   : 0);

  var args = [UPC.SET_CLIENT_ATTR,
              clientID,
              "",
              attrName,
              attrValue,
              attrScope,
              attrOptions];
  msgManager.sendUPC.apply(msgManager, args);
};

colin

RE: problem using UPC ----SET_CLIENT_ATTR - Added by syed hayder 373 days ago

to check the attrbute update I use

msgManager.addMessageListener(UPC.CLIENT_ATTR_UPDATE, requestResultListener, this);
function requestResultListener(roomID,clientID,userID,attrName,attrVal,attrOptions) {
alart("called requestResultListener");
displayChatMessage(roomID+" "+clientID+" "+userID+" "+attrName+" "+attrVal+" "+attrOptions);
}

this code but its not showing any thing..
>how can i chack is client attr is updated or not?
>and i want to use only userID to set attr of a user not clientID.
thanks for your reply.

RE: problem using UPC ----SET_CLIENT_ATTR - Added by syed hayder 373 days ago

here if i add this line(msgManager.addMessageListener(UPC.CLIENT_ATTR_UPDATE, requestResultListener, this);) to add an event lisener to client update event it dosent work
and the close listener event rises..
help me out plz...:(