/// <summary> /// Unblock contact. /// </summary> public void UnBlock() { if (session.ServiceDiscovery.SupportsBlocking) { var iq = new IQ { ID = XmppIdentifierGenerator.Generate(), From = session.UserId, Type = IQType.Set }; var unBlock = new UnBlock(); unBlock.Items.Add ( new BlockItem { Jid = ContactId.BareIdentifier } ); iq.Items.Add(unBlock); session.Send(iq); } }
/// <summary> /// 初始化銀行的連線資料 /// </summary> /// <param name="ip">銀行的IP</param> /// <param name="port">銀行的Port</param> /// <param name="maxRetry">重試上限(-1:無上限)</param> /// <param name="sendTimeout">非同步送出的Timeout(second)</param> public AsyncConnect(string ip, int port, int sendTimeout, int maxRetry = -1) { this.ip = ip; this.port = port; //this.connectTimeout = connectTimeout; this.Status = ConnectStatus.None; this.ManualInited = false; //this.isConnect = false; //this.BankCode = bankCode; this.maxRetry = maxRetry; this.sendTimeout = sendTimeout; //this.CurrentConnectStatus = false; this.ConnectDone = new ManualResetEvent(false); //this.CurrentRetryCount = 0; //若要取消Receive,設定KeepReceive屬性 => false,內部的委派會Invoke這個暱名方法 this.OnReleaseBlock = (bool keep) => { if (!keep) { log.Debug("取消接收"); if (this.ReceiveDone != null) { this.ReceiveDone.Set();//解除接收的blocking } } else { log.Debug("保持接收"); } return(keep); }; }