示例#1
0
 internal RosterItem(JId jid, string name, RosterItemSubscriptionType subscriptionType)
 {
     JId = jid;
     Name = name;
     SubscriptionType = subscriptionType;
     Groups = new List<string>();
 }
示例#2
0
 public void Add(JId jid, string name, string[] groups)
 {
     if (jid == JId) {
         throw new InvalidOperationException("You cannot add yourself to your roster");
     }
     if (_items.ContainsKey(jid)) {
         return; //TODO what should happen here? Exception?
     }
     var content = new XElement(XName.Get("item",Namespace) , new XAttribute("jid", jid), new XAttribute("name", name));
     if(groups != null && groups.Length > 0) {
         foreach (string group in groups) {
             content.Add(new XElement(XName.Get("group", Namespace), group));
         }
     }
     SendIQ(new IQRequest("query", new []{ content },  IQRequestType.Set, null));
 }
示例#3
0
 protected DirectedStanza(JId from, JId to, string id)
 {
     From = from;
     To = to;
 }
示例#4
0
 internal static PresenceStanza CreateInitial(JId jid, string id)
 {
     return CreateBroadcastGeneral(jid, id, PresenceAvailabilityStatus.None);
 }
示例#5
0
 internal static PresenceStanza CreateCancelSubscription(JId to, string id)
 {
     return new PresenceStanza(null, to, id, PresenceType.Unsubscribed, PresenceAvailabilityStatus.None, string.Empty);
 }
示例#6
0
 internal static PresenceStanza CreateBroadcastUnavilable(JId from, string id)
 {
     return new PresenceStanza(from, null, id, PresenceType.Unavailable, PresenceAvailabilityStatus.None, string.Empty);
 }
示例#7
0
 internal static PresenceStanza CreateBroadcastGeneral(JId from,string id, PresenceAvailabilityStatus presenceAvailabilityStatus, string detailedStatus)
 {
     return new PresenceStanza(from, null, id, PresenceType.None, presenceAvailabilityStatus, detailedStatus);
 }
示例#8
0
 private PresenceStanza(JId from, JId to, string id, PresenceType presenceType, PresenceAvailabilityStatus presenceAvailabilityStatus, string detailStatus)
     : base(from, to, id)
 {
     this.presenceType = presenceType;
     this.presenceAvailabilityStatus = presenceAvailabilityStatus;
 }
示例#9
0
 private IQResponse(JId from, JId to, string innerElementLocalName, XElement[] content, IQResponseType requestType, Error error)
     : base(to, innerElementLocalName, content)
 {
     From = from;
     ResponseType = requestType;
     Error = error;
 }
示例#10
0
 internal IQResponse(JId from, JId to, Error error)
     : this(from, to, null, null, IQResponseType.Error, error)
 {
 }
示例#11
0
 internal IQResponse(JId from, JId to, string innerElementLocalName, XElement[] content)
     : this(from, to, innerElementLocalName, content, IQResponseType.Result, null)
 {
 }
示例#12
0
 internal IQRequest(JId to, string innerElementLocalName, XElement[] content, IQRequestType requestType, Action<IQResponse> responseCallback)
     : base(to, innerElementLocalName, content)
 {
     RequestType = requestType;
     ResponseCallback = responseCallback;
 }
示例#13
0
 protected IQ(JId to, string innerElementLocalName, XElement[] content)
 {
     To = to;
     InnerElementLocalName = innerElementLocalName;
     Content = content;
 }
示例#14
0
 internal ClientInitialStream(JId to, Version version)
 {
     To = to;
     Version = version;
 }
示例#15
0
 internal MessageStanza(JId from, JId to, string id, string body)
     : base(from, to, id)
 {
     this.body = body;
 }