예제 #1
0
        private void MessageWindow_Load(object sender, EventArgs e)
        {
            RosterItem ri = null;

            if (!XmppGlobal.Roster.TryGetValue(foreign_jid, out ri))
            {
                XmppGlobal.Roster.TryGetValue(new jabber.JID(foreign_jid.Bare), out ri);
            }

            if (ri == null)
            {
                this.Text = foreign_jid.Bare;
                this.Icon = PaintFunctions.ImageToIcon((Bitmap)XmppImages.DefaultAvatar);
                this.ChattingWith.Text = string.Format("Chatting with {0}", foreign_jid.ToString());
            }
            else
            {
                this.Text = ri.GetDisplayName();
                this.Icon = PaintFunctions.ImageToIcon((Bitmap)ri.BaseAvatar);
                this.ChattingWith.Text = string.Format("Chatting with {0}", ri.GetDisplayName());

                ri.PresenceChanged += new EventHandler <PresenceItemEventArgs> (PresenceChanged);
                PresenceChanged(ri, new PresenceItemEventArgs(ri.GetPresence()));
            }

            StatusBarPanel1.Image = XmppImages.AwayOverlay;
        }
예제 #2
0
        // User clicked the refresh button
        private void RefreshButton_Click(object sender, EventArgs e)
        {
            if (current_jid != null)
            {
                AddressTextBox.Text = current_jid.ToString();

                SubmitQuery(current_jid, string.Empty, true);
            }
        }
예제 #3
0
        public void LoadEntityTime(jabber.JID jid)
        {
            TimeIQ iq = XmppGlobal.Queries.CreateTimeQuery();

            iq.To = jid;

            XmppGlobal.Queries.SendQuery(iq, new QueryCallback(GotTimeQuery), null);

            JidLabel.Text   = jid.ToString();
            Spinner.Visible = true;
        }
예제 #4
0
        public void DiscoItemsQuery(jabber.JID to, string node, bool refresh, QueryCallback callback, object state)
        {
            if (!refresh)
            {
                IQ cache_version = XmppGlobal.InternalQueryCache.DiscoItems[to.ToString() + "!!!!!" + node];

                if (cache_version != null)
                {
                    callback.Invoke(this, cache_version, state);
                    return;
                }
            }

            DiscoItemsIQ iq = XmppGlobal.Queries.CreateDiscoItemsQuery();

            iq.To = to;

            if (!string.IsNullOrEmpty(node))
            {
                iq.Node = node;
            }

            XmppGlobal.Queries.SendQuery(iq, callback, state);
        }