/// <summary> /// Retrieving all Privacy Lists /// </summary> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void GetLists(IqCB cb, object cbArg) { /* Example: Client requests names of privacy lists from server: <iq from='[email protected]/orchard' type='get' id='getlist1'> <query xmlns='jabber:iq:privacy'/> </iq> Example: Server sends names of privacy lists to client, preceded by active list and default list: <iq type='result' id='getlist1' to='[email protected]/orchard'> <query xmlns='jabber:iq:privacy'> <active name='private'/> <default name='public'/> <list name='public'/> <list name='private'/> <list name='special'/> </query> </iq> */ PrivacyIq pIq = new PrivacyIq(); pIq.Type = IqType.get; SendStanza(pIq, cb, cbArg); }
/// <summary> /// Request the bookmarks from the storage on the server /// </summary> /// <param name="cb"></param> /// <param name="cbArgs"></param> public void RequestBookmarks(IqCB cb, object cbArgs) { StorageIq siq = new StorageIq(IqType.get); if (cb == null) m_connection.Send(siq); else m_connection.IqGrabber.SendIq(siq, cb, cbArgs); }
/// <summary> /// create an "instant room". This means you accept the default configuration and dont want to configure the room. /// </summary> /// <param name="room"></param> /// <param name="cb"></param> /// <param name="cbArgs"></param> public void AcceptDefaultConfiguration(Jid room, IqCB cb, object cbArgs) { OwnerIq oIq = new XMPPProtocol.Protocol.x.muc.iq.owner.OwnerIq(IqType.set, room); oIq.Query.AddChild(new Data(XDataFormType.submit)); if (cb == null) m_connection.Send(oIq); else m_connection.IqGrabber.SendIq(oIq, cb, cbArgs); }
public void CreateInstantNode(Jid to, Jid from, IqCB cb,object cbArgs) { PubSubIq pubsubIq = new PubSubIq(IqType.set, to); if (from != null) pubsubIq.From = from; pubsubIq.PubSub.Create = new Create(); if (cb == null) m_connection.Send(pubsubIq); else m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); }
public void CreateCollectionNode(Jid to, Jid from, string node, bool defaultConfig, IqCB cb, object cbArgs) { PubSubIq pubsubIq = new PubSubIq(IqType.set, to); if (from != null) pubsubIq.From = from; pubsubIq.PubSub.Create = new Create(node, Type.collection); if (defaultConfig) pubsubIq.PubSub.Configure = new Configure(); if (cb == null) m_connection.Send(pubsubIq); else m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); }
/// <summary> /// Change the active list /// </summary> /// <param name="name"></param> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void ChangeActiveList(string name, IqCB cb, object cbArg) { /* Example: Client requests change of active list: <iq from='[email protected]/orchard' type='set' id='active1'> <query xmlns='jabber:iq:privacy'> <active name='special'/> </query> </iq> The server MUST activate and apply the requested list before sending the result back to the client. Example: Server acknowledges success of active list change: <iq type='result' id='active1' to='[email protected]/orchard'/> If the user attempts to set an active list but a list by that name does not exist, the server MUST return an <item-not-found/> stanza error to the user: Example: Client attempts to set a non-existent list as active: <iq to='[email protected]/orchard' type='error' id='active2'> <query xmlns='jabber:iq:privacy'> <active name='The Empty Set'/> </query> <error type='cancel'> <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> */ PrivacyIq pIq = new PrivacyIq(); pIq.Type = XMPPProtocol.Protocol.client.IqType.set; pIq.Query.Active = new Active(name); SendStanza(pIq, cb, cbArg); }
public void DiscoverItems(Jid to, IqCB cb) { DiscoverItems(to, null, null, cb, null); }
public void Unsubscribe(Jid to, Jid from, Jid unsubscribe, string node, string subid, IqCB cb, object cbArgs) { PubSubIq pubsubIq = new PubSubIq(IqType.set, to); if (from != null) { pubsubIq.From = from; } Unsubscribe unsub = new Unsubscribe(node, unsubscribe); if (subid != null) { unsub.SubId = subid; } pubsubIq.PubSub.Unsubscribe = unsub; if (cb == null) { m_connection.Send(pubsubIq); } else { m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); } }
public void CreateInstantNode(Jid to, IqCB cb) { CreateInstantNode(to, null, cb, null); }
/// <summary> /// Send an IQ Request and store the object with callback in the Hashtable /// </summary> /// <param name="iq">The iq to send</param> /// <param name="cb">the callback function which gets raised for the response</param> /// <param name="cbArg">additional object for arguments</param> public void SendIq(IQ iq, IqCB cb, object cbArg,bool isTo) { // check if the callback is null, in case of wrong usage of this class //if (cb != null) //{ // TrackerData td = new TrackerData(); // td.cb = cb; // td.data = cbArg; // m_grabbing[iq.Id] = td; //} //m_connection.Send(iq); // check if the callback is null, in case of wrong usage of this class if (cb != null) { TrackerData td = new TrackerData(); td.cb = cb; td.data = cbArg; m_grabbing[iq.Id] = td; //iq��CSS.IM.XMPP�з���Iq�ڵ�ʱ����iq.RemoveAttribute("to") //iq.RemoveAttribute("to"); } m_connection.Send(iq); }
/// <summary> /// Send an IQ Request and store the object with callback in the Hashtable /// </summary> /// <param name="iq">The iq to send</param> /// <param name="cb">the callback function which gets raised for the response</param> /// <param name="cbArg">additional object for arguments</param> public void SendIq(IQ iq, IqCB cb, object cbArg) { // check if the callback is null, in case of wrong usage of this class if (cb != null) { TrackerData td = new TrackerData(); td.cb = cb; td.data = cbArg; m_grabbing[iq.Id] = td; } m_connection.Send(iq); }
public void RequestSubscriptions(Jid to, Jid from, IqCB cb) { RequestSubscriptions(to, from, cb, null); }
public void DiscoverInformation(Jid to, Jid from, IqCB cb) { DiscoverInformation(to, from, null, cb, null); }
public void RequestSubscriptionOptions(Jid to, Jid from, Jid subscribe, string node, IqCB cb, object cbArgs) { PubSubIq pubsubIq = new PubSubIq(IqType.get, to); if (from != null) { pubsubIq.From = from; } pubsubIq.PubSub.Options = new Options(subscribe, node); if (cb == null) { m_connection.Send(pubsubIq); } else { m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); } }
public void RequestSubscriptionOptions(Jid to, Jid from, Jid subscribe, string node, IqCB cb) { RequestSubscriptionOptions(to, from, subscribe, node, cb, null); }
public void RequestSubscriptionOptions(Jid to, Jid subscribe, string node, IqCB cb, object cbArgs) { RequestSubscriptionOptions(to, null, subscribe, node, cb, cbArgs); }
public void RequestAffiliations(Jid to, Jid from, IqCB cb) { RequestAffiliations(to, from, cb, null); }
public void RequestAffiliations(Jid to, IqCB cb, object cbArgs) { RequestAffiliations(to, null, cb, cbArgs); }
public void RequestAffiliations(Jid to, IqCB cb) { RequestAffiliations(to, null, cb, null); }
public void DiscoverItems(Jid to, Jid from, IqCB cb, object cbArgs) { DiscoverItems(to, from, null, cb, cbArgs); }
public void DiscoverItems(Jid to, string node, IqCB cb, object cbArgs) { DiscoverItems(to, null, node, cb, cbArgs); }
public void OwnerRequestSubscribers(Jid to, string node, IqCB cb, object cbArgs) { OwnerRequestSubscribers(to, null, node, cb, cbArgs); }
public void OwnerRequestSubscribers(Jid to, Jid from, string node, IqCB cb) { OwnerRequestSubscribers(to, from, node, cb, null); }
/// <summary> /// Send booksmarks to the server storage /// </summary> /// <param name="urls"></param> /// <param name="cb"></param> /// <param name="cbArgs"></param> public void StoreBookmarks(Url[] urls, IqCB cb, object cbArgs) { StoreBookmarks(urls, null, cb, cbArgs); }
/// <summary> /// Sends a PrivacyIq over the active connection /// </summary> /// <param name="pIq"></param> /// <param name="cb"></param> /// <param name="cbArg"></param> private void SendStanza(PrivacyIq pIq, IqCB cb, object cbArg) { if (cb == null) m_connection.Send(pIq); else m_connection.IqGrabber.SendIq(pIq, cb, cbArg); }
/// <summary> /// Send booksmarks to the server storage /// </summary> /// <param name="conferences"></param> /// <param name="cb"></param> public void StoreBookmarks(Conference[] conferences, IqCB cb) { StoreBookmarks(null, conferences, cb, null); }
/// <summary> /// Get the default configuration of the node. /// </summary> /// <param name="service">JID of the pub/sub service</param> /// <param name="callback">Callback. Must not be null. Will not be called back /// if there is an error, but instead OnError will be called.</param> /// <param name="state">State information to be passed back to callback</param> public void GetDefaults(JID service, IqCB callback, object state) { OwnerPubSubCommandIQ<OwnerDefault> iq = new OwnerPubSubCommandIQ<OwnerDefault>(m_stream.Document); iq.To = service; iq.Type = IQType.get; BeginIQ(iq, OnDefaults, new IQTracker.TrackerData(callback, state, null, null)); }
/// <summary> /// Send booksmarks to the server storage /// </summary> /// <param name="conferences"></param> /// <param name="cb"></param> /// <param name="cbArgs"></param> public void StoreBookmarks(Conference[] conferences, IqCB cb, object cbArgs) { StoreBookmarks(null, conferences, cb, cbArgs); }
/// <summary> /// Modify the roles of the parties in this list. /// To use, retrive a ParticipantCollection, change the roles /// of the parties in that collection, then pass that modified /// collection in here. /// </summary> /// <param name="parties">The modified participant collection</param> /// <param name="reason">The reason for the change</param> /// <param name="callback">A callback to call when complete. Will have a null IQ if there were no changes to make.</param> /// <param name="state">Caller's state information</param> public void ModifyAffiliations(ParticipantCollection parties, string reason, IqCB callback, object state) { /* <iq from='*****@*****.**' id='ban2' to='[email protected]/throne' type='result'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item affiliation='outcast' jid='*****@*****.**'> <reason>Treason</reason> </item> </query> </iq> */ RoomAdminIQ iq = new RoomAdminIQ(m_manager.Stream.Document); iq.To = m_room; iq.Type = IQType.set; AdminQuery query = iq.Instruction; int count = 0; foreach (RoomParticipant party in parties) { if (party.Changed && (party.RealJID != null)) { count++; AdminItem item = query.AddItem(); item.JID = party.RealJID; item.Affiliation = party.Affiliation; item.Reason = reason; } } if (count > 0) m_manager.BeginIQ(iq, callback, state); else callback(this, null, state); }
/// <summary> /// Send booksmarks to the server storage /// </summary> /// <param name="urls"></param> /// <param name="conferences"></param> /// <param name="cb"></param> public void StoreBookmarks(Url[] urls, Conference[] conferences, IqCB cb) { StoreBookmarks(urls, conferences, cb, null); }
public void RequestSubscriptions(Jid to, IqCB cb) { RequestSubscriptions(to, null, cb, null); }
/// <summary> /// Request the bookmarks from the storage on the server /// </summary> /// <param name="cb"></param> public void RequestBookmarks(IqCB cb) { RequestBookmarks(cb, null); }
public void Unsubscribe(Jid to, Jid from, Jid unsubscribe, string node, IqCB cb, object cbArgs) { Unsubscribe(to, from, unsubscribe, node, null, cb, cbArgs); }
/// <summary> /// Send booksmarks to the server storage /// </summary> /// <param name="urls"></param> /// <param name="cb"></param> public void StoreBookmarks(Url[] urls, IqCB cb) { StoreBookmarks(urls, null, cb, null); }
public void DiscoverItems(Jid to, Jid from, IqCB cb) { DiscoverItems(to, from, null, cb, null); }
/// <summary> /// Add a new list with the given name and rules. /// </summary> /// <param name="name"></param> /// <param name="rules"></param> ///// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void AddList(string name, Item[] rules, IqCB cb, object cbArg) { UpdateList(name, rules, cb, cbArg); }
public void DiscoverItems(Jid to, Jid from, string node, IqCB cb) { DiscoverItems(to, from, node, cb, null); }
/// <summary> /// Change the default list /// </summary> /// <param name="name">name of the new default list</param> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void ChangeDefaultList(string name, IqCB cb, object cbArg) { PrivacyIq pIq = new PrivacyIq(); pIq.Type = agsXMPP.protocol.client.IqType.set; pIq.Query.Default = new Default(name); SendStanza(pIq, cb, cbArg); }
public void DiscoverItems(Jid to, Jid from, string node, IqCB cb, object cbArgs) { DiscoItemsIq discoIq = new DiscoItemsIq(IqType.get); discoIq.To = to; if (from != null) discoIq.From = from; if (node != null && node.Length > 0) discoIq.Query.Node = node; xmppConnection.IqGrabber.SendIq(discoIq, cb, cbArgs); }
/// <summary> /// Decline the use of the default list /// </summary> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void DeclineDefaultList(IqCB cb, object cbArg) { PrivacyIq pIq = new PrivacyIq(); pIq.Type = agsXMPP.protocol.client.IqType.set; pIq.Query.Default = new Default(); SendStanza(pIq, cb, cbArg); }
public void DiscoverInformation(Jid to, Jid from, IqCB cb, object cbArgs) { DiscoverInformation(to, from, null, cb, cbArgs); }
/// <summary> /// Remove a privacy list /// </summary> /// <param name="name">name of the privacy list to remove</param> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void RemoveList(string name, IqCB cb, object cbArg) { PrivacyIq pIq = new PrivacyIq(); pIq.Type = agsXMPP.protocol.client.IqType.set; pIq.Query.AddList(new List(name)); SendStanza(pIq, cb, cbArg); }
public void RequestSubscriptions(Jid to, IqCB cb, object cbArgs) { RequestSubscriptions(to, null, cb, cbArgs); }
/// <summary> /// Decline the use of any active list /// </summary> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void DeclineActiveList(IqCB cb, object cbArg) { /* In order to decline the use of any active list, the connected resource MUST send an empty <active/> element with no 'name' attribute. Example: Client declines the use of active lists: <iq from='[email protected]/orchard' type='set' id='active3'> <query xmlns='jabber:iq:privacy'> <active/> </query> </iq> Example: Server acknowledges success of declining any active list: <iq type='result' id='active3' to='[email protected]/orchard'/> */ PrivacyIq pIq = new PrivacyIq(); pIq.Type = agsXMPP.protocol.client.IqType.set; pIq.Query.Active = new Active(); SendStanza(pIq, cb, cbArg); }
/// <summary> /// Requests a privacy list from the server by its name /// </summary> /// <param name="name">name of the privacy list to retrieve</param> /// <param name="cb">Callback for the server result</param> /// <param name="cbArg">Callback arguments for the result when needed</param> public void GetList(string name, IqCB cb, object cbArg) { /* Example: Client requests a privacy list from server: <iq from='[email protected]/orchard' type='get' id='getlist2'> <query xmlns='jabber:iq:privacy'> <list name='public'/> </query> </iq> Example: Server sends a privacy list to client: <iq type='result' id='getlist2' to='[email protected]/orchard'> <query xmlns='jabber:iq:privacy'> <list name='public'> <item type='jid' value='*****@*****.**' action='deny' order='1'/> <item action='allow' order='2'/> </list> </query> </iq> */ PrivacyIq pIq = new PrivacyIq(); pIq.Type = agsXMPP.protocol.client.IqType.get; pIq.Query.AddList(new List(name)); SendStanza(pIq, cb, cbArg); }
public void DiscoverInformation(Jid to, string node, IqCB cb, object cbArgs) { DiscoverInformation(to, null, node, cb, cbArgs); }
/// <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); }
/// <summary> /// Request configuration form as the owner /// </summary> /// <param name="callback">Callback. Must not be null. Will not be called back /// if there is an error, but instead OnError will be called.</param> /// <param name="state">State information to be passed back to callback</param> public void Configure(IqCB callback, object state) { OwnerPubSubCommandIQ<OwnerConfigure> iq = new OwnerPubSubCommandIQ<OwnerConfigure>(m_stream.Document); iq.To = m_jid; iq.Type = IQType.get; iq.Command.Node = m_node; BeginIQ(iq, OnConfigure, new IQTracker.TrackerData(callback, state, null, null)); }
/// <summary> /// Send an IQ Request and store the object with callback in the Hashtable /// </summary> /// <param name="iq">The iq to send</param> /// <param name="cb">the callback function which gets raised for the response</param> public void SendIq(IQ iq, IqCB cb) { SendIq(iq, cb, null); }
/// <summary> /// Modify the roles of the parties in this list. /// To use, retrive a ParticipantCollection, change the roles /// of the parties in that collection, then pass that modified /// collection in here. /// </summary> /// <param name="parties">The modified participant collection</param> /// <param name="reason">The reason for the change</param> /// <param name="callback">A callback to call when complete. Will have a null IQ if there were no changes to make.</param> /// <param name="state">Caller's state information</param> public void ModifyRoles(ParticipantCollection parties, string reason, IqCB callback, object state) { /* <iq from='[email protected]/globe' id='voice4' to='*****@*****.**' type='set'> <query xmlns='http://jabber.org/protocol/muc#admin'> <item nick='Hecate' role='visitor'/> <item nick='rosencrantz' role='participant'> <reason>A worthy fellow.</reason> </item> <item nick='guildenstern' role='participant'> <reason>A worthy fellow.</reason> </item> </query> </iq> */ RoomAdminIQ iq = new RoomAdminIQ(m_manager.Stream.Document); iq.To = m_room; iq.Type = IQType.set; AdminQuery query = iq.Instruction; int count = 0; foreach (RoomParticipant party in parties) { if (party.Changed) { count++; AdminItem item = query.AddItem(); item.Nick = party.Nick; item.Role = party.Role; item.Reason = reason; } } if (count > 0) m_manager.BeginIQ(iq, callback, state); else callback(this, null, state); }
///<summary> /// Does an asynchronous IQ call. /// If the from address hasn't been set, and an OverrideFrom has been set, /// the from address will be set to the value of OverrideFrom. ///</summary> ///<param name="iq">IQ packet to send.</param> ///<param name="cb">Callback to execute when the result comes back.</param> ///<param name="cbArg">Arguments to pass to the callback.</param> public void BeginIQ(IQ iq, IqCB cb, object cbArg) { if ((m_overrideFrom != null) && (iq.From == null)) iq.From = m_overrideFrom; m_stream.Tracker.BeginIQ(iq, cb, cbArg); }
public void DiscoverInformation(Jid to, Jid from, string node, IqCB cb) { DiscoverInformation(to, from, node, cb, null); }