public static TextBox CreateBlockFromStanza(Stanza stanza, Language translationLanguage) { if (stanza.Language == Language.Default) { stanza.Language = translationLanguage; } string displayText = stanza.Text; if (stanza.Language == Language.Coptic) { // TextBox doesn't seem to know where to break Coptic (Unicode?) // lines, so insert a zero-width space at every space so // word wrap acutally works displayText = stanza.Text.Replace(" ", " \u200B"); } TextBox contentBlock = new TextBox { Text = Scripting.ParseTextCommands(displayText), FontFamily = Common.DefaultFont, FontSize = Common.DefaultFontSize, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Right }; if (stanza.Language == Language.Arabic) { contentBlock.TextAlignment = TextAlignment.Right; } return(contentBlock); }
// Begins an auto play starting w/ a stanza private IEnumerator StartAutoPlay(Stanza startingStanza, TinkerText startingTinkerText) { // If we aren't starting from the beginning, read the audio progress from the startingTinkerText GetComponent <AudioSource>().time = startingTinkerText.GetStartTime(); Debug.Log("start time:" + startingTinkerText + startingTinkerText.GetStartTime()); // Start playing the full stanza audio GetComponent <AudioSource>().Play(); int startingStanzaIndex = stanzas.IndexOf(startingStanza); Debug.Log("time:" + startingTinkerText.GetStartTime() + "index:" + startingStanzaIndex); for (int i = startingStanzaIndex; i < stanzas.Count; i++) { if (i == startingStanzaIndex) { yield return(StartCoroutine(stanzas[i].AutoPlay(startingTinkerText))); } else { yield return(StartCoroutine(stanzas[i].AutoPlay())); } // Abort early? if (CancelAutoPlay()) { autoPlaying = false; GetComponent <AudioSource>().Stop(); yield break; } } autoPlaying = false; yield break; }
public override void SessionLoop() { while (true) { try { var el = NextElement(); if (el.Name.LocalName.Equals("iq")) { OnIq(Stanza.Parse <XMPPIq>(el)); } if (el.Name.LocalName.Equals("message")) { OnMessage(Stanza.Parse <XMPPMessage>(el)); } if (el.Name.LocalName.Equals("presence")) { OnPresence(Stanza.Parse <XMPPPresence>(el)); } } catch (Exception e) { OnConnectionFailed(new ConnFailedArgs { Message = e.Message }); break; } } }
public async Task <StanzaResult> OnStanzaReceivedAsync(Stanza stanza) { if (stanza.Element.Name == Xmlns.Streams.Stream) { if (State.HasDocumentTag) { return(new StanzaResult(StreamAction.Close, Stanza.FromFullElement( new XElement(Xmlns.Streams.Error, new XElement(Xmlns.Client.Namespace + "bad-format"))))); } else { State.HasDocumentTag = true; var element = new XElement(Xmlns.Streams.Stream, new XAttribute(XNamespace.Xmlns + "stream", Xmlns.Streams.Stream.NamespaceName), new XAttribute("xmlns", Xmlns.Client.Namespace.NamespaceName), new XAttribute(Xmlns.Attr.Version, "1.0")); var features = new XElement(Xmlns.Streams.Features); element.Add(features); foreach (var feat in State.Features.Values) { var actor = ActorProxy.Create <IStreamFeature>(feat, Constants.ApplicationName); element.Add(await actor.CreateDescriptiveElementAsync()); } return(new StanzaResult(Stanza.FromOpeningTag(element))); } } else { return(null); } }
internal StanzaError(Client User, Stanza Query, string Message, int CustomCode, int Code = 8) : base(Message) { XDocument Packet = new XDocument(); XElement iqElement = new XElement(Gateway.JabberNS + "iq"); iqElement.Add(new XAttribute("type", "result")); iqElement.Add(new XAttribute("from", Query.To)); iqElement.Add(new XAttribute("to", User.JID)); iqElement.Add(new XAttribute("id", Query.Id)); XElement queryElement = new XElement(Stanza.NameSpace + "query"); XElement accountElement = new XElement(Query.Name); queryElement.Add(accountElement); XElement errorElement = new XElement((XNamespace)"urn:ietf:params:xml:ns:xmpp-stanzas" + "error"); errorElement.Add(new XAttribute("type", "continue")); errorElement.Add(new XAttribute("code", 8)); errorElement.Add(new XAttribute("custom_code", CustomCode)); iqElement.Add(queryElement); iqElement.Add(errorElement); Packet.Add(iqElement); User.Send(Packet.ToString(SaveOptions.DisableFormatting)); }
/// <summary> /// Stampa nella 'box' il contenuto dell'oggetto 'stanza', formattandolo. /// </summary> /// <param name="box">RichTextBox in cui stampare</param> /// <param name="stanza">Oggetto Stanza da parsificare</param> static public void StampaStanza(RichTextBox box, Stanza stanza) { //Controllo testo all'interno della box VerificaLunghezza(box); //TITOLO Stanza box.AppendText(Environment.NewLine); box.SelectionFont = new Font("Courier New", 12, FontStyle.Bold); box.SelectionColor = Color.DarkRed; box.AppendText(stanza.Nome); //DESCRIZIONE Stanza box.AppendText(Environment.NewLine); box.SelectionFont = new Font("Courier New", 10, FontStyle.Regular); box.SelectionColor = Color.White; box.AppendText(stanza.Descrizione); //OGGETTI nella Stanza if (stanza.OggettiStanza.Count > 0) { box.AppendText(Environment.NewLine); box.SelectionFont = new Font("Courier New", 10, FontStyle.Regular); box.SelectionColor = Color.Blue; box.AppendText("Oggetti a terra:"); foreach (var ogg in stanza.OggettiStanza) { box.AppendText(Environment.NewLine); box.SelectionFont = new Font("Courier New", 10, FontStyle.Regular); box.SelectionColor = Color.Turquoise; box.AppendText(ogg.Descrizione); } } box.ScrollToCaret(); }
public static void BookmarksManagerSendsThePasswordToJoin() { using var stream = new MemoryStream(); using var connection = new MockedXmppTcpConnection(null, stream); var elements = new List <XElement>(); connection.Element += (_, element) => elements.Add(element.Stanza); var conference = new BookmarkedConference { JID = new JID("*****@*****.**"), Password = "******" }; var bookmarksManager = new BookmarksManager(connection, false); bookmarksManager.Join(conference); Thread.MemoryBarrier(); var joinElement = Stanza.Parse <XMPPPresence>(elements.Single()); var password = joinElement .Element(XNamespace.Get(Namespaces.MUC) + "x") ! .Element(XNamespace.Get(Namespaces.MUC) + "password") ! .Value; Assert.AreEqual("12345", password); }
public void Start(XmppTcpConnection connection) { connection.Features = Stanza.Parse <Features>(connection.NextElement()); if (connection.Features.Bind) { var bind = new Elements.Bind(connection.Jid.Resource); var iq = new XMPPIq(XMPPIq.IqTypes.set); iq.Add(bind); connection.Query(iq, (bindResult) => { var jid = bindResult.Element(XNamespace.Get(Namespaces.XmppBind) + "bind"); if (jid == null) { return; } connection.Jid = new JID(jid.Element(XNamespace.Get(Namespaces.XmppBind) + "jid").Value); if (connection.Features.Session) { var sess = new XElement(XNamespace.Get(Namespaces.XmppSession) + "session"); var sessIq = new XMPPIq(XMPPIq.IqTypes.set); sessIq.Add(sess); connection.Query(sessIq, (sessionResponse) => OnSessionStarted(connection)); } else { OnSessionStarted(connection); } }); connection.SessionLoop(); } }
public override void StreamEvents(InputDefinition inputDefinition) { #region Get stanza values Stanza stanza = inputDefinition.Stanza; SystemLogger.Write(string.Format("Name of Stanza is : {0}", stanza.Name)); string reportName = GetConfigurationValue(stanza, ConstantReportName); string emailAddress = GetConfigurationValue(stanza, ConstantEmailAddress); string password = GetConfigurationValue(stanza, ConstantPassword); SystemLogger.Write(GetConfigurationValue(stanza, ConstantStartDate)); DateTime startDate = TryParseDateTime(GetConfigurationValue(stanza, ConstantStartDate), DateTime.MinValue); DateTime endDate = TryParseDateTime(GetConfigurationValue(stanza, ConstantEndDate), DateTime.MinValue); #endregion Get stanza values string streamName = stanza.Name; ReportingContext context = new ReportingContext("https://reports.office365.com/ecp/reportingwebservice/reporting.svc"); context.UserName = GetConfigurationValue(stanza, ConstantEmailAddress); context.Password = GetConfigurationValue(stanza, ConstantPassword); context.FromDateTime = TryParseDateTime(GetConfigurationValue(stanza, ConstantStartDate), DateTime.MinValue); context.ToDateTime = TryParseDateTime(GetConfigurationValue(stanza, ConstantEndDate), DateTime.MinValue); context.SetLogger(new SplunkTraceLogger()); IReportVisitor visitor = new SplunkReportVisitor(streamName); ReportingStream stream = new ReportingStream(context, reportName, streamName); stream.RetrieveData(visitor); }
public bool ValidateStanza(Stanza stanza, XmppStream stream, XmppHandlerContext context) { Element result = null; if (stream.Namespace == Uri.CLIENT) { result = ValidateClientStanza(stanza, stream); } if (stream.Namespace == Uri.SERVER) { result = ValidateServerStanza(stanza, stream); } if (result == null) { return(true); } if (result is Stanza) { context.Sender.SendTo(stream, result); } else if (result is Error) { context.Sender.SendToAndClose(stream, result); } else { return(true); } return(false); }
public void IdentityTests() { var info = new DiscoInfo { Identity = new Identity { IdentityName = "SharpXMPP", IdentityType = "pc", Category = "client" }, Features = new List <string> { Namespaces.DiscoInfo } }; var cf = new XElement(XNamespace.Get("storage:bookmarks") + "conference"); cf.SetAttributeValue("jid", "*****@*****.**"); cf.SetAttributeValue("name", "lalallaa"); cf.SetAttributeValue("autojoin", "false"); var room = Stanza.Parse <BookmarkedConference>(cf); Assert.IsFalse(room.IsAutojoin); var cf2 = new XElement(XNamespace.Get("storage:bookmarks") + "conference"); cf2.SetAttributeValue("jid", "*****@*****.**"); cf2.SetAttributeValue("name", "lalallaa"); cf2.SetAttributeValue("autojoin", "1"); var room2 = Stanza.Parse <BookmarkedConference>(cf2); Assert.IsTrue(room2.IsAutojoin); }
public string GetXML(StanzaType type, string data = null, string to = null, string from = null) { var stanza = new Stanza(type); return(stanza.ToString().Replace(Message.DataTemplate, data).Replace(Message.TagToTemplate, to) .Replace(Message.TagFromTemplate, from)); }
public BookmarksManager(XmppConnection conn, bool autoAsk = true) { connection = conn; connection.SignedIn += (sender, e) => { if (autoAsk) { var query = new XMPPIq(XMPPIq.IqTypes.get); var priv = new XElement(XNamespace.Get("jabber:iq:private") + "query", new XElement(XNamespace.Get(Namespaces.StorageBookmarks) + "storage") ); query.Add(priv); connection.Query(query, (response) => { var roomsXML = response.Element(XNamespace.Get("jabber:iq:private") + "query") .Element(XNamespace.Get(Namespaces.StorageBookmarks) + "storage") .Elements(XNamespace.Get(Namespaces.StorageBookmarks) + "conference"); foreach (var roomObj in roomsXML) { var room = Stanza.Parse <BookmarkedConference>(roomObj); Rooms.Add(room); if (room.IsAutojoin) { Join(room); } } OnBookmarksSynced(conn); }); } }; }
private Element ValidateClientStanza(Stanza stanza, XmppStream stream) { if (!stream.Authenticated) { if (!(stanza is AuthIq) && (stanza is IQ && !(((IQ)stanza).Query is Register))) { return(XmppStanzaError.ToNotAuthorized(stanza)); } } //remove empty jids if (stanza.HasFrom && string.IsNullOrEmpty(stanza.From.ToString())) { stanza.From = null; } if (stanza.HasTo && string.IsNullOrEmpty(stanza.To.ToString())) { stanza.To = null; } //prep strings stanza.From = NodePrep(stanza.From); stanza.To = NodePrep(stanza.To); if (!ValidateJid(stanza.From) || !ValidateJid(stanza.To)) { return(XmppStanzaError.ToBadRequest(stanza)); } if (stanza.HasFrom) { if (!stream.JidBinded(stanza.From)) { // return null if we have from in bind iq (for qutIM 0.3 client) if (!(stanza is IQ) || ((IQ)stanza).Bind == null || ((IQ)stanza).Bind.Resource != stanza.From.Resource) { return(XmppStreamError.InvalidFrom); } } } else { if (stream.MultipleResources) { return(XmppStanzaError.ToConflict(stanza)); } stanza.From = new Jid(string.Format("{0}@{1}/{2}", stream.User, stream.Domain, 0 < stream.Resources.Count ? stream.Resources[0] : null)); } if (stanza is Message) { var message = (Message)stanza; if (message.Type == MessageType.chat && message.To == null) { return(XmppStanzaError.ToRecipientUnavailable(stanza)); } } return(null); }
public Hymn BuildHymn(string content, string title) { Hymn hymn = new Hymn(); string numberPart = ""; Regex regexNumber = new Regex(PATTERN_DIGIT); // the number is the first part of the title numberPart = title.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries).First(); hymn.Number = int.Parse(numberPart); using (StringReader sr = new StringReader(content)) { // first line is the title hymn.Title = sr.ReadLine(); StringBuilder stanzaContent = new StringBuilder(); int stanzaNumber = 0; // we assume that there is no blank line until the end of the content string line = sr.ReadLine(); string[] stanzaParts = null; while (!string.IsNullOrWhiteSpace(line)) { // we try to figure out if the current line contains stanza number stanzaParts = line.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries); if (stanzaParts != null && stanzaParts.Length == 2 && regexNumber.IsMatch(stanzaParts[0])) { // we have new stanza, // we store the current stanza first if (stanzaNumber > 0) { Stanza stanza = new Stanza(); stanza.Number = stanzaNumber; stanza.Content = stanzaContent.ToString(); hymn.Stanzas.Add(stanza); stanzaContent = new StringBuilder(); } // and then, we will consider the new one stanzaNumber = int.Parse(stanzaParts[0]); stanzaContent.AppendLine(stanzaParts[1]); } else { // "normal" content line stanzaContent.AppendLine(line); } line = sr.ReadLine(); } // we add the last stanza var r = from s in hymn.Stanzas where s.Number == stanzaNumber select s; if (!r.Any()) { hymn.Stanzas.Add(new Stanza() { Number = stanzaNumber, Content = stanzaContent.ToString() }); } } return(hymn); }
private Element ValidateServerStanza(Stanza stanza, XmppStream stream) { if (!stanza.HasTo || !stanza.HasFrom) { return(XmppStreamError.ImproperAddressing); } return(null); }
/// <summary> /// Asynchronously writes the specified stanza to the stream. /// </summary> /// <param name="stanza">The stanza.</param> /// <returns> /// A <see cref="Task"/> that represents the asynchronous write stanza operation. /// </returns> private Task WriteStanzaAsync(Stanza stanza) { var request = new StanzaWriteRequest(stanza); _pendingStanzas.Enqueue(request); Interlocked.Exchange(ref _stanzaReady, new TaskCompletionSource <int>()).TrySetResult(0); return(request.CompletionSource.Task); }
public static TextBlock CreateBlockFromStanza(Stanza stanza, Language translationLanguage, Color foreground) { TextBlock contentBlock = null; if (stanza.Language == Language.Default) { stanza.Language = translationLanguage; } switch (stanza.Language) { #region English case Language.English: contentBlock = new TextBlock { Text = Scripting.ParseTextCommands(stanza.Text), FontFamily = Common.Segoe, FontSize = Common.GetEnglishFontSize(), TextWrapping = TextWrapping.Wrap, Foreground = new SolidColorBrush(foreground) }; break; #endregion #region Coptic case Language.Coptic: contentBlock = new TextBlock { // TextBlock doesn't seem to know where to break Coptic (Unicode?) // lines, so insert a zero-width space at every space so // word wrap acutally works Text = Scripting.ParseTextCommands(stanza.Text.Replace(" ", " \u200B")), FontFamily = Common.Segoe, FontSize = Common.GetCopticFontSize(), TextWrapping = TextWrapping.Wrap, Foreground = new SolidColorBrush(foreground) }; return(contentBlock); #endregion #region Arabic case Language.Arabic: contentBlock = new TextBlock { Text = Scripting.ParseTextCommands(stanza.Text), FontFamily = Common.Segoe, FontSize = Common.GetEnglishFontSize(), TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Right, Foreground = new SolidColorBrush(foreground) }; break; #endregion } return(contentBlock); }
private void ResolveData(string xmlData) { Stanza requestObject = _stanzaManager.GetStanzaObject(xmlData); _dataResolveContext = new DataResolveContext( _dictDataResolveStrategies[requestObject.Type]); _dataResolveContext.Execute(this, requestObject); }
// Should be called by StoryManager after all stanzas are loaded. // Attaches swipe handlers so that StorybookEvent ROS messages get sent when stanzas are swiped. public void SetStanzaSwipeHandlers() { for (int i = 0; i < this.stanzas.Count; i++) { Stanza stanza = this.stanzas[i].GetComponent <Stanza>(); string text = stanza.GetStanzaText(); stanza.AddSwipeHandler(this.rosManager.SendStanzaSwipedAction(i, text)); } }
public override bool Handle(XmppConnection sender, XMPPIq element) { if (Stanza.Parse <DiscoItems>(element.Elements().FirstOrDefault()) != null) { sender.Send(element.Reply()); return(true); } return(false); }
// Method to request an auto play starting w/ a stanza public void RequestAutoPlay(Stanza startingStanza, TinkerText startingTinkerText = null) { Debug.Log("request" + autoPlaying); if (!autoPlaying) // && !sceneManager.disableAutoplay) { autoPlaying = true; cancelAutoPlay = false; // reset our cancel flag StartCoroutine(StartAutoPlay(startingStanza, startingTinkerText)); } }
/// <summary> /// Writes the specified stanza to the connection. /// </summary> /// <param name="stanza">The stanza.</param> public async void WriteStanza(Stanza stanza) { try { await WriteStanzaAsync(stanza); } catch (Exception e) { var tmp = _client.OnErrorOccurredAsync(e); } }
public void Send(Stanza msg) { if (msg != null) { _clientSocket.BeginSend(msg.ToString()); } else { InvokeOnError(new Error(new NullReferenceException("Message instance is null."))); } }
// Should be called by StoryManager after all stanzas are loaded. // Attaches swipe handlers so that StorybookEvent ROS messages get sent when stanzas are swiped. public void SetSentenceSwipeHandlers() { for (int i = 0; i < this.stanzas.Count; i++) { Stanza stanza = this.stanzas[i].GetComponent <Stanza>(); // TODO: consider only first stanza in the sentence needs a swipe handler. // Decided not to since it might confuse kids. int sentenceIndex = stanza.GetSentenceIndex(); string text = this.sentences[sentenceIndex].GetSentenceText(); stanza.AddSwipeHandler(this.rosManager.SendSentenceSwipedAction(sentenceIndex, text)); } }
private Conversation conversationConstructor(JSONObject conversationToConstruct) { Conversation conversationToReturn = new Conversation(conversationToConstruct[(int)ConversationParserHelper.NAME].str, conversationToConstruct[(int)ConversationParserHelper.ONESHOT].b); for (int i = 0; i < conversationToConstruct[(int)ConversationParserHelper.STANZA].Count; i++) { Stanza stanzaToAdd = new Stanza(conversationToConstruct[(int)ConversationParserHelper.STANZA][i][0].str, getEmotionForStanza(conversationToConstruct[(int)ConversationParserHelper.STANZA][i][1].str)); conversationToReturn.addStanza(stanzaToAdd); } AddAllKindsOfUnlocker(conversationToReturn, conversationToConstruct); return(conversationToReturn); }
private void button1_Click(object sender, EventArgs e) { //MultiThreading TT = new MultiThreading(); //TT.StartTick(); Stanza provaStanza = new Stanza(); provaStanza.NuovaStanza(1); ElaboraTesto.Recursione += 1; ElaboraTesto.StampaTesto(rtbBlocco, Convert.ToString(ElaboraTesto.Recursione)); ElaboraTesto.StampaStanza(rtbBlocco, provaStanza); }
private bool Send(Stanza stanza) { if (stanza.To == null) { XmppStanzaError.ToForbidden(stanza); } XmppSession session = SessionManager.GetSession(stanza.To); if (session != null) { Sender.SendTo(session.Stream, stanza); } return(session != null); }
private void Broadcast(MucRoomMember member, bool includeSender, Stanza stanza) { foreach (MucRoomMember existingMember in members) { if (!ReferenceEquals(member, existingMember) || includeSender) { existingMember.Send(stanza); } } //send to self if was removed already if (!members.Contains(member) && includeSender) { member.Send(stanza); } }
private string GetConfigurationValue(Stanza stanza, string keyName) { string value; if (stanza.SingleValueParameters.TryGetValue( keyName, out value)) { SystemLogger.Write(string.Format("Value for [{0}] retrieved successfully.", keyName)); return(value); } SystemLogger.Write(string.Format("Value for [{0}] retrieved failed. Return empty string.", keyName)); return(string.Empty); }
/// <summary> /// Allow stanzas by Jid /// </summary> /// <param name="JidToBlock"></param> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item AllowByJid(Jid JidToBlock, int Order, Stanza stanza) { return new Item(Action.allow, Order, CSS.IM.XMPP.protocol.iq.privacy.Type.jid, JidToBlock.ToString(), stanza); }
/// <summary> /// /// </summary> /// <param name="action"></param> /// <param name="order"></param> /// <param name="block"></param> public Item(Action action, int order, Stanza stanza) : this(action, order) { Stanza = stanza; }
/// <summary> /// Allow stanzas for a given roster group /// </summary> /// <param name="group"></param> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item AllowByGroup(string group, int Order, Stanza stanza) { return new Item(Action.allow, Order, XMPPProtocol.Protocol.iq.privacy.Type.group, group, stanza); }
/// <summary> /// /// </summary> /// <param name="action"></param> /// <param name="order"></param> /// <param name="type"></param> /// <param name="value"></param> /// <param name="block"></param> public Item(Action action, int order, Type type, string value, Stanza stanza) : this(action, order, type, value) { Stanza = stanza; }
/// <summary> /// Allow stanzas by subscription type /// </summary> /// <param name="subType"> </param> /// <param name="Order"> </param> /// <param name="stanza"> stanzas you want to block </param> /// <returns> </returns> public Item AllowBySubscription(SubscriptionType subType, int Order, Stanza stanza) { return new Item(Action.allow, Order, Type.subscription, subType.ToString(), stanza); }
/// <summary> /// Block stanzas by Jid /// </summary> /// <param name="JidToBlock"></param> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item BlockByJid(Jid JidToBlock, int Order, Stanza stanza) { return new Item(Action.deny, Order, XMPPProtocol.Protocol.iq.privacy.Type.jid, JidToBlock.ToString(), stanza); }
/// <summary> /// Allow stanzas by subscription type /// </summary> /// <param name="subType"></param> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item AllowBySubscription(SubscriptionType subType, int Order, Stanza stanza) { return new Item(Action.allow, Order, CSS.IM.XMPP.protocol.iq.privacy.Type.subscription, subType.ToString(), stanza); }
/// <summary> /// Block stanzas for a given roster group /// </summary> /// <param name="group"></param> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item BlockByGroup(string group, int Order, Stanza stanza) { return new Item(Action.deny, Order, CSS.IM.XMPP.protocol.iq.privacy.Type.group, group, stanza); }
/// <summary> /// Block globally (all users) the given stanzas /// </summary> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item BlockGlobal(int Order, Stanza stanza) { return new Item(Action.deny, Order, stanza); }
/// <summary> /// Block stanzas by Jid /// </summary> /// <param name="jidToBlock"></param> /// <param name="order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item BlockByJid(Jid jidToBlock, int order, Stanza stanza) { return new Item(Action.deny, order, Type.jid, jidToBlock.ToString(), stanza); }
/// <summary> /// Block stanzas by subscription type /// </summary> /// <param name="subType"></param> /// <param name="Order"></param> /// <param name="stanza">stanzas you want to block</param> /// <returns></returns> public Item BlockBySubscription(SubscriptionType subType, int Order, Stanza stanza) { return new Item(Action.deny, Order, XMPPProtocol.Protocol.iq.privacy.Type.subscription, subType.ToString(), stanza); }
/// <summary> /// Allow stanzas for a given roster group /// </summary> /// <param name="group"> </param> /// <param name="Order"> </param> /// <param name="stanza"> stanzas you want to block </param> /// <returns> </returns> public Item AllowByGroup(string group, int Order, Stanza stanza) { return new Item(Action.allow, Order, Type.group, group, stanza); }
/// <summary> /// Allow stanzas by Jid /// </summary> /// <param name="JidToBlock"> </param> /// <param name="Order"> </param> /// <param name="stanza"> stanzas you want to block </param> /// <returns> </returns> public Item AllowByJid(Jid JidToBlock, int Order, Stanza stanza) { return new Item(Action.allow, Order, Type.jid, JidToBlock.ToString(), stanza); }
/// <summary> /// Block stanzas by subscription type /// </summary> /// <param name="subType"> </param> /// <param name="Order"> </param> /// <param name="stanza"> stanzas you want to block </param> /// <returns> </returns> public Item BlockBySubscription(SubscriptionType subType, int Order, Stanza stanza) { return new Item(Action.deny, Order, Type.subscription, subType.ToString(), stanza); }
/// <summary> /// Block stanzas for a given roster group /// </summary> /// <param name="group"> </param> /// <param name="Order"> </param> /// <param name="stanza"> stanzas you want to block </param> /// <returns> </returns> public Item BlockByGroup(string group, int Order, Stanza stanza) { return new Item(Action.deny, Order, Type.group, group, stanza); }