Пример #1
0
        /// <summary>
        ///     Retrieves a list of channels, which user has joined
        /// </summary>
        public void GetMyChannels(ChatChannelsCallback callback, IClientSocket connection)
        {
            if (!connection.IsConnected)
            {
                callback.Invoke(new List <string>(), "Not connected");
                return;
            }

            connection.SendMessage((short)MsfOpCodes.GetCurrentChannels, (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);
            });
        }
Пример #2
0
        /// <summary>
        /// Retrieves a list of channels, which user has joined
        /// </summary>
        public void GetMyChannels(ChatChannelsCallback callback, IClientSocket connection)
        {
            if (!connection.IsConnected)
            {
                callback.Invoke(new List <ChatChannelInfo>(), "Not connected");
                return;
            }

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

                var data = response.Deserialize(new ChatChannelsListPacket());
                callback.Invoke(data.Channels, null);
            });
        }
Пример #3
0
        /// <summary>
        /// Retrieves a list of channels, which user has joined
        /// </summary>
        public void GetJoinedChannels(ChatChannelsCallback callback, ErrorCallback errorCallback)
        {
            if (!Client.IsConnected)
            {
                errorCallback.Invoke("Not connected");
                return;
            }

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

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

                callback.Invoke(list);
            });
        }
Пример #4
0
 /// <summary>
 /// Retrieves a list of channels, which user has joined
 /// </summary>
 /// <param name="callback"></param>
 public void GetMyChannels(ChatChannelsCallback callback)
 {
     GetMyChannels(callback, Connection);
 }