Hi.
You need to override the method for your custom chat provider :
public class MyCustomProvider : ChatProvider
{
public override AppDataManager CreateDataManagerInstance(AppPortal portal)
{
return new MyDataManager(portal);
}
}
And then , you can override the code , and return your contact list .
public class MyDataManager : AppDataManager
{
public override void AddContact(ChatIdentity identity, string userid)
{
string myname=ChatProvider.Instance.FromUserId(identity.UniqueId);
string friendname=ChatProvider.Instance.FromUserId(userid);
MyCommunityDatabase.AddFriend(myname);
this.OnContactAdded(identity,userid,friendname);
}
public override void RemoveContact(ChatIdentity identity, string userid)
{
//get the username from cutechat's userid
string myname=ChatProvider.Instance.FromUserId(identity.UniqueId);
string friendname=ChatProvider.Instance.FromUserId(userid);
//my custom implementation
MyCommunityDatabase.RemoveFriend(myname,friendname);
//tell cutechat that the relative have been removed.
this.OnContactRemoved(identity,userid);
}
public override IChatUserInfo[] GetContacts(ChatIdentity identity)
{
string myname=ChatProvider.Instance.FromUserId(identity.UniqueId);
string[] friends=MyCommunityDatabase.GetFriends(myname);
IChatUserInfo[] arr=new IChatUserInfo[friends.Length];
for(int i=0;i<friends.Length;i++)
{
string friendid=ChatProvider.Instance.ToUserId(friends[ i ]);
arr[ i ]=base.GetUserInfo(friendid);
}
return arr;
}
public override void AddIgnore(ChatIdentity identity, string userid)
{
base.AddIgnore (identity, userid);
}
public override void RemoveIgnore(ChatIdentity identity, string userid)
{
base.RemoveIgnore (identity, userid);
}
public override IChatUserInfo[] GetIgnores(ChatIdentity identity)
{
return base.GetIgnores (identity);
}
public MyDataManager(AppPortal portal):base(portal)
{
}
}
Hope this helps.
Regards , Terry .