本文整理汇总了C#中agsXMPP.protocol.client.IQ类的典型用法代码示例。如果您正苦于以下问题:C# IQ类的具体用法?C# IQ怎么用?C# IQ使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IQ类属于agsXMPP.protocol.client命名空间,在下文中一共展示了IQ类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VcardResult
private void VcardResult(object sender, IQ iq, object data)
{
if (InvokeRequired)
{
// Windows Forms are not Thread Safe, we need to invoke this :(
// We're not in the UI thread, so we need to call BeginInvoke
BeginInvoke(new IqCB(VcardResult), new object[] { sender, iq, data });
return;
}
if (iq.Type == IqType.result)
{
Vcard vcard = iq.Vcard;
if (vcard != null)
{
txtFullname.Text = vcard.Fullname;
txtNickname.Text = vcard.Nickname;
txtBirthday.Text = vcard.Birthday.ToString();
txtDescription.Text = vcard.Description;
Photo photo = vcard.Photo;
if (photo != null)
picPhoto.Image = vcard.Photo.Image;
}
}
}
示例2: FileTransfer
public FileTransfer(XmppClientConnection xmppCon, IQ iq, IContact from)
: base(from)
{
_siIq = iq;
_si = iq.SelectSingleElement(typeof (SI)) as SI;
if (_si != null)
{
// get SID for file transfer
_sid = _si.Id;
_file = _si.File;
Contact = from;
if (_file != null)
{
_fileLength = _file.Size;
FileDescription = _file.Description;
FileName = _file.Name;
}
_xmppConnection = xmppCon;
}
}
示例3: con_OnIq
private void con_OnIq(object sender, IQ iq)
{
if (iq.Query != null)
{
if (iq.Query is DiscoInfo && iq.Type == IqType.get)
{
/*
<iq type='get'
from='[email protected]/orchard'
to='plays.shakespeare.lit'
id='info1'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
*/
iq.SwitchDirection();
iq.Type = IqType.result;
DiscoInfo di = iq.Query as DiscoInfo;
if (ClientName != null)
di.AddIdentity(new DiscoIdentity(ClientCategory.ToString(), this.ClientName, "client"));
foreach (string feature in ClientFeatures)
{
di.AddFeature(new DiscoFeature(feature));
}
xmppCon.Send(iq);
}
}
}
示例4: OnRequestResult
private void OnRequestResult(object sender, IQ iq, object data)
{
if (iq.Error != null)
{
EventError eventError = new EventError("Request for bookmarks on server failed", iq.Error);
Events.Instance.OnEvent(this, eventError);
}
else if (iq.Type == IqType.result)
{
Private privateData = iq.Query as Private;
if (privateData != null && privateData.Storage != null)
{
Conference[] conferences = privateData.Storage.GetConferences();
lock (MucMarks.Instance._syncObject)
{
MucMarks.Instance.Clear();
foreach (Conference conference in conferences)
{
MucMarks.Instance.AddBookmark(conference);
}
}
}
}
}
示例5: GetConfig
/// <summary>
/// Send message to HarmonyHub to request Configuration.
/// Result is parsed by OnIq based on ClientCommandType
/// </summary>
public void GetConfig()
{
EnsureConnection();
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.ConfigDocument());
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
var iq = iqGrabber.SendIq(iqToSend, 10000);
if (iq != null)
{
var match = IdentityRegex.Match(iq.InnerXml);
if (match.Success)
{
RawConfig = match.Groups[1].ToString();
Config = null;
try
{
Config = new JavaScriptSerializer().Deserialize<HarmonyConfigResult>(RawConfig);
}
catch { }
}
}
}
示例6: dbcon_oniq
// on Successfull Login
// When someone checks our client details through requesting iq
private void dbcon_oniq(object sender, IQ iq)
{
if (InvokeRequired)
{
BeginInvoke(new IqHandler(dbcon_oniq), new object[] { sender, iq });
return;
}
if (iq.Query != null)
{
if (iq.Query.GetType() == typeof(agsXMPP.protocol.iq.version.Version))
{
agsXMPP.protocol.iq.version.Version vers = (agsXMPP.protocol.iq.version.Version)iq.Query;
if (iq.Type == agsXMPP.protocol.client.IqType.get)
{
iq.SwitchDirection();
iq.Type = agsXMPP.protocol.client.IqType.result;
vers.Name = "Nimbuzz Profile Changer Coded by [email protected]";
vers.Ver = "1.0.1";
vers.Os = "Coded By [email protected]\nFor More Visit: http://dbh4ck.blogspot.in";
((XmppClientConnection)sender).Send(iq);
}
}
}
}
示例7: IQEventArgs
public IQEventArgs(IQ iq)
{
if (iq == null) {
throw new ArgumentNullException("iq");
}
IQ = iq;
}
示例8: frmFileTransfer
public frmFileTransfer(XmppClientConnection XmppCon, IQ iq)
{
InitializeComponent();
cmdSend.Enabled = false;
this.Text = "Receive File from " + iq.From.ToString();
siIq = iq;
si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI;
// get SID for file transfer
m_Sid = si.Id;
m_From = iq.From;
file = si.File;
if (file != null)
{
m_lFileLength = file.Size;
this.lblDescription.Text = file.Description;
this.lblFileName.Text = file.Name;
this.lblFileSize.Text = HRSize(m_lFileLength);
this.txtDescription.Visible = false;
}
m_XmppCon = XmppCon;
this.progress.Maximum = 100;
//this.Text += iq.From.ToString();
//this.tbFileSize.Text = FileTransferUtils.ConvertToByteString(m_lFileLength);
XmppCon.OnIq += new IqHandler(XmppCon_OnIq);
}
示例9: OnStoreResult
private void OnStoreResult(object sender, IQ iq, object data)
{
if (iq.Error != null)
{
EventError eventError = new EventError("Saving for bookmarks on server failed", iq.Error);
Events.Instance.OnEvent(this, eventError);
}
}
示例10: ConstructConfigurationRequest
public static IQ ConstructConfigurationRequest()
{
Element query = new Element(Constants.XmppQueryActionElement, string.Empty, Constants.LogitechConnectNamespace);
query.Attributes.Add(Constants.XmppMimeAttribute, Constants.ConfigurationRequestPath);
IQ message = new IQ(IqType.get);
message.Id = agsXMPP.Id.GetNextId();
message.Query = query;
return message;
}
示例11: ProcessDiscoInfo
private void ProcessDiscoInfo(IQ iq)
{
IQ diiq = new IQ();
diiq.To = iq.From;
diiq.Id = iq.Id;
diiq.Type = IqType.result;
diiq.Query = xmppConnection.DiscoInfo;
xmppConnection.Send(diiq);
}
示例12: DiscoverItemsDone
private void DiscoverItemsDone(object sender, IQ iq, object data)
{
var discoItems = iq.Query as DiscoItems;
if(discoItems == null)
return;
var items = discoItems.GetDiscoItems();
foreach(var item in items)
search.Enqueue(item.Jid);
Search();
}
示例13: SwapAuthToken
/// <summary>
/// Send message to HarmonyHub with UserAuthToken, wait for SessionToken
/// </summary>
/// <param name="userAuthToken"></param>
/// <returns></returns>
public string SwapAuthToken(string userAuthToken)
{
var iqToSend = new IQ { Type = IqType.get, Namespace = "", From = "1", To = "guest" };
iqToSend.AddChild(HarmonyDocuments.LogitechPairDocument(userAuthToken));
iqToSend.GenerateId();
var iqGrabber = new IqGrabber(Xmpp);
iqGrabber.SendIq(iqToSend, 10);
WaitForData(5);
return _sessionToken;
}
示例14: ConstructSessionInfoRequest
public static IQ ConstructSessionInfoRequest(string authenticationToken)
{
string token = string.Format(Constants.SessionTokenRequestFormat, authenticationToken, Constants.SessionName, Constants.SessionOs, Constants.SessionDevice);
Element query = new Element(Constants.XmppQueryActionElement, token, Constants.LogitechConnectNamespace);
query.Attributes.Add(Constants.XmppMimeAttribute, Constants.SessionRequestPath);
IQ message = new IQ(IqType.get);
message.Id = agsXMPP.Id.GetNextId();
message.Query = query;
return message;
}
示例15: EventInfoFileTransfer
public EventInfoFileTransfer(IQ iq)
: base(string.Empty, EventSeverity.Info)
{
_iq = iq;
agsXMPP.protocol.extensions.si.SI si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI;
if (si != null)
{
_file = si.File;
_contact = Roster.Instance.FindContactOrGetNew(iq.From);
}
_message = string.Format("Incoming file '{0}' from {1}", FileName, Contact.DisplayName);
}