예제 #1
0
파일: Privacy.cs 프로젝트: don59/agsXmpp
 /// <summary>
 /// Get all Lists
 /// </summary>
 /// <returns>Array of all privacy lists</returns>
 public List[] GetList()
 {
     ElementList el = SelectElements(typeof(List));
     int i = 0;
     List[] result = new List[el.Count];
     foreach (List list in el)
     {
         result[i] = list;
         i++;
     }
     return result;
 }
예제 #2
0
        /// <summary>
        /// Update the list with the given name and rules.
        /// </summary>
        /// <remarks>
        /// Specify the desired changes to the list by including all elements/rules in the list 
        /// (not the "delta")
        /// </remarks>
        /// <param name="name">name of this list</param>
        /// <param name="rules">rules of this list</param>
        /// <param name="cb">Callback for the server result</param>
        /// <param name="cbArg">Callback arguments for the result when needed</param>
        public void UpdateList(string name, Item[] rules, IqCB cb, object cbArg)
        {
            PrivacyIq pIq = new PrivacyIq();
            pIq.Type = agsXMPP.protocol.client.IqType.set;

            // create a new list with the given name
            List list = new List(name);
            list.AddItems(rules);
            // add the list to the query
            pIq.Query.AddList(list);

            SendStanza(pIq, cb, cbArg);
        }
예제 #3
0
파일: Privacy.cs 프로젝트: don59/agsXmpp
 /// <summary>
 /// Add a provacy list
 /// </summary>
 /// <param name="list"></param>
 public void AddList(List list)
 {
     this.AddChild(list);
 }
예제 #4
0
 private void xmppDiscoServerInformation(object sender, agsXMPP.protocol.client.IQ iq, object data)
 {
     if (iq.Type == agsXMPP.protocol.client.IqType.result)
     {
         if (iq.Query != null && iq.Query is DiscoInfo)
         {
             DiscoInfo di = iq.Query as DiscoInfo;
             List<string> features = new List<string>();
             if (di.GetFeatures() != null)
             {
                 DiscoFeature[] fs = di.GetFeatures();
                 foreach (DiscoFeature f in fs)
                 {
                     if (!features.Contains(f.Var))
                     {
                         features.Add(f.Var);
                     }
                 }
             }
             if (features.Contains("http://jabber.org/protocol/pubsub"))
             {
                 if (features.Contains("http://jabber.org/protocol/pubsub#publish"))
                 {
                     _pepCapable = true;
                     Jabber._presence.setMood(Jabber._presence.mood.type, Jabber._presence.mood.text);
                     Jabber._presence.setActivity(Jabber._presence.activity.type, Jabber._presence.activity.text);
                     Jabber._presence.setLocation(Jabber._presence.location);
                     Jabber._presence.clearTune();
                 }
             }
         }
     }
     if (Jabber.xmpp.IqGrabber != null && iq.Id != null) { Jabber.xmpp.IqGrabber.Remove(iq.Id); }
 }