Hi ken,
Thanks for your reply but your solution wouldn't work cause i'm implementing my own datamanager as mentioned in my previous post.
Here is the recap:
- Public Overrides Function CreateDataManagerInstance(ByVal portal As AppPortal) As AppDataManager
- Return New myCreateDataManagerInstance(portal)
- End Function
So by using your code and my function:
- Public Overrides Function GetContacts(ByVal identity As ChatIdentity) As IChatUserInfo()
- Dim loginname As String = ChatProvider.Instance.FromUserId(identity.UniqueId)
-
- If loginname = "" then
- Dim portal As CuteChat.ChatPortal = CuteChat.ChatSystem.Instance.GetCurrentPortal()
- Dim myid As CuteChat.ChatIdentity = New CuteChat.AppChatIdentity("nickname", False, "User:empty", "0.0.0.0")
- Dim contacts As CuteChat.IChatUserInfo() = portal.DataManager.GetContacts(myid)
- Return contacts
- End if
-
- Dim friends() as string = myDATABASE.getcontacts(loginname)
-
- Dim arr(friends.Length - 1) As IChatUserInfo
-
- For i = 0 To friends.Length - 1
- Dim friendid as string = ChatProvider.Instance.ToUserId(friends(i))
- arr(i) = MyBase.GetUserInfo(friendid)
- Next
-
- Return arr
- End Function
I't just basically asking my function to call itself and later return something that does not exist again!
So the question is, what should i return in mydatamanager.getContacts() when the username is Anonymous (invalid or "" or not in my database), ie guest, that will not cause the chat to create the error.
- If loginname = "" then
-
- return nothing
- End if
Need help, thanks.