Esempio n. 1
0
        internal void GotVCardResponse(object sender, jabber.protocol.client.IQ response, object data)
        {
            try {
                XmppGlobal.InternalQueryCache.VCard[response.From.Bare] = response;

                jabber.protocol.iq.VCard vcard = (jabber.protocol.iq.VCard)response.Query;

                if (vcard.Photo != null)
                {
                    if (vcard.Photo["BINVAL"] != null)
                    {
                        BaseAvatar = ImageManipulation.Base64ToImage(vcard.Photo["BINVAL"].InnerText);
                    }
                }

                OnVCardReceived(new VCardEventArgs(response));

                CallbackState state = (CallbackState)data;

                if (state.Callback != null)
                {
                    state.Callback.Invoke(sender, response, state.State);
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }
Esempio n. 2
0
        private void GotVCard(object sender, jabber.protocol.client.IQ iq, object data)
        {
            jabber.protocol.iq.VCard vcard = (jabber.protocol.iq.VCard)iq.Query;

            if (iq.Type != jabber.protocol.client.IQType.result)
            {
                return;
            }

            PopulateName(vcard);
            PopulateAddresses(vcard);
            PopulateTelephones(vcard);

            EmailLink.Text      = vcard.Email;
            CommentTextBox.Text = vcard.Description;

            if (vcard.Url != null)
            {
                WebLink.Text = vcard.Url.ToString();
            }

            PhotoPictureBox.Image = XmppImages.DefaultAvatar;

            if (vcard.Photo != null)
            {
                if (vcard.Photo["BINVAL"] != null)
                {
                    PhotoPictureBox.Image = ImageManipulation.Base64ToImage(vcard.Photo["BINVAL"].InnerText);
                }
            }

            Spinner.Visible = false;
        }
Esempio n. 3
0
 void AddRosterItemComplete(object sender, jabber.protocol.client.IQ response, object data)
 {
     if (response.Type != jabber.protocol.client.IQType.set)
     {
         QApplication.Invoke(delegate {
             QMessageBox.Critical(Gui.MainWindow, "Failed to add octy", "Server returned an error.");
         });
     }
 }
Esempio n. 4
0
        public void RequestVCard(QueryCallback callback, object state, bool forceRefresh)
        {
            jabber.protocol.client.IQ cached = XmppGlobal.InternalQueryCache.VCard[jid];

            if (!forceRefresh && cached != null)
            {
                if (callback != null)
                {
                    callback.Invoke(this, cached, state);
                }
            }
            else
            {
                jabber.protocol.iq.VCardIQ iq = new jabber.protocol.iq.VCardIQ(XmppGlobal.InternalClient.Document);
                iq.To = jid;

                XmppGlobal.InternalTracker.BeginIQ(iq, new jabber.connection.IqCB(GotVCardResponse), new CallbackState(callback, state));
            }
        }
Esempio n. 5
0
        private void GotRosterItemHandler(object sender, jabber.protocol.iq.Item ri)
        {
            try {
                // See if we already have this Item in our collection
                RosterItem item;
                roster_items.TryGetValue(ri.JID, out item);

                // If it's new, add it to our roster and raise the GotRosterItem event
                if (item == null)
                {
                    item = new RosterItem(ri.JID);
                    roster_items.Add(ri.JID, item);

                    OnGotRosterItem(new RosterItemEventArgs(item, ri));
                }
                else
                {
                    // If it's a remove roster update, remove the RosterItem as raise the RosterItemRemoved event
                    if (ri.Subscription == jabber.protocol.iq.Subscription.remove)
                    {
                        roster_items.Remove(item.Jid);
                        OnRosterItemRemoved(new RosterItemEventArgs(item, ri));
                    }
                    else
                    {
                        // If it's an update, send it to the existing RosterItem, which will handle raising events
                        item.GotUpdatedRosterItem(ri);
                    }
                }

                // If the server sent us a "set" (update) roster item, we are supposed to acknowledge it with a "result"
                if ((ri.ParentNode.ParentNode as XmlElement).GetAttribute("type") == "set")
                {
                    jabber.protocol.client.IQ result = (jabber.protocol.client.IQ)ri.ParentNode.ParentNode;
                    result.Type = jabber.protocol.client.IQType.result;
                    result.Swap();
                    XmppGlobal.InternalClient.Write(result);
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 6
0
 private void BotClient_OnIQ(object sender, jabber.protocol.client.IQ iq)
 {
     Console.WriteLine(iq.ToString());
 }
Esempio n. 7
0
 void _client_OnIQ(object sender, jabber.protocol.client.IQ iq)
 {
     //throw new NotImplementedException();
 }
Esempio n. 8
0
 public VCardEventArgs(jabber.protocol.client.IQ item)
 {
     this.item = item;
 }
 public VCardEventArgs(jabber.protocol.client.IQ item)
 {
     this.item = item;
 }