本文整理汇总了C#中IqCB类的典型用法代码示例。如果您正苦于以下问题:C# IqCB类的具体用法?C# IqCB怎么用?C# IqCB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IqCB类属于命名空间,在下文中一共展示了IqCB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLists
/// <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);
}
示例2: RequestBookmarks
/// <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);
}
示例3: AcceptDefaultConfiguration
/// <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);
}
示例4: CreateInstantNode
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);
}
示例5: CreateCollectionNode
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);
}
示例6: ChangeActiveList
/// <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);
}
示例7: UpdateList
/// <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);
}
示例8: RemoveList
/// <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);
}
示例9: GetList
/// <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='[email protected]'
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);
}
示例10: DeclineDefaultList
/// <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);
}
示例11: DiscoverItems
public void DiscoverItems(Jid to, Jid from, IqCB cb, object cbArgs)
{
DiscoverItems(to, from, null, cb, cbArgs);
}
示例12: GetDefaults
/// <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));
}
示例13: SendIq
/// <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);
}
示例14: DiscoverInformation
public void DiscoverInformation(Jid to, Jid from, IqCB cb)
{
DiscoverInformation(to, from, null, cb, null);
}
示例15: SendStanza
/// <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);
}