Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ExternalRequest.cs
1using System;
4
6{
11 {
12 private readonly IqEventArgs request;
13 private bool responseReturned = false;
14
19 : base()
20 {
21 this.request = Request;
22 }
23
31 public override void Error(EDalerUriErrorType ErrorType, string ErrorMessage, bool LogAsNotice)
32 {
33 if (!this.responseReturned)
34 {
35 this.responseReturned = true;
36
37 switch (ErrorType)
38 {
39 case EDalerUriErrorType.BadRequest:
40 this.request.IqErrorBadRequest(this.request.To, ErrorMessage, "en");
41 break;
42
43 case EDalerUriErrorType.Forbidden:
44 this.request.IqErrorForbidden(this.request.To, ErrorMessage, "en");
45 break;
46
47 case EDalerUriErrorType.ResourceConstraint:
48 this.request.IqErrorResourceConstraint(this.request.To, ErrorMessage, "en");
49 break;
50
51 case EDalerUriErrorType.Conflict:
52 this.request.IqErrorConflict(this.request.To, ErrorMessage, "en");
53 break;
54
55 case EDalerUriErrorType.ServiceUnavailable:
56 case EDalerUriErrorType.Internal:
57 case EDalerUriErrorType.Remote:
58 default:
59 this.request.IqErrorServiceUnavailable(this.request.To, ErrorMessage, "en");
60 break;
61 }
62
63 base.Error(ErrorType, ErrorMessage, LogAsNotice);
64 }
65 }
66
73 public override void Error(string ErrorType, string ErrorXml, string ErrorMessage)
74 {
75 if (!this.responseReturned)
76 {
77 this.responseReturned = true;
78 this.request.IqError(ErrorType, ErrorXml, this.request.To, ErrorMessage, string.Empty);
79
80 base.Error(ErrorType, ErrorXml, ErrorMessage);
81 }
82 }
83
88 public override void Error(Exception Exception)
89 {
90 if (!this.responseReturned)
91 {
92 this.responseReturned = true;
93 this.request.IqError(Exception, this.request.To);
94
95 base.Error(Exception);
96 }
97 }
98
103 public override void Result(string Xml)
104 {
105 if (!this.responseReturned)
106 {
107 this.responseReturned = true;
108 this.request.IqResult(Xml, this.request.To);
109
110 base.Result(Xml);
111 }
112 }
113
117 public override XmppAddress For
118 {
119 get
120 {
121 if (this.request.From.IsDomain && this.request.Query.HasAttribute("for"))
122 return new XmppAddress(this.request.Query.GetAttribute("for")).ToBareJID();
123 else if (!this.request.From.IsDomain)
124 return this.request.From.ToBareJID();
125 else
126 return null;
127 }
128 }
129
133 public override CaseInsensitiveString Sender => this.request.From.Address;
134
139 {
140 get
141 {
142 string s = this.Sender;
143
144 if (this.request.From.IsDomain && this.request.Query.HasAttribute("for"))
145 s = this.request.Query.GetAttribute("for");
146
147 return s;
148 }
149 }
150
154 public override bool Relayed => this.request.From.IsDomain;
155
156 }
157}
Event arguments for IQ queries.
Definition: IqEventArgs.cs:12
Contains information about one XMPP address.
Definition: XmppAddress.cs:9
XmppAddress ToBareJID()
Returns the Bare JID as an XmppAddress object.
Definition: XmppAddress.cs:215
Represents a case-insensitive string.
string ErrorMessage
Error message, or null if no error.
Current state of URI from external source
override void Error(string ErrorType, string ErrorXml, string ErrorMessage)
Reports an error with the URI
ExternalRequest(IqEventArgs Request)
Current state of URI from external source
override void Result(string Xml)
Reports a positive result.
override CaseInsensitiveString OriginalSender
Who the original sender of the URI is.
override void Error(Exception Exception)
Reports an error with the URI
override void Error(EDalerUriErrorType ErrorType, string ErrorMessage, bool LogAsNotice)
Reports an error with the URI
override XmppAddress For
Who the payment is for.
override CaseInsensitiveString Sender
Who the sender of the URI is.