void _client_OnMessage(object sender, jabber.protocol.client.Message msg) { string key = msg.InnerXml; if (_prevents.Contains(key)) { return; } _prevents.Add(key); this.Status = true; /*<body xmlns="jabber:client"><img src="/files/b147e27b87c5028726a4cdee13e682de.jpg" * id="smile_33" class="smile_cl"></body>123<delay xmlns="urn:xmpp:delay" * from="[email protected]/33232fea" stamp="2015-04-13T10:40:04.789Z" /> * <x xmlns="jabber:x:delay" from="[email protected]/33232fea" * stamp="20150413T10:40:04" />*/ // Console.WriteLine( msg.InnerXml ); newMessagesArrived(new ChatMessage[] { new ChatMessage() { Date = DateTime.Now, Name = msg.From.Resource, Text = SetupSmiles(msg.Body), Source = this, Id = this.Label, ToMe = this.ContainKeywords(msg.Body), //?? //Form = 0 } }); }
//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; } })); } }
void c_OnMessage(object sender, jabber.protocol.client.Message msg) { if ((OnMessage != null) && (!msg.Body.StartsWith("<body>"))) { if (users.ContainsKey(msg.From.User)) { OnMessage(users[msg.From.User], msg.Body, DateTime.Now); } } }
private void testbutton_Click(object sender, RoutedEventArgs e) { Client.Message("sum222908", "<body><inviteId>8649134</inviteId><userName>Snowl</userName><profileIconId>576</profileIconId><gameType>NORMAL_GAME</gameType><groupId></groupId><seasonRewards>-1</seasonRewards><mapId>1</mapId><queueId>2</queueId><gameMode>classic_pvp</gameMode><gameDifficulty></gameDifficulty></body>", ChatSubjects.GAME_INVITE); jabber.protocol.client.Message x = new jabber.protocol.client.Message(new XmlDocument()); x.Body = "<body><inviteId>8649134</inviteId><userName>Snowl</userName><profileIconId>576</profileIconId><gameType>NORMAL_GAME</gameType><groupId></groupId><seasonRewards>-1</seasonRewards><mapId>1</mapId><queueId>2</queueId><gameMode>classic_pvp</gameMode><gameDifficulty></gameDifficulty></body>"; x.From = new jabber.JID("sum222900"); Client.SwitchPage(new TeamQueuePage(x, true)); this.Visibility = System.Windows.Visibility.Hidden; }
private void btnSend_Click(object sender, System.EventArgs e) { jabber.protocol.client.Message msg = new jabber.protocol.client.Message(m_jc.Document); msg.To = txtTo.Text; if (txtSubject.Text != "") { msg.Subject = txtSubject.Text; } msg.Body = txtBody.Text; m_jc.Write(msg); this.Close(); }
/// <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 void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg) { if (Client.AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body) && Client.ChatItem != null) { ChatPlayerItem chatItem = Client.AllPlayers[msg.From.User]; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { if ((string)Client.ChatItem.PlayerLabelName.Content == chatItem.Username) { Update(); } })); } }
private void newRoom_OnRoomMessage(object sender, jabber.protocol.client.Message msg) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { 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); } })); }
public void sendMessage(string to, string message) { try { _myClient.OnMessage += new jabber.client.MessageHandler(_myClient_OnMessage); jabber.protocol.client.Message msg = new jabber.protocol.client.Message(_myClient.Document); msg.To = to; msg.Body = message; _myClient.Write(msg); } catch (Exception e) { throw new Exception("Error during sendMessage\r\n" + e.Message); } }
public void GotMessage(jabber.protocol.client.Message msg) { foreign_jid = msg.From; message_type = msg.Type; thread_id = msg.Thread; if (msg.Body.Trim().Length > 0) { RichTextBox1.SelectionColor = Color.Red; RichTextBox1.AppendText(string.Format("({0}) {1}: ", DateTime.Now.ToString("hh:mm:ss"), Text)); RichTextBox1.SelectionColor = Color.Black; RichTextBox1.AppendText(string.Format("{0}\n", msg.Body)); XmppSounds.PlaySound(DefaultSounds.MessageIn); } }
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 async void Client_OnMessage(object sender, jabber.protocol.client.Message msg) { if (msg.Subject != null) { ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true); double[] Double = new double[1] { Convert.ToDouble(msg.From.User.Replace("sum", "")) }; string[] Name = await RiotCalls.GetSummonerNames(Double); Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { InvitePlayer invitePlayer = null; foreach (var x in Client.InviteListView.Items) { InvitePlayer tempInvPlayer = (InvitePlayer)x; if ((string)tempInvPlayer.PlayerLabel.Content == Name[0]) { invitePlayer = x as InvitePlayer; break; } } if (subject == ChatSubjects.PRACTICE_GAME_INVITE_ACCEPT) { invitePlayer.StatusLabel.Content = "Accepted"; if (IsOwner) { Client.Message(msg.From.User, msg.Body, ChatSubjects.PRACTICE_GAME_INVITE_ACCEPT_ACK); } } if (subject == ChatSubjects.GAME_INVITE_REJECT) { invitePlayer.StatusLabel.Content = "Rejected"; } if (subject == ChatSubjects.GAME_INVITE_LIST_STATUS) { ParseCurrentInvitees(msg.Body); } })); } }
void _client_OnMessage(object sender, jabber.protocol.client.Message msg) { try { if (msg.Body != null && msg.From != null) { _OnMessageReceived(msg.From.Bare, msg.Body, false); } } catch (Exception ex) { } //if (msg.X != null && msg.X.NextSibling != null && // msg.X.NextSibling.Name.ToLower() == @"active" || msg.X.NextSibling.Name.ToLower() == @"body" // || msg.X.NextSibling.Name.ToLower() == @"#text") //{ // //_OnMessageReceived(msg.From.Bare, msg.Body, false); //} }
private void BotClient_OnMessage(object sender, jabber.protocol.client.Message msg) { if (msg.Body == "" || msg.Body == null) { return; } JabberClient temp = (JabberClient)sender; ApplicationUser usr; string usrname = string.Format("{0}@{1}", msg.From.User.ToString(), msg.From.Server.ToString()); if (!this.AppMan.AppUsers.TryGetValue(usrname, out usr)) { usr = this.AppMan.AddUser(usrname); usr.SystemReply += new SystemReplyHandler(usr_SystemReply); usr.TriggerApplicationEvent += new TriggerApplicationEventHandler(usr_TriggerApplicationEvent); usr.Tag = msg.From.ToString(); } usr.Input = msg.Body; }
private void _myClient_OnMessage(object sender, jabber.protocol.client.Message msg) { throw new NotImplementedException(); }
private static void jabberClient1_OnMessage(object sender, jabber.protocol.client.Message msg) { Console.WriteLine ("RECV: " + msg); }
public MessageEventArgs(jabber.protocol.client.Message item) { this.item = item; }
private void btnSend_Click(object sender, System.EventArgs e) { jabber.protocol.client.Message msg = new jabber.protocol.client.Message(m_jc.Document); msg.To = txtTo.Text; if (txtSubject.Text != "") msg.Subject = txtSubject.Text; msg.Body = txtBody.Text; m_jc.Write(msg); this.Close(); }