/// <summary> /// Publication de la fiche d'identité /// </summary> /// <returns>vrai si la publication a bien été effectuée, sinon faux</returns> public bool publish() { // si il n'y a pas de stream XMPP en cours ou si ce n'est pas notre fiche d'identité, on s'arrete là. if (!Jabber.xmpp.Authenticated || Jabber.xmpp.MyJID.ToString() != jabberID.full) { return(false); } agsXMPP.protocol.iq.vcard.VcardIq viq = new agsXMPP.protocol.iq.vcard.VcardIq(); viq.Type = agsXMPP.protocol.client.IqType.set; viq.To = Jabber.xmpp.MyJID; viq.Vcard = toVcard(); Jabber.xmpp.Send(viq); onIdentityPublished(); return(true); }
/// <summary> /// Demande d'identité /// </summary> /// <returns>vrai si la demande est effectuée, sinon faux</returns> public bool retrieve() { // si il n'y a pas de stream XMPP en cours, on s'arrete là. if (!Jabber.xmpp.Authenticated) { return(false); } agsXMPP.protocol.iq.vcard.VcardIq viq = new agsXMPP.protocol.iq.vcard.VcardIq(); viq.Type = agsXMPP.protocol.client.IqType.get; viq.From = Jabber.xmpp.MyJID; if (Jabber.xmpp.MyJID.ToString() != jabberID.full) { viq.To = new agsXMPP.Jid(jabberID.full); } Jabber.xmpp.IqGrabber.SendIq(viq, new agsXMPP.IqCB(retrieveIqResult), viq.Id); return(true); }
void xmpp_OnRosterStart(object sender) { 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 ObjectHandler(xmpp_OnRosterStart), new object[] { sender }); return; } agsXMPP.protocol.iq.vcard.VcardIq viq = new agsXMPP.protocol.iq.vcard.VcardIq(agsXMPP.protocol.client.IqType.get, new Jid(fullname)); xmpp.IqGrabber.SendIq(viq, new agsXMPP.IqCB(VcardResult), null); }
void xmpp_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item) { 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 XmppClientConnection.RosterHandler(xmpp_OnRosterItem), new object[] { sender, item }); return; } //listEvents.Items.Add(String.Format("Received Contact {0}", item.Jid.Bare)); //listEvents.SelectedIndex = listEvents.Items.Count - 1; if (item.Jid.Server == "gmail.com") { contactsRoster.Add(item.Jid.Bare, item); agsXMPP.protocol.iq.vcard.VcardIq viq = new agsXMPP.protocol.iq.vcard.VcardIq(agsXMPP.protocol.client.IqType.get, new Jid(item.Jid.Bare)); xmpp.IqGrabber.SendIq(viq, new agsXMPP.IqCB(VcardResult), null); } }
/// <summary> /// Demande d'identité /// </summary> /// <returns>vrai si la demande est effectuée, sinon faux</returns> public bool retrieve() { // si il n'y a pas de stream XMPP en cours, on s'arrete là. if (!Jabber.xmpp.Authenticated) { return false; } agsXMPP.protocol.iq.vcard.VcardIq viq = new agsXMPP.protocol.iq.vcard.VcardIq(); viq.Type = agsXMPP.protocol.client.IqType.get; viq.From = Jabber.xmpp.MyJID; if (Jabber.xmpp.MyJID.ToString() != jabberID.full) { viq.To = new agsXMPP.Jid(jabberID.full); } Jabber.xmpp.IqGrabber.SendIq(viq, new agsXMPP.IqCB(retrieveIqResult), viq.Id); return true; }
/// <summary> /// Publication de la fiche d'identité /// </summary> /// <returns>vrai si la publication a bien été effectuée, sinon faux</returns> public bool publish() { // si il n'y a pas de stream XMPP en cours ou si ce n'est pas notre fiche d'identité, on s'arrete là. if (!Jabber.xmpp.Authenticated || Jabber.xmpp.MyJID.ToString() != jabberID.full) { return false; } agsXMPP.protocol.iq.vcard.VcardIq viq = new agsXMPP.protocol.iq.vcard.VcardIq(); viq.Type = agsXMPP.protocol.client.IqType.set; viq.To = Jabber.xmpp.MyJID; viq.Vcard = toVcard(); Jabber.xmpp.Send(viq); onIdentityPublished(); return true; }