Esempio n. 1
0
 public void SendMessage(S22.Xmpp.Jid to, IDictionary <string, string> bodies, IDictionary <string, string> subjects = null, string thread = null, MessageType type = 0, CultureInfo language = null)
 {
     this.AssertValid();
     to.ThrowIfNull <S22.Xmpp.Jid>("to");
     bodies.ThrowIfNull <IDictionary <string, string> >("bodies");
     this.im.SendMessage(to, bodies, subjects, thread, type, language);
 }
Esempio n. 2
0
 public void SendMessage(S22.Xmpp.Jid to, string body, string subject = null, string thread = null, MessageType type = 0, CultureInfo language = null)
 {
     this.AssertValid();
     to.ThrowIfNull <S22.Xmpp.Jid>("to");
     body.ThrowIfNullOrEmpty("body");
     this.im.SendMessage(to, body, subject, thread, type, language);
 }
Esempio n. 3
0
 public void Block(S22.Xmpp.Jid jid)
 {
     this.AssertValid();
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     if (this.block.Supported)
     {
         this.block.Block(jid);
     }
     else
     {
         PrivacyList privacyList        = null;
         string      defaultPrivacyList = this.im.GetDefaultPrivacyList();
         if (defaultPrivacyList != null)
         {
             privacyList = this.im.GetPrivacyList(defaultPrivacyList);
         }
         foreach (PrivacyList list2 in this.im.GetPrivacyLists())
         {
             if (list2.Name == "blocklist")
             {
                 privacyList = list2;
             }
         }
         if (privacyList == null)
         {
             privacyList = new PrivacyList("blocklist");
         }
         privacyList.Add(new JidPrivacyRule(jid, false, 0, 0), true);
         this.im.EditPrivacyList(privacyList);
         this.im.SetDefaultPrivacyList(privacyList.Name);
         this.im.SetActivePrivacyList(privacyList.Name);
     }
 }
 public AvatarChangedEventArgs(S22.Xmpp.Jid jid, string hash = null, Image avatar = null)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid    = jid;
     this.Hash   = hash;
     this.Avatar = avatar;
 }
Esempio n. 5
0
 public void AddContact(S22.Xmpp.Jid jid, string name = null, params string[] groups)
 {
     this.AssertValid();
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.im.AddToRoster(new RosterItem(jid, name, groups));
     this.im.RequestSubscription(jid);
 }
Esempio n. 6
0
 public Item(S22.Xmpp.Jid jid, string node = null, string name = null)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid  = jid;
     this.Node = node;
     this.Name = name;
 }
Esempio n. 7
0
 public void RevokeSubscription(S22.Xmpp.Jid jid)
 {
     this.AssertValid(true);
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     S22.Xmpp.Im.Presence presence = new S22.Xmpp.Im.Presence(jid, null, PresenceType.Unsubscribed, null, null, new XmlElement[0]);
     this.SendPresence(presence);
 }
Esempio n. 8
0
 public StatusEventArgs(S22.Xmpp.Jid jid, S22.Xmpp.Im.Status status)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     status.ThrowIfNull <S22.Xmpp.Im.Status>("status");
     this.Jid    = jid;
     this.Status = status;
 }
Esempio n. 9
0
 public MessageEventArgs(S22.Xmpp.Jid jid, S22.Xmpp.Im.Message message)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     message.ThrowIfNull <S22.Xmpp.Im.Message>("message");
     this.Jid     = jid;
     this.Message = message;
 }
 public MoodChangedEventArgs(S22.Xmpp.Jid jid, S22.Xmpp.Extensions.Mood mood, string description = null)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid         = jid;
     this.Mood        = mood;
     this.Description = description;
 }
Esempio n. 11
0
 public ActivityChangedEventArgs(S22.Xmpp.Jid jid, GeneralActivity activity, SpecificActivity specific = SpecificActivity.Other, string description = null)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid         = jid;
     this.Activity    = activity;
     this.Specific    = specific;
     this.Description = description;
 }
Esempio n. 12
0
 public Streamhost(S22.Xmpp.Jid jid, string host, int port)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     host.ThrowIfNullOrEmpty("host");
     port.ThrowIfOutOfRange("port", 0, 0xffff);
     this.Jid  = jid;
     this.Host = host;
     this.Port = port;
 }
Esempio n. 13
0
 public void Unblock(S22.Xmpp.Jid jid)
 {
     this.AssertValid();
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     if (this.block.Supported)
     {
         this.block.Unblock(jid);
     }
     else
     {
         PrivacyList privacyList        = null;
         string      defaultPrivacyList = this.im.GetDefaultPrivacyList();
         if (defaultPrivacyList != null)
         {
             privacyList = this.im.GetPrivacyList(defaultPrivacyList);
         }
         foreach (PrivacyList list2 in this.im.GetPrivacyLists())
         {
             if (list2.Name == "blocklist")
             {
                 privacyList = list2;
             }
         }
         if (privacyList != null)
         {
             ISet <JidPrivacyRule> set = new HashSet <JidPrivacyRule>();
             foreach (PrivacyRule rule in privacyList)
             {
                 if (rule is JidPrivacyRule)
                 {
                     JidPrivacyRule item = rule as JidPrivacyRule;
                     if (!(!(item.Jid == jid) || item.Allow))
                     {
                         set.Add(item);
                     }
                 }
             }
             foreach (JidPrivacyRule rule3 in set)
             {
                 privacyList.Remove(rule3);
             }
             if (privacyList.Count == 0)
             {
                 this.im.SetDefaultPrivacyList(null);
                 this.im.RemovePrivacyList(privacyList.Name);
             }
             else
             {
                 this.im.EditPrivacyList(privacyList);
                 this.im.SetDefaultPrivacyList(privacyList.Name);
             }
         }
     }
 }
Esempio n. 14
0
        public void RemoveFromRoster(S22.Xmpp.Jid jid)
        {
            this.AssertValid(true);
            jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
            XmlElement data    = Xml.Element("query", "jabber:iq:roster").Child(Xml.Element("item", null).Attr("jid", jid.ToString()).Attr("subscription", "remove"));
            Iq         errorIq = this.IqRequest(IqType.Set, null, this.Jid, data, null, -1, "");

            if (errorIq.Type == IqType.Error)
            {
                throw Util.ExceptionFromError(errorIq, "The item could not be removed from the roster.");
            }
        }
Esempio n. 15
0
 internal RosterItem(S22.Xmpp.Jid jid, string name, S22.Xmpp.Im.SubscriptionState state, bool pending, IEnumerable <string> groups)
 {
     this.groups = new HashSet <string>();
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid  = jid;
     this.Name = name;
     if (groups != null)
     {
         foreach (string str in groups)
         {
             if (!string.IsNullOrEmpty(str))
             {
                 this.groups.Add(str);
             }
         }
     }
     this.SubscriptionState = state;
     this.Pending           = pending;
 }
Esempio n. 16
0
 public void RemoveContact(S22.Xmpp.Jid jid)
 {
     this.AssertValid();
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.im.RemoveFromRoster(jid);
 }
Esempio n. 17
0
 public SubscriptionRequestEventArgs(S22.Xmpp.Jid jid)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid = jid;
 }
Esempio n. 18
0
 public JidPrivacyRule(S22.Xmpp.Jid jid, bool allow, uint order, PrivacyGranularity granularity = 0) : base(allow, order, granularity)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid = jid;
 }
 public ChatStateChangedEventArgs(S22.Xmpp.Jid jid, S22.Xmpp.Extensions.ChatState state)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid       = jid;
     this.ChatState = state;
 }
Esempio n. 20
0
 public TuneEventArgs(S22.Xmpp.Jid jid, TuneInformation information = null)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid         = jid;
     this.Information = information;
 }
Esempio n. 21
0
 public UnsubscribedEventArgs(S22.Xmpp.Jid jid)
 {
     jid.ThrowIfNull <S22.Xmpp.Jid>("jid");
     this.Jid = jid;
 }