Create a room and change the options

If I create a room with the script

//–script initializing the chatRoom Object omited

chatRoom.join(true);//If I omit the “TRUE” parameter, the room creates with default options

takes place a “room configuration” process, the server sends me an XML requesting me to “complete a form” with certains fields I must fill and send. Until that, the room is “locked” for everyone.

How I create a group by this proces?

What is a form?

How I manage it?

What other thigs can I do with a form?

TIA

Message was edited by:

WEREW0LF

errata, the subject showld say “room” instead “group”

The form thing is just a way to make it easier. Once you made a form translater (“list-single” -> comboBox

“text-private”: -> TextInput

“text-multi”: -> TextInput

“text-single”: -> TextInput

“boolean” -> checkBox)

with auto feeding and events checker it’'s easy to configure quite anything!

—For example, I give you my light version (I tried to make it clear and english)

//****************************************************************************** ***//

//–


Initialisation and objects instanciations–


//

//****************************************************************************** ***//

this.attachMovie(“Button”, “sendButton”, _root.curDepth++);

this.sendButton.label = _root.labelSauve;

this.attachMovie(“Label”,“Title”,_root.curDepth++);

//FEEDING FUNCTION - CREATE THE FORM

function feedConf(configurationMessage){

this.Instructions.text=configurationMessage.instructions;

this.Title.text=configurationMessage.title;

tab=configurationMessage.getAllFields();

for(i=tab.length-1;i>=0;i–){

var tabi=tab[ i ];

var index=0;

switch(tabi.type){

case “list-single”:

this.attachMovie(“Label”,"label"tabi.name,_root.curDepth+);

eval(“this.label”+tabi.name).text=tabi.label;

this.attachMovie(“ComboBox”,tabi.name,_root.curDepth++);

for(j=0;j<tabi.getAllOptions().length;j++){

tabio=tabi.getAllOptions();

eval(“this.”+tabi.name).addItem(tabio[j].label);

if(tabi.getAllValues()[0]==tabio[j].label)

index=j;//This is the selected option

}

eval(“this.”+tabi.name).selectedIndex=index;

break;

case “text-private”:

case “text-multi”:

case “text-single”:

this.attachMovie(“Label”,"label"tabi.name,_root.curDepth+);

eval(“this.label”+tabi.name).text=tabi.label;

this.attachMovie(“TextInput”,tabi.name,_root.curDepth++);

if(tabi.getAllValues()[0]==undefined)

eval(“this.”+tabi.name).text="";

else

eval(“this.”+tabi.name).text=tabi.getAllValues()[0];

break;

case “boolean”:

this.attachMovie(“Label”,"label"tabi.name,_root.curDepth+);

eval(“this.label”+tabi.name).text=tabi.label;

this.attachMovie(“CheckBox”,tabi.name,_root.curDepth++);

eval(“this.”+tabi.name).selected=tabi.getAllValues()[0];

break;

default:

break;

}

eval(“this.”+configurationMessage[ i ]).tabIndex=tab.length-i;

}

}

//ACTION FUNCTIONS - SEND THE FORM ONCE FILLED

//****************************************************************************** ***//

//–


Evenements, Behaviors et code boutons–


//

//****************************************************************************** ***//

this.sendButton.onPress=function(){

var fieldmap=new Object;

tab=configurationMessage.getAllFields();

for(i=tab.length-1;i>=0;i–){

var tabi=tab[ i ];

var ar=new Array();

switch(tabi.type){

case “list-single”:

ar.push(eval(“this.”+tabi.name).text);

break;

case “text-private”:

case “text-multi”:

case “text-single”:

ar.push(eval(“this.”+tabi.name).text);

break;

case “boolean”:

ar.push( eval(“this.”+tabi.name).selected?1:0 );

break;

default:

if(ar.push( tabi.getAllValues()[0] )!=undefined)

ar.push( tabi.getAllValues()[0] );

else

ar.push("");

break;

}

if(tabi.name!=undefined)

fieldmap[tabi.name] = ;

else

fieldmap[""] = ;

}

chatRoom.configure(fieldmap);

break;

}

//****************************************************************************** ***//

//–


Position and Size–


//

//****************************************************************************** ***//

function positionAndSize() {

tab=configurationMessage.getAllFields();

this.Title._x=_root.margin;

this.Title._y=_root.margin;

this.Title.setSize(larg-10,25);

var posY=this.Title._y+30;

for(i=tab.length-1;i>=0;i–){

var tabi=tab[ i ];

if(tabi.type!=“fixed”){

eval(“this.label”+tabi.name)._x=_root.margin;

eval(“this.label”+tabi.name)._y=posY;

eval(“this.label”+tabi.name).setSize(larg-150,25);

eval(“this.”+tabi.name)._x=larg-150;

eval(“this.”+tabi.name)._y=posY;

eval(“this.”+tabi.name).setSize(150,25);

posY+=30;

}

}

this.sendButton.setSize(100, 30);

this.sendButton._x = _root.margin;

this.sendButton._y = posY;

};

feedConf(configurationMessage);

positionAndSize();

Of course, the configuration message is obtained by the configureForm event and is available with the eventObj.data

Not for publicity, but I did one

http://usuc.dyndns.org/tv/Jabber/novachat.php

Create a room (in the Menu) and click in the Room Roster and click Configuration.

You should see what it looks like.

boris, thanks, your example looks pretty nice, but I can’'t generate de “fieldmap” structure correctly, this is my code:


CUT HERE----


case “configureForm” :

var fieldMap:Object = new Object();

      fieldMap["FORM_TYPE"] = "http://jabber.org/protocol/muc#roomconfig";

fieldMap[“muc#roomconfig_roomname”] = “werem11”;

fieldMap[“muc#roomconfig_roomdesc”] = “weremsard”;

fieldMap[“muc#roomconfig_changesubject”] = 0;

fieldMap[“muc#roomconfig_publicroom”] = 1;

fieldMap[“muc#roomconfig_persistentroom”] = 0;

fieldMap[“muc#roomconfig_moderatedroom”] = 0;

fieldMap[“muc#roomconfig_membersonly”] = 0;

fieldMap[“muc#roomconfig_allowinvites”] = 0;

fieldMap[“muc#roomconfig_passwordprotectedroom”] = 0;

fieldMap[“muc#roomconfig_roomsecret”] = “”;

fieldMap[“muc#roomconfig_enablelogging”] = 0;

fieldMap[“x-muc#roomconfig_reservednick”] = 0;

fieldMap[“x-muc#roomconfig_canchangenick”] = 1;

fieldMap[“x-muc#roomconfig_registration”] = 1;

fieldMap[“muc#roomconfig_maxusers”] = 2;

fieldMap[“muc#roomconfig_presencebroadcast”] = “participant”;

fieldMap[“muc#roomconfig_whois”] = “moderators”;

gameRoom.configure(fieldMap);

break;


CUT HERE----


the rooms creates weirdly, with the name beetween parentesis and the subjects with invalida characters, any idea?

Regards

  1. How do I read the fieldmap to create the form:[/u]

I get my fieldmap on configureForm, it’'s my “eventObj.data”

After getting this, I just get the fields into an array like:

fieldmap=eventObj.data.getAllFields();

and access with fieldmap[ i ].type (or name, label,… property)

  1. How do I send the fieldmap:[/u]

Personaly, I put the datas into an Array, I don’‘t remember why exactly, but after some tests, I think it’'s better to put the value into an array.

You’‘ll also see I’‘m not using muc#roomconfig but muc#owner… I think it doesn’‘t change many (but your configuration method seem more powerful because you can edit the admin list , see the JEP http://www.jabber.org/jeps/jep-0045.html) but I didn’'t test muc#roomconfig (I receive a muc#owner form, I fill a muc#owner form… logical )

fieldmap[“muc#owner_roomname”]=new Array(“tototiti”);

fieldmap[“muc#owner_roomdesc”]=new Array(“This is a test”);

fieldmap[“leave”]=new Array(“is gone elsewhere”);

fieldmap[“join”]=new Array(“entered the place”);

fieldmap[“rename”]=new Array(“changed name”);

fieldmap[“muc#owner_changesubject”]=new Array(0);

fieldmap[“muc#owner_maxusers”]=new Array(10);

fieldmap[“privacy”]=new Array(1);…

note: I prefer keeping creating fields automatically! [/i]

  1. Character problem:[/u]

I’‘m not an expert in charsets, so I tried this last week because of the “?” problem on my chat (wasn’'t it you?) and tried

useCodePage=true;

but it also brings its problems, It doesn’‘t seem very recommended… but give it a try… after you should try if it doesn’‘t fuck up the international charsets support to the user’‘s country’'s charset only…

I hope it can remove at least one problem… Taking my source code again helped me doing it better… so I thank you for that…

Boris, I’'m looking your chat and I want to ask you how do you do the budy list. Can you drop me a wire?

Thanks!

my buddy list uses IconCellRenderer (also called cellRenderer) to replace texts by graphics.

It’‘s a bit long to explain and doesn’'t have many to do with XIFF… but tutorial exists, you can find one here: http://www.sephiroth.it/tutorials/flashPHP/cellRenderer/

To hide some column from your Roster, you need to specifiy the ones you want to see.

I told it once , it was on this forum (search first, then ask!)

http://www.jivesoftware.org/forums/thread.jspa?messageID=101035&#101035

Hope it could help you