private static Packet RequestChannelAccess(Packet p) { ServerAcknowledgementRequestChannelAccess packet = (ServerAcknowledgementRequestChannelAccess)p; if (packet.success) { //Channel access granted, notify the user Console.WriteLine("Acces granted to channel {0}", packet.id); } return(null); }
private static Packet RequestChannelAccess(Packet p) { try { ClientRequestChannelAccess packet = new ClientRequestChannelAccess(); Console.WriteLine(packet.id); Channel channel = Channel.GetChannelById(packet.id); channel?.AddUser(packet.SenderID); ServerAcknowledgementRequestChannelAccess response = new ServerAcknowledgementRequestChannelAccess(); response.success = true; response.id = channel.id; return(response); } catch (Exception e) { Console.WriteLine(e.ToString()); } return(null); }