
function ChatHistoryData () {
    
	// for PlugIn API
    this.ChatName          		= null;
	this.Type					= null;
    this.Participants			= null;				//space    
	this.FriendlyName			= null;
	this.Time					= null;
	this.NewChatNum				= null;
	
	//for Item
	this.UserName				= null;
	this.UserDisplayName		= null;
	this.IS_MultiChat			= false;
	this.ChatMemberNum			= 1;
	this.Availablity			= null;
	this.AvatarPath				= null;
	this.AvatarType				= null;
}


ChatHistoryData.prototype.SetData = function(ChatName_,Type_,Participants_,FriendlyName_,Time_,NewChatNum_) {

	alert("ChatHistoryData.SetData ");
	
	this.ChatName = ChatName_;
	this.Type = Type_;
	this.FriendlyName = FriendlyName_;
	this.Time = Time_;
	this.NewChatNum = NewChatNum_;
	
	//var ChatType = parseInt(Type_);
	
	if(Type_ == String(ENUM_CHAT_HISTORY_TYPE.MULTICHAT) ){
		alert("This is Multy Chat!!!!");
		this.IS_MultiChat = true;
	}
	alert("Participants = " + Participants_);
	
	var SkypeNameArray = Participants_.split(' ');
	
	this.ChatMemberNum = SkypeNameArray.length;
	
	if(this.ChatMemberNum < 1){
		alert("ChatMemberNum error!!!");
		this.ChatMemberNum = 1;
	}

	var myName = PluginAPIMgr.GetMySkyeName();
		
	for (var i=0; i<SkypeNameArray.length; i++) {
		if(SkypeNameArray[i] != myName){
			this.UserName = SkypeNameArray[i];
			break;
		}
	}
	this.UserDisplayName = PluginAPIMgr.GetChatMemberDisplayName(this.UserName);
	alert("UserName = " + this.UserName);
	
	var anotherNames = "";	
    var anotherNamesNumber = 0;
	
	for (var j=0; j<SkypeNameArray.length; j++) {
		if(SkypeNameArray[j] != myName){
			
			anotherNamesNumber++;
            
			if( anotherNamesNumber == SkypeNameArray.length - 1){
                anotherNames = anotherNames + PluginAPIMgr.GetChatMemberDisplayName(SkypeNameArray[j]);
            }
            else{
                anotherNames = anotherNames + PluginAPIMgr.GetChatMemberDisplayName(SkypeNameArray[j]) + ", ";
            }			
            
		}
	}

	this.Participants = anotherNames;
		
	if(this.IS_MultiChat){
		
		this.Availablity	= ENUM_CONTACT_AVAILABILITY.GROUP;
		this.AvatarPath		= g_Image.IMAGE_LIST_MAIN_HISTORY_LIST_ITEM_DEFAULT_AVATA_GROUP 
		this.AvatarType		= ENUM_CHAT_HISTORY_AVATAR_TYPE.GROUP;
		
	}
	//1:1 dialog 
	else if(this.IS_MultiChat == false){

		this.Availablity = parseInt(PluginAPIMgr.GetContactAvailabilityWithName(this.UserName));
		//alert("Availablity = " + this.Availablity);

		this.AvatarPath = PluginAPIMgr.GetAvatarPath(this.UserName);
		this.AvatarType = PluginAPIMgr.GetAvatarType(this.UserName);			
	}

} 



