Example #1
0
        public IAsyncResult BeginRemoveBlockedSubscription(AccountId userId, AsyncCallback callback)
        {
            AssertLoggedIn();
            AsyncNoResult ar = new AsyncNoResult(callback);

            if (!_blockedSubscriptions.Contains((userId)))
            {
                ar.SetCompletedSynchronously();
                return(ar);
            }
            var request = new vx_req_account_delete_block_rule_t
            {
                account_handle = _accountHandle,
                block_mask     = userId.ToString()
            };

            VxClient.Instance.BeginIssueRequest(request, result =>
            {
                try
                {
                    VxClient.Instance.EndIssueRequest(result);
                    _blockedSubscriptions.Remove(userId);
                    ar.SetComplete();
                }
                catch (Exception e)
                {
                    VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}");
                    ar.SetComplete(e);
                    if (VivoxDebug.Instance.throwInternalExcepetions)
                    {
                        throw;
                    }
                    return;
                }
            });
            return(ar);
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(vx_req_account_delete_block_rule_t obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }