Cutechat configuration for anonymous user

Last post 08-27-2010, 12:24 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  08-25-2010, 7:38 AM 63608

    Cutechat configuration for anonymous user

    Hi,
     
    By clicking anonymous, public users are able to view and participate in chat and vice-versa for unclicking. How do I customise CuteChat settings so that any anonymous user can go in to view the chat but not participate?
     
    Thanks!
     
     
  •  08-27-2010, 12:24 AM 63687 in reply to 63608

    Re: Cutechat configuration for anonymous user

    Hi innspiral,
     
    Try this way
     
    1. Create a CS file use the code below
     
    1. public class MyChatSystem : CuteChat.AppSystem   
    2.  {   
    3.      protected override CuteChat.ChatPortal CreatePortalInstance(string name)   
    4.      {   
    5.          return new MyChatPortal(name);   
    6.      }   
    7.  }   
    8.  public class MyChatPortal : CuteChat.AppPortal   
    9.  {   
    10.      public MyChatPortal(string name)   
    11.          : base(name)   
    12.      {   
    13.      }   
    14.      public override CuteChat.ChatChannel CreateChannel(string name)   
    15.      {   
    16.          CuteChat.ChatChannel channel = base.CreateChannel(name);   
    17.          CuteChat.AppLobbyChannel lc = channel as CuteChat.AppLobbyChannel;   
    18.          if (lc != null)   
    19.          {   
    20.              return new MyLobbyChannel(this, name, lc.Lobby);   
    21.          }   
    22.          return base.CreateChannel(name);   
    23.      }   
    24.  }   
    25.  public class MyLobbyChannel : CuteChat.AppLobbyChannel   
    26.  {   
    27.      public MyLobbyChannel(MyChatPortal portal, string name, CuteChat.AppLobby lobby)   
    28.          : base(portal, name, lobby)   
    29.      {   
    30.      }   
    31.   
    32.      public override bool PreProcessCTSMessage(CuteChat.ChatConnection conn, string msgid, string[] args, System.Collections.Specialized.NameValueCollection nvc)   
    33.      {   
    34.          if (conn.Identity.IsAnonymous)   
    35.          {   
    36.              this.Manager.PushSTCMessage(conn, ChatMetaData.ServerMsg_SYS_ERROR_MESSAGE, null"You can't do anything because you have not signed up.");   
    37.          }   
    38.   
    39.          return base.PreProcessCTSMessage(conn, msgid, args, nvc);   
    40.      }   
    41.  }  
    2. Change the chat provider start section to
     
    CuteChat.ChatProvider.Instance=new SamplePortal.Components.SampleProvider();
    CuteChat.ChatSystem.Start(new MyChatSystem());
     //MyChatSystem() is the class definition by above code
     
    Regards,
     
    ken
View as RSS news feed in XML