/// <summary> /// Create an x:data form from the given iq stanza. /// </summary> /// <param name="parent">Original stanza</param> public XDataForm(jabber.protocol.client.IQ parent) : this(FindData(parent)) { m_stanza = (Packet) parent.CloneNode(true); Data d = FindData(m_stanza); m_parent = (Element)d.ParentNode; m_parent.RemoveChild(d); }
private void m_node_OnItemAdd(PubSubNode node, jabber.protocol.iq.PubSubItem item) { // OnItemRemove should have fired first, so no reason to remove it here. // Hopefully. Debug.Assert(lbID.Items.IndexOf(item.ID) == -1); lbID.Items.Add(item.ID); }
/// <summary> /// Create an x:data form from the given message stanza. /// </summary> /// <param name="parent">Original stanza</param> public XDataForm(jabber.protocol.client.Message parent) : this(FindData(parent) as jabber.protocol.x.Data) { m_stanza = (Packet) parent.CloneNode(true); Data d = FindData(m_stanza); Debug.Assert(d != null); m_parent = (Element)d.ParentNode; m_parent.RemoveChild(d); }
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."); }); } }
private void m_node_OnItemRemove(PubSubNode node, jabber.protocol.iq.PubSubItem item) { int index = lbID.Items.IndexOf(item.ID); if (lbID.SelectedIndex == index) rtItem.Clear(); if (index >= 0) lbID.Items.RemoveAt(index); }
public LolChatUser(string jid, string nickname, string @group, string status, jabber.protocol.iq.Item item) { Item = item; Jid = jid; _nickname = nickname; _group = @group; _status = status; }
public User(string JID, string Nickname, string Group, string status, jabber.protocol.iq.Item _item) { item = _item; _JID = JID; _Nickname = Nickname; _Group = Group; _status = status; }
//Blink and add to notification list if messaged void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg) { //If is special message, don't show popup if (msg.Subject != null) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true); if ((subject == ChatSubjects.PRACTICE_GAME_INVITE || subject == ChatSubjects.GAME_INVITE) && Client.NotificationContainer.Visibility != System.Windows.Visibility.Visible) { NotificationButton.Content = "."; } })); return; } if (Client.AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body)) { ChatPlayerItem chatItem = Client.AllPlayers[msg.From.User]; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { NotificationChatPlayer player = null; foreach (NotificationChatPlayer x in ChatListView.Items) { if (x.PlayerName == chatItem.Username) { player = x; break; } } if (player == null) { player = new NotificationChatPlayer(); player.Tag = chatItem; player.PlayerName = chatItem.Username; player.Margin = new Thickness(1, 0, 1, 0); player.PlayerLabelName.Content = chatItem.Username; Client.ChatListView.Items.Add(player); } if (Client.ChatItem != null) { if ((string)Client.ChatItem.PlayerLabelName.Content != chatItem.Username) { player.BlinkRectangle.Visibility = System.Windows.Visibility.Visible; } } else { player.BlinkRectangle.Visibility = System.Windows.Visibility.Visible; } })); } }
/// <summary> /// Insert the given message into the history. The timestamp on the message will be used, if /// included, otherwise the current time will be used. /// Messages without bodies will be ignored. /// </summary> /// <param name="msg"></param> public void InsertMessage(jabber.protocol.client.Message msg) { string body = msg.Body; if (body == null) return; // typing indicator, e.g. string nick = (m_nick == null) ? msg.From.Resource : m_nick; AppendMaybeScroll(m_recvColor, nick + ":", body); }
public SendMessage(jabber.client.JabberClient jc) { // // Required for Windows Form Designer support // InitializeComponent(); m_jc = jc; }
public void LoadVCard(jabber.JID jid) { Text = string.Format ("Information for {0}", jid.Bare); JidLabel.Text = jid.Bare; jabber.protocol.iq.VCardIQ iq = XmppGlobal.Queries.CreateVCardQuery (); iq.To = new jabber.JID (jid.Bare); iq.Type = jabber.protocol.client.IQType.get; XmppGlobal.Queries.SendQuery (iq, new QueryCallback (GotVCard), null); }
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; }
public void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg) { if (Client.AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body)) { ChatPlayerItem chatItem = Client.AllPlayers[msg.From.User]; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { if ((string)Client.ChatItem.PlayerLabelName.Content == chatItem.Username) { Update(); } })); } }
public SubscriptionRequestDialog(jabber.protocol.client.Presence request) { InitializeComponent (); this.request = request; RequestLabel.Text = string.Format ("{0} would like to add you to their contact list. Is this OK?", request.From.Bare); AddCheckBox.Visible = false; if (!XmppGlobal.Roster.ContainsKey (request.From)) if (!XmppGlobal.Roster.ContainsKey (new jabber.JID (request.From.Bare))) AddCheckBox.Visible = true; }
public MessageWindow(jabber.JID jid) { InitializeComponent (); foreign_jid = jid; thread_id = Guid.NewGuid ().ToString ().Replace ("-", ""); UserAvatar.Image = XmppImages.DefaultAvatar; Activated += new EventHandler (MessageWindow_Activated); FormClosing += new FormClosingEventHandler (MessageWindow_FormClosing); Load += new EventHandler (MessageWindow_Load); OutgoingTextBox.KeyDown += new KeyEventHandler (OutgoingTextBox_KeyDown); RichTextBox1.LinkClicked += new LinkClickedEventHandler (RichTextBox1_LinkClicked); SendButton.Click += new EventHandler (SendButton_Click); }
public void _jabberClient_OnMessage(object sender, jabber.protocol.client.Message msg) { if (!this.ReceiveFlag) { if (msg.From.Bare == this.MailId) { if (msg.Body != "") { string receivedMsg = msg.From.User + " Says : " + msg.Body + "\n"; AppendConversation(receivedMsg); msg.Body = ""; } } } }
public void ProcessMessage(jabber.protocol.client.Message message) { AuctionEvent ev = AuctionEvent.From(message.Body); switch(ev.Type) { case "CLOSE": _listener.AuctionClosed(); break; case "PRICE": _listener.CurrentPrice(ev.CurrentPrice, ev.Increment, ev.IsFrom(_sniperId)); break; default: throw new Exception("Invalid message"); } }
public void DiscoInfoQuery(jabber.JID to, string node, bool refresh, QueryCallback callback, object state) { if (!refresh) { IQ cache_version = XmppGlobal.InternalQueryCache.DiscoInfo[to.ToString () + "!!!!!" + node]; if (cache_version != null) { callback.Invoke (this, cache_version, state); return; } } DiscoInfoIQ iq = XmppGlobal.Queries.CreateDiscoInfoQuery (); iq.To = to; if (!string.IsNullOrEmpty (node)) iq.Node = node; XmppGlobal.Queries.SendQuery (iq, callback, state); }
// Manage the back button entry list private void AddBackJid(jabber.JID jid, string node) { if (back_history.Count > 0) { ItemNode inode = back_history.Peek (); if (inode.Jid != jid || inode.Node != node) { back_history.Push (new ItemNode (jid, node)); BackButton.Enabled = true; } } else { back_history.Push (new ItemNode (jid, node)); BackButton.Enabled = true; } }
private void GotItems(DiscoManager sender, jabber.connection.DiscoNode node, object state) { // TODO: some of this will break in 2003. TreeNode[] nodes = tvServices.Nodes.Find(node.Key, true); foreach (TreeNode n in nodes) { n.ImageIndex = 7; n.SelectedImageIndex = 7; foreach (jabber.connection.DiscoNode dn in node.Children) { TreeNode tn = n.Nodes.Add(dn.Key, dn.Name); tn.ToolTipText = dn.Key.Replace('\u0000', '\n'); tn.Tag = dn; tn.ImageIndex = 8; tn.SelectedImageIndex = 8; } } pgServices.Refresh(); }
private void GotInitialFeatures(DiscoManager sender, jabber.connection.DiscoNode node, object state) { m_disco.BeginGetItems(node, new jabber.connection.DiscoNodeHandler(GotItems), state); }
private void GotInfo(DiscoManager sender, jabber.connection.DiscoNode node, object state) { pgServices.SelectedObject = node; }
private void jc_OnMessage(object sender, jabber.protocol.client.Message msg) { jabber.protocol.x.Data x = msg["x", URI.XDATA] as jabber.protocol.x.Data; if (x != null) { muzzle.XDataForm f = new muzzle.XDataForm(msg); f.ShowDialog(this); jc.Write(f.GetResponse()); } else MessageBox.Show(this, msg.Body, msg.From, MessageBoxButtons.OK); }
private void bmm_OnConferenceRemove(jabber.client.BookmarkManager manager, BookmarkConference conference) { string jid = conference.JID; if (lvBookmarks.Items.ContainsKey(jid)) lvBookmarks.Items.RemoveByKey(jid); }
private void Chatroom_OnRoomMessage(object sender, jabber.protocol.client.Message msg) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { //Ignore the message that is always sent when joining if (msg.Body != "This room is not anonymous") { TextRange tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd); tr.Text = msg.From.Resource + ": "; tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Blue); tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd); tr.Text = msg.InnerText.Replace("<![CDATA[", "").Replace("]]>", "") + Environment.NewLine; tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White); } })); }
// Manage the forward button entry list private void AddForwardJid(jabber.JID jid, string node) { forward_history.Push (new ItemNode (jid, node)); ForwardButton.Enabled = true; }
// Submit a new query private void SubmitQuery(jabber.JID jid, string node, bool refresh) { IdentityNameLabel.Text = string.Empty; IdentityAddressLabel.Text = string.Empty; IdentityCategoryTypeLabel.Text = string.Empty; Label4.Visible = false; ActionButton.Visible = false; StopButton.Enabled = true; Spinner.Visible = true; ErrorPicture.Visible = false; got_one_response = false; was_stopped = false; ServiceListView.Items.Clear (); AddressTextBox.SelectAll (); current_jid = jid; current_node = node; XmppGlobal.Disco.DiscoInfoQuery (jid, node, refresh, new QueryCallback (GotInfoQuery), null); XmppGlobal.Disco.DiscoItemsQuery (jid, node, refresh, new QueryCallback (GotItemsQuery), null); }
private void rm_OnUnsubscription(jabber.client.RosterManager manager, Presence pres, ref bool remove) { MessageBox.Show(pres.From + " has removed you from their roster.", "Unsubscription notification", MessageBoxButtons.OK); }
void InternalClient_OnMessage(object sender, jabber.protocol.client.Message msg) { OnGotMessage (new MessageEventArgs (msg)); }
private void bmm_OnConferenceAdd(jabber.client.BookmarkManager manager, BookmarkConference conference) { string jid = conference.JID; string name = conference.ConferenceName; if (name == null) name = jid; if (lvBookmarks.Items.ContainsKey(jid)) lvBookmarks.Items.RemoveByKey(jid); ListViewItem item = lvBookmarks.Items.Add(jid, name, -1); item.SubItems.Add(conference.Nick); item.SubItems.Add(conference.AutoJoin.ToString()); item.Tag = conference.JID; }