Ejemplo n.º 1
0
        /// <summary>
        ///     Retrieves a list of users in a channel
        /// </summary>
        public void GetUsersInChannel(string channel, ChatUsersCallback callback, IClientSocket connection)
        {
            if (!connection.IsConnected)
            {
                callback.Invoke(new List <string>(), "Not connected");
                return;
            }

            connection.SendMessage((short)MsfOpCodes.GetUsersInChannel, channel, (status, response) => {
                if (status != ResponseStatus.Success)
                {
                    callback.Invoke(new List <string>(), response.AsString("Unknown error"));
                    return;
                }

                var list = new List <string>().FromBytes(response.AsBytes());

                callback.Invoke(list, null);
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves a list of users in a channel
        /// </summary>
        public void GetUsersInChannel(string channel, ChatUsersCallback callback, ErrorCallback errorCallback)
        {
            if (!Client.IsConnected)
            {
                errorCallback.Invoke("Not connected");
                return;
            }

            Client.SendMessage((ushort)OpCodes.GetUsersInChannel, channel, (status, response) =>
            {
                if (status != ResponseStatus.Success)
                {
                    errorCallback.Invoke(response.AsString("Unknown error"));
                    return;
                }

                var list = new List <string>().FromBytes(response.AsBytes());

                callback.Invoke(list);
            });
        }