public void KickFromChannelAsync(TLChannel channel, TLInputUserBase userId, TLBool kicked, Action <TLUpdatesBase> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLKickFromChannel {
                Channel = channel.ToInputChannel(), UserId = userId, Kicked = kicked
            };

            const string caption = "channels.kickFromChannel";

            SendInformativeMessage <TLUpdatesBase>(caption, obj,
                                                   result =>
            {
                if (channel.ParticipantsCount != null)
                {
                    channel.ParticipantsCount = new TLInt(channel.ParticipantsCount.Value - 1);
                }
                _cacheService.Commit();

                var multiPts = result as IMultiPts;
                if (multiPts != null)
                {
                    _updatesService.SetState(multiPts, caption);
                }
                else
                {
                    ProcessUpdates(result, null);
                }

                callback.SafeInvoke(result);
            },
                                                   faultCallback);
        }
Example #2
0
        public void KickFromChannelAsync(TLChannel channel, TLInputUserBase userId, TLBool kicked, Action <TLUpdatesBase> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLKickFromChannel {
                Channel = channel.ToInputChannel(), UserId = userId, Kicked = kicked
            };

            const string caption = "channels.kickFromChannel";

            SendInformativeMessage <TLUpdatesBase>(caption, obj,
                                                   result =>
            {
                var multiPts = result as IMultiPts;
                if (multiPts != null)
                {
                    _updatesService.SetState(multiPts, caption);
                }
                else
                {
                    ProcessUpdates(result, null);
                }

                GetFullChannelAsync(channel.ToInputChannel(),
                                    messagesChatFull => callback.SafeInvoke(result),
                                    faultCallback.SafeInvoke);
            },
                                                   faultCallback);
        }