Display UserList on another page

Last post 10-09-2009, 5:12 AM by craig88. 5 replies.
Sort Posts: Previous Next
  •  09-08-2009, 3:49 AM 55433

    Display UserList on another page

    Hi
     
    I need to display a list of users that are currently chatting - how can I do that?
     
  •  09-09-2009, 2:31 AM 55456 in reply to 55433

    Re: Display UserList on another page

    The idea is to display a "How is online" list - like the one on CuteSoft forum frontpage.
     
    Is there really no one who knows how to do this?
  •  09-09-2009, 10:45 AM 55484 in reply to 55456

    Re: Display UserList on another page

    Please check chat.aspx.
     
    1. private void rptLobbies_ItemDataBound(object sender, DataListItemEventArgs e)   
    2.     {   
    3.         if (e.Item.DataItem == null)   
    4.         {   
    5.             return;   
    6.         }   
    7.   
    8.         LobbyInfo lobby = (LobbyInfo)e.Item.DataItem;   
    9.   
    10.                    
    11.         HyperLink lnkLobby = e.Item.FindControl("lnkLobby"as HyperLink;   
    12.         lnkLobby.NavigateUrl = CuteChat.ChatWebUtility.ResolveResource(this.Context, "Channel.Aspx") + "?Place=Lobby-" + lobby.Lobby.LobbyId;   
    13.         lnkLobby.Target = "_blank";   
    14.   
    15.         String sOnlineChater = lobby.JoinClient(",");   
    16.   
    17.         Label lblOnlineChater = e.Item.FindControl("lblOnlineChater"as Label;   
    18.         lblOnlineChater.Text = lobby.ClientCount.ToString();   
    19.         lnkLobby.ToolTip = sOnlineChater;   
    20.     }  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-10-2009, 2:59 AM 55514 in reply to 55484

    Re: Display UserList on another page

    That page is not avaliable in my version?
  •  09-10-2009, 5:29 AM 55522 in reply to 55514

    Re: Display UserList on another page

    But Ok - I got something from it anyway:
     
    1.    IChatLobby[] lobbies = ChatApi.GetLobbyArray();  
    2.    foreach (IChatLobby lobby in lobbies)  
    3.    {  
    4.      LobbyInfo li = new LobbyInfo(lobby);  
    5.      lbl.Text += "There's currently " + li.ClientCount + " users in " + li.Name;  
    6.    }  

     Only problem is - it returns zero AND if I do
    1. li.JoinClient(","); 

    I get an exception:    System.NullReferenceException: Object reference not set to an instance of an object.
  •  10-09-2009, 5:12 AM 56257 in reply to 55522

    Re: Display UserList on another page

    The function to use is GetLobbyInfoArray like this:
                         
    1.                         <div id="channellistwithusers" style="margin: 6px">
                              Channel List<br />
                              <%LobbyInfo[] lobbies=ChatApi.GetLobbyInfoArray();%>
                              <%foreach(LobbyInfo lobby in lobbies)%>
                              <%{
                                  string sOnlineChater = lobby.JoinClient(",");

                              %>
                              Lobby-ID:
                              <%=lobby.LobbyId%>,
                              Title:<%=lobby.Name%>,
                              Users:
                              <%=sOnlineChater%>,
                              numOnline:<%=lobby.ClientCount.ToString()%><br />
                              <%}%>
                            </div>
     
    But you need to poll it to keep it up to date. Would be nice to have Javascript update it. In SupportClient.js it looks like SUI_HandleChatEvent("USER" ...) does just this but I haven't tried it.
     
     
View as RSS news feed in XML