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); }
public void TogglePreHistoryHiddenAsync(TLInputChannelBase channel, TLBool enabled, Action <TLUpdatesBase> callback, Action <TLRPCError> faultCallback = null) { var obj = new TLTogglePreHistoryHidden { Channel = channel, Enabled = enabled }; const string caption = "channels.togglePreHistoryHidden"; SendInformativeMessage <TLUpdatesBase>(caption, obj, result => { var multiPts = result as IMultiPts; if (multiPts != null) { _updatesService.SetState(multiPts, caption); } else { ProcessUpdates(result, null); } callback.SafeInvoke(result); }, faultCallback); }
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); }
public void SendVerifyPhoneCodeAsync(TLString phoneNumber, TLBool currentNumber, Action <TLSentCodeBase> callback, Action <TLRPCError> faultCallback = null) { var obj = new TLSendVerifyPhoneCode { Flags = new TLInt(0), PhoneNumber = phoneNumber, CurrentNumber = currentNumber }; SendInformativeMessage("account.sendVerifyPhoneCode", obj, callback, faultCallback); }
public void ImportContactsAsync(TLVector <TLInputContactBase> contacts, TLBool replace, Action <TLImportedContacts> callback, Action <TLRPCError> faultCallback = null) { var obj = new TLImportContacts { Contacts = contacts, Replace = replace }; SendInformativeMessage <TLImportedContacts>("contacts.importContacts", obj, result => _cacheService.SyncContacts(result, callback), faultCallback); }
public override TLObject FromBytes(byte[] bytes, ref int position) { bytes.ThrowExceptionIfIncorrect(ref position, Signature); PhoneRegistered = GetObject <TLBool>(bytes, ref position); PhoneInvited = GetObject <TLBool>(bytes, ref position); return(this); }
public void UpdateStatusAsync(TLBool offline, Action <TLBool> callback, Action <TLRPCError> faultCallback = null) { if (_activeTransport.AuthKey == null) { return; } #if WIN_RT if (_deviceInfo != null && _deviceInfo.IsBackground) { var message = string.Format("::{0} {1} account.updateStatus {2}", _deviceInfo.BackgroundTaskName, _deviceInfo.BackgroundTaskId, offline); Logs.Log.Write(message); #if DEBUG AddToast("task", message); #endif } #endif var obj = new TLUpdateStatus { Offline = offline }; SendInformativeMessage("account.updateStatus", obj, callback, faultCallback); }
public void UpdateStatusAsync(TLBool offline, Action <TLBool> callback, Action <TLRPCError> faultCallback = null) { if (_activeTransport.AuthKey == null) { return; } #if WIN_RT if (_deviceInfo != null && _deviceInfo.IsBackground) { var message = string.Format("::{0} {1} account.updateStatus {2}", _deviceInfo.BackgroundTaskName, _deviceInfo.BackgroundTaskId, offline); Logs.Log.Write(message); #if DEBUG && WNS_PUSH_SERVICE AddToast("task", message); #endif } #endif TLObject obj = null; if (_deviceInfo != null && _deviceInfo.IsBackground) { obj = new TLInvokeWithoutUpdates { Object = new TLUpdateStatus { Offline = offline } }; } else { obj = new TLUpdateStatus { Offline = offline }; } System.Diagnostics.Debug.WriteLine("account.updateStatus offline=" + offline.Value); SendInformativeMessage("account.updateStatus", obj, callback, faultCallback); }
public void SetFeedBroadcastsAsync(TLInt feedId, TLVector <TLInputChannelBase> channels, TLBool alsoNewlyJoined, Action <TLUpdatesBase> callback, Action <TLRPCError> faultCallback = null) { var obj = new TLSetFeedBroadcasts { FeedId = feedId, Channels = channels, AlsoNewlyJoined = alsoNewlyJoined }; const string caption = "channels.setFeedBroadcasts"; SendInformativeMessage <TLUpdatesBase>(caption, obj, result => { callback(result); }, faultCallback); }