Re: Using existing membership information + chat + Allow Anonymous= Error!!!

  •  12-09-2009, 10:42 AM

    Re: Using existing membership information + chat + Allow Anonymous= Error!!!

    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:
    1. Public Overrides Function CreateDataManagerInstance(ByVal portal As AppPortal) As AppDataManager      
    2.     Return New myCreateDataManagerInstance(portal)      
    3. End Function    
    So by using your code and my function:
    1. Public Overrides Function GetContacts(ByVal identity As ChatIdentity) As IChatUserInfo()      
    2.     Dim loginname As String = ChatProvider.Instance.FromUserId(identity.UniqueId)      
    3.           
    4.     If loginname = "" then        
    5.            Dim portal As CuteChat.ChatPortal = CuteChat.ChatSystem.Instance.GetCurrentPortal()      
    6.            Dim myid As CuteChat.ChatIdentity = New CuteChat.AppChatIdentity("nickname"False"User:empty""0.0.0.0")      
    7.            Dim contacts As CuteChat.IChatUserInfo() = portal.DataManager.GetContacts(myid) 'CALLING itself again!!!        
    8.            Return contacts   
    9.     End if      
    10.           
    11.     Dim friends() as string = myDATABASE.getcontacts(loginname)      
    12.      
    13.     Dim arr(friends.Length - 1) As IChatUserInfo      
    14.      
    15.     For i = 0 To friends.Length - 1      
    16.         Dim friendid as string = ChatProvider.Instance.ToUserId(friends(i))      
    17.         arr(i) = MyBase.GetUserInfo(friendid)      
    18.     Next     
    19.      
    20.     Return arr      
    21. 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. 
    1. If loginname = "" then        
    2.       'What should i return if "nothing" won't work?   
    3.       return nothing '<- It won't work.   
    4. End if    
     
    Need help, thanks.

     

     
View Complete Thread